Commit Graph
952 Commits
Author SHA1 Message Date
Tooru Fujisawa ebec92d70e Bug 1991358 - Part 3: Remove ScriptLoadRequest::MarkScriptForCache and ModuleLoadRequest::MarkModuleForCache. r=nbp
Differential Revision: https://phabricator.services.mozilla.com/D266620
2025-10-01 09:58:50 +00:00
Tooru Fujisawa 7fa3a4ebaf Bug 1991358 - Part 1: Stop performing JS::FinishCollectingDelazifications/JS::AbortCollectingDelazifications. r=nbp
Now the effect of JS::FinishCollectingDelazifications is only to
stop collecting delazifications, which is not necessary for the consumer's side.
The cost of collecting delazification is also negligible with the
InitialStencilAndDelazifications structure, and also keeping the stencil
reference won't result in too much trouble.

Differential Revision: https://phabricator.services.mozilla.com/D266618
2025-10-01 09:58:43 +00:00
Cristina Horotan f21b53b704 Revert "Bug 1968903 - Avoid creating script and CSS loaders for documents loaded as data. r=firefox-style-system-reviewers,emilio,layout-reviewers" for causing bug 1991800
This reverts commit 6cbdfe15a0.
2025-10-01 07:15:03 +00:00
Tooru Fujisawa 926bbd302a Bug 1991081 - Part 7: Rewrite EncodeBytecodeAndSave with LoadedScript. r=nbp
Differential Revision: https://phabricator.services.mozilla.com/D266617
2025-09-30 11:39:29 +00:00
Tooru Fujisawa 8c38c4c093 Bug 1991081 - Part 6: Remove testing-only events from EncodeBytecodeAndSave. r=nbp
scriptloader_bytecode_saved and scriptloader_bytecode_failed are
testing-only events.  The tests use them are disabled right now,
and they should be rewritten with the updated cache mechanism.

Differential Revision: https://phabricator.services.mozilla.com/D266616
2025-09-30 11:39:26 +00:00
Tooru Fujisawa d6475781cd Bug 1991081 - Part 5: Use single field for SRI and optional bytecode, for bytecode case and for cached stencil case. r=nbp
Differential Revision: https://phabricator.services.mozilla.com/D266615
2025-09-30 11:39:22 +00:00
Tooru Fujisawa 8044e8dae9 Bug 1991081 - Part 4: Use LoadedScript for logging in EncodeBytecodeAndSave. r=nbp
Differential Revision: https://phabricator.services.mozilla.com/D266614
2025-09-30 11:39:18 +00:00
Tooru Fujisawa a3149ca9dd Bug 1991081 - Part 3: Store nsICacheInfoChannel to LoadedScript also in text and bytecode variants. r=nbp
Differential Revision: https://phabricator.services.mozilla.com/D266613
2025-09-30 11:39:14 +00:00
Tooru Fujisawa eca472223f Bug 1991081 - Part 2: Store stencil to LoadedScript also in text and bytecode variants. r=nbp
Differential Revision: https://phabricator.services.mozilla.com/D266612
2025-09-30 11:39:11 +00:00
Tooru Fujisawa 6bc2703f1a Bug 1991081 - Part 1: Rename Stencil variant to CachedStencil in LoadedScript. r=nbp
Differential Revision: https://phabricator.services.mozilla.com/D266610
2025-09-30 11:39:07 +00:00
Henri Sivonen 6cbdfe15a0 Bug 1968903 - Avoid creating script and CSS loaders for documents loaded as data. r=firefox-style-system-reviewers,emilio,layout-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D264779
2025-09-30 10:27:43 +00:00
agoloman 0a11d7413f Revert "Bug 1968903 - Avoid creating script and CSS loaders for documents loaded as data. r=firefox-style-system-reviewers,emilio,layout-reviewers" for causing multiple wpt failures.
This reverts commit f83cb28789.
2025-09-30 09:25:22 +00:00
Henri Sivonen f83cb28789 Bug 1968903 - Avoid creating script and CSS loaders for documents loaded as data. r=firefox-style-system-reviewers,emilio,layout-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D264779
2025-09-30 07:45:53 +00:00
Tooru Fujisawa d279bc435d Bug 1931908 - Rename the navigation cache pref to make it more explicit about testing-only. r=nbp,denispal,webdriver-reviewers,necko-reviewers,devtools-reviewers,nchevobbe,whimboo,jesup
Differential Revision: https://phabricator.services.mozilla.com/D266570
2025-09-30 04:26:10 +00:00
Tooru Fujisawa 77e682ad81 Bug 1991250 - Do not add to the mCacheableDependencyModules twice. r=nbp
Differential Revision: https://phabricator.services.mozilla.com/D266569
2025-09-29 15:48:03 +00:00
Tooru Fujisawa 71d7c4fe34 Bug 1991362 - Remove the filtering based on list for non-top-level modules. r=nbp
Non-top-level modules are part of the mCacheableDependencyModules list only when
it passed the condition and until it's queued or dropped.
Thus, being part of the list already meets the requred condition there.

Differential Revision: https://phabricator.services.mozilla.com/D266572
2025-09-29 10:39:41 +00:00
Alexandru Marc 17032d74be Revert "Bug 1968890 - Part 9: Add test for dynamic import. r=jonco" as potential cause of javascript engine crashes (bug 1991268)
This reverts commit c6e5d9e61c.

Revert "Bug 1968890 - Part 8: Remove FinishDynamicImportAndReject. r=jonco"

This reverts commit 0c71c535fc.

Revert "Bug 1968890 - Part 7: Add Cancel method. r=jonco"

This reverts commit 4efb29fcff.

Revert "Bug 1968890 - Part 6: ScriptLoaders update. r=jonco,dom-worker-reviewers,edenchuang"

This reverts commit 0bd0adafd8.

Revert "Bug 1968890 - Part 5: Add ModuleLoadRequest::SetErroredLoadingImports(). r=jonco"

This reverts commit 36f140b26b.

Revert "Bug 1968890 - Part 4: Handle Dynamic import in LoadRequestedModulesRejected. r=jonco"

This reverts commit 3837c393b5.

Revert "Bug 1968890 - Part 3: Call ModuleErrored in OnFetchFailed. r=jonco"

This reverts commit 33105bfe8d.

Revert "Bug 1968890 - Part 2: Handle dynamic import in OnFetchFailed. r=jonco"

This reverts commit 4396212837.

Revert "Bug 1968890 - Part 1: Dynamic import is not a top-level request. r=jonco,dom-worker-reviewers,edenchuang"

This reverts commit 43e95dfc62.
2025-09-27 09:31:04 +00:00
Yoshi Cheng-Hao Huang 4efb29fcff Bug 1968890 - Part 7: Add Cancel method. r=jonco
Triggers FinishLoadingImportedModule in Cancel() to prevent memory leak.

Differential Revision: https://phabricator.services.mozilla.com/D264809
2025-09-26 06:47:34 +00:00
Yoshi Cheng-Hao Huang 0bd0adafd8 Bug 1968890 - Part 6: ScriptLoaders update. r=jonco,dom-worker-reviewers,edenchuang
OnFetchComplete will do the error handling and update the state, so we
don't need to call Cancel nor LoadFailed.

Also, ModuleErrored() will call ModuleLoader::OnModuleLoadComplete,
which will move the request to Loaded requests, so we also need to
update HandLoadError as well.

Differential Revision: https://phabricator.services.mozilla.com/D264808
2025-09-26 06:47:31 +00:00
Yoshi Cheng-Hao Huang 43e95dfc62 Bug 1968890 - Part 1: Dynamic import is not a top-level request. r=jonco,dom-worker-reviewers,edenchuang
According to the spec, requests created in HostLoadImportedModule have
the isTopLevel flag set to false. This means both static and dynamic
import requests should also have this flag set to false.

[HostLoadImportedModule](https://html.spec.whatwg.org/#hostloadimportedmodule)
Step 14. Fetch a single imported module script ...

[Fetch a single imported module script](https://html.spec.whatwg.org/#fetch-a-single-imported-module-script)
Step 4. Fetch a single module script given url, fetchClient, destination, options, settingsObject, referrer, moduleRequest, false, and onComplete.

The false argument in the second-to-last parameter of 'Fetch a single
module script' corresponds to the top-levl flag.

[Fetch a single module script](https://html.spec.whatwg.org/#fetch-a-single-module-script)
given a URL url, an environment settings object fetchClient, a
destination destination, a script fetch options options, an environment
settings object settingsObject, a referrer referrer, an optional
ModuleRequest Record moduleRequest, a boolean isTopLevel, an algorithm
onComplete,

The spec was updated in https://github.com/whatwg/html/issues/7996. We’re
updating the implementation to reflect this change.

Differential Revision: https://phabricator.services.mozilla.com/D265593
2025-09-26 06:47:16 +00:00
Tooru Fujisawa 924a35fac5 Bug 1980156 - Cache nsICacheInfoChannel and use it for saving bytecode in navigation cache. r=nbp
Differential Revision: https://phabricator.services.mozilla.com/D265616
2025-09-25 11:00:12 +00:00
Tooru Fujisawa 069c0551be Bug 1980152 - Part 2: Save bytecode also with stencil navigation. r=nbp
Differential Revision: https://phabricator.services.mozilla.com/D265615
2025-09-25 11:00:09 +00:00
Tooru Fujisawa 17d44b97e3 Bug 1980152 - Part 1: Calculate the disk caching plan also with stencil-based requests. r=nbp
Differential Revision: https://phabricator.services.mozilla.com/D265614
2025-09-25 11:00:07 +00:00
Tooru Fujisawa f643116a41 Bug 1989877 - Part 3: Remove non-top-level modules from mCacheableDependencyModules when resetting the flag. r=nbp
Differential Revision: https://phabricator.services.mozilla.com/D265613
2025-09-25 11:00:04 +00:00
Tooru Fujisawa bbc915b2c5 Bug 1989877 - Part 2: Add separate state for in-memory cache vs disk cache. r=nbp
Differential Revision: https://phabricator.services.mozilla.com/D265612
2025-09-25 11:00:01 +00:00
Tooru Fujisawa 9a399e62d6 Bug 1989877 - Part 1: Add ScriptLoadRequest::HasDiskCacheReference and use {HasDiskCacheReference,DropDiskCacheReference} consistently. r=nbp
Differential Revision: https://phabricator.services.mozilla.com/D265611
2025-09-25 10:59:58 +00:00
Tooru Fujisawa cc1ec21cd0 Bug 1977740 - Add fetch count to in-memory script cache. r=nbp
Differential Revision: https://phabricator.services.mozilla.com/D265610
2025-09-25 10:59:55 +00:00
Tooru Fujisawa 81ac1b8590 Bug 1988086 - Add some logging for SharedScriptCache usage. r=nbp
Differential Revision: https://phabricator.services.mozilla.com/D265609
2025-09-25 10:59:52 +00:00
Alexandru Marc ea0e5ede0e Revert "Bug 1968890 - Part 9: Add test for dynamic import. r=jonco" for causing multiple wpt failures
This reverts commit 6126014923.

Revert "Bug 1968890 - Part 8: Remove FinishDynamicImportAndReject. r=jonco"

This reverts commit 111e590ac7.

Revert "Bug 1968890 - Part 7: Add Cancel method. r=jonco"

This reverts commit 6af0a75aa4.

Revert "Bug 1968890 - Part 6: ScriptLoaders update. r=jonco,dom-worker-reviewers,edenchuang"

This reverts commit 38def54b95.

Revert "Bug 1968890 - Part 5: Add ModuleLoadRequest::SetErroredLoadingImports(). r=jonco"

This reverts commit d3e0ec0a70.

Revert "Bug 1968890 - Part 4: Handle Dynamic import in LoadRequestedModulesRejected. r=jonco"

This reverts commit 59b34ef09e.

Revert "Bug 1968890 - Part 3: Call ModuleErrored in OnFetchFailed. r=jonco"

This reverts commit 3ef1571f6c.

Revert "Bug 1968890 - Part 2: Handle dynamic import in OnFetchFailed. r=jonco"

This reverts commit 4846001155.

Revert "Bug 1968890 - Part 1: Dynamic import is not a top-level request. r=jonco,dom-worker-reviewers,edenchuang"

This reverts commit 2f3764f5f6.
2025-09-25 02:50:52 +00:00
Yoshi Cheng-Hao Huang 6af0a75aa4 Bug 1968890 - Part 7: Add Cancel method. r=jonco
Triggers FinishLoadingImportedModule in Cancel() to prevent memory leak.

Differential Revision: https://phabricator.services.mozilla.com/D264809
2025-09-24 18:19:51 +00:00
Yoshi Cheng-Hao Huang 38def54b95 Bug 1968890 - Part 6: ScriptLoaders update. r=jonco,dom-worker-reviewers,edenchuang
OnFetchComplete will do the error handling and update the state, so we
don't need to call Cancel nor LoadFailed.

Also, ModuleErrored() will call ModuleLoader::OnModuleLoadComplete,
which will move the request to Loaded requests, so we also need to
update HandLoadError as well.

Differential Revision: https://phabricator.services.mozilla.com/D264808
2025-09-24 18:19:48 +00:00
Yoshi Cheng-Hao Huang 2f3764f5f6 Bug 1968890 - Part 1: Dynamic import is not a top-level request. r=jonco,dom-worker-reviewers,edenchuang
According to the spec, requests created in HostLoadImportedModule have
the isTopLevel flag set to false. This means both static and dynamic
import requests should also have this flag set to false.

[HostLoadImportedModule](https://html.spec.whatwg.org/#hostloadimportedmodule)
Step 14. Fetch a single imported module script ...

[Fetch a single imported module script](https://html.spec.whatwg.org/#fetch-a-single-imported-module-script)
Step 4. Fetch a single module script given url, fetchClient, destination, options, settingsObject, referrer, moduleRequest, false, and onComplete.

The false argument in the second-to-last parameter of 'Fetch a single
module script' corresponds to the top-levl flag.

[Fetch a single module script](https://html.spec.whatwg.org/#fetch-a-single-module-script)
given a URL url, an environment settings object fetchClient, a
destination destination, a script fetch options options, an environment
settings object settingsObject, a referrer referrer, an optional
ModuleRequest Record moduleRequest, a boolean isTopLevel, an algorithm
onComplete,

The spec was updated in https://github.com/whatwg/html/issues/7996. We’re
updating the implementation to reflect this change.

Differential Revision: https://phabricator.services.mozilla.com/D265593
2025-09-24 18:19:33 +00:00
Tom Schuster 5015aacb9c Bug 1989806 - Use switch for MimeTypeMatchesExpectedModuleType. r=dminor
Differential Revision: https://phabricator.services.mozilla.com/D265549
2025-09-23 22:28:29 +00:00
Denis b8795be34d Bug 1988603: Add a new value for dom.script_loader.bytecode_cache.strategy that sets fetchCountMin to 2. r=nbp
Differential Revision: https://phabricator.services.mozilla.com/D264873
2025-09-16 17:09:55 +00:00
Daniel Minor 1fb38a1293 Bug 1720570 - Support fetching css module scripts; r=dom-core,smaug
Differential Revision: https://phabricator.services.mozilla.com/D263415
2025-09-15 21:24:16 +00:00
Alexandru Marc 982c15a70d Revert "Bug 1720570: apply code formatting via Lando" for causing build bustages @ ModuleLoaderBase.h
This reverts commit ba4e616475.

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

This reverts commit 27214f9ae8.

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

This reverts commit 97ec45d1db.

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

This reverts commit e54b57ec16.

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

This reverts commit 2eb55b783d.

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

This reverts commit 2ccebf50bb.

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

This reverts commit 040b387d3e.

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

This reverts commit 4b64b94cb1.

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

This reverts commit 3f20b1d5b7.

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

This reverts commit ef5e3a7151.

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

This reverts commit 7a9b1fbac0.
2025-09-10 01:10:49 +00:00
Daniel Minor e54b57ec16 Bug 1720570 - Support fetching css module scripts; r=dom-core,smaug
Differential Revision: https://phabricator.services.mozilla.com/D263415
2025-09-10 00:44:32 +00:00
Tooru Fujisawa e7eecd2715 Bug 1986384 - Part 2: Make ScriptLoader::EncodeBytecodeAndSave receive each input separately. r=nbp
Differential Revision: https://phabricator.services.mozilla.com/D263751
2025-09-09 06:31:18 +00:00
Tooru Fujisawa 9def1cbb6b Bug 1986384 - Part 1: Do not use ScriptLoadRequest as a temporary space for bytecode calculation. r=nbp
Differential Revision: https://phabricator.services.mozilla.com/D263750
2025-09-09 06:31:14 +00:00
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