Commit Graph

319 Commits

Author SHA1 Message Date
Bryan Thrall
25dd49c76e Bug 1724236 - Rename JSExecutionUtils from JSExecutionContext r=arai
Differential Revision: https://phabricator.services.mozilla.com/D218458
2024-10-30 13:41:47 +00:00
Jon Coppeard
1f0c1c2c8c Bug 1927125 - Avoid triggering gray unmarking when unlinking module scripts r=sfink
Differential Revision: https://phabricator.services.mozilla.com/D226902
2024-10-28 17:34:58 +00:00
serge-sans-paille
6af2d4d061 Bug 1923330 - Reorder using declaration to prevent -Wchanges-meaning warning r=jonco
Differential Revision: https://phabricator.services.mozilla.com/D224935
2024-10-09 12:30:17 +00:00
Tooru Fujisawa
3b8e2cac5e Bug 1916635 - Part 1: Create PerformanceResourceTiming entry for SharedScriptCache. r=bthrall
Differential Revision: https://phabricator.services.mozilla.com/D223357
2024-10-01 12:17:26 +00:00
Jonatan Klemets
f37966e2da Bug 1917899 - Check unsupported import attributes before resolving specifier r=jonco
We need to check if we have an unsupported attribute before resolving the
specifier because, according to the spec, the unknown attribute should be
reported before the invalid specifier.

Differential Revision: https://phabricator.services.mozilla.com/D221998
2024-09-17 08:25:46 +00:00
Jonatan Klemets
62e1b7048b Bug 1877792 - Part 15: Skip ExposeScriptToDebugger/UpdateDebugMetadata for synthetic modules r=spidermonkey-reviewers,jonco
Differential Revision: https://phabricator.services.mozilla.com/D218562
2024-09-03 08:10:53 +00:00
Jonatan Klemets
e31a8b4afd Bug 1877792 - Part 14: Return early in ModuleLoaderBase::ResolveRequestedModules for synthetic modules r=spidermonkey-reviewers,jonco
Synthetic modules do not have any dependencies, so calling
`GetRequestedModulesCount` results in cash. This patch fixes this by making
`ResolveRequestedModules` return early for synthetic modules.

Differential Revision: https://phabricator.services.mozilla.com/D218561
2024-09-03 08:10:53 +00:00
Jonatan Klemets
8abf56a6f1 Bug 1877792 - Part 13: Skip setting/clearing the module private for synthetic modules r=spidermonkey-reviewers,jonco
Synthetic modules do not have a module private.

Differential Revision: https://phabricator.services.mozilla.com/D218560
2024-09-03 08:10:52 +00:00
Jonatan Klemets
f51d6ad0ee Bug 1877792 - Part 10: Get the module type from the module request r=spidermonkey-reviewers,jonco
Differential Revision: https://phabricator.services.mozilla.com/D218557
2024-09-03 08:10:51 +00:00
Jonatan Klemets
90ce482d33 Bug 1877792 - Part 9: Add module type to ModuleLoaderBase::{CreateStaticImport,CreateDynamicImport} r=spidermonkey-reviewers,dom-worker-reviewers,dom-core,asuth,jonco,mccr8
This patch adds a module type parameter to
`ModuleLoaderBase::{CreateStaticImport,CreateDynamicImport},` and gets rid of a
bunch of hard-coded `JS::ModuleType::JavaScript.` However, the module type is
still hard-coded when we call `CreateDynamicImport` and `CreateStaticImport`.

Differential Revision: https://phabricator.services.mozilla.com/D218556
2024-09-03 08:10:51 +00:00
Jonatan Klemets
db231924a1 Bug 1877792 - Part 8: Add module type to ModuleLoadRequest::NewVisitedSetForTopLevelImport r=spidermonkey-reviewers,dom-worker-reviewers,dom-core,asuth,jonco,mccr8
This patch adds the new parameter to the `NewVisitedSetForTopLevelImport`
method, but we hard-code the module type (which will be addressed in a later
patch)

Differential Revision: https://phabricator.services.mozilla.com/D218555
2024-09-03 08:10:50 +00:00
Jonatan Klemets
0b9e8773d1 Bug 1877792 - Part 7: Add ModuleLoadRequest::mModuleType r=dom-core,spidermonkey-reviewers,dom-worker-reviewers,asuth,jonco,mccr8
This patch gets rid of most hard-coded `JS::ModuleType::JavaScript` in
`js/loader/ModuleLoaderBase.cpp`. However, the module type is still hard-coded
when constructing the `ModuleLoadRequest` (will be addressed in a later patch).

