Commit Graph
379 Commits
Author SHA1 Message Date
Yoshi Cheng-Hao Huang f793f2b086 Bug 1820594 - Part 22: Throw TypeError if the module type is unsupported. r=jonco
Differential Revision: https://phabricator.services.mozilla.com/D241812
2025-07-21 23:09:26 +00:00
Yoshi Cheng-Hao Huang 2c2abeb8a3 Bug 1820594 - Part 21: Implement HostLoadImportedModule and FinishLoadingImportedModule in ModuleLoaderBase. r=jonco
Differential Revision: https://phabricator.services.mozilla.com/D228856
2025-07-21 23:09:23 +00:00
Yoshi Cheng-Hao Huang e92cdaa129 Bug 1820594 - Part 20: Update module script's referrer policy. r=jonco
- Move UpdateReferrerPolicy from ScriptLoadRequest to ModuleLoadRequest,
  as this can only happend for a module load.

- Add UpdateReferrerPolicy method to ModuleScript.
  Introduces a new UpdateReferrerPolicy method for ModuleScript,
  allowing the referrer policy to be updated based on the associated
  ModuleLoadRequest.

Differential Revision: https://phabricator.services.mozilla.com/D255127
2025-07-21 23:09:20 +00:00
Yoshi Cheng-Hao Huang e7cc5dcf27 Bug 1820594 - Part 19: Refactor CreateStaticImport. r=jonco
Pass LoadContextBase to CreateStaticImport

Differential Revision: https://phabricator.services.mozilla.com/D255126
2025-07-21 23:09:17 +00:00
Yoshi Cheng-Hao Huang 96b553c522 Bug 1820594 - Part 18: Add mReferrerObj, mModuleRequestObj, mReferencingPrivate, mStatePrivate in ModuleLoadRequest r=jonco
Add data structures to pass those information to
FinishLoadingImportedModule.

Differential Revision: https://phabricator.services.mozilla.com/D228852
2025-07-21 23:09:14 +00:00
Yoshi Cheng-Hao Huang 4b60b4037a Bug 1820594 - Part 17: Add OnFetchSucceeded r=jonco
Differential Revision: https://phabricator.services.mozilla.com/D228853
2025-07-21 23:09:11 +00:00
Yoshi Cheng-Hao Huang a75c3d1989 Bug 1820594 - Part 16-1 : Use sync version of LoadRequestedModules for chrome pages. r=jonco
In mochitest-browser tests, it's possible for the about:neterror page to
load. This triggers aboutNetError.html, which in turn loads aboutNetError.mjs.

Occasionally, the load promise from
LoadRequestedModules(aboutNetError.mjs) is never resolved because the
PromiseJobRunnable is not executed if the global is in the process of
shutting down.

To avoid this issue, we now use the synchronous version of
LoadRequestedModules when loading chrome resources.

Differential Revision: https://phabricator.services.mozilla.com/D257676
2025-07-21 23:09:09 +00:00
Yoshi Cheng-Hao Huang cf9a4a886d Bug 1820594 - Part 16: Call LoadRequestedModules in StartFetchingModuleDependencies. r=jonco
Differential Revision: https://phabricator.services.mozilla.com/D251142
2025-07-21 23:09:06 +00:00
Yoshi Cheng-Hao Huang 8c45c3380e Bug 1820594 - Part 15: Remove HostResolveImportedModule and HostImportModuleDynamically r=jonco
Differential Revision: https://phabricator.services.mozilla.com/D228851
2025-07-21 23:09:03 +00:00
Yoshi Cheng-Hao Huang 09f1ea1a1a Bug 1820594 - Part 14: Remove VisitedURLSet. r=jonco
Visited set has been removed from the spec.
See https://whatpr.org/html/8253/085d4d1...75e7bf0/webappapis.html

