Commit Graph
1163 Commits
Author SHA1 Message Date
agoloman c75e2e420f Revert "Bug 2020707, Bug 2020704 - Part 6: Update test expectations now that speculationrules scripts are supported. r=dom-core-reviewers,jjaschke" for causing bc failures @browser_misused_characters_in_strings.js.
This reverts commit 524a1fc191.

Revert "Bug 2020707 - Part 5: Gate speculation rules script support behind a pref. r=dom-core-reviewers,jjaschke"

This reverts commit 11741d18ad.

Revert "Bug 2020707 - Part 4: Unregister speculation rules when their script element is removed. r=dom-core-reviewers,hsivonen"

This reverts commit 5202943dc9.

Revert "Bug 2020707 - Part 3: Report an exception if speculation rules parsing fails. r=dom-core-reviewers,jjaschke"

This reverts commit 70c5aa5425.

Revert "Bug 2020707 - Part 2: Add support for speculationrules script type. r=dom-core-reviewers,jjaschke"

This reverts commit 65b30a350b.

Revert "Bug 2020707 - Part 1: Allow speculation rules to be registered to the document from scripts. r=hsivonen,jjaschke"

This reverts commit 28c7050de9.

Revert "Bug 2020704 - Part 2: Add parser for speculation rule sets. r=hsivonen,jjaschke"

This reverts commit eabb8c6eb3.

Revert "Bug 2020704 - Part 1: Add speculation rules crate. r=dom-core-reviewers,jjaschke"

This reverts commit cd65bed005.
2026-06-12 06:28:05 +00:00
Adam Vandolder 11741d18ad Bug 2020707 - Part 5: Gate speculation rules script support behind a pref. r=dom-core-reviewers,jjaschke
Differential Revision: https://phabricator.services.mozilla.com/D305775
2026-06-12 04:48:34 +00:00
Adam Vandolder 70c5aa5425 Bug 2020707 - Part 3: Report an exception if speculation rules parsing fails. r=dom-core-reviewers,jjaschke
Differential Revision: https://phabricator.services.mozilla.com/D303211
2026-06-12 04:48:29 +00:00
Adam Vandolder 65b30a350b Bug 2020707 - Part 2: Add support for speculationrules script type. r=dom-core-reviewers,jjaschke
Differential Revision: https://phabricator.services.mozilla.com/D286178
2026-06-12 04:48:27 +00:00
Denis Palmeiro 6c1e7b91c2 Bug 2037599: Move compiled async scripts from loading list to loaded list during ProcessOffThreadRequest. r=smaug
This fixes a race condition in the nytimes awsy test when speculation for link preload scripts is enabled.  The same problem exists for async speculation.  The element is created while the link preload script is still compiling.  This puts the script in the `mLoadingAsyncScripts` list (which is correct).  Then when the script is finished compiling, it calls `ProcessOffThreadRequest` which sets the script to ready and then checks if the script is already in a list.  Since this script is already in the loading list, it is not processed and the script is left in the `mLoadingAsyncScripts` forever.  The fix is to move the script to the `mLoadedAsyncScripts` list if this happens so it can be processed later in ProcessPendingRequests.

Differential Revision: https://phabricator.services.mozilla.com/D303368
2026-05-29 22:26:47 +00:00
Nicolas B. Pierron 8c6ecc287a Bug 2042907 - Use the script loader's document in EvaluateScriptElements. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D302836
2026-05-28 12:20:41 +00:00
Tim Huang 76ccc02a1a Bug 2038663 - Part 3: Move classifier blocking error code helpers into ChannelClassifierUtils. r=bvandersloot,media-playback-reviewers,firefox-style-system-reviewers,aosmond,emilio
This patch moves the BlockingErrorCode table and the
IsClassifierBlockingErrorCode / IsClassifierBlockingEventCode /
GetClassifierBlockingEventCode / ClassifierBlockingErrorCodeToConsoleMessage
helpers from UrlClassifierFeatureFactory into ChannelClassifierUtils so the
latter no longer needs to depend on UrlClassifierFeatureFactory.h.