Differential Revision: https://phabricator.services.mozilla.com/D218554
2024-09-03 08:10:50 +00:00
Jonatan Klemets
9b253ffb2f Bug 1877792 - Part 6: Change ModuleLoaderBase::ResolveRequestedModules to handle URL and module type r=spidermonkey-reviewers,jonco
This patch is a small step towards the end goal, so we hardcoded the module
type to `JS::ModuleType::JavaScript`, but that will get changed in a later
patch.

Differential Revision: https://phabricator.services.mozilla.com/D218553
2024-09-03 08:10:50 +00:00
Jonatan Klemets
dff276102a Bug 1877792 - Part 3: Update module map methods to take ModuleMapKey instead of nsIURI r=spidermonkey-reviewers,jonco
Differential Revision: https://phabricator.services.mozilla.com/D218209
2024-09-03 08:10:48 +00:00
Jonatan Klemets
ba08d2d2a6 Bug 1877792 - Part 2: Change the module map key to include both URL and module type r=yulia,jonco
The module maps (`mFetchingModules` and `mFetchedModules`) in
`ModuleLoaderBase`, and `VisitedURLSet` were previously only keyed by the URL
and used the `nsURIHashKey` hashtable key class. This is no longer sufficient,
and the key should also contain the module type.

This patch introduces a new hashtable key class called `ModuleMapKey` and
changes `mFetchingModules`, `mFetchedModules`, and `VisitedURLSet` to use the
new key type.

To make this a bit easier to review, this first patch only introduces the new
key type and hard-codes the type to Javascript, where the key is constructed.
The hard-corded module types will be fixed in later patches.

Differential Revision: https://phabricator.services.mozilla.com/D155160
2024-09-03 08:10:48 +00:00
Cristina Horotan
4a265fbad7 Backed out 20 changesets (bug 1877792) for causing wpt failures at importscripts_mime_local.any.sharedworker.html CLOSED TREE
Backed out changeset 19d78d0b6ee4 (bug 1877792)
Backed out changeset 14f104e5ce51 (bug 1877792)
Backed out changeset 662eb52b2a6f (bug 1877792)
Backed out changeset 48dc4035a14f (bug 1877792)
Backed out changeset d98ecddf2f59 (bug 1877792)
Backed out changeset 1234a31ff88f (bug 1877792)
Backed out changeset a3b5b0cde6ce (bug 1877792)
Backed out changeset a1f494b9592a (bug 1877792)
Backed out changeset a4d7565218f3 (bug 1877792)
Backed out changeset fe179004423b (bug 1877792)
Backed out changeset 39a20aee3942 (bug 1877792)
Backed out changeset 95b20763e650 (bug 1877792)
Backed out changeset d763241fccaf (bug 1877792)
Backed out changeset 0674cf646120 (bug 1877792)
Backed out changeset bd23c96418b6 (bug 1877792)
Backed out changeset 5b1e29e4c597 (bug 1877792)
Backed out changeset 3cead4149e6b (bug 1877792)
Backed out changeset d73a9f57f03c (bug 1877792)
Backed out changeset 82a58a80f58a (bug 1877792)
Backed out changeset 4c7182604e4f (bug 1877792)
2024-08-22 19:23:15 +03:00
Jonatan Klemets
a0b20e3de5 Bug 1877792 - Part 15: Skip ExposeScriptToDebugger/UpdateDebugMetadata for synthetic modules r=spidermonkey-reviewers,jonco
Differential Revision: https://phabricator.services.mozilla.com/D218562
2024-08-22 14:21:54 +00:00
Jonatan Klemets
ecdca2b7fa Bug 1877792 - Part 14: Return early in ModuleLoaderBase::ResolveRequestedModules for synthetic modules r=spidermonkey-reviewers,jonco
Synthetic modules do not have any dependencies, so calling
`GetRequestedModulesCount` results in cash. This patch fixes this by making
`ResolveRequestedModules` return early for synthetic modules.

Differential Revision: https://phabricator.services.mozilla.com/D218561
2024-08-22 14:21:53 +00:00
Jonatan Klemets
3f5c66cd48 Bug 1877792 - Part 13: Skip setting/clearing the module private for synthetic modules r=spidermonkey-reviewers,jonco
Synthetic modules do not have a module private.

