Remove ScriptFetchOptions::mElement field
Categories
(Core :: JavaScript Engine, task, P3)
Tracking
()
Tracking | Status | |
---|---|---|
firefox128 | --- | fixed |
People
(Reporter: arai, Assigned: arai)
References
(Blocks 1 open bug)
Details
Attachments
(12 files)
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
Bug 1899172 - Part 7: Add ScriptLoadContext::{BeginEvaluatingTopLevel,EndEvaluatingTopLevel}. r?nbp!
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review |
ScriptFetchOptions::mElement
holds a reference to script element which triggered the fetching.
class ScriptFetchOptions {
...
/*
* Represents fields populated by DOM elements (nonce, parser metadata)
* Leave this field as a nullptr for any fetch that requires the
* default classic script options.
* (https://html.spec.whatwg.org/multipage/webappapis.html#default-classic-script-fetch-options)
* TODO: extract necessary fields rather than passing this object
*/
nsCOMPtr<mozilla::dom::Element> mElement;
the option is held by LoadedScript
, which means caching LoadedScript
holds the reference to the original script
unnecessarily longer.
class LoadedScript : public nsIMemoryReporter {
...
RefPtr<ScriptFetchOptions> mFetchOptions;
As the comment above mElement
suggests, we should copy necessary info into ScriptFetchOptions
, so that the reference can be removed.
Assignee | ||
Comment 1•1 year ago
•
|
||
Actually, there's no longer direct dependency to the script element.
only one case I can think of is the hint charset
attribute, but preload handles it separately, and it's also not part of the script fetch options per spec, so we can just move the element field to ScriptLoadContext
or somewhere.
anyway, I have some refactoring patch stack that was necessary to figure out the above, and I'll post them here.
Comment 2•1 year ago
|
||
Thanks for working on this arai. It would be nice to get rid of that element pointer altogether.
Updated•1 year ago
|
Assignee | ||
Comment 3•1 year ago
|
||
TRACE_FOR_TEST depends on script element reference for imported modules.
This patch stack will remove the reference except for top-level scripts.
Updated•1 year ago
|
Assignee | ||
Comment 4•1 year ago
|
||
Assignee | ||
Comment 5•1 year ago
|
||
Assignee | ||
Comment 6•1 year ago
|
||
Assignee | ||
Comment 7•1 year ago
|
||
They'll be reworked in later patch not to depend on script element.
Assignee | ||
Comment 8•1 year ago
|
||
Assignee | ||
Comment 9•1 year ago
|
||
Assignee | ||
Comment 10•1 year ago
|
||
Assignee | ||
Comment 11•1 year ago
|
||
Assignee | ||
Comment 12•1 year ago
|
||
Assignee | ||
Comment 13•1 year ago
|
||
Assignee | ||
Comment 14•1 year ago
|
||
Comment 15•1 year ago
|
||
Comment 16•1 year ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/7bc1862524f4
https://hg.mozilla.org/mozilla-central/rev/28dcd53fa44f
https://hg.mozilla.org/mozilla-central/rev/8efea89fc137
https://hg.mozilla.org/mozilla-central/rev/7a085fc3c619
https://hg.mozilla.org/mozilla-central/rev/291409abc485
https://hg.mozilla.org/mozilla-central/rev/ade4594e901a
https://hg.mozilla.org/mozilla-central/rev/27b7be9780a1
https://hg.mozilla.org/mozilla-central/rev/e759f417c8bc
https://hg.mozilla.org/mozilla-central/rev/034a04c83391
https://hg.mozilla.org/mozilla-central/rev/7869dd324684
https://hg.mozilla.org/mozilla-central/rev/bf36733567ec
https://hg.mozilla.org/mozilla-central/rev/fb1ed32eb195
Description
•