Closed Bug 1311726 Opened 8 years ago Closed 3 years ago

Factor module loader out of nsScriptLoader

Categories

(Core :: DOM: Core & HTML, task, P2)

task

Tracking

()

RESOLVED FIXED
97 Branch
Tracking Status
firefox97 --- fixed

People

(Reporter: jonco, Assigned: yulia)

References

(Blocks 2 open bugs)

Details

(Whiteboard: [overhead:noted])

Attachments

(18 files, 10 obsolete files)

(deleted), text/x-phabricator-request
Details
(deleted), text/x-phabricator-request
Details
(deleted), text/x-phabricator-request
Details
(deleted), text/x-phabricator-request
Details
(deleted), text/x-phabricator-request
Details
(deleted), text/x-phabricator-request
Details
(deleted), text/x-phabricator-request
Details
(deleted), text/x-phabricator-request
Details
(deleted), text/x-phabricator-request
Details
(deleted), text/x-phabricator-request
Details
(deleted), text/x-phabricator-request
Details
(deleted), text/x-phabricator-request
Details
(deleted), text/x-phabricator-request
Details
(deleted), text/x-phabricator-request
Details
(deleted), text/x-phabricator-request
Details
(deleted), text/x-phabricator-request
Details
(deleted), text/x-phabricator-request
Details
(deleted), text/x-phabricator-request
Details
For bug 1308512 and bug 1290021 it would be useful to factor the module loading logic out of nsScriptLoader and into its own class. The caller would need to supply an interface to fetch data from the network.
This sounds like a P2 according to bug 1290021 comment 37
Priority: -- → P2
Blocks: 1473463
Whiteboard: [overhead:noted]
Blocks: 1572644
No longer blocks: 1473463
Type: defect → task
Blocks: 1247687

Hey Yulia, is this on the WebVM team's radar? It seems audio worklets not being able to import module scripts (bug 1572644) is starting to become a compatibility problem of sorts per padenot.

Flags: needinfo?(ystartsev)

I had 1572644 in mind. Thanks for the heads up about the compat issue, will look into it and see if we can get it done soon.

Flags: needinfo?(ystartsev)
Assignee: nobody → ystartsev

Depends on D124761

Depends on D124768

Attachment #9239792 - Attachment is obsolete: true
Attachment #9239793 - Attachment is obsolete: true
Attachment #9239794 - Attachment is obsolete: true
Attachment #9239796 - Attachment is obsolete: true
Attachment #9239797 - Attachment is obsolete: true
Attachment #9239798 - Attachment is obsolete: true
Attachment #9239799 - Attachment is obsolete: true
Attachment #9239800 - Attachment is obsolete: true
Attachment #9239801 - Attachment is obsolete: true

Previously, we were setting the ProcessingScriptTag for Module compilation as well as script
execution. This patch creates a helper function (GetGlobalWithContext) and removes a superfluous
setting of the "ProcessingScriptTag".

ProcessingScriptTag should be set when a script is executing, as it helps correct our behavior
around history replacement during JS execution: https://searchfox.org/mozilla-central/rev/e9cd2997be1071b9bb76fc14df0f01a2bd721c30/dom/base/LocationBase.cpp#223-231

The Scriptloader will be shared by multiple modules, not all of them have ready access to the
docshell (MozJSComponentLoader currently uses the JSContext for this purpose. Workers and worklets
are not tracking performance yet). Our profiling code relies on the docShell present in the script loader. This changes the
current profiling code to use the JSContext instead.

Depends on D132603

The goal of splitting classic script loading from module script loading was to keep a minimum
selection of methods for other script loaders to implement. In addition, the security
flags were distinct for the two cases, and had no overlap.

Caching behavior was left as shared, as it is likely modules will have this soon.

Depends on D132604

first initialization is on line 3140 and covers the module case.

Depends on D132605

Depends on D132608

Depends on D132613

Attachment #9253281 - Attachment description: Bug 1311726 - create ScriptLoaderInterface; r=jonco → Bug 1311726 - Create ScriptLoaderInterface; r=jonco
Attachment #9253276 - Attachment description: Bug 1311726 - Create ModuleLoader class; r=jonco → Bug 1311726 - Create ModuleLoader Class; r=jonco
Attachment #9249030 - Attachment is obsolete: true
Attachment #9253280 - Attachment description: Bug 1311726 - Move Dynamic Import Methods and Module Evaluation to ModuleLoader; r=jonco → Bug 1311726 - Move Dynamic Import Methods to ModuleLoader; r=jonco