Differential Revision: https://phabricator.services.mozilla.com/D218560
2024-08-22 14:21:53 +00:00
Jonatan Klemets
daa92e2070 Bug 1877792 - Part 10: Get the module type from the module request r=spidermonkey-reviewers,jonco
Differential Revision: https://phabricator.services.mozilla.com/D218557
2024-08-22 14:21:52 +00:00
Jonatan Klemets
3144c8595c Bug 1877792 - Part 9: Add module type to ModuleLoaderBase::{CreateStaticImport,CreateDynamicImport} r=spidermonkey-reviewers,dom-worker-reviewers,dom-core,asuth,jonco,mccr8
This patch adds a module type parameter to
`ModuleLoaderBase::{CreateStaticImport,CreateDynamicImport},` and gets rid of a
bunch of hard-coded `JS::ModuleType::JavaScript.` However, the module type is
still hard-coded when we call `CreateDynamicImport` and `CreateStaticImport`.

Differential Revision: https://phabricator.services.mozilla.com/D218556
2024-08-22 14:21:51 +00:00
Jonatan Klemets
964442fc8b Bug 1877792 - Part 8: Add module type to ModuleLoadRequest::NewVisitedSetForTopLevelImport r=spidermonkey-reviewers,dom-worker-reviewers,dom-core,asuth,jonco,mccr8
This patch adds the new parameter to the `NewVisitedSetForTopLevelImport`
method, but we hard-code the module type (which will be addressed in a later
patch)

Differential Revision: https://phabricator.services.mozilla.com/D218555
2024-08-22 14:21:51 +00:00
Jonatan Klemets
2e394c79e0 Bug 1877792 - Part 7: Add ModuleLoadRequest::mModuleType r=dom-core,spidermonkey-reviewers,dom-worker-reviewers,asuth,jonco,mccr8
This patch gets rid of most hard-coded `JS::ModuleType::JavaScript` in
`js/loader/ModuleLoaderBase.cpp`. However, the module type is still hard-coded
when constructing the `ModuleLoadRequest` (will be addressed in a later patch).

Differential Revision: https://phabricator.services.mozilla.com/D218554
2024-08-22 14:21:50 +00:00
Jonatan Klemets
781478dd62 Bug 1877792 - Part 6: Change ModuleLoaderBase::ResolveRequestedModules to handle URL and module type r=spidermonkey-reviewers,jonco
This patch is a small step towards the end goal, so we hardcoded the module
type to `JS::ModuleType::JavaScript`, but that will get changed in a later
patch.

Differential Revision: https://phabricator.services.mozilla.com/D218553
2024-08-22 14:21:50 +00:00
Jonatan Klemets
8594c67208 Bug 1877792 - Part 3: Update module map methods to take ModuleMapKey instead of nsIURI r=spidermonkey-reviewers,jonco
Differential Revision: https://phabricator.services.mozilla.com/D218209
2024-08-22 14:21:49 +00:00
Jonatan Klemets
2d109af176 Bug 1877792 - Part 2: Change the module map key to include both URL and module type r=yulia,jonco
The module maps (`mFetchingModules` and `mFetchedModules`) in
`ModuleLoaderBase`, and `VisitedURLSet` were previously only keyed by the URL
and used the `nsURIHashKey` hashtable key class. This is no longer sufficient,
and the key should also contain the module type.

This patch introduces a new hashtable key class called `ModuleMapKey` and
changes `mFetchingModules`, `mFetchedModules`, and `VisitedURLSet` to use the
new key type.

To make this a bit easier to review, this first patch only introduces the new
key type and hard-codes the type to Javascript, where the key is constructed.
The hard-corded module types will be fixed in later patches.

