Commit Graph
1163 Commits
Author SHA1 Message Date
Atila Butkovits c5ace57d5c Revert "Bug 1720570: apply code formatting via Lando" for causing Hazard failures.
This reverts commit 8267f4ae14.

Revert "Bug 1720570 - Update web-platform test expectations; r=layout-reviewers,emilio"

This reverts commit 0a8f6facf2.

Revert "Bug 1720570 - Use backgroundImage in relative-urls.html; r=layout-reviewers,emilio"

This reverts commit 886bec571a.

Revert "Bug 1720570 - Support fetching css module scripts; r=dom-core,smaug"

This reverts commit 161decf185.

Revert "Bug 1720570 - Add support for css modules in ModuleLoader, WorkerModuleLoader and WorkletModuleLoader; r=allstarschh,dom-core,emilio,smaug"

This reverts commit 1c0eba5a86.

Revert "Bug 1720570 - Break out separate method to create constructed stylesheets; r=layout-reviewers,firefox-style-system-reviewers,emilio"

This reverts commit 0552b0f555.

Revert "Bug 1720570 - Move ModuleTypeAllowed check into ModuleLoaderBase; r=allstarschh"

This reverts commit b3be3d8fc4.

Revert "Bug 1720570 - Handle css module in GetModuleType; r=allstarschh"

This reverts commit 6ff53c0877.

Revert "Bug 1720570 - Add CreateCssModule; r=allstarschh"

This reverts commit cf4c677737.

Revert "Bug 1720570 - Add ModuleType::CSS; r=allstarschh"

This reverts commit e5f6251479.

Revert "Bug 1720570 - Add pref for css module scripts; r=layout-reviewers,emilio"

This reverts commit 9155521841.
2025-09-09 00:35:54 +00:00
Daniel Minor 161decf185 Bug 1720570 - Support fetching css module scripts; r=dom-core,smaug
Differential Revision: https://phabricator.services.mozilla.com/D263415
2025-09-08 18:30:29 +00:00
Denis 33c47a05a3 Bug 1980830: Eagerly baseline compile off the main thread when bytecode and jit hints are available. r=iain,arai
This patch will look for functions during instantiation that have bytecode and jit hints and will eagerly dispatch baseline compilations off the main thread when present.

Differential Revision: https://phabricator.services.mozilla.com/D261939
2025-09-05 00:39:18 +00:00
Frédéric Wang 163aea67f3 Bug 1928932 - Part 2 - Implement enforcements for untrusted script elements. r=smaug
Spec: https://w3c.github.io/trusted-types/dist/spec/#enforcement-in-scripts
PR: https://github.com/w3c/trusted-types/pull/579/

Differential Revision: https://phabricator.services.mozilla.com/D251855
2025-09-02 20:04:40 +00:00
Mathew Hodson ce2189870d Bug 1975128 - Align event script processing with spec r=smaug
Use nsContentUtils::IsHTMLWhitespace to match
https://infra.spec.whatwg.org/#ascii-whitespace

Differential Revision: https://phabricator.services.mozilla.com/D255750
2025-09-01 19:42:08 +00:00
Nika Layzell 7d39c30b5b Bug 1979013 - Part 2: Require nsITimer API callers to provide a nsACString, r=xpcom-reviewers,media-playback-reviewers,webrtc-reviewers,profiler-reviewers,dom-storage-reviewers,toolkit-telemetry-reviewers,firefox-style-system-reviewers,mstange,emz,bwc,janv,emilio,padenot
This avoids the small overhead and potential for bugs from the previous
approach of assuming all `const char*` arguments passed to `nsITimer`
initializers are string literals, by instead requiring the argument to be a
`const nsACString&`. This involves changing all callsites to pass a `""_ns`
string literal down instead of a bare string literal.

It appears that while there were currently no buggy callers which
would've provided a dynamic string, there was at least one piece of code
(nsRepeatService::Start) which did pass down a raw char* which may be
dynamically allocated (all callers pass down `nsLiteralCString` so we're
actually OK here right now, but this was a footgun).