Differential Revision: https://phabricator.services.mozilla.com/D301722
2026-05-22 07:58:00 +00:00
Tim Huang 21a72ace6c Bug 2038663 - Part 1: Introduce ClassifierChannelUtils and move relevant APIs. r=bvandersloot
This patch moves relevant APIs that interact with the channel to a
separate ClassifierChannelUtils class from the URLClassifierCommon.

The ClassifierChannelUtils shares between the UrlClassifier and
the ContentClassifier.

Differential Revision: https://phabricator.services.mozilla.com/D301027
2026-05-22 07:57:54 +00:00
Jeff Muizelaar 648c935839 Bug 2039129 - Add markers and flows for ScriptLoadRequest. r=nbp
This is helful for tracking when scripts load. I used it
to debug bug 2030614.

Differential Revision: https://phabricator.services.mozilla.com/D300198
2026-05-22 02:15:47 +00:00
iulian moraru 3c140a28ee Revert "Bug 2039129 - Add markers and flows for ScriptLoadRequest. r=nbp" for causing linux AddressSanitiezr failures on BaseProfilerMarkersPrerequisites.h.
This reverts commit b45b8c0c39.
2026-05-17 11:37:49 +00:00
Jeff Muizelaar b45b8c0c39 Bug 2039129 - Add markers and flows for ScriptLoadRequest. r=nbp
This is helful for tracking when scripts load. I used it
to debug bug 2030614.

Differential Revision: https://phabricator.services.mozilla.com/D300198
2026-05-17 01:37:49 +00:00
Tooru Fujisawa b1578b8a63 Bug 2036849 - Part 8: Rewrite the IsTextSource and IsSerializedStencil accessors for the ScriptLoadRequest to avoid accidental use after converting to cache. r=nbp,dom-worker-reviewers,asuth
LoadedScript::{IsTextSource,IsSerializedStencil} accessors can return
false once it's converted to cache.
Most of the consumers need the flag to branch on the server response, before
converting to cache.
Add assertions to avoid accidental use.

Differential Revision: https://phabricator.services.mozilla.com/D299926
2026-05-13 17:09:56 +00:00
Tooru Fujisawa 399c7971ed Bug 2036849 - Part 7: Eagerly clear more response data. r=nbp
Differential Revision: https://phabricator.services.mozilla.com/D299925
2026-05-13 17:09:53 +00:00
Tooru Fujisawa 2d1b0d7a84 Bug 2036849 - Part 6: Directly use LoadedScript to clear the non-cached response. r=nbp
The subsequent patches will restrict the ScriptLoadRequest's IsTextSource and
IsSerializedStencil accessors usage, so that they can be used only before
they're converted to cached stencil.

This patch rewrites their consumer after that point to directly use the
underlying LoadedScript accessors and methods.

Differential Revision: https://phabricator.services.mozilla.com/D299924
2026-05-13 17:09:49 +00:00
Tooru Fujisawa bb7694d2af Bug 2036849 - Part 4: Remove LoadedScript::OnceCachedStencil. r=nbp
Differential Revision: https://phabricator.services.mozilla.com/D299922
2026-05-13 17:09:41 +00:00
Tooru Fujisawa 5026dda743 Bug 2036849 - Part 3: Use ScriptLoadRequest::IsRetrievedFromMemoryCache. r=nbp
Differential Revision: https://phabricator.services.mozilla.com/D299921
2026-05-13 17:09:37 +00:00
Tooru Fujisawa a917470f06 Bug 2038694 - Part 1: Make ModuleScript a separate class than LoadedScript. r=nbp,allstarschh
ModuleScript is used only as the place to hold the compilation and evaluation
result of modules, and it's no longer necessary to be a LoadedScript subclass.

This makes all LoadedScript instances GC-free, and the module's LoadedScript
(temporailry renamed to LoadedModuleScript) can directly be stored into the
SharedScriptCache.

The subsequent patches will cleanup the LoadedScript, its subclasses, and
their consumers.

Differential Revision: https://phabricator.services.mozilla.com/D299916
2026-05-13 15:59:02 +00:00
Tooru Fujisawa 036a4bf280 Bug 2038623 - Do not borrow the buffer for decoded stencils if the in-memory cache is enabled. r=nbp
Differential Revision: https://phabricator.services.mozilla.com/D299700
2026-05-11 15:33:20 +00:00
Eemeli Aro 56550e9469 Bug 2024854 Part 9 - Allow all mime types for text imports. r=dminor,dom-worker-reviewers,edenchuang
Differential Revision: https://phabricator.services.mozilla.com/D295494
2026-05-06 07:24:19 +00:00
Eemeli Aro b3e20ac5c2 Bug 2024854 Part 3 - Set text content policy for text modules. r=dminor,dom-worker-reviewers,edenchuang
Differential Revision: https://phabricator.services.mozilla.com/D295488
2026-05-06 07:24:03 +00:00
Tooru Fujisawa 036a7339ad Bug 2036190 - Convert ModuleScript to LoadedScript before caching. r=nbp
Differential Revision: https://phabricator.services.mozilla.com/D297797
2026-05-04 18:20:22 +00:00
Tooru Fujisawa 32c2970f79 Bug 2036042 - Handle invalidated cached stencil also as cached case. r=nbp
Differential Revision: https://phabricator.services.mozilla.com/D297796
2026-05-04 18:20:20 +00:00
rperta c1b532f543 Revert "Bug 2024854 Part 15 - Fix and enable import-text WPT tests. r=dminor" for causing python-telemetry failures
This reverts commit cdddcc0cff.

This reverts commit d818e0fa08.

This reverts commit 7fe31f22c7.

This reverts commit 9d5be194ed.

This reverts commit e0fba2c9ac.

Revert "Bug 2024854 Part 10 - Create text modules: script. r=dminor"

This reverts commit dd57815041.

This reverts commit 409b1063aa.

This reverts commit cd7afbc8ee.

This reverts commit 03b66bc4f0.

This reverts commit c1b7e2177a.

This reverts commit 4696b1602f.

This reverts commit 21f4777b22.

This reverts commit 00eab305c3.

This reverts commit 10d0e76a4f.

This reverts commit e1746ab8a2.
2026-04-29 20:12:13 +00:00
Eemeli Aro 409b1063aa Bug 2024854 Part 9 - Allow all mime types for text imports. r=dminor,dom-worker-reviewers,edenchuang
Differential Revision: https://phabricator.services.mozilla.com/D295494
2026-04-29 19:52:09 +00:00
Eemeli Aro 00eab305c3 Bug 2024854 Part 3 - Set text content policy for text modules. r=dminor,dom-worker-reviewers,edenchuang
Differential Revision: https://phabricator.services.mozilla.com/D295488
2026-04-29 19:51:52 +00:00
Tooru Fujisawa 62f4734928 Bug 2035556 - Immediately stop the delazification collection without dispatch. r=nbp
Differential Revision: https://phabricator.services.mozilla.com/D297074
2026-04-28 23:51:41 +00:00
Tooru Fujisawa c05d81a70a Bug 2031077 - Part 4: Add invalidated cache state for LoadedScript. r=bthrall
On memory pressure, the stencil held only for the cache should be released.
In that situation, the LoadedScript instances can still be held by
ScriptLoadRequest etc, and thus the LoadedScript instance itself should be kept
alive, while the stencil pointer being released.

Differential Revision: https://phabricator.services.mozilla.com/D294601
2026-04-25 04:54:34 +00:00
Tooru Fujisawa 7e75539d07 Bug 2031077 - Part 3: Repurpose LoadedScript::mStencil only for the cached case. r=bthrall
Differential Revision: https://phabricator.services.mozilla.com/D294600
2026-04-25 04:54:31 +00:00
Tooru Fujisawa 75d3103746 Bug 2031077 - Part 1: Use cached stencil type in the non-stencil-navigation disk cache. r=bthrall
The later patches will make the LoadedScript::mStencil specific to the cached
stencil type.
The non-stencil-navigation's disk cache handling is almost same as the
cached stencil, so reuse it.

Differential Revision: https://phabricator.services.mozilla.com/D294598
2026-04-25 04:54:23 +00:00
Tooru Fujisawa 95cdb37e67 Bug 2031075 - Part 2: Clear unused stencil on memory pressure. r=bthrall
Differential Revision: https://phabricator.services.mozilla.com/D294597
2026-04-24 19:34:44 +00:00
Tooru Fujisawa 96ecb0e51b Bug 2031075 - Part 1: Fix the condition to clear unused stencil. r=bthrall
If the stencil navigation is enabled and the current request's stencil
is not going to be stored into the in-memory cache, we can clear it immediately.

Differential Revision: https://phabricator.services.mozilla.com/D294596
2026-04-24 19:34:40 +00:00
Tooru Fujisawa e22d4c846c Bug 2031078 - Part 6: Stop collecting delazifications on idle. r=bthrall
In order to avoid keeping the scripts and modules unnecessarily longer,
the delazification collection should also be stopped after a while.

Differential Revision: https://phabricator.services.mozilla.com/D294595
2026-04-24 14:23:12 +00:00
Tooru Fujisawa d469f1b60c Bug 2031078 - Part 5: Stop collecting delazifications on memory pressure. r=bthrall
Differential Revision: https://phabricator.services.mozilla.com/D294594
2026-04-24 14:23:08 +00:00
Tooru Fujisawa f5e150d410 Bug 2031078 - Part 4: Distinguish the call JS::StartCollectingDelazifications on a script with asm.js. r=bthrall
JS::StartCollectingDelazifications doesn't start collection if the script
contains asm.js, because XDR is not supported.
In order to avoid keeping the script references unnecessarily on the consumer
distinguish the case where the collection isn't started.

Differential Revision: https://phabricator.services.mozilla.com/D294593
2026-04-24 14:23:04 +00:00
Tooru Fujisawa d6cfc25827 Bug 2031078 - Part 1: Hold scripts and modules while collecting delazifications. r=bthrall,mccr8
In order to stop collecting delazifications, hold any newly-started collections'
scripts and modules.
The later patches will add the code to stop on each situation.

Differential Revision: https://phabricator.services.mozilla.com/D294590
2026-04-24 14:22:52 +00:00
Atila Butkovits 6c7fe7e77b Revert "Bug 2031078 - Part 6: Stop collecting delazifications on idle. r=bthrall" for causing SM bustages in js.cpp.
This reverts commit 1e6f986667.

Revert "Bug 2031078 - Part 5: Stop collecting delazifications on memory pressure. r=bthrall"

This reverts commit 52e7376bc2.

Revert "Bug 2031078 - Part 4: Distinguish the call JS::StartCollectingDelazifications on a script with asm.js. r=bthrall"

This reverts commit 62233eb1f0.

Revert "Bug 2031078 - Part 3: Ignore JS::AbortCollectingDelazifications call on not-collecting cases. r=bthrall"

This reverts commit a51e0ee4eb.

Revert "Bug 2031078 - Part 2: Make JS::AbortCollectingDelazifications take raw pointer. r=bthrall"

This reverts commit 285dd9183b.

Revert "Bug 2031078 - Part 1: Hold scripts and modules while collecting delazifications. r=bthrall,mccr8"

This reverts commit 0c81cde149.
2026-04-24 04:59:09 +00:00
Tooru Fujisawa 1e6f986667 Bug 2031078 - Part 6: Stop collecting delazifications on idle. r=bthrall
In order to avoid keeping the scripts and modules unnecessarily longer,
the delazification collection should also be stopped after a while.

Differential Revision: https://phabricator.services.mozilla.com/D294595
2026-04-24 04:22:03 +00:00
Tooru Fujisawa 52e7376bc2 Bug 2031078 - Part 5: Stop collecting delazifications on memory pressure. r=bthrall
Differential Revision: https://phabricator.services.mozilla.com/D294594
2026-04-24 04:22:00 +00:00
Tooru Fujisawa 62233eb1f0 Bug 2031078 - Part 4: Distinguish the call JS::StartCollectingDelazifications on a script with asm.js. r=bthrall
JS::StartCollectingDelazifications doesn't start collection if the script
contains asm.js, because XDR is not supported.
In order to avoid keeping the script references unnecessarily on the consumer
distinguish the case where the collection isn't started.

Differential Revision: https://phabricator.services.mozilla.com/D294593
2026-04-24 04:21:56 +00:00
Tooru Fujisawa 0c81cde149 Bug 2031078 - Part 1: Hold scripts and modules while collecting delazifications. r=bthrall,mccr8
In order to stop collecting delazifications, hold any newly-started collections'
scripts and modules.
The later patches will add the code to stop on each situation.

Differential Revision: https://phabricator.services.mozilla.com/D294590
2026-04-24 04:21:44 +00:00
Tooru Fujisawa edcea6935f Bug 2031200 - Part 11: Repurpose LoadedScript::mReferrerPolicy for the cached case. r=bthrall
Same as base URL, the mReferrerPolicy reflects the server response, and it
need to be retained for the cached case.
The existing consumers use the ScriptFetchInfo field.

Differential Revision: https://phabricator.services.mozilla.com/D294343
2026-04-22 04:12:44 +00:00
Tooru Fujisawa bd431250d5 Bug 2031200 - Part 10: Repurpose LoadedScript::mBaseURL for the cached case. r=bthrall
The existing consumers of the base URL now use the
ScriptFetchInfo::mBaseURL, and then the LoadedScript::mBaseURL
is renmaed to LoadedScript::mCachedBaseURL, used only by cached stencil case,
to retain the server responses for the subsequent requests.

Differential Revision: https://phabricator.services.mozilla.com/D294342
2026-04-22 04:12:40 +00:00
Tooru Fujisawa 60050df3f8 Bug 2031200 - Part 9: Add ScriptLoadRequest::FetchOptions() accessor and remove LoadedScript::mFetchOptions. r=bthrall
Differential Revision: https://phabricator.services.mozilla.com/D294341
2026-04-22 04:12:37 +00:00
Tooru Fujisawa 24365da24e Bug 2031200 - Part 8: Remove ScriptHashKey constructor with LoadedScript. r=bthrall
The subsequent patches will remove the fields from LoadedScript, and then
use the ScriptLoadRequest::mFetchInfo instead.
The LoadedScript variant of ScriptHashKey is no longer necessary.

Differential Revision: https://phabricator.services.mozilla.com/D294340
2026-04-22 04:12:33 +00:00
Tooru Fujisawa 83c3d50d82 Bug 2031200 - Part 7: Use ScriptFetchInfo for the script private and module private instead of LoadedScript. r=bthrall,allstarschh,dom-worker-reviewers,asuth
Replace the all places that stores and uses the script/module private to use
ScriptFetchInfo instead of LoadedScript/ModuleScript, so that the
LoadedScript/ModuleScript can be released earlier.

Differential Revision: https://phabricator.services.mozilla.com/D294339
2026-04-22 04:12:30 +00:00
Tooru Fujisawa 8585e0670f Bug 2031200 - Part 6: Do not pass private value to JS::UpdateDebugMetadata. r=bthrall
There are two places that try to put the script private:
  * JS::UpdateDebugMetadata, performed conditionally
  * LoadedScript::AssociateWithScript, performed unconditionally,
    except for conditionally on the script private itself

The former is unnecessary, so that the latter covers all cases.

Differential Revision: https://phabricator.services.mozilla.com/D294338
2026-04-22 04:12:26 +00:00
Alexandru Marc bcdf79e032 Revert "Bug 2031200 - Part 12: Remove ModuleScript::mForPreload. r=allstarschh" for causing hazard bustages @ ModuleLoaderBase
This reverts commit 260ad06a2e.

Revert "Bug 2031200 - Part 11: Repurpose LoadedScript::mReferrerPolicy for the cached case. r=bthrall"

This reverts commit cedffcba4e.

Revert "Bug 2031200 - Part 10: Repurpose LoadedScript::mBaseURL for the cached case. r=bthrall"

This reverts commit a4fd83ce4d.

Revert "Bug 2031200 - Part 9: Add ScriptLoadRequest::FetchOptions() accessor and remove LoadedScript::mFetchOptions. r=bthrall"

This reverts commit 66bc9492b3.

Revert "Bug 2031200 - Part 8: Remove ScriptHashKey constructor with LoadedScript. r=bthrall"

This reverts commit 5bb4928c8f.

Revert "Bug 2031200 - Part 7: Use ScriptFetchInfo for the script private and module private instead of LoadedScript. r=bthrall,allstarschh,dom-worker-reviewers,asuth"

This reverts commit 0011dfbdcc.

Revert "Bug 2031200 - Part 6: Do not pass private value to JS::UpdateDebugMetadata. r=bthrall"

This reverts commit 0e8a2f1032.

Revert "Bug 2031200 - Part 5: Sync ModuleScript::mForPreload and ScriptFetchInfo::mIsForModulePreload. r=bthrall"

This reverts commit 0f69b1fb94.

Revert "Bug 2031200 - Part 4: Sync LoadedScript::mBaseURL and ScriptFetchInfo::mBaseURL. r=bthrall,dom-worker-reviewers,asuth"

This reverts commit 472f447c9e.

Revert "Bug 2031200 - Part 3: Sync LoadedScript::mReferrerPolicy and ScriptFetchInfo::mReferrerPolicy. r=bthrall"

This reverts commit b5410280f5.

Revert "Bug 2031200 - Part 2: Remove obsolete code to sync the exact same field. r=bthrall"

This reverts commit 2b784b6e6f.

Revert "Bug 2031200 - Part 1: Add ScriptFetchInfo class and ScriptLoadRequest::mFetchInfo field. r=bthrall"

This reverts commit fc8d3b6c48.
2026-04-21 21:28:08 +00:00
Tooru Fujisawa cedffcba4e Bug 2031200 - Part 11: Repurpose LoadedScript::mReferrerPolicy for the cached case. r=bthrall
Same as base URL, the mReferrerPolicy reflects the server response, and it
need to be retained for the cached case.
The existing consumers use the ScriptFetchInfo field.

Differential Revision: https://phabricator.services.mozilla.com/D294343
2026-04-21 15:58:13 +00:00
Tooru Fujisawa a4fd83ce4d Bug 2031200 - Part 10: Repurpose LoadedScript::mBaseURL for the cached case. r=bthrall
The existing consumers of the base URL now use the
ScriptFetchInfo::mBaseURL, and then the LoadedScript::mBaseURL
is renmaed to LoadedScript::mCachedBaseURL, used only by cached stencil case,
to retain the server responses for the subsequent requests.

Differential Revision: https://phabricator.services.mozilla.com/D294342
2026-04-21 15:58:10 +00:00
Tooru Fujisawa 66bc9492b3 Bug 2031200 - Part 9: Add ScriptLoadRequest::FetchOptions() accessor and remove LoadedScript::mFetchOptions. r=bthrall
Differential Revision: https://phabricator.services.mozilla.com/D294341
2026-04-21 15:58:06 +00:00