Differential Revision: https://phabricator.services.mozilla.com/D155160
2024-08-22 14:21:48 +00:00
Tooru Fujisawa
1abe447481 Bug 1907009 - Part 1: Add CacheExpirationTime type. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D217957
2024-08-06 05:38:23 +00:00
Tooru Fujisawa
6a28b524a7 Bug 1896709 - Part 13: Use SharedSubResourceCache in ScriptLoader. r=nbp
Differential Revision: https://phabricator.services.mozilla.com/D215882
2024-07-18 21:58:14 +00:00
Tooru Fujisawa
5df27e020f Bug 1896709 - Part 9: Add ScriptLoadRequest::CacheEntryFound. r=nbp
Differential Revision: https://phabricator.services.mozilla.com/D215878
2024-07-18 21:58:13 +00:00
Tooru Fujisawa
7cfcc2dd16 Bug 1896709 - Part 8: Add Stencil variant to LoadedScript. r=nbp
Differential Revision: https://phabricator.services.mozilla.com/D215877
2024-07-18 21:58:12 +00:00
Tooru Fujisawa
63ff32222f Bug 1896709 - Part 5: Add ScriptLoadRequest::IsCacheable. r=nbp
Differential Revision: https://phabricator.services.mozilla.com/D215874
2024-07-18 21:58:11 +00:00
Tooru Fujisawa
6e28e4193f Bug 1896709 - Part 4: Accumulate cache expiration time in script load. r=nbp
Differential Revision: https://phabricator.services.mozilla.com/D215873
2024-07-18 21:58:11 +00:00
Tooru Fujisawa
f5b744f9a0 Bug 1896709 - Part 3: Add LoadedScript::CanHaveBytecode. r=nbp
Differential Revision: https://phabricator.services.mozilla.com/D215872
2024-07-18 21:58:10 +00:00
Tooru Fujisawa
796f803980 Bug 1896709 - Part 2: Add const variant of ScriptLoadRequest::GetScriptLoadContext. r=nbp
Differential Revision: https://phabricator.services.mozilla.com/D215871
2024-07-18 21:58:10 +00:00
Tooru Fujisawa
b09906793a Bug 1896709 - Part 1: Add const variant of LoadContextBase::AsWindowContext. r=nbp
Differential Revision: https://phabricator.services.mozilla.com/D215870
2024-07-18 21:58:09 +00:00
Norisz Fay
4f9e791bda Backed out 17 changesets (bug 1896709) for causing build bustage and mochitest failures CLOSED TREE
Backed out changeset 046f0f522ce7 (bug 1896709)
Backed out changeset 0271e50308e6 (bug 1896709)
Backed out changeset 26fac760de19 (bug 1896709)
Backed out changeset 6fa3424dfc40 (bug 1896709)
Backed out changeset b7bcb9904435 (bug 1896709)
Backed out changeset c6878c5fdde4 (bug 1896709)
Backed out changeset 8ca8a4082e44 (bug 1896709)
Backed out changeset 20ff83806cc6 (bug 1896709)
Backed out changeset 6c9338852a19 (bug 1896709)
Backed out changeset e8615b5d82ab (bug 1896709)
Backed out changeset 842f2047a4bd (bug 1896709)
Backed out changeset 54eea04a7342 (bug 1896709)
Backed out changeset 220b544127cb (bug 1896709)
Backed out changeset 52ce0ebfb29a (bug 1896709)
Backed out changeset 34fc79dc1ad7 (bug 1896709)
Backed out changeset 50b0f6a23e3c (bug 1896709)
Backed out changeset 89c4c6bb465a (bug 1896709)
2024-07-18 14:48:46 +03:00
Tooru Fujisawa
f961ea023d Bug 1896709 - Part 13: Use SharedSubResourceCache in ScriptLoader. r=nbp
Differential Revision: https://phabricator.services.mozilla.com/D215882
2024-07-18 09:15:28 +00:00
Tooru Fujisawa
472805ac07 Bug 1896709 - Part 9: Add ScriptLoadRequest::CacheEntryFound. r=nbp
Differential Revision: https://phabricator.services.mozilla.com/D215878
2024-07-18 09:15:26 +00:00
Tooru Fujisawa
3034737b45 Bug 1896709 - Part 8: Add Stencil variant to LoadedScript. r=nbp
Differential Revision: https://phabricator.services.mozilla.com/D215877
2024-07-18 09:15:26 +00:00
Tooru Fujisawa
d86319fc89 Bug 1896709 - Part 5: Add ScriptLoadRequest::IsCacheable. r=nbp
Differential Revision: https://phabricator.services.mozilla.com/D215874
2024-07-18 09:15:25 +00:00
Tooru Fujisawa
c2bffeebe3 Bug 1896709 - Part 4: Accumulate cache expiration time in script load. r=nbp
Differential Revision: https://phabricator.services.mozilla.com/D215873
2024-07-18 09:15:24 +00:00
Tooru Fujisawa
212a2bd80d Bug 1896709 - Part 3: Add LoadedScript::CanHaveBytecode. r=nbp
Differential Revision: https://phabricator.services.mozilla.com/D215872
2024-07-18 09:15:24 +00:00
Tooru Fujisawa
996f0be02b Bug 1896709 - Part 2: Add const variant of ScriptLoadRequest::GetScriptLoadContext. r=nbp
Differential Revision: https://phabricator.services.mozilla.com/D215871
2024-07-18 09:15:24 +00:00
Tooru Fujisawa
cdfa392aae Bug 1896709 - Part 1: Add const variant of LoadContextBase::AsWindowContext. r=nbp
Differential Revision: https://phabricator.services.mozilla.com/D215870
2024-07-18 09:15:23 +00:00
Yoshi Cheng-Hao Huang
d9196c184b Bug 1901482: Fix failed requests being kept in mDynamicImportRequests. r=jonco
In StartDynamicImport, if StartModuleLoad failed, the request would be
kept in mDynamicImportRequests until shutdown.
This fixes the problem by removing it from mDynamicImportRequests once
StartModuleLoad fails.