Module evaluation is independent of it's context. We just need the globalObject to set up the
execution environment.

Depends on D132677

Attachment #9253281 - Attachment is obsolete: true
Attachment #9253281 - Attachment is obsolete: false
Pushed by ystartsev@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/23ea474c05ec Only set "ProcessingScript" tag when executing; r=jonco https://hg.mozilla.org/integration/autoland/rev/f1e4c9199289 Switch MarkerInnerWindowIdFromDocShell to MarkerInnerWindowIdFromJSContext; r=canaltinova https://hg.mozilla.org/integration/autoland/rev/1de8b528723e Split StartLoad into StartClassicLoad, StartModuleLoad, StartLoadInternal; r=jonco https://hg.mozilla.org/integration/autoland/rev/a8279e757309 Remove second initialization of currentScript in EvaluateScript; r=jonco https://hg.mozilla.org/integration/autoland/rev/dd2dbe11315d Split EvaluateScript into EvaluateScript and EvaluateModule; r=jonco https://hg.mozilla.org/integration/autoland/rev/1ad7d1308b5f Pass JSContext instead of JSAPI to FillCompileOptionsForRequest; r=jonco https://hg.mozilla.org/integration/autoland/rev/6ba119a4e33e Create ModuleLoader Class; r=jonco https://hg.mozilla.org/integration/autoland/rev/40c635fb36eb Move methods related to instantiating the module tree to ModuleLoader;r=jonco https://hg.mozilla.org/integration/autoland/rev/ee2e01e59950 Move methods related to resolution and error handling to ModuleLoader;r=jonco https://hg.mozilla.org/integration/autoland/rev/8db98e65b147 Move CheckModuleDependeciesLoaded to ModuleLoadRequest; r=jonco https://hg.mozilla.org/integration/autoland/rev/a909be9fa973 Move Dynamic Import Methods to ModuleLoader; r=jonco https://hg.mozilla.org/integration/autoland/rev/b758abeed4cc ModuleLoadRequest loader is a ModuleLoader; r=jonco https://hg.mozilla.org/integration/autoland/rev/558fec312301 Move module hook instantiation to ModuleLoader constructor; r=jonco https://hg.mozilla.org/integration/autoland/rev/4597b327e9be Move Module Evaluation into ModuleLoader; r=jonco https://hg.mozilla.org/integration/autoland/rev/b21e580a778f Move getScriptSource to ScriptLoadRequest; r=jonco https://hg.mozilla.org/integration/autoland/rev/03f767c08221 Move GetProfilerLabelForRequest to ScriptLoadRequest; r=jonco https://hg.mozilla.org/integration/autoland/rev/2f4e89d930b0 Create ScriptLoaderInterface; r=jonco https://hg.mozilla.org/integration/autoland/rev/1f9c13be6642 Split ScriptLoader into ScriptLoader and ModuleLoader; r=jonco
Flags: needinfo?(ystartsev)
Pushed by ystartsev@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/bfea110e6afe Only set "ProcessingScript" tag when executing; r=jonco https://hg.mozilla.org/integration/autoland/rev/beb9e9b17522 Switch MarkerInnerWindowIdFromDocShell to MarkerInnerWindowIdFromJSContext; r=canaltinova https://hg.mozilla.org/integration/autoland/rev/eac12c9d76b7 Split StartLoad into StartClassicLoad, StartModuleLoad, StartLoadInternal; r=jonco https://hg.mozilla.org/integration/autoland/rev/68ab853d072d Remove second initialization of currentScript in EvaluateScript; r=jonco https://hg.mozilla.org/integration/autoland/rev/ebc87f932050 Split EvaluateScript into EvaluateScript and EvaluateModule; r=jonco https://hg.mozilla.org/integration/autoland/rev/15df1b7e0208 Pass JSContext instead of JSAPI to FillCompileOptionsForRequest; r=jonco https://hg.mozilla.org/integration/autoland/rev/d130a9772d31 Create ModuleLoader Class; r=jonco https://hg.mozilla.org/integration/autoland/rev/340bd3d73849 Move methods related to instantiating the module tree to ModuleLoader;r=jonco https://hg.mozilla.org/integration/autoland/rev/0ef6c06dac5b Move methods related to resolution and error handling to ModuleLoader;r=jonco https://hg.mozilla.org/integration/autoland/rev/258188246118 Move CheckModuleDependeciesLoaded to ModuleLoadRequest; r=jonco https://hg.mozilla.org/integration/autoland/rev/79aac20615b8 Move Dynamic Import Methods to ModuleLoader; r=jonco https://hg.mozilla.org/integration/autoland/rev/a151ddb7068d ModuleLoadRequest loader is a ModuleLoader; r=jonco https://hg.mozilla.org/integration/autoland/rev/2deb35690efb Move module hook instantiation to ModuleLoader constructor; r=jonco https://hg.mozilla.org/integration/autoland/rev/9ecb9ac4f2f7 Move Module Evaluation into ModuleLoader; r=jonco https://hg.mozilla.org/integration/autoland/rev/7b266f1fbbff Move getScriptSource to ScriptLoadRequest; r=jonco https://hg.mozilla.org/integration/autoland/rev/d6f6a7d13dc2 Move GetProfilerLabelForRequest to ScriptLoadRequest; r=jonco https://hg.mozilla.org/integration/autoland/rev/fd3a9e4f5e5e Create ScriptLoaderInterface; r=jonco https://hg.mozilla.org/integration/autoland/rev/0e1179305bc2 Split ScriptLoader into ScriptLoader and ModuleLoader; r=jonco
Pushed by ystartsev@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/00fc94ca6194 Only set "ProcessingScript" tag when executing; r=jonco https://hg.mozilla.org/integration/autoland/rev/9b34af047654 Switch MarkerInnerWindowIdFromDocShell to MarkerInnerWindowIdFromJSContext; r=canaltinova https://hg.mozilla.org/integration/autoland/rev/a25fe257d5b8 Split StartLoad into StartClassicLoad, StartModuleLoad, StartLoadInternal; r=jonco https://hg.mozilla.org/integration/autoland/rev/7c63590b66f4 Remove second initialization of currentScript in EvaluateScript; r=jonco https://hg.mozilla.org/integration/autoland/rev/6664c04f4830 Split EvaluateScript into EvaluateScript and EvaluateModule; r=jonco https://hg.mozilla.org/integration/autoland/rev/732e15c4958d Pass JSContext instead of JSAPI to FillCompileOptionsForRequest; r=jonco https://hg.mozilla.org/integration/autoland/rev/e4eb33a27999 Create ModuleLoader Class; r=jonco https://hg.mozilla.org/integration/autoland/rev/cb1f93008fcb Move methods related to instantiating the module tree to ModuleLoader;r=jonco https://hg.mozilla.org/integration/autoland/rev/1095d8b43ce7 Move methods related to resolution and error handling to ModuleLoader;r=jonco https://hg.mozilla.org/integration/autoland/rev/2deb80998e49 Move CheckModuleDependeciesLoaded to ModuleLoadRequest; r=jonco https://hg.mozilla.org/integration/autoland/rev/90253f348658 Move Dynamic Import Methods to ModuleLoader; r=jonco https://hg.mozilla.org/integration/autoland/rev/345f2b65d68a ModuleLoadRequest loader is a ModuleLoader; r=jonco https://hg.mozilla.org/integration/autoland/rev/fa7f6356b9d7 Move module hook instantiation to ModuleLoader constructor; r=jonco https://hg.mozilla.org/integration/autoland/rev/a61540a0e574 Move Module Evaluation into ModuleLoader; r=jonco https://hg.mozilla.org/integration/autoland/rev/b7f3da90d4a7 Move getScriptSource to ScriptLoadRequest; r=jonco https://hg.mozilla.org/integration/autoland/rev/b6c210ac83f7 Move GetProfilerLabelForRequest to ScriptLoadRequest; r=jonco https://hg.mozilla.org/integration/autoland/rev/b3315084d575 Create ScriptLoaderInterface; r=jonco https://hg.mozilla.org/integration/autoland/rev/5968a2827351 Split ScriptLoader into ScriptLoader and ModuleLoader; r=jonco
Flags: needinfo?(ystartsev)
Regressions: 1745626
Blocks: 1801764
No longer blocks: 1801764
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: