gecko-dev/js/loader
Yulia 0350774d47 Bug 1540913 - Part 4: Introduce WorkerScriptLoader configuration for dynamic import; r=jonco
Earlier, we introduced GetBaseURI to the module loader. This allows us to get the BaseURI for a
dynamic import even after the importing script/module's ScriptLoader has been cleaned up. However,
we now need to be able to handle the case where we need to run the dynamic import and load it. In
order to do this, we need to create a scriptloader configured for dynamic import. The most important
difference between this scriptloader and the one that is normally used for script loading in workers
is that we *do not have a syncLoopTarget* to which we return. There are a couple of reasons for
this:

* Dynamic import (and modules in general) relies on the event loop to resolve. If we create a
syncLoop here, we will end up pausing execution, and this breaks the StartModuleLoad algorithm. We
will never complete and the result will be that we are in the wrong state when we return here.
* We do not have perfect knowledge of the future, so we cannot keep the existing script loader alive
in the case that it might be used for loading in the future.
* We cannot migrate the ModuleLoader to not use sync loading without significantly changing other
aspects of how loading scripts on workers works. This becomes particularily evident with error
handling
(https://searchfox.org/mozilla-central/rev/00ea1649b59d5f427979e2d6ba42be96f62d6e82/dom/workers/WorkerPrivate.cpp#383-444),
and in addition, for reasons I wasn't able to discern, using the CurrentEventTarget results in hard
to identify errors. When there is time to investigate this fully, the ModuleLoader may move away
from using a syncLoop itself.

For now, all main-script loads (whether they are modules or classic scripts) will use the sync loop,
and all dynamic imports will create a new script loader for their needs that is not using the sync
loop. The book keeping for this is in the next patch.

Differential Revision: https://phabricator.services.mozilla.com/D171685
2023-03-14 18:16:31 +00:00
..
ImportMap.cpp Bug 1808357: Add better error message for importmaps of invalid JSON format. r=jonco 2023-01-06 13:34:17 +00:00
ImportMap.h Bug 1778289 - Part 12: Update spec links as the PR is merged. r=jonco,yulia 2022-10-07 13:56:27 +00:00
LoadContextBase.cpp Bug 1572644 - Part 4: Add WorkletLoadContext and nsMainThreadPtrHandle to delegate WorkletFetchHandler on the worklet thread. r=jonco,yulia 2023-03-13 22:59:37 +00:00
LoadContextBase.h Bug 1572644 - Part 4: Add WorkletLoadContext and nsMainThreadPtrHandle to delegate WorkletFetchHandler on the worklet thread. r=jonco,yulia 2023-03-13 22:59:37 +00:00
LoadedScript.cpp Bug 1811238 - Correct QueryInterface implementation of LoadedScript and ModuleLoaderBase. r=mccr8 2023-01-24 09:55:27 +00:00
LoadedScript.h Bug 1811238 - Correct QueryInterface implementation of LoadedScript and ModuleLoaderBase. r=mccr8 2023-01-24 09:55:27 +00:00
ModuleLoaderBase.cpp Bug 1540913 - Part 3: Exit early if worker module evaluation is aborted; r=jonco 2023-03-14 18:16:31 +00:00
ModuleLoaderBase.h Bug 1540913 - Part 4: Introduce WorkerScriptLoader configuration for dynamic import; r=jonco 2023-03-14 18:16:31 +00:00
ModuleLoadRequest.cpp Bug 1813494 - Part 3: Add more cancellation checks and state assertions to module load requests r=smaug 2023-02-07 11:55:51 +00:00
ModuleLoadRequest.h Bug 1813494 - Part 3: Add more cancellation checks and state assertions to module load requests r=smaug 2023-02-07 11:55:51 +00:00
moz.build
ResolveResult.h Bug 1572644 - Part 11-2: Preload localized error msg and format it when resolving failed. r=jonco,yulia 2023-03-13 22:59:41 +00:00
ScriptKind.h
ScriptLoadRequest.cpp Bug 1572644 - Part 4: Add WorkletLoadContext and nsMainThreadPtrHandle to delegate WorkletFetchHandler on the worklet thread. r=jonco,yulia 2023-03-13 22:59:37 +00:00
ScriptLoadRequest.h Bug 1572644 - Part 8: Compile fetched module. r=jonco,yulia 2023-03-13 22:59:39 +00:00