Differential Revision: https://phabricator.services.mozilla.com/D261032
2025-08-29 16:18:25 +00:00
iulian moraru f5d6849317 Revert "Bug 1979013: apply code formatting via Lando" for causing windows build bustages on MFTEncoder.cpp.
This reverts commit 8c929cc018.

Revert "Bug 1979013 - Part 2: Require nsITimer API callers to provide a nsACString, r=xpcom-reviewers,media-playback-reviewers,webrtc-reviewers,profiler-reviewers,dom-storage-reviewers,toolkit-telemetry-reviewers,firefox-style-system-reviewers,mstange,emz,bwc,janv,emilio,padenot"

This reverts commit e01c0a6a32.

Revert "Bug 1979013 - Part 1: Eagerly fetch name for timer callbacks, r=xpcom-reviewers,mccr8"

This reverts commit 9f8e73c163.
2025-08-27 23:00:09 +00:00
Nika Layzell e01c0a6a32 Bug 1979013 - Part 2: Require nsITimer API callers to provide a nsACString, r=xpcom-reviewers,media-playback-reviewers,webrtc-reviewers,profiler-reviewers,dom-storage-reviewers,toolkit-telemetry-reviewers,firefox-style-system-reviewers,mstange,emz,bwc,janv,emilio,padenot
This avoids the small overhead and potential for bugs from the previous
approach of assuming all `const char*` arguments passed to `nsITimer`
initializers are string literals, by instead requiring the argument to be a
`const nsACString&`. This involves changing all callsites to pass a `""_ns`
string literal down instead of a bare string literal.

It appears that while there were currently no buggy callers which
would've provided a dynamic string, there was at least one piece of code
(nsRepeatService::Start) which did pass down a raw char* which may be
dynamically allocated (all callers pass down `nsLiteralCString` so we're
actually OK here right now, but this was a footgun).

Differential Revision: https://phabricator.services.mozilla.com/D261032
2025-08-27 22:04:15 +00:00
Tooru Fujisawa 772c2d9c97 Bug 1979595 - Reduce ScriptLoadRequest::mSourceMapURL size. r=nbp
Differential Revision: https://phabricator.services.mozilla.com/D260915
2025-08-25 05:48:00 +00:00
Tooru Fujisawa ff81aa7a45 Bug 1977148 - Part 5: Stop using JS::FinishCollectingDelazifications with TranscodeBuffer. r=nbp
JS::FinishCollectingDelazifications with TranscodeBuffer is the equivalent of
JS::FinishCollectingDelazifications with stencil and JS::EncodeStencil, and
nothing is optimized (e.g. skip some allocation etc).

Differential Revision: https://phabricator.services.mozilla.com/D260912
2025-08-25 05:47:49 +00:00
Tooru Fujisawa ea00d6421a Bug 1977148 - Part 4: Rename bytecode-encoding-related identifiers to cache. r=nbp
There are shared path between "save bytecode" vs "cache stencil".
This patch just renames everything, and the subsequent bugs and patches will
split the flag and methods.

Differential Revision: https://phabricator.services.mozilla.com/D260911
2025-08-25 05:47:45 +00:00
Tooru Fujisawa 7cce2db4cd Bug 1977148 - Part 3: Always call CalculateCacheFlag. r=nbp
As a preparation to calculate the "bytecode encoding" separately than "do cache"
for the navigation cache, we should always calculate the flag.

Differential Revision: https://phabricator.services.mozilla.com/D260910
2025-08-25 05:47:42 +00:00
Tooru Fujisawa 3c47d21515 Bug 1977148 - Part 2: Do not set the same stencil again. r=nbp
With the InitialStencilAndDelazifications structure,
JS::FinishCollectingDelazifications returns the same stencil as what's passed
to JS::StartCollectingDelazifications.

Differential Revision: https://phabricator.services.mozilla.com/D260909
2025-08-25 05:47:38 +00:00
Tooru Fujisawa fe1794e0cd Bug 1977148 - Part 1: Use the navigation-cache-specific path also for modules. r=nbp
If the navigation cache is enabled, the modules case should also take a
dedicate path, so that the bytecode encoding doesn't happen unexpectedly.

