Commit Graph
126 Commits
Author SHA1 Message Date
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 be238abf95 Bug 2036849 - Part 5: Add some assertions. r=nbp
Differential Revision: https://phabricator.services.mozilla.com/D299923
2026-05-13 17:09:44 +00:00
Sylvestre Ledru 9eb1a31a98 Bug 2023419 - Remove Emacs/Vim modelines from dom/ r=emilio,media-playback-reviewers,webidl,padenot
replaced by .editorconfig
# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D287843
2026-03-16 21:02:32 +00:00
Tom Schuster 5da523c2c7 Bug 2017102 - Integrate WAICT with script loading. r=arai
Differential Revision: https://phabricator.services.mozilla.com/D283675
2026-03-04 01:09:06 +00:00
Serban Stanca d2b0e0df0e Revert "Bug 2017102 - Integrate WAICT with script loading. r=arai" for causing build bustages in SiteIntegrityService.h.
This reverts commit e64e92aee9.

This reverts commit 11aa1b2a8e.

This reverts commit ba19d2f5eb.

This reverts commit 3f66d522f4.
2026-03-03 21:56:30 +00:00
Tom Schuster e64e92aee9 Bug 2017102 - Integrate WAICT with script loading. r=arai
Differential Revision: https://phabricator.services.mozilla.com/D283675
2026-03-03 20:12:23 +00:00
Daniel Minor 6d26170c97 Bug 2007672 - Support eWasmBytes in script loader; r=arai
Differential Revision: https://phabricator.services.mozilla.com/D278170
2026-01-29 22:14:18 +00:00
Serban Stanca 1963fb1616 Revert "Bug 2007672 - Compile wasm modules as bytes; r=allstarschh,dom-worker-reviewers,edenchuang" for causing non-unified build bustages in ScriptLoadHandler.cpp.
This reverts commit d538496d6f.

This reverts commit fd4fd6566a.

This reverts commit 96e631a782.