Differential Revision: https://phabricator.services.mozilla.com/D213016
2024-06-10 17:48:48 +00:00
Tooru Fujisawa
d56e00ca0e Bug 1899172 - Part 11: Move nsIScriptElement from ScriptFetchOptions to ScriptLoadContext. r=nbp
Differential Revision: https://phabricator.services.mozilla.com/D211912
2024-05-30 05:01:18 +00:00
Tooru Fujisawa
c0957a7fc8 Bug 1899172 - Part 2: Add ScriptLoadContext::GetInlineScriptText. r=nbp
Differential Revision: https://phabricator.services.mozilla.com/D211902
2024-05-30 05:01:15 +00:00
Tooru Fujisawa
24265d53c5 Bug 1899172 - Part 1: Cleanup TRACE_FOR_TEST macros. r=nbp
Differential Revision: https://phabricator.services.mozilla.com/D211901
2024-05-30 05:01:14 +00:00
Tooru Fujisawa
071e366ef9 Bug 1898677 - Cache the result of bytecode encoding condition. r=nbp
Differential Revision: https://phabricator.services.mozilla.com/D211517
2024-05-27 06:31:16 +00:00
Yoshi Cheng-Hao Huang
7eff133516 Bug 1894631 - Add CancelingImport state in ScriptLoadRequest::State. r=jonco
In the following module graph:

0.html
    +---- 1.mjs
        +---- 2.mjs (modulepreload)
            +---- 3.mjs (modulepreload)
            +---- 4.mjs
        +---- non_existing.mjs

Fetching non_existing.mjs will fail, which will notify its parent module
1.mjs with ModuleErrored(), and then 1.mjs will cancel its imports.

The sequence is as follows:
1. 1.mjs cancels 2.mjs, 2.mjs changes to Cancel state
2. 2.mjs cancels 3.mjs, 3.mjs is already preloaded, its state still remains Finished.
3. 2.mjs cancels 4.mjs, 4.mjs changes to Cancel state.

Now, 2.mjs will call ChildLoadComplete[1], which will call 1.mjs
ModuleErrored()[2] again (The 1st time is called when loading non_existing.mjs failed)

Now 1.mjs wants to cancel 2.mjs again, and 2.mjs has been canceled
previously, so it will do AssertAllImportsCanceled() check[3].

However, 3.mjs has been fetched by <modulepreload> and is in Finished
state, which triggers the assertion failure.

To fix this, I add a new state in ScriptLoadRequest::State called
CancelingImport, to fix the problem the CancelImport() call is called by
non_existing.mjs and 2.mjs.

[1]: https://searchfox.org/mozilla-central/rev/f1532761de0b60337e42c6c3f525288a523dabef/js/loader/ModuleLoadRequest.cpp#100
[2]: https://searchfox.org/mozilla-central/rev/f1532761de0b60337e42c6c3f525288a523dabef/js/loader/ModuleLoaderBase.cpp#954
[3]: https://searchfox.org/mozilla-central/rev/f1532761de0b60337e42c6c3f525288a523dabef/js/loader/ModuleLoadRequest.cpp#86

Differential Revision: https://phabricator.services.mozilla.com/D209218
2024-05-07 16:03:20 +00:00