Differential Revision: https://phabricator.services.mozilla.com/D228850
2025-07-21 23:09:00 +00:00
Yoshi Cheng-Hao Huang a5edee9705 Bug 1820594 - Part 13: Resume waiting requests after fetching dependencies. r=jonco
Process the ModuleLoadRequest itself first when it's fetched, then process the
waiting requests.

Differential Revision: https://phabricator.services.mozilla.com/D228849
2025-07-21 23:08:57 +00:00
Yoshi Cheng-Hao Huang b487d8ffec Bug 1820594 - Part 12: Implement ContinueDynamicImport. r=jonco
Implement https://tc39.es/ecma262/#sec-ContinueDynamicImport.

Differential Revision: https://phabricator.services.mozilla.com/D241811
2025-07-21 23:08:54 +00:00
Yoshi Cheng-Hao Huang 4f00fb82af Bug 1820594 - Part 5: Update Module Hook. r=jonco
Replace resolve hook and dynamic import hook with load hook.

Differential Revision: https://phabricator.services.mozilla.com/D214569
2025-07-21 23:08:33 +00:00
Yoshi Cheng-Hao Huang 5aaa5b3e47 Bug 1971701 - Remove JS::ExposeScriptToDebugger. r=arai
The script will be exposed to the debugger during stencil instantiation.
https://searchfox.org/mozilla-central/rev/61f64da2b20e50610d532675877ca4b5b9d6f1e4/js/src/frontend/BytecodeCompiler.cpp#498

Hence removing the extra call to expose the script.

Differential Revision: https://phabricator.services.mozilla.com/D253467
2025-07-09 12:50:08 +00:00
Sandor Molnar 3fd83b1709 Revert "Bug 1971701 - Remove JS::ExposeScriptToDebugger. r=arai" for causing regression.
This reverts commit 82b31dee46.
2025-07-03 17:23:02 +00:00
Yoshi Cheng-Hao Huang 82b31dee46 Bug 1971701 - Remove JS::ExposeScriptToDebugger. r=arai
The script will be exposed to the debugger during stencil instantiation.
https://searchfox.org/mozilla-central/rev/61f64da2b20e50610d532675877ca4b5b9d6f1e4/js/src/frontend/BytecodeCompiler.cpp#498

Hence removing the extra call to expose the script.

Differential Revision: https://phabricator.services.mozilla.com/D253467
2025-06-12 21:31:46 +00:00
Yoshi Cheng-Hao Huang 1722215448 Bug 1965426 - Check recursion limit in ModuleLoaderBase. r=jonco
Differential Revision: https://phabricator.services.mozilla.com/D249674
2025-06-03 08:20:31 +00:00
Serban Stanca fc8269fc61 Revert "Bug 1965426 - Update test. r=jonco"
This reverts commit 2e8fb158ca. for causing hazard linux build bustages in ModuleLoaderBase.cpp.

This reverts commit 7f1190586b.
2025-05-29 00:08:21 +00:00
Yoshi Cheng-Hao Huang 7f1190586b Bug 1965426 - Check recursion limit in ModuleLoaderBase. r=jonco
Differential Revision: https://phabricator.services.mozilla.com/D249674
2025-05-28 18:02:34 +00:00
Tooru Fujisawa c882062351 Bug 1949932 - Part 1: Use SharedScriptCache from ModuleLoader. r=nbp
Differential Revision: https://phabricator.services.mozilla.com/D242728
2025-04-01 13:09:04 +00:00
Stanca Serban 3d34fe1048 Backed out 8 changesets (bug 1949932) for causing reftests failures in LoadedScript.h. CLOSED TREE
Backed out changeset de39fd08733d (bug 1949932)
Backed out changeset b75281f1b27c (bug 1949932)
Backed out changeset 8920e6d4cf8c (bug 1949932)
Backed out changeset c05f9bf802ae (bug 1949932)
Backed out changeset 2c9718bfd7be (bug 1949932)
Backed out changeset 03f4514cfba8 (bug 1949932)
Backed out changeset 9fe4fd6ee6e8 (bug 1949932)
Backed out changeset 1cebf102e64e (bug 1949932)
2025-04-01 08:59:51 +03:00
Tooru Fujisawa 872eb028b0 Bug 1949932 - Part 1: Use SharedScriptCache from ModuleLoader. r=nbp
Differential Revision: https://phabricator.services.mozilla.com/D242728
2025-04-01 03:11:18 +00:00
Goloman Adrian 62c97b0b6c Backed out 8 changesets (bug 1949932) for causing build bustages @RootingAPI.h. CLOSED TREE
Backed out changeset 181cde5d267e (bug 1949932)
Backed out changeset 44fd656c40de (bug 1949932)
Backed out changeset b4d93df0edb1 (bug 1949932)
Backed out changeset 7c20db67f688 (bug 1949932)
Backed out changeset ac742d9dc3aa (bug 1949932)
Backed out changeset 102e0dc46dff (bug 1949932)
Backed out changeset 80d1b3331844 (bug 1949932)
Backed out changeset cc1834c3ea2a (bug 1949932)
2025-04-01 07:09:29 +03:00
Tooru Fujisawa 85a3b6e05a Bug 1949932 - Part 1: Use SharedScriptCache from ModuleLoader. r=nbp
Differential Revision: https://phabricator.services.mozilla.com/D242728
2025-04-01 03:11:18 +00:00
Tooru Fujisawa bcc4c6ecf8 Bug 1954644 - Part 9: Remove unnecessary cast. r=nbp
Differential Revision: https://phabricator.services.mozilla.com/D242314
2025-03-22 04:03:56 +00:00
Tooru Fujisawa 303abbb5c4 Bug 1954644 - Part 1: Make the cycle collection macro use consistent. r=nbp
Differential Revision: https://phabricator.services.mozilla.com/D242306
2025-03-22 04:03:54 +00:00
Fatih Kilic 37486aeb74 Bug 1945540: Part 3 - Get integrity from import map. r=tschuster,jonco,dom-core,mccr8
Differential Revision: https://phabricator.services.mozilla.com/D236559
2025-03-06 14:16:30 +00:00
Yoshi Cheng-Hao Huang 0f700f4d20 Bug 1948589 - Part 1: Report exception if import() a unknown module type. r=jonco
Differential Revision: https://phabricator.services.mozilla.com/D238421
2025-02-18 17:41:52 +00:00
Jonatan Klemets d81453192a 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 4823d60d86 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 d79584cae1 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 00609001ca 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 24c00f1528 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 becd3a556a 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 76c8568c12 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 c5a80d9d47 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 0598953bb0 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 a842adb0d9 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 4f0c793a69 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 8fcdc93c58 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 939678147a 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 df3d32caa7 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 fa63416707 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 5855439476 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 bf0dcb0282 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 c0c83bb35e 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
Yoshi Cheng-Hao Huang 3835b8b745 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 10f6e873a0 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
Yoshi Cheng-Hao Huang 3c82f6e2c6 Bug 1893164 - Make CancelImport() won't cancel a request if the URI is been waiting by other requests. r=jonco
In the following module graph:

0.html
  +---- 1.mjs
    +---- non_existing.mjs
    +---- 3.mjs
  +----- 2.mjs
    +---- 3.mjs

Both 1.mjs and 2.mjs have a common submodule called 3.mjs
But 1.mjs also has a non-existing submodule, so we can't instantiate the
module graph of 1.mjs. which in turn will cancel 3.mjs

But 3.mjs is also a sub-module of 2.mjs, so in order to instantiate the
module graph of 2.mjs, we skip canceling 3.mjs when we processed 1.mjs

Differential Revision: https://phabricator.services.mozilla.com/D209210
2024-05-07 16:03:20 +00:00
Mike Hommey e99c9ea189 Bug 1894861 - Avoid unused-but-set-variable on release/beta builds. r=spidermonkey-reviewers,jandem
Differential Revision: https://phabricator.services.mozilla.com/D209326
2024-05-03 07:23:01 +00:00