This reverts commit 01b786e3f5.
2026-01-29 02:38:21 +00:00
Daniel Minor fd4fd6566a Bug 2007672 - Support eWasmBytes in script loader; r=arai
Differential Revision: https://phabricator.services.mozilla.com/D278170
2026-01-28 23:26:54 +00:00
Tom Schuster 9131e1c430 Bug 2012158 - Simplify the ScriptLoader by passing around an nsIChannel instead of nsIIncrementalStreamLoader. r=arai
Differential Revision: https://phabricator.services.mozilla.com/D280284
2026-01-26 09:43:27 +00:00
Tooru Fujisawa fb06302042 Bug 1907011 - Part 7: Update the most of the remaining usage of "bytecode" and update document. r=nbp
Differential Revision: https://phabricator.services.mozilla.com/D273960
2025-11-26 04:13:26 +00:00
Tooru Fujisawa dee0f66355 Bug 1907011 - Part 2: Split LoadedScript::SRIAndBytecode into LoadedScript::SRI and LoadedScript::SRIAndSerializedStencil for each cosnumer. r=nbp
Differential Revision: https://phabricator.services.mozilla.com/D273955
2025-11-26 04:13:12 +00:00
Tooru Fujisawa 58730279e1 Bug 1907011 - Part 1: Rename bytecode to serialized stencil in LoadedScript DataType. r=nbp
Differential Revision: https://phabricator.services.mozilla.com/D273954
2025-11-26 04:13:10 +00:00
Tooru Fujisawa 65f479e282 Bug 1853173 - Part 3: Skip unnecessary SRI verification for invalid integrity attribute. r=nbp
Differential Revision: https://phabricator.services.mozilla.com/D271024
2025-11-05 04:12:05 +00:00
Tooru Fujisawa b1c9db5a25 Bug 1996160 - Part 1: Use observer notifications for ScriptLoader tests. r=nbp
Differential Revision: https://phabricator.services.mozilla.com/D270110
2025-10-29 23:32:13 +00:00
serge-sans-paille f61f1d17c2 Bug 1996566 - Remove unused mfbt inclusion in dom/** r=emilio,media-playback-reviewers,dom-storage-reviewers,dom-worker-reviewers,jari,alwu,asuth
Differential Revision: https://phabricator.services.mozilla.com/D270172
2025-10-28 07:24:25 +00:00
Tooru Fujisawa 793840c062 Bug 1992341 - Part 1: Move the DiskCacheReference handling into ScriptLoader. r=nbp
Differential Revision: https://phabricator.services.mozilla.com/D269518
2025-10-23 04:19:08 +00:00
Tooru Fujisawa cde6c638b3 Bug 1991607 - Part 10: Remove ScriptLoadRequest::mURI. r=bthrall,dom-worker-reviewers,edenchuang
Differential Revision: https://phabricator.services.mozilla.com/D267359
2025-10-22 11:20:59 +00:00
Atila Butkovits 13ff5f1bad Revert "Bug 1991607 - Part 12: Reorder ScriptLoadRequest/ModuleLoadRequest fields. r=bthrall" for causing bustages at LoadedScript.cpp.
This reverts commit 30499d5cdc.

Revert "Bug 1991607 - Part 11: Remove ScriptLoadRequest::mBaseURL. r=bthrall,dom-worker-reviewers,edenchuang"

This reverts commit 85324622ab.

Revert "Bug 1991607 - Part 10: Remove ScriptLoadRequest::mURI. r=bthrall,dom-worker-reviewers,edenchuang"

This reverts commit 3b1afd5ca0.

Revert "Bug 1991607 - Part 9: Pass URI to LoadedScript ctor from ScriptLoadRequest ctor callsites. r=bthrall,dom-worker-reviewers,edenchuang"

This reverts commit 10dc4e2bc0.

Revert "Bug 1991607 - Part 8: Remove ScriptLoadRequest::mFetchOptions. r=bthrall,dom-worker-reviewers,edenchuang"

This reverts commit b4c09eb6e1.

Revert "Bug 1991607 - Part 7: Pass FetchOptions to LoadedScript ctor from ScriptLoadRequest ctor callsites. r=bthrall,dom-worker-reviewers,edenchuang"

This reverts commit f48d2160e1.

Revert "Bug 1991607 - Part 6: Remove ScriptLoadRequest::mReferrerPolicy. r=bthrall,dom-worker-reviewers,edenchuang"

This reverts commit a6901c3f1d.

Revert "Bug 1991607 - Part 5: Pass ReferrerPolicy to LoadedScript ctor from ScriptLoadRequest ctor callsites. r=bthrall,dom-worker-reviewers,edenchuang"

This reverts commit c2b5cb885a.

Revert "Bug 1991607 - Part 4: Add ImportMapScript subclass for LoadedScript. r=bthrall"

This reverts commit 09b8ae44b8.

Revert "Bug 1991607 - Part 3: Make LoadedScript::mKind field const. r=bthrall"

This reverts commit 3eebccc479.

Revert "Bug 1991607 - Part 2: Let ScriptLoader::CheckContentPolicy receive LoadedScript-related parameters separately. r=bthrall"

This reverts commit dd8530cb71.

Revert "Bug 1991607 - Part 1: Let ScriptHashKey and ScriptLoadData receive LoadedScript-related parameters separately. r=bthrall"

This reverts commit b4a4f94096.
2025-10-22 05:40:38 +00:00
Tooru Fujisawa 3b1afd5ca0 Bug 1991607 - Part 10: Remove ScriptLoadRequest::mURI. r=bthrall,dom-worker-reviewers,edenchuang
Differential Revision: https://phabricator.services.mozilla.com/D267359
2025-10-22 04:38:17 +00:00
Tooru Fujisawa 2aa5d00aaf 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-10-16 09:05:41 +00:00
agoloman 3352c88229 Revert "Bug 1991081 - Part 7: Rewrite EncodeBytecodeAndSave with LoadedScript. r=nbp" for causing failures @LoadedScript.h.
This reverts commit b10b7c8add.

Revert "Bug 1991081 - Part 6: Remove testing-only events from EncodeBytecodeAndSave. r=nbp"

This reverts commit caf275708e.

Revert "Bug 1991081 - Part 5: Use single field for SRI and optional bytecode, for bytecode case and for cached stencil case. r=nbp"

This reverts commit 86631a6e10.

Revert "Bug 1991081 - Part 4: Use LoadedScript for logging in EncodeBytecodeAndSave. r=nbp"

This reverts commit 0f9d7f11e8.

Revert "Bug 1991081 - Part 3: Store nsICacheInfoChannel to LoadedScript also in text and bytecode variants. r=nbp"

This reverts commit 370f5bcd48.

Revert "Bug 1991081 - Part 2: Store stencil to LoadedScript also in text and bytecode variants. r=nbp"

This reverts commit 7eaf4f425f.

Revert "Bug 1991081 - Part 1: Rename Stencil variant to CachedStencil in LoadedScript. r=nbp"

This reverts commit a7a6ce8f6f.
2025-10-15 13:30:07 +00:00
Tooru Fujisawa 370f5bcd48 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-10-15 09:44:09 +00:00
Serban Stanca 713fa52191 Revert "Bug 1991370, Bug 1991380, Bug 1991358, Bug 1991081 - Part 4: Use FrontendContext-based EncodeStencil in ScriptPreloader. r=bthrall" for causing multiple bugs.
This reverts commit b1f784aebb.

This reverts commit 7f4d0b5564.

This reverts commit 7292c33902.

This reverts commit cbe156f214.

This reverts commit 3412fc5535.

This reverts commit 1b08161b6d.

This reverts commit d0cf6f5210.

This reverts commit da56ddfb2f.

This reverts commit 926bbd302a.

This reverts commit 8c38c4c093.

This reverts commit d6475781cd.

This reverts commit 8044e8dae9.

This reverts commit a3149ca9dd.

This reverts commit eca472223f.

This reverts commit 6bc2703f1a.
2025-10-08 12:57:20 +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 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
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
Tooru Fujisawa 84727f2cc6 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
c8ef 1fd1c0a45c Bug 1911403 - fix typo in source code -> r=nalexander,profiler-reviewers,jandem,masayuki,canaltinova
Differential Revision: https://phabricator.services.mozilla.com/D218474
2024-08-07 05:35:02 +00:00
Tooru Fujisawa adec9d4fda 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 16292d50d1 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
Norisz Fay 471367226c 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 99e7436687 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 688fe4a358 Bug 1906393 - Add nsIIncrementalStreamLoader.onStartRequest. r=necko-reviewers,kershaw
Differential Revision: https://phabricator.services.mozilla.com/D215831
2024-07-10 06:24:34 +00:00
Tooru Fujisawa c8e79647f8 Bug 1899172 - Part 3: Add ScriptLoadContext::GetHintCharset. r=nbp
Differential Revision: https://phabricator.services.mozilla.com/D211903
2024-05-30 05:01:15 +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
Tooru Fujisawa ad3f8f8a06 Bug 1800641 - Part 8: Add LoadContextBase* parameter to ScriptLoadRequest methods which is going to be moved to LoadedScriptDelegate. r=nbp
Depends on D197845

Differential Revision: https://phabricator.services.mozilla.com/D197846
2024-01-08 14:57:38 +00:00
Tooru Fujisawa e45786c019 Bug 1800641 - Part 6: Add ScriptLoadRequest::{,Set}ReceivedScriptTextLength. r=nbp
Depends on D197843

Differential Revision: https://phabricator.services.mozilla.com/D197844
2024-01-08 14:57:38 +00:00
Tooru Fujisawa 168d0ccdd7 Bug 1800641 - Part 4: Add ScriptLoadRequest::{Get,Set}SRILength. r=nbp
Depends on D197841

Differential Revision: https://phabricator.services.mozilla.com/D197842
2024-01-08 14:57:37 +00:00
Tooru Fujisawa 929368a3f4 Bug 1800641 - Part 3: Add ScriptLoadRequest::SRIAndBytecode. r=nbp
Depends on D197840

Differential Revision: https://phabricator.services.mozilla.com/D197841
2024-01-08 14:57:36 +00:00
Noemi Erli 46e817bca8 Backed out changeset 4d6294424819 (bug 1800641) for causing Bug 1872347 2023-12-29 16:23:18 +02:00
Nicolas B. Pierron 7ad7f045d4 Bug 1800641 - Move some ScriptLoadRequest fields into LoadedScript. r=yulia
We are looking into caching loaded script in memory. To do so we need something
to cache.

At the moment, the `ScriptLoadRequest` structure hold all the fields which are
loaded, and used before executing JavaScript code. Then, the `ScriptLoadRequest`
is not guaranteed to out-live the first execution.

Therefore, we have to move fields out of the `ScriptLoadRequest` such that they
can later be used by any caching mechanism. The `LoadedScript` is the closest
existing structure which exists which fit the description.

This patch moves fields out of the ScriptLoadRequest into the `LoadedScript`,
which already has a `LoadedScript` field.

The `LoadedScript` field is initialized sooner, when the `ScriptLoadRequest` is
created, to be subsituted later by a real cache implementation. At the moment
the function `ScriptLoadRequest::NoCacheEntryFound` is used as a placeholder to
change the state of the `ScriptLoadRequest` from `CheckingCache` to `Fetching`.
Existing initializations are replaced by assertions to fail in debug build if
the current patch does not reproduce the expected state properly.

The `LoadedScript` get fields such as the source text, the text length, the
bytecode buffer (which also contains SRI), and the offset at which the bytecode
starts within the bytecode buffer. As these fields are no longer reachable by
name, multiple accessors are added to work-around the issue. Using this as an
opportunity to add extra assertions as part of these accessors.

A new class named `LoadedScriptDelegate` is added to re-add, by inheritance, all
the accessors which used to be part of `ScriptLoadRequest` as methods which are
delegating to the field which is holding the `LoadedScript`. This class is using
templates to avoid virtual inheritance which might hinder inlining, especially
since `ScriptLoadRequest` cannot be made final, as `ModuleLoadRequest` extends
it.

The `ScriptFetchOptions` structure is moved to its own file to solve C++ include
issues.

Differential Revision: https://phabricator.services.mozilla.com/D163615
2023-12-25 09:46:54 +00:00
Cosmin Sabou 78d82c8098 Backed out changeset f69f493b2f3c (bug 1800641) for causing non-unified build bustages on LoadedScript.cpp. CLOSED TREE 2023-12-25 08:38:51 +02:00
Nicolas B. Pierron d60b4bd3b1 Bug 1800641 - Move some ScriptLoadRequest fields into LoadedScript. r=yulia
We are looking into caching loaded script in memory. To do so we need something
to cache.

At the moment, the `ScriptLoadRequest` structure hold all the fields which are
loaded, and used before executing JavaScript code. Then, the `ScriptLoadRequest`
is not guaranteed to out-live the first execution.

Therefore, we have to move fields out of the `ScriptLoadRequest` such that they
can later be used by any caching mechanism. The `LoadedScript` is the closest
existing structure which exists which fit the description.

This patch moves fields out of the ScriptLoadRequest into the `LoadedScript`,
which already has a `LoadedScript` field.

The `LoadedScript` field is initialized sooner, when the `ScriptLoadRequest` is
created, to be subsituted later by a real cache implementation. At the moment
the function `ScriptLoadRequest::NoCacheEntryFound` is used as a placeholder to
change the state of the `ScriptLoadRequest` from `CheckingCache` to `Fetching`.
Existing initializations are replaced by assertions to fail in debug build if
the current patch does not reproduce the expected state properly.

The `LoadedScript` get fields such as the source text, the text length, the
bytecode buffer (which also contains SRI), and the offset at which the bytecode
starts within the bytecode buffer. As these fields are no longer reachable by
name, multiple accessors are added to work-around the issue. Using this as an
opportunity to add extra assertions as part of these accessors.

A new class named `LoadedScriptDelegate` is added to re-add, by inheritance, all
the accessors which used to be part of `ScriptLoadRequest` as methods which are
delegating to the field which is holding the `LoadedScript`. This class is using
templates to avoid virtual inheritance which might hinder inlining, especially
since `ScriptLoadRequest` cannot be made final, as `ModuleLoadRequest` extends
it.

The `ScriptFetchOptions` structure is moved to its own file to solve C++ include
issues.

Differential Revision: https://phabricator.services.mozilla.com/D163615
2023-12-25 05:50:53 +00:00
Yulia Startsev 796c9da32b Bug 1742438 - Part 7: Make ScriptDecoder an independent class rather than a base class; r=arai
Now that the Worker ScriptLoader largely conforms to the same shape as the DOM ScriptLoader, and
represents requests in the same way, we can start sharing some code. The ScriptLoadHandler isn't
entirely common to both cases, as it handles preloads (which are not possible in workers). This
patch splits out the common class, ScriptDecoder, as it's own thing. A demonstration of its use is
in Part 8 of this patch queue.

Differential Revision: https://phabricator.services.mozilla.com/D146213
2022-07-14 17:07:27 +00:00
Yulia Startsev cd6402b243 Bug 1742438 - Part 6: Factor out ScriptDecoder class from ScriptLoadHandler; r=arai
This patch splits out the decoding from the ScriptLoadHandler. This will be reused by the worker
ScriptLoader for loading scripts via both NetworkLoadHandler and CacheLoadHandler.

Differential Revision: https://phabricator.services.mozilla.com/D146178
2022-07-14 17:07:26 +00:00
Bryan Thrall ab3bb7fe91 Bug 1757833 - Add PerfStat probes for bytecode cache reads, writes, compression, and decompression r=nbp,necko-reviewers,kershaw
Differential Revision: https://phabricator.services.mozilla.com/D145012
2022-05-20 18:25:42 +00:00
Bryan Thrall fc29361ac3 Bug 1757833 - Extract methods ScriptBytecodeCompress and ScriptBytecodeDecompress r=nbp
This leaves the code in ScriptLoader and ScriptLoadHandler a lot more readable.

ScriptBytecodeCompressedDataLayout and ScriptBytecodeDataLayout simplify
locating data in the ScriptLoadRequest bytecode buffer when compressing and
decompressing it.

The interface is still error-prone. For example, these classes don't check
that the returned pointers are within the bounds of the buffer.

Differential Revision: https://phabricator.services.mozilla.com/D145011
2022-05-20 18:25:40 +00:00
Bryan Thrall 827cd45046 Bug 1757833 - Compress Stencil bytecode before writing to cache r=nbp
The SRI hash at the beginning of ScriptLoadRequest::mScriptBytecode is left
uncompressed because ScriptLoader::OnIncrementalData() tries to decode it
as soon as enough data is read (instead of waiting until OnStreamComplete()).

ScriptLoader writes the length of the uncompressed bytecode to the buffer
to make it easy for ScriptLoadHandler to allocate an buffer of the right size
to decompress the bytecode.

These changes are based on the bytecode compression implemented for WASM in
dom/fetch/FetchUtil.cpp.

Differential Revision: https://phabricator.services.mozilla.com/D141524
2022-05-20 18:25:40 +00:00
Iulian Moraru d3b3df8951 Backed out 6 changesets (bug 1757833) for causing multiple crashes with MOZ_Z_inflateInit2_. CLOSED TREE
Backed out changeset 6a7d3034db0a (bug 1757833)
Backed out changeset faa0393886db (bug 1757833)
Backed out changeset 4bffe0cf490e (bug 1757833)
Backed out changeset 189b81cc13fd (bug 1757833)
Backed out changeset a59c66e4fb68 (bug 1757833)
Backed out changeset 2b5d9869fbcb (bug 1757833)
2022-05-19 01:14:05 +03:00