Differential Revision: https://phabricator.services.mozilla.com/D260908
2025-08-25 05:47:34 +00:00
Cristina Horotan b5a01df6d6 Revert "Bug 957054 - Test that unsupported script types don't speculatively load r=smaug" on request by smaug
This reverts commit 2da909cbae.

Revert "Bug 957054 - Don't preload scripts with unknown type r=smaug"

This reverts commit e892f62139.
2025-08-19 19:33:58 +00:00
Henri Sivonen b94ab79d68 Bug 1978091 - Make onerror on scripts with an unknown URL scheme fire at similar time compared to failed HTTP fetches. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D259848
2025-08-07 10:26:08 +00:00
Emilio Cobos Álvarez 791917d8af Bug 1976665 - Sort headers in dom/. r=dom-core,media-playback-reviewers,webrtc-reviewers,dom-storage-reviewers,padenot,janv,smaug,jesup,jib
Most changes are automated. Relevant bit is dom/.clang-format. I had to
manually disable clang-format in a few places where importing external
files and so on that aren't self-contained, and fix a couple includes /
forward declarations.

Differential Revision: https://phabricator.services.mozilla.com/D256800
2025-08-05 11:47:34 +00:00
Cristina Horotan 5d85401073 Revert "Bug 1975128 - Align event script processing with spec r=smaug" for causing wpt failures on /execution-timing/149.html
This reverts commit 9772b1ea20.
2025-08-04 19:50:34 +00:00
Mathew Hodson 9772b1ea20 Bug 1975128 - Align event script processing with spec r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D255750
2025-08-04 18:36:42 +00:00
Mathew Hodson e892f62139 Bug 957054 - Don't preload scripts with unknown type r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D201323
2025-07-30 18:34:12 +00:00
pstanciu c6c7060b08 Revert "Bug 1975128 - Align event script processing with spec r=smaug" for causing BP bustages @ScriptLoader.cpp
This reverts commit 5ab9be4c96.

Revert "Bug 957054 - Test that unsupported script types don't speculatively load r=smaug"

This reverts commit f1d8923b7f.

Revert "Bug 957054 - Don't preload scripts with unknown type r=smaug"

This reverts commit 78e1e21e6e.
2025-07-27 20:12:43 +00:00
Mathew Hodson 5ab9be4c96 Bug 1975128 - Align event script processing with spec r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D255750
2025-07-27 19:21:45 +00:00
Mathew Hodson 78e1e21e6e Bug 957054 - Don't preload scripts with unknown type r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D201323
2025-07-27 19:17:17 +00:00
Yoshi Cheng-Hao Huang a61af56c37 Bug 1820594 - Part 36: Add CancelFetchingModules. 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, eventually importing pkijs.js. The pkijs.js module is
compiled off-thread.

However, when the test framework proceeds to the next test, the
associated document may be detached before the off-thread compilation of
pkijs.js completes. If this happens while TaskController is shutting
down, the compilation task may never finish.

Currently, ScriptLoader only tracks top-level off-thread compilation
requests, not submodules involved in those tasks. To address this, we
now call CancelFetchingModules when ScriptLoader cancels ongoing
requests, ensuring submodule fetches are also properly aborted.

Differential Revision: https://phabricator.services.mozilla.com/D257677
2025-07-22 18:30:00 +00:00
Yoshi Cheng-Hao Huang a45a4b1662 Bug 1820594 - Part 28: DOM, Worker, Worklet ScriptLoader, mozJSModuleLoader update r=jonco
Differential Revision: https://phabricator.services.mozilla.com/D228863
2025-07-22 18:29:37 +00:00
Yoshi Cheng-Hao Huang 264c8307be Bug 1820594 - Part 27: Remove redundant module graph data structures from host layer. r=jonco
Since the module graph is now traversed within the JS engine itself, the
related data structures in the host layer are no longer necessary.

Differential Revision: https://phabricator.services.mozilla.com/D255129
2025-07-22 18:29:34 +00:00
Yoshi Cheng-Hao Huang cfaa6e7c06 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-22 18:29:13 +00:00
Atila Butkovits f46ece6f70 Revert "Bug 1820594 - Part 36: Add CancelFetchingModules. r=jonco" for causing failures at mochitest.toml.
This reverts commit bb9106dfec.

Revert "Bug 1820594 - Part 35: Disable testSyncImportWhileAsyncImportTLA. r=arai"

This reverts commit bd7ac6c6da.

Revert "Bug 1820594 - Part 34: Update wpt ini for dynamic import. r=jonco"

This reverts commit 6dc30859a2.

Revert "Bug 1820594 - Part 33: Update choice-of-error-1.html.ini and error-type-1.html.ini failed as expected. r=jonco"

This reverts commit 696d4051b2.

Revert "Bug 1820594 - Part 32: Remove js/src/jit-test/tests/modules/bug-1287410.js. r=jonco"

This reverts commit 6a47bd9a7c.

Revert "Bug 1820594 - Part 31: Test the child requests accross multiple module graphs. r=jonco"

This reverts commit fc403c5ea9.

Revert "Bug 1820594 - Part 30: Update JS Shell implementation for HostLoadImportedModule. r=jonco"

This reverts commit 5a2f281ba7.

Revert "Bug 1820594 - Part 29: Remove ModuleLoader::ResolveImportedModule and ModuleLoader::ImportModuleDynamically in JS Shell r=jonco"

This reverts commit aa686310fc.

Revert "Bug 1820594 - Part 28: DOM, Worker, Worklet ScriptLoader, mozJSModuleLoader update r=jonco"

This reverts commit 86aea74da6.

Revert "Bug 1820594 - Part 27: Remove redundant module graph data structures from host layer. r=jonco"

This reverts commit 81673cfb4e.

Revert "Bug 1820594 - Part 26: Remove FindFirstParseError and check for parse error. r=jonco"

This reverts commit 665970f847.

Revert "Bug 1820594 - Part 25: Call FinishLoadingImportedModule for dynamic import. r=jonco"

This reverts commit 9037595d27.

Revert "Bug 1820594 - Part 24: Add ModuleErroredRunnable to dispatch ModuleErrored. r=jonco"

This reverts commit aa0e96e6c1.

Revert "Bug 1820594 - Part 23: Error handling when module fetching failed. r=jonco"

This reverts commit 8054f6d6b3.

Revert "Bug 1820594 - Part 22: Throw TypeError if the module type is unsupported. r=jonco"

This reverts commit f793f2b086.

Revert "Bug 1820594 - Part 21: Implement HostLoadImportedModule and FinishLoadingImportedModule in ModuleLoaderBase. r=jonco"

This reverts commit 2c2abeb8a3.

Revert "Bug 1820594 - Part 20: Update module script's referrer policy. r=jonco"

This reverts commit e92cdaa129.

Revert "Bug 1820594 - Part 19: Refactor CreateStaticImport. r=jonco"

This reverts commit e7cc5dcf27.

Revert "Bug 1820594 - Part 18: Add mReferrerObj, mModuleRequestObj, mReferencingPrivate, mStatePrivate in ModuleLoadRequest r=jonco"

This reverts commit 96b553c522.

Revert "Bug 1820594 - Part 17: Add OnFetchSucceeded r=jonco"

This reverts commit 4b60b4037a.

Revert "Bug 1820594 - Part 16-1 : Use sync version of LoadRequestedModules for chrome pages. r=jonco"

This reverts commit a75c3d1989.

Revert "Bug 1820594 - Part 16: Call LoadRequestedModules in StartFetchingModuleDependencies. r=jonco"

This reverts commit cf9a4a886d.

Revert "Bug 1820594 - Part 15: Remove HostResolveImportedModule and HostImportModuleDynamically r=jonco"

This reverts commit 8c45c3380e.

Revert "Bug 1820594 - Part 14: Remove VisitedURLSet. r=jonco"

This reverts commit 09f1ea1a1a.

Revert "Bug 1820594 - Part 13: Resume waiting requests after fetching dependencies. r=jonco"

This reverts commit a5edee9705.

Revert "Bug 1820594 - Part 12: Implement ContinueDynamicImport. r=jonco"

This reverts commit b487d8ffec.

Revert "Bug 1820594 - Part 11: Implement LoadRequestedModules. r=jonco"

This reverts commit 0049bf82d1.

Revert "Bug 1820594 - Part 10: Implement ImportAttributes in InnerModuleLoading. r=jonco"

This reverts commit 3115d8a191.

Revert "Bug 1820594 - Part 9: Implement FinishLoadingImportedModule, ContinueModuleLoading. r=jonco"

This reverts commit 85bcdccef3.

Revert "Bug 1820594 - Part 8: Update js::FinishDynamicModuleImport. r=jonco"

This reverts commit f5546f06d2.

Revert "Bug 1820594 - Part 7: Remove JS::FinishDynamicModuleImport. r=jonco"

This reverts commit 1e6d8581b9.

Revert "Bug 1820594 - Part 6: Implement InnerModuleLoading. r=jonco"

This reverts commit ef4d03deaf.

Revert "Bug 1820594 - Part 5: Update Module Hook. r=jonco"

This reverts commit 4f00fb82af.

Revert "Bug 1820594 - Part 4: Implement GetImportedModule. r=jonco"

This reverts commit 19507524a2.

Revert "Bug 1820594 - Part 3: Implement LoadedModules in ModuleObject. r=jonco"

This reverts commit f639c7eb96.

Revert "Bug 1820594 - Part 2: Implement GraphLoadingStateRecord. r=jonco"

This reverts commit 05a2b76d9c.

Revert "Bug 1820594 - Part 1: Add ModuleStatus::New. r=jonco"

This reverts commit bfd2615ef1.
2025-07-22 01:03:15 +00:00
Yoshi Cheng-Hao Huang bb9106dfec Bug 1820594 - Part 36: Add CancelFetchingModules. 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, eventually importing pkijs.js. The pkijs.js module is
compiled off-thread.

However, when the test framework proceeds to the next test, the
associated document may be detached before the off-thread compilation of
pkijs.js completes. If this happens while TaskController is shutting
down, the compilation task may never finish.

Currently, ScriptLoader only tracks top-level off-thread compilation
requests, not submodules involved in those tasks. To address this, we
now call CancelFetchingModules when ScriptLoader cancels ongoing
requests, ensuring submodule fetches are also properly aborted.

Differential Revision: https://phabricator.services.mozilla.com/D257677
2025-07-21 23:10:08 +00:00
Yoshi Cheng-Hao Huang 86aea74da6 Bug 1820594 - Part 28: DOM, Worker, Worklet ScriptLoader, mozJSModuleLoader update r=jonco
Differential Revision: https://phabricator.services.mozilla.com/D228863
2025-07-21 23:09:44 +00:00
Yoshi Cheng-Hao Huang 81673cfb4e Bug 1820594 - Part 27: Remove redundant module graph data structures from host layer. r=jonco
Since the module graph is now traversed within the JS engine itself, the
related data structures in the host layer are no longer necessary.

Differential Revision: https://phabricator.services.mozilla.com/D255129
2025-07-21 23:09:41 +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
Lando 2f23b0e311 Bug 1968607, 1972911: apply code formatting via Lando
# ignore-this-changeset
2025-07-11 05:39:45 +00:00
Fatih Kilic eed44c4862 Bug 1968607 - Part 1: Replace CSP with PolicyContainer. r=tschuster,webidl,smaug
We are making changes to many files. Very huge chunk of the changes are just renaming CSP -> PolicyContainer. Part 1 and part 2 are solely separated as frontend and backend. The unfortunate thing is, I mistakenly placed IDL changes in part 1, and many of those IDL changes affect frontend code too. I'm sorry for this inconvinience and hard to review patch(es).

(FWIW before this rewrite we had another patch stack. It is 25 patches and I believe isn't as comprehensive as this one. It also didn't replace CSP's inheritance but was copied alongside with CSP, but we decided to change our method and make policy conttainer contain CSP and copy it around after some discussion and reviews)

Differential Revision: https://phabricator.services.mozilla.com/D249248
2025-07-11 05:39:17 +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
Fatih Kilic 427a847124 Bug 1966694 - Remove nsIHttpChannelInternal::integrityMetadata. r=tschuster,necko-reviewers,kershaw
I checked every `HttpBaseChannel::SetupReplacementChannel` call (including calls to overrides) and we always create a copy of the existing loadinfo, usually with `CloneLoadInfoForRedirect`, except for TRR, it just calls `TRRLoadInfo::Clone`.

Differential Revision: https://phabricator.services.mozilla.com/D255316
2025-07-04 21:46:41 +00:00
Tooru Fujisawa 0d72b03aa6 Bug 1974827 - Handle the abandoned dependency modules properly. r=bthrall
Differential Revision: https://phabricator.services.mozilla.com/D255611
2025-07-03 04:31:01 +00:00
Tooru Fujisawa a1c08d443c Bug 1973206 - Part 6: Store non-top-level module requests which passed the bytecode encoding condition into a separate list. r=nbp,allstarschh
ModuleLoadRequest::mImports is going to be removed in bug 1820594.
In order to operate on dependency modules, we need to collect them in
a separate list, until they're queued for bytecode encoding.

This list and encoding queue should be removed in bug 1902951,
by refactoring how the bytecode encoding works.
The SharedScriptCache should already be holding the requests.

Differential Revision: https://phabricator.services.mozilla.com/D254652
2025-06-25 13:16:02 +00:00
Tooru Fujisawa 184a27e187 Bug 1973206 - Part 5: Remove unused variable in ScriptLoader::MaybePrepareModuleForBytecodeEncodingBeforeExecute. r=nbp
Differential Revision: https://phabricator.services.mozilla.com/D254651
2025-06-25 13:15:58 +00:00
Tooru Fujisawa d16ae3ad3a Bug 1973206 - Part 4: Filter out JSON modules earlier in ScriptLoader::CalculateBytecodeCacheFlag. r=nbp
Differential Revision: https://phabricator.services.mozilla.com/D254650
2025-06-25 13:15:54 +00:00
Tooru Fujisawa 09193c773c Bug 1973206 - Part 3: Move CalculateBytecodeCacheFlag to instance method as a preparation for the subsequent patches. r=nbp
Differential Revision: https://phabricator.services.mozilla.com/D254649
2025-06-25 13:15:50 +00:00
Tooru Fujisawa bf91233ef8 Bug 1973206 - Part 2: Verify the list in IsAlreadyHandledForBytecodeEncodingPreparation. r=nbp
Differential Revision: https://phabricator.services.mozilla.com/D254648
2025-06-25 13:15:46 +00:00
Cosmin Sabou a78b9076b4 Revert "Bug 1973206 - Part 6: Store non-top-level module requests which passed the bytecode encoding condition into a separate list. r=nbp,allstarschh" for causing shippable builds bustages.
This reverts commit 99ce61fb4e.

Revert "Bug 1973206 - Part 5: Remove unused variable in ScriptLoader::MaybePrepareModuleForBytecodeEncodingBeforeExecute. r=nbp"

This reverts commit 73dd64fbdc.

Revert "Bug 1973206 - Part 4: Filter out JSON modules earlier in ScriptLoader::CalculateBytecodeCacheFlag. r=nbp"

This reverts commit 5c8d191154.

Revert "Bug 1973206 - Part 3: Move CalculateBytecodeCacheFlag to instance method as a preparation for the subsequent patches. r=nbp"

This reverts commit 2e9c7ce88a.

Revert "Bug 1973206 - Part 2: Verify the list in IsAlreadyHandledForBytecodeEncodingPreparation. r=nbp"

This reverts commit 64d3a74e4d.
2025-06-25 03:36:42 +00:00
Tooru Fujisawa 99ce61fb4e Bug 1973206 - Part 6: Store non-top-level module requests which passed the bytecode encoding condition into a separate list. r=nbp,allstarschh
ModuleLoadRequest::mImports is going to be removed in bug 1820594.
In order to operate on dependency modules, we need to collect them in
a separate list, until they're queued for bytecode encoding.

This list and encoding queue should be removed in bug 1902951,
by refactoring how the bytecode encoding works.
The SharedScriptCache should already be holding the requests.

Differential Revision: https://phabricator.services.mozilla.com/D254652
2025-06-25 01:58:46 +00:00
Tooru Fujisawa 73dd64fbdc Bug 1973206 - Part 5: Remove unused variable in ScriptLoader::MaybePrepareModuleForBytecodeEncodingBeforeExecute. r=nbp
Differential Revision: https://phabricator.services.mozilla.com/D254651
2025-06-25 01:58:42 +00:00
Tooru Fujisawa 5c8d191154 Bug 1973206 - Part 4: Filter out JSON modules earlier in ScriptLoader::CalculateBytecodeCacheFlag. r=nbp
Differential Revision: https://phabricator.services.mozilla.com/D254650
2025-06-25 01:58:38 +00:00
Tooru Fujisawa 2e9c7ce88a Bug 1973206 - Part 3: Move CalculateBytecodeCacheFlag to instance method as a preparation for the subsequent patches. r=nbp
Differential Revision: https://phabricator.services.mozilla.com/D254649
2025-06-25 01:58:35 +00:00
Tooru Fujisawa 64d3a74e4d Bug 1973206 - Part 2: Verify the list in IsAlreadyHandledForBytecodeEncodingPreparation. r=nbp
Differential Revision: https://phabricator.services.mozilla.com/D254648
2025-06-25 01:58:31 +00:00
Yoshi Cheng-Hao Huang 49588bd532 Bug 1973346 : Remove iteration over mImports in ReportPreloadErrorsToConsole. r=jonco
The mUnreportedPreloadError flag is set within ReportErrorToConsole [1].

The list of callers for ReportErrorToConsole is as follows:

    1. Indirectly via ScriptLoaderInterface::ReportErrorToConsole:

        - This includes StartFetchingModuleAndDependencies [2] (for static imports)
          and StartDynamicImport [3] (for dynamic imports).

        - Both are invoked when StartModuleLoad fails, which implies the request
          has no child modules.

    2. Failures during script processing:

        1. StartLoad() fails in ProcessExternalScript [4], which only happens if
           CanStartLoad fails [5]. This condition also ensures that the request
           will not have any child modules.

        2. OnFetchComplete fails in ProcessInlineScript [6], indicating that
           CreateModuleScript has failed. Again, this means there are no children.

        3. PrepareLoadedRequest fails in OnStreamComplete [7], which implies a
           failure in OnFetchComplete [8]. As mentioned in 2.2, this is due to
           a failure in CreateModuleScript, so no child requests are present.

Based on the above analysis, whenever mUnreportedPreloadError is set, the
request does not have any child modules.

[1]: https://searchfox.org/mozilla-central/rev/96296f9d65cf8074e1e789aff92456a8442f7e9d/dom/script/ScriptLoader.cpp#4026
[2]: https://searchfox.org/mozilla-central/rev/96296f9d65cf8074e1e789aff92456a8442f7e9d/dom/script/ScriptLoader.cpp#1046
[3]: https://searchfox.org/mozilla-central/rev/96296f9d65cf8074e1e789aff92456a8442f7e9d/js/loader/ModuleLoaderBase.cpp#1094
[4]: https://searchfox.org/mozilla-central/rev/96296f9d65cf8074e1e789aff92456a8442f7e9d/dom/script/ScriptLoader.cpp#1391
[5]: https://searchfox.org/mozilla-central/rev/96296f9d65cf8074e1e789aff92456a8442f7e9d/js/loader/ModuleLoaderBase.cpp#491
[6]: https://searchfox.org/mozilla-central/rev/96296f9d65cf8074e1e789aff92456a8442f7e9d/dom/script/ScriptLoader.cpp#1638
[7]: https://searchfox.org/mozilla-central/rev/96296f9d65cf8074e1e789aff92456a8442f7e9d/dom/script/ScriptLoader.cpp#3913
[8]: https://searchfox.org/mozilla-central/rev/96296f9d65cf8074e1e789aff92456a8442f7e9d/dom/script/ScriptLoader.cpp#4456

Differential Revision: https://phabricator.services.mozilla.com/D254605
2025-06-23 20:51:27 +00:00
Yoshi Cheng-Hao Huang 32a16f9d21 Bug 1973078 - Use referrer info to get parent module info. r=arai
To get the parent module information, the correct way should be using
the "mReferrer" member.

Differential Revision: https://phabricator.services.mozilla.com/D254494
2025-06-23 19:03:57 +00:00