Commit graph

179 commits

Author SHA1 Message Date
Tooru Fujisawa
5f7c671736 Bug 1881564 - Initialize module loader also for ServiceWorker to allow ChromeUtils.importESModule in DevTools ServiceWorker debugger global. r=yulia
Dynamic import is prevented by IsDynamicImportSupported, and now it now throws
TypeError instead of Error, and related wpt passes with it.

Differential Revision: https://phabricator.services.mozilla.com/D202494
2024-03-20 11:22:45 +00:00
Yoshi Cheng-Hao Huang
fc4a4562a1 Bug 1877703 - Part 5: Call SetHadImportMap when the module script is created. r=jonco
Differential Revision: https://phabricator.services.mozilla.com/D204937
2024-03-20 06:28:39 +00:00
Jon Coppeard
2081da2013 Bug 1877703 - Part 3: Also remove currently fetching preload modules from the module map when import map is registered r=smaug
A further problem with dynamically inserted import maps was discovered where
sometimes module scripts would never execute. This happens when the script is
still being fetched when the import map is added.

To fix this, cancel all fetching module preloads as well when an import map is
registered and remove them from the module map. In theory this shouldn't be
necessary but I wasn't able to make the tests pass without this step.

For simplicity also remove all module preloads from the scriptloader's list of
preload requests rather than detecting and ignoring them later on.

Differential Revision: https://phabricator.services.mozilla.com/D204202
2024-03-19 10:07:35 +00:00
Jon Coppeard
3e83b7268e Bug 1877703 - Part 2: Track request for currently fetching module in the module map r=smaug
Currently we record the URI of each fetching modules and any addtional requests
that are blocked waiting on that fetch. This adds the fetching module request
itself.

This is needed by the next patch.

Differential Revision: https://phabricator.services.mozilla.com/D204201
2024-03-19 10:07:34 +00:00
Jon Coppeard
81c18a4a24 Bug 1877703 - Part 1: Remove speculatively preloaded modules from the module map when import map is registered r=smaug,allstarschh
The initial problem reported in the bug is that we try to speculatively load a
bareword import before the import map is dynamically inserted that makes that
load valid. The load fails and then we cache the failure in the module map.

The more general problem is that import maps change the locations that imports
are resolved to so if when there is a dynamically inserted import map
speculative preload may load and cache the wrong things.

This patch fixes this problem by removing any preloaded modules from the module
map when an import map is registered.

Previously we used to do something like this but it was changed because I
wasn't confident that it wouldn't remove too much. However it appears that this
is necessary to handle this situation, so it's implemented here but with more
checks that it only removes preloaded modules. This is handled by adding extra
flags where necessary so we have the information on hand to check.

I've made these diagnostic asserts so that this actually gets check in real use.

Differential Revision: https://phabricator.services.mozilla.com/D202611
2024-03-19 10:07:34 +00:00
Norisz Fay
66f73c547b Backed out 4 changesets (bug 1877703) as requested by dev for causing Bug 1885443
Backed out changeset 5eb60e36ef79 (bug 1877703)
Backed out changeset 5921d1fb831e (bug 1877703)
Backed out changeset 64281b11237e (bug 1877703)
Backed out changeset 7ee0827809fb (bug 1877703)
2024-03-15 13:28:07 +02:00
Jon Coppeard
7c8b38161a Bug 1877703 - Part 3: Also remove currently fetching preload modules from the module map when import map is registered r=smaug
A further problem with dynamically inserted import maps was discovered where
sometimes module scripts would never execute. This happens when the script is
still being fetched when the import map is added.

To fix this, cancel all fetching module preloads as well when an import map is
registered and remove them from the module map. In theory this shouldn't be
necessary but I wasn't able to make the tests pass without this step.

For simplicity also remove all module preloads from the scriptloader's list of
preload requests rather than detecting and ignoring them later on.

Differential Revision: https://phabricator.services.mozilla.com/D204202
2024-03-13 13:25:30 +00:00
Jon Coppeard
e5f17b703c Bug 1877703 - Part 2: Track request for currently fetching module in the module map r=smaug
Currently we record the URI of each fetching modules and any addtional requests
that are blocked waiting on that fetch. This adds the fetching module request
itself.

This is needed by the next patch.

Differential Revision: https://phabricator.services.mozilla.com/D204201
2024-03-13 13:25:29 +00:00
Jon Coppeard
a8ad63760a Bug 1877703 - Part 1: Remove speculatively preloaded modules from the module map when import map is registered r=smaug,allstarschh
The initial problem reported in the bug is that we try to speculatively load a
bareword import before the import map is dynamically inserted that makes that
load valid. The load fails and then we cache the failure in the module map.

The more general problem is that import maps change the locations that imports
are resolved to so if when there is a dynamically inserted import map
speculative preload may load and cache the wrong things.

This patch fixes this problem by removing any preloaded modules from the module
map when an import map is registered.

Previously we used to do something like this but it was changed because I
wasn't confident that it wouldn't remove too much. However it appears that this
is necessary to handle this situation, so it's implemented here but with more
checks that it only removes preloaded modules. This is handled by adding extra
flags where necessary so we have the information on hand to check.

I've made these diagnostic asserts so that this actually gets check in real use.

Differential Revision: https://phabricator.services.mozilla.com/D202611
2024-03-13 13:25:29 +00:00
Norisz Fay
2700ed8b59 Backed out 4 changesets (bug 1877703) for causing ScriptLoader related wpt failures
Backed out changeset 6b99c1c567b4 (bug 1877703)
Backed out changeset bc9c70289244 (bug 1877703)
Backed out changeset 1e17b87ab7f8 (bug 1877703)
Backed out changeset 591b5483bcd8 (bug 1877703)
2024-03-12 23:43:16 +02:00
Jon Coppeard
4709a86e24 Bug 1877703 - Part 3: Also remove currently fetching preload modules from the module map when import map is registered r=smaug
A further problem with dynamically inserted import maps was discovered where
sometimes module scripts would never execute. This happens when the script is
still being fetched when the import map is added.

To fix this, cancel all fetching module preloads as well when an import map is
registered and remove them from the module map. In theory this shouldn't be
necessary but I wasn't able to make the tests pass without this step.

For simplicity also remove all module preloads from the scriptloader's list of
preload requests rather than detecting and ignoring them later on.

Differential Revision: https://phabricator.services.mozilla.com/D204202
2024-03-12 16:43:49 +00:00
Jon Coppeard
7a84df2611 Bug 1877703 - Part 2: Track request for currently fetching module in the module map r=smaug
Currently we record the URI of each fetching modules and any addtional requests
that are blocked waiting on that fetch. This adds the fetching module request
itself.

This is needed by the next patch.

Differential Revision: https://phabricator.services.mozilla.com/D204201
2024-03-12 16:43:48 +00:00
Jon Coppeard
4043264813 Bug 1877703 - Part 1: Remove speculatively preloaded modules from the module map when import map is registered r=smaug,allstarschh
The initial problem reported in the bug is that we try to speculatively load a
bareword import before the import map is dynamically inserted that makes that
load valid. The load fails and then we cache the failure in the module map.

The more general problem is that import maps change the locations that imports
are resolved to so if when there is a dynamically inserted import map
speculative preload may load and cache the wrong things.

This patch fixes this problem by removing any preloaded modules from the module
map when an import map is registered.

Previously we used to do something like this but it was changed because I
wasn't confident that it wouldn't remove too much. However it appears that this
is necessary to handle this situation, so it's implemented here but with more
checks that it only removes preloaded modules. This is handled by adding extra
flags where necessary so we have the information on hand to check.

I've made these diagnostic asserts so that this actually gets check in real use.

Differential Revision: https://phabricator.services.mozilla.com/D202611
2024-03-12 16:43:48 +00:00
Tooru Fujisawa
7533056300 Bug 1880708 - Handle CC unlink when destroying ScriptLoader/ModuleLoader. r=jonco
Differential Revision: https://phabricator.services.mozilla.com/D202080
2024-02-19 15:09:00 +00:00
Tooru Fujisawa
e379bd0e94 Bug 1803810 - Part 4: Add mozJSModuleLoader for non-shared global. r=jonco
On the main thread, single mozJSModuleLoader instance is shared across all
loads in non-shared global, with resetting the internal state after importing
a module graph.

NonSharedGlobalSyncModuleLoaderScope manages the lifetime of each usage.
Import into the same non-shared global can be nested, but import into the
different non-shared gloobal is not allowed while other import for non-shared
global is ongoing.

Differential Revision: https://phabricator.services.mozilla.com/D199456
2024-02-14 02:01:37 +00:00
Tooru Fujisawa
a380811687 Bug 1803810 - Part 3: Add methods to copy and move imported modules. r=jonco
In non-shared global, the sync load is performed by separate SyncModuleLoader,
with the following algorithm:
  1. copy all loaded modules from async module loader, so that they can be
     used in the module graph in SyncModuleLoader
  2. import a module graph
  3. move all modules to async module loader

ModuleLoaderBase::CopyModulesTo is for step 1, and
ModuleLoaderBase::MoveModulesTo is for step 3.

The consumer should assert that there's no fetching modules.

Differential Revision: https://phabricator.services.mozilla.com/D199455
2024-02-14 02:01:37 +00:00
Tooru Fujisawa
5ae702d96e Bug 1803810 - Part 2: Make module loader overridable. r=jonco
In order to perform sync load in arbitrary global, add
ModuleLoaderBase::mOverriddenBy field, and let
ModuleLoaderBase::GetCurrentModuleLoader return the overridden loader,
so that the module loading can be overridden by SyncModuleLoader.

AutoOverrideModuleLoader manages the lifetime of the override.

Differential Revision: https://phabricator.services.mozilla.com/D199454
2024-02-14 02:01:36 +00:00
Cosmin Sabou
e4edda3c7e Backed out 10 changesets (bug 1803810) for xpcshell failures on test_import_global. CLOSED TREE
Backed out changeset d5df64b38425 (bug 1803810)
Backed out changeset b8f45cbb5596 (bug 1803810)
Backed out changeset c02d879622bd (bug 1803810)
Backed out changeset 9593275c0195 (bug 1803810)
Backed out changeset 2e2f01296233 (bug 1803810)
Backed out changeset 9699c18e5bf7 (bug 1803810)
Backed out changeset 84cdfd738db6 (bug 1803810)
Backed out changeset 58160b9119ef (bug 1803810)
Backed out changeset 4aa6e036fe7a (bug 1803810)
Backed out changeset 656b61cbd15c (bug 1803810)
2024-02-13 17:41:01 +02:00
Tooru Fujisawa
fe5f5aa268 Bug 1803810 - Part 4: Add mozJSModuleLoader for non-shared global. r=jonco
On the main thread, single mozJSModuleLoader instance is shared across all
loads in non-shared global, with resetting the internal state after importing
a module graph.

NonSharedGlobalSyncModuleLoaderScope manages the lifetime of each usage.
Import into the same non-shared global can be nested, but import into the
different non-shared gloobal is not allowed while other import for non-shared
global is ongoing.

Differential Revision: https://phabricator.services.mozilla.com/D199456
2024-02-13 14:34:22 +00:00
Tooru Fujisawa
e4bebfd949 Bug 1803810 - Part 3: Add methods to copy and move imported modules. r=jonco
In non-shared global, the sync load is performed by separate SyncModuleLoader,
with the following algorithm:
  1. copy all loaded modules from async module loader, so that they can be
     used in the module graph in SyncModuleLoader
  2. import a module graph
  3. move all modules to async module loader

ModuleLoaderBase::CopyModulesTo is for step 1, and
ModuleLoaderBase::MoveModulesTo is for step 3.

The consumer should assert that there's no fetching modules.

Differential Revision: https://phabricator.services.mozilla.com/D199455
2024-02-13 14:34:21 +00:00
Tooru Fujisawa
8dc876f29b Bug 1803810 - Part 2: Make module loader overridable. r=jonco
In order to perform sync load in arbitrary global, add
ModuleLoaderBase::mOverriddenBy field, and let
ModuleLoaderBase::GetCurrentModuleLoader return the overridden loader,
so that the module loading can be overridden by SyncModuleLoader.

AutoOverrideModuleLoader manages the lifetime of the override.

Differential Revision: https://phabricator.services.mozilla.com/D199454
2024-02-13 14:34:21 +00:00
Tooru Fujisawa
73c36f0f8f Bug 1878817 - Remove unused ModuleLoaderBase::mEventTarget member. r=jonco
Differential Revision: https://phabricator.services.mozilla.com/D200753
2024-02-06 10:15:29 +00:00
Natalia Csoregi
68afaea1df Backed out changeset 67f13af428e3 (bug 1877703) for causing crashes and assertion failures on ModuleLoaderBase.cpp. CLOSED TREE 2024-02-02 23:17:41 +02:00
Yoshi Cheng-Hao Huang
80236c4ec3 Bug 1877703 - Don't add the URI into mFetchedModules if it has a parse error and is preloaded. r=jonco
Differential Revision: https://phabricator.services.mozilla.com/D200431
2024-02-02 17:42:32 +00:00
Tooru Fujisawa
4be2bb52e4 Bug 1875836 - Part 2: Support dynamic import in ComponentModuleLoader. r=jonco
Differential Revision: https://phabricator.services.mozilla.com/D199279
2024-01-23 23:29:53 +00:00
Matthew Gaudet
02a257be41 Bug 1835669 - Remove host hook r=dminor
Depends on D194256

Differential Revision: https://phabricator.services.mozilla.com/D194257
2024-01-19 01:01:30 +00:00
Tooru Fujisawa
d8c07cffa3 Bug 1800641 - Part 11: Allocate script in ScriptLoadRequest::NoCacheEntryFound. r=nbp
Depends on D197848

Differential Revision: https://phabricator.services.mozilla.com/D197849
2024-01-08 14:57:40 +00:00
Tooru Fujisawa
17c5cde210 Bug 1800641 - Part 10: Add ScriptLoadRequest::mLoadedScript. r=nbp
Depends on D197847

Differential Revision: https://phabricator.services.mozilla.com/D197848
2024-01-08 14:57:39 +00:00
Tooru Fujisawa
bdc574a37f Bug 1800641 - Part 9: Add LoadedScript::mURI and call SetBaseURL separately. r=nbp
Depends on D197846

Differential Revision: https://phabricator.services.mozilla.com/D197847
2024-01-08 14:57:39 +00:00
Tooru Fujisawa
976c794ad0 Bug 1800641 - Part 8: Add LoadContextBase* parameter to ScriptLoadRequest methods which is going to be moved to LoadedScriptDelegate. r=nbp
Depends on D197845

Differential Revision: https://phabricator.services.mozilla.com/D197846
2024-01-08 14:57:38 +00:00
Tooru Fujisawa
f135bad3aa Bug 1800641 - Part 7: Add ScriptLoadRequest::State::{CheckingCache,PendingFetchingError}. r=nbp
Depends on D197844

Differential Revision: https://phabricator.services.mozilla.com/D197845
2024-01-08 14:57:38 +00:00
Gregory Pappas
e3f2c5ad80 Bug 1853547 - Remove dom.importMaps.enabled pref r=allstarschh
Differential Revision: https://phabricator.services.mozilla.com/D197751
2024-01-06 01:53:19 +00:00
Noemi Erli
7fd755cbb5 Backed out changeset 4d6294424819 (bug 1800641) for causing Bug 1872347 2023-12-29 16:23:18 +02:00
Nicolas B. Pierron
8a851d2266 Bug 1800641 - Move some ScriptLoadRequest fields into LoadedScript. r=yulia
We are looking into caching loaded script in memory. To do so we need something
to cache.

At the moment, the `ScriptLoadRequest` structure hold all the fields which are
loaded, and used before executing JavaScript code. Then, the `ScriptLoadRequest`
is not guaranteed to out-live the first execution.

Therefore, we have to move fields out of the `ScriptLoadRequest` such that they
can later be used by any caching mechanism. The `LoadedScript` is the closest
existing structure which exists which fit the description.

This patch moves fields out of the ScriptLoadRequest into the `LoadedScript`,
which already has a `LoadedScript` field.

The `LoadedScript` field is initialized sooner, when the `ScriptLoadRequest` is
created, to be subsituted later by a real cache implementation. At the moment
the function `ScriptLoadRequest::NoCacheEntryFound` is used as a placeholder to
change the state of the `ScriptLoadRequest` from `CheckingCache` to `Fetching`.
Existing initializations are replaced by assertions to fail in debug build if
the current patch does not reproduce the expected state properly.

The `LoadedScript` get fields such as the source text, the text length, the
bytecode buffer (which also contains SRI), and the offset at which the bytecode
starts within the bytecode buffer. As these fields are no longer reachable by
name, multiple accessors are added to work-around the issue. Using this as an
opportunity to add extra assertions as part of these accessors.

A new class named `LoadedScriptDelegate` is added to re-add, by inheritance, all
the accessors which used to be part of `ScriptLoadRequest` as methods which are
delegating to the field which is holding the `LoadedScript`. This class is using
templates to avoid virtual inheritance which might hinder inlining, especially
since `ScriptLoadRequest` cannot be made final, as `ModuleLoadRequest` extends
it.

The `ScriptFetchOptions` structure is moved to its own file to solve C++ include
issues.

Differential Revision: https://phabricator.services.mozilla.com/D163615
2023-12-25 09:46:54 +00:00
Cosmin Sabou
a9cb718ef1 Backed out changeset f69f493b2f3c (bug 1800641) for causing non-unified build bustages on LoadedScript.cpp. CLOSED TREE 2023-12-25 08:38:51 +02:00
Nicolas B. Pierron
7b23c511de Bug 1800641 - Move some ScriptLoadRequest fields into LoadedScript. r=yulia
We are looking into caching loaded script in memory. To do so we need something
to cache.

At the moment, the `ScriptLoadRequest` structure hold all the fields which are
loaded, and used before executing JavaScript code. Then, the `ScriptLoadRequest`
is not guaranteed to out-live the first execution.

Therefore, we have to move fields out of the `ScriptLoadRequest` such that they
can later be used by any caching mechanism. The `LoadedScript` is the closest
existing structure which exists which fit the description.

This patch moves fields out of the ScriptLoadRequest into the `LoadedScript`,
which already has a `LoadedScript` field.

The `LoadedScript` field is initialized sooner, when the `ScriptLoadRequest` is
created, to be subsituted later by a real cache implementation. At the moment
the function `ScriptLoadRequest::NoCacheEntryFound` is used as a placeholder to
change the state of the `ScriptLoadRequest` from `CheckingCache` to `Fetching`.
Existing initializations are replaced by assertions to fail in debug build if
the current patch does not reproduce the expected state properly.

The `LoadedScript` get fields such as the source text, the text length, the
bytecode buffer (which also contains SRI), and the offset at which the bytecode
starts within the bytecode buffer. As these fields are no longer reachable by
name, multiple accessors are added to work-around the issue. Using this as an
opportunity to add extra assertions as part of these accessors.

A new class named `LoadedScriptDelegate` is added to re-add, by inheritance, all
the accessors which used to be part of `ScriptLoadRequest` as methods which are
delegating to the field which is holding the `LoadedScript`. This class is using
templates to avoid virtual inheritance which might hinder inlining, especially
since `ScriptLoadRequest` cannot be made final, as `ModuleLoadRequest` extends
it.

The `ScriptFetchOptions` structure is moved to its own file to solve C++ include
issues.

Differential Revision: https://phabricator.services.mozilla.com/D163615
2023-12-25 05:50:53 +00:00
Jon Coppeard
f9febfda89 Bug 1871075 - Part 1: Store referencing private as a pointer to the underlying LoadedScript r=yulia
In Gecko we use a LoadedScript pointer as the referencing private for dynamic
imports. This is passed through the JS engine as a private value, which doesn't
care what it means. Currently we store this in the module loader as a JS::Value,
but we could just as well unpack it since we know what it is. That lets use a
RefPtr which also keeps it alive and will let use remove some manual reference
counting.

We also don't need to pass it to the CreateDynamicImport method twice.

This change makes it the responsibility of the module loader for keeping the
referencing private alive until FinishDynamicModuleImport is called.

Differential Revision: https://phabricator.services.mozilla.com/D196974
2023-12-21 13:30:34 +00:00
Jon Coppeard
9ec5953695 Bug 1865410 - Part 2: Removed unused module APIs following previous patch r=allstarschh
Differential Revision: https://phabricator.services.mozilla.com/D194767
2023-12-02 08:49:59 +00:00
Tooru Fujisawa
e1306f14b6 Bug 1861309 - Part 1: Use 1-origin column number in JS::GetRequestedModuleSourcePos and ModuleLoaderBase::HandleResolveFailure. r=jonco
Depends on D192781

Differential Revision: https://phabricator.services.mozilla.com/D192782
2023-11-08 02:01:37 +00:00
Yoshi Cheng-Hao Huang
cd69bc3c65 Bug 1841859 - Part 1: Move ReferrerPolicy to ScriptLoadRequest and LoadedScript. r=jonco,smaug
Suggested by jonco during review,
https://phabricator.services.mozilla.com/D186944#inline-1036982

Differential Revision: https://phabricator.services.mozilla.com/D187385
2023-09-20 17:32:15 +00:00
Tooru Fujisawa
ce72fea4a7 Bug 1846194 - Remove off-thread compilation and decode API. r=nbp
Differential Revision: https://phabricator.services.mozilla.com/D185125
2023-09-01 03:43:21 +00:00
Tooru Fujisawa
70c40a1658 Bug 1845638 - Part 1: Use JS::FrontendContext APIs and TaskController in compilation and decode in ScriptLoader. r=smaug,bthrall
Differential Revision: https://phabricator.services.mozilla.com/D184896
2023-08-29 12:07:18 +00:00
Tooru Fujisawa
b23c224e33 Bug 1847469 - Part 20: Use column number types in JSErrorBase. r=iain
Differential Revision: https://phabricator.services.mozilla.com/D185758
2023-08-16 17:31:40 +00:00
Tooru Fujisawa
41cb19fe2a Bug 1847469 - Part 6: Use column number types in Module API. r=iain
Differential Revision: https://phabricator.services.mozilla.com/D185744
2023-08-16 17:31:37 +00:00
Cristian Tuns
4fe9ed8f30 Backed out 27 changesets (bug 1847469) for causing spidermonkey bustages in Script.cpp CLOSED TREE
Backed out changeset 9d6e2651a013 (bug 1847469)
Backed out changeset 9b72d668efd2 (bug 1847469)
Backed out changeset 86abf5cf0a22 (bug 1847469)
Backed out changeset 46833087f8ac (bug 1847469)
Backed out changeset f3e2207fdeec (bug 1847469)
Backed out changeset aed75776cfff (bug 1847469)
Backed out changeset 8292a38bd99f (bug 1847469)
Backed out changeset 1320f83fb8c7 (bug 1847469)
Backed out changeset df9f925f9837 (bug 1847469)
Backed out changeset 69f32cf1862a (bug 1847469)
Backed out changeset b2ddddec8818 (bug 1847469)
Backed out changeset 056eed7abc97 (bug 1847469)
Backed out changeset 5df4f43ac0bf (bug 1847469)
Backed out changeset cb57923f6532 (bug 1847469)
Backed out changeset a0993f2a2195 (bug 1847469)
Backed out changeset 782499fbedf2 (bug 1847469)
Backed out changeset cf84fb98c5e1 (bug 1847469)
Backed out changeset 1fa5ab59814b (bug 1847469)
Backed out changeset f5f78944df81 (bug 1847469)
Backed out changeset aa14337bf5c6 (bug 1847469)
Backed out changeset 6757db4575d7 (bug 1847469)
Backed out changeset 236ff135701e (bug 1847469)
Backed out changeset 9b4d5b435020 (bug 1847469)
Backed out changeset a0f789621bc8 (bug 1847469)
Backed out changeset c19b81f48055 (bug 1847469)
Backed out changeset b4521e546d7e (bug 1847469)
Backed out changeset f26a10289316 (bug 1847469)
2023-08-16 07:08:01 -04:00
Tooru Fujisawa
ee81f946a2 Bug 1847469 - Part 20: Use column number types in JSErrorBase. r=iain
Differential Revision: https://phabricator.services.mozilla.com/D185758
2023-08-16 10:26:32 +00:00
Tooru Fujisawa
475220dbaa Bug 1847469 - Part 6: Use column number types in Module API. r=iain
Differential Revision: https://phabricator.services.mozilla.com/D185744
2023-08-16 10:26:28 +00:00
Tooru Fujisawa
441e14104a Bug 1846913 - Part 1: Use 1-origin column number for compile errors, compile wanring, and error notes. r=iain,devtools-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D185370
2023-08-11 08:11:48 +00:00
Jon Coppeard
970aa448a4 Bug 1847813 - Process loaded modules asynchronously in DOM module loader r=smaug
Based on the explanation on the bug, the solution would seem to be to call the
ModuleLoaderBase::OnModuleLoadComplete hook from a microtask. This causes a ton
of test failures.

Instead this patch changes the DOM script loader to implement this hook with a
runnable. This fixes the problem (verified manually) and all tests pass.

(Replacing the runnable with a microtask just in the DOM script loader also
does not work and results in many test failures. I'm still trying to understand
why.)

The changes to ContinueDynamicImport are removed because they are also on this
path and we don't need a microtask as well.

This takes us closer to the state before bug 1842798 landed when all the module
loader used MozPromise internally and completions like this happened via
runnables.

I was not able to immediately come up with a test for this.

Differential Revision: https://phabricator.services.mozilla.com/D185830
2023-08-09 22:49:46 +00:00
Jon Coppeard
80cac6bbb5 Bug 1843838 - Rename ScriptLoadRequest::IsReadyToRun to IsFinished since this returns true for cancelled requests r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D183740
2023-08-04 09:40:40 +00:00