Commit Graph
786 Commits
Author SHA1 Message Date
Jonatan Klemets 4d18cba1b0 Bug 1877792 - Part 16: Disable off-thread compilaton for JSON modules r=spidermonkey-reviewers,jonco
This is something we may want to investigate and implement, but it felt out of
scope for the initial implementation.

Differential Revision: https://phabricator.services.mozilla.com/D218563
2024-09-03 08:10:54 +00:00
Jonatan Klemets 5bb3af7ad5 Bug 1877792 - Part 11: Only allow expected mime types r=dom-worker-reviewers,asuth
Differential Revision: https://phabricator.services.mozilla.com/D218558
2024-09-03 08:10:52 +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 72a54fd53e Bug 1877792 - Part 16: Disable off-thread compilaton for JSON modules r=spidermonkey-reviewers,jonco
This is something we may want to investigate and implement, but it felt out of
scope for the initial implementation.

Differential Revision: https://phabricator.services.mozilla.com/D218563
2024-08-22 14:21:54 +00:00
Jonatan Klemets 2cb8c6cf67 Bug 1877792 - Part 11: Only allow expected mime types r=dom-worker-reviewers,dom-core,asuth,hsivonen
Differential Revision: https://phabricator.services.mozilla.com/D218558
2024-08-22 14:21:52 +00:00
Florian Quèze fddcf12682 Bug 1913624 - Remove expired telemetry histograms DOM_SCRIPT_KIND and DOM_SCRIPT_PRELOAD_RESULT, r=TravisLong.
Depends on D219458

Differential Revision: https://phabricator.services.mozilla.com/D219459
2024-08-20 20:56:44 +00:00
Emilio Cobos Álvarez a44b49af0b Bug 1910698 - Add a struct to represent JS caller location and more general warning source location. r=smaug,necko-reviewers,anti-tracking-reviewers,dom-storage-reviewers,pbz,kershaw,janv
Use it liberally across the tree. This could be cleaned up even more in the future.

Differential Revision: https://phabricator.services.mozilla.com/D218114
2024-08-01 17:12:48 +00:00
Tooru Fujisawa 3f46be92f0 Bug 1896709 - Part 13: Use SharedSubResourceCache in ScriptLoader. r=nbp
Differential Revision: https://phabricator.services.mozilla.com/D215882
2024-07-18 21:58:14 +00:00
Tooru Fujisawa 85f4805168 Bug 1896709 - Part 12: Add SharedScriptCache field to ScriptLoader. r=nbp
Differential Revision: https://phabricator.services.mozilla.com/D215881
2024-07-18 21:58:14 +00:00
Tooru Fujisawa 6924910f83 Bug 1896709 - Part 10: Add SharedScriptCache. r=nbp
Differential Revision: https://phabricator.services.mozilla.com/D215879
2024-07-18 21:58:13 +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 309452cddc Bug 1896709 - Part 13: Use SharedSubResourceCache in ScriptLoader. r=nbp
Differential Revision: https://phabricator.services.mozilla.com/D215882
2024-07-18 09:15:28 +00:00
Tooru Fujisawa de3ba3568c Bug 1896709 - Part 12: Add SharedScriptCache field to ScriptLoader. r=nbp
Differential Revision: https://phabricator.services.mozilla.com/D215881
2024-07-18 09:15:28 +00:00
Tooru Fujisawa 2fd3dec9e1 Bug 1896709 - Part 10: Add SharedScriptCache. r=nbp
Differential Revision: https://phabricator.services.mozilla.com/D215879
2024-07-18 09:15:27 +00: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 599af2d7d2 Bug 1899172 - Part 11: Move nsIScriptElement from ScriptFetchOptions to ScriptLoadContext. r=nbp
Differential Revision: https://phabricator.services.mozilla.com/D211912
2024-05-30 05:01:18 +00:00
Tooru Fujisawa 09599bede7 Bug 1899172 - Part 10: Add dedicate ScriptLoadContext::GetScriptElement* methods for each purpose. r=nbp
Differential Revision: https://phabricator.services.mozilla.com/D211911
2024-05-30 05:01:18 +00:00
Tooru Fujisawa ce938c9b54 Bug 1899172 - Part 9: Add ScriptLoadContext::GetScriptOwnerDocument. r=nbp
Differential Revision: https://phabricator.services.mozilla.com/D211910
2024-05-30 05:01:18 +00:00
Tooru Fujisawa d760478b60 Bug 1899172 - Part 8: Add ScriptLoadContext::{UnblockParser,ContinueParserAsync}. r=nbp
Differential Revision: https://phabricator.services.mozilla.com/D211908
2024-05-30 05:01:17 +00:00
Tooru Fujisawa 2e811d3553 Bug 1899172 - Part 7: Add ScriptLoadContext::{BeginEvaluatingTopLevel,EndEvaluatingTopLevel}. r=nbp
Differential Revision: https://phabricator.services.mozilla.com/D211907
2024-05-30 05:01:17 +00:00
Tooru Fujisawa 2a32316716 Bug 1899172 - Part 6: Consistently use ScriptLoadContext::GetParserCreated. r=nbp
Differential Revision: https://phabricator.services.mozilla.com/D211906
2024-05-30 05:01:16 +00:00
Tooru Fujisawa 59bd4fb561 Bug 1899172 - Part 5: Add ScriptLoadContext::HasScriptElement. r=nbp
Differential Revision: https://phabricator.services.mozilla.com/D211905
2024-05-30 05:01:16 +00:00
Tooru Fujisawa b9294b559d Bug 1899172 - Part 4: Add ScriptLoadContext::{GetScriptLineNumber,GetScriptColumnNumber}. r=nbp
They'll be reworked in later patch not to depend on script element.

Differential Revision: https://phabricator.services.mozilla.com/D211904
2024-05-30 05:01:15 +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 6e5b7d5d1b Bug 1898677 - Cache the result of bytecode encoding condition. r=nbp
Differential Revision: https://phabricator.services.mozilla.com/D211517
2024-05-27 06:31:16 +00:00
Jon Coppeard 2d8c18b5d5 Bug 1877703 - Part 3: Also remove currently fetching preload modules from the module map when import map is registered r=smaug
A further problem with dynamically inserted import maps was discovered where
sometimes module scripts would never execute. This happens when the script is
still being fetched when the import map is added.

To fix this, cancel all fetching module preloads as well when an import map is
registered and remove them from the module map. In theory this shouldn't be
necessary but I wasn't able to make the tests pass without this step.

For simplicity also remove all module preloads from the scriptloader's list of
preload requests rather than detecting and ignoring them later on.

Differential Revision: https://phabricator.services.mozilla.com/D204202
2024-03-19 10:07:35 +00:00
Nicolas B. Pierron ed93bacb41 Bug 1800896 - Move padding of the bytecode vector into SaveSRIHash. r=arai
When saving the SRI Hash, we resize the btyecode buffer to the expected size of
the buffer. Previously, after saving the bytecode, the code surrounding
SaveSRIHash introduced the padding necessary for potentially saving bytecode
after.

This patch move the padding into SaveSRIHash, to reduce the overhead of
understanding why the btyecode buffer is being manipulated in what seems to be
out-of-context. Moving it into SaveSRIHash might seems strange but it closer to
other actions to the bytecode buffer which makes it less unexpected.

Differential Revision: https://phabricator.services.mozilla.com/D203131
2024-03-18 14:26:57 +00:00
Norisz Fay d4dacb8c6c Backed out 4 changesets (bug 1877703) as requested by dev for causing Bug 1885443
Backed out changeset 5eb60e36ef79 (bug 1877703)
Backed out changeset 5921d1fb831e (bug 1877703)
Backed out changeset 64281b11237e (bug 1877703)
Backed out changeset 7ee0827809fb (bug 1877703)
2024-03-15 13:28:07 +02:00
Jon Coppeard 7fcbd86e7c Bug 1877703 - Part 3: Also remove currently fetching preload modules from the module map when import map is registered r=smaug
A further problem with dynamically inserted import maps was discovered where
sometimes module scripts would never execute. This happens when the script is
still being fetched when the import map is added.

To fix this, cancel all fetching module preloads as well when an import map is
registered and remove them from the module map. In theory this shouldn't be
necessary but I wasn't able to make the tests pass without this step.

For simplicity also remove all module preloads from the scriptloader's list of
preload requests rather than detecting and ignoring them later on.

Differential Revision: https://phabricator.services.mozilla.com/D204202
2024-03-13 13:25:30 +00:00
Norisz Fay 88f0544e64 Backed out 4 changesets (bug 1877703) for causing ScriptLoader related wpt failures
Backed out changeset 6b99c1c567b4 (bug 1877703)
Backed out changeset bc9c70289244 (bug 1877703)
Backed out changeset 1e17b87ab7f8 (bug 1877703)
Backed out changeset 591b5483bcd8 (bug 1877703)
2024-03-12 23:43:16 +02:00
Jon Coppeard fa39122d39 Bug 1877703 - Part 3: Also remove currently fetching preload modules from the module map when import map is registered r=smaug
A further problem with dynamically inserted import maps was discovered where
sometimes module scripts would never execute. This happens when the script is
still being fetched when the import map is added.

To fix this, cancel all fetching module preloads as well when an import map is
registered and remove them from the module map. In theory this shouldn't be
necessary but I wasn't able to make the tests pass without this step.

For simplicity also remove all module preloads from the scriptloader's list of
preload requests rather than detecting and ignoring them later on.

Differential Revision: https://phabricator.services.mozilla.com/D204202
2024-03-12 16:43:49 +00:00
Bryan Thrall 44a7b81e41 Bug 1857536 - Remove unneeded struct CompilationStorage r=arai
Differential Revision: https://phabricator.services.mozilla.com/D203632
2024-03-11 14:56:01 +00:00
Emilio Cobos Álvarez 5b62de6483 Bug 1883435 - Don't include GleanMetrics.h from Document.h. r=chutten,necko-reviewers,valentin
In bug 1883435 comment 2 chutten mentions that including
nsGlobalWindowInner.h from GleanMetrics.h causes a stylo build failure.

This is because nsGlobalWindowInner.h itself brings a bunch of DOM
bindings template soup that bindgen isn't great at dealing with.

That can be fixed in various ways. However, there is a simpler fix,
which is not including GleanMetrics at all.

It's trivial to do, and given it's a massive autogenerated file, and
Document.h is a very common header, it's worth doing this if only for
build times.

Fix a bunch of unused includes while at it.

Differential Revision: https://phabricator.services.mozilla.com/D203625
2024-03-05 17:54:14 +00:00
Frédéric Wang c1b028d713 Bug 1880528 - Introduce preference for fetch priority adjustment of scripts. r=valentin,necko-reviewers
This introduces preferences for non-link scripts. See D201997 for the
rationale, test coverage and why there is no behavior change.

Differential Revision: https://phabricator.services.mozilla.com/D202046
2024-02-19 13:35:39 +00:00
Frédéric Wang a81ab9e9b6 Bug 1880528 - Introduce preference for fetch priority adjustment of <link rel=preload as=script>. r=valentin,necko-reviewers
The fetchpriority attribute allows web developers to request some
adjustment to the internal priorities when fetching resources. In order
to give some flexibility for experimenting and choosing the values that
work best for Gecko, we will introduce new preferences to control
exactly how the internal priority is adjusted, depending on the value
auto/high/low of the fetchpriority attribute.

This is the first patch of a series introducing such preferences,
focusing on the case `<link rel=preload as=script>`. The following 3
integer preferences are introduced:

```
network.fetchpriority.adjustments.link-preload-script.low
network.fetchpriority.adjustments.link-preload-script.high
network.fetchpriority.adjustments.link-preload-script.auto
```

and are set so that we don't change current behavior (already
covered by tests). A test is also added to verify basic invariants
for such adjustments.

Differential Revision: https://phabricator.services.mozilla.com/D201997
2024-02-19 13:35:39 +00:00
Chris H-C 0d6eaa8089 Bug 1877843 - Migrate javascript.pageload GVST metrics r=perry.mcmanis,denispal
Differential Revision: https://phabricator.services.mozilla.com/D200974
2024-02-09 21:11:06 +00:00
Tooru Fujisawa e29632369c Bug 1877596 - Use original URL as base URL for internal scheme also in worker. r=jonco,dom-storage-reviewers,janv,dom-worker-reviewers,smaug
Differential Revision: https://phabricator.services.mozilla.com/D200129
2024-02-05 01:12:24 +00:00
Yoshi Cheng-Hao Huang 56420709da Bug 1877122 - Resue the preloaded request before it starts loading imports. r=jonco
Differential Revision: https://phabricator.services.mozilla.com/D199961
2024-01-31 12:41:26 +00:00
Tom Schuster 940baabb7a Bug 1397308 - Implement CSP 'Is element nonceable?' check. r=emilio,hsivonen,freddyb
Differential Revision: https://phabricator.services.mozilla.com/D198150
2024-01-26 14:56:32 +00:00
Yoshi Cheng-Hao Huang dfa7642264 Bug 1873417 : Cancel the preloaded request only if the it has been fetched. r=jonco
Fist, the module script bug_1873417.mjs is preloaded, then an import map is
inserted. Then ScriptLoader will cancel the preloaded request [1],
and create a new ScriptLoadRequest.
The new ScriptLoadRequest will be added into WaitingRequests in
mFetchingModules [2].
Finally, ScriptLoader finishes fetching the original preloaded ScriptLoadRequest,
but since it is cancelled, NS_BINDING_ABORTED will be passed to
OnFetchComplete [3] [4] [5], and then call ResumeWaitingRequests for the
new created ScriptLoadRequest [6], which in turn calls LoadFailed() [7].

[1]: https://searchfox.org/mozilla-central/rev/47b65cbe249613b9af936cd4660789bb642a8e30/dom/script/ScriptLoader.cpp#1149
[2]: https://searchfox.org/mozilla-central/rev/47b65cbe249613b9af936cd4660789bb642a8e30/js/loader/ModuleLoaderBase.cpp#433
[3]: https://searchfox.org/mozilla-central/rev/47b65cbe249613b9af936cd4660789bb642a8e30/dom/script/ScriptLoader.cpp#3791
[4]: https://searchfox.org/mozilla-central/rev/47b65cbe249613b9af936cd4660789bb642a8e30/dom/script/ScriptLoader.cpp#3377
[5]: https://searchfox.org/mozilla-central/rev/47b65cbe249613b9af936cd4660789bb642a8e30/dom/script/ScriptLoader.cpp#3563
[6]: https://searchfox.org/mozilla-central/rev/47b65cbe249613b9af936cd4660789bb642a8e30/js/loader/ModuleLoaderBase.cpp#515
[7]: https://searchfox.org/mozilla-central/rev/47b65cbe249613b9af936cd4660789bb642a8e30/js/loader/ModuleLoaderBase.cpp#531

To fix this, we check the state of the ScriptLoadRequest, if the preloaded
request isn't fetched yet, then we should reuse it.

Differential Revision: https://phabricator.services.mozilla.com/D199094
2024-01-22 17:42:21 +00:00
Tom Schuster 694c3e8534 Bug 1872839 - Remove aMimeTypeGuess parameter from nsIContentPolicy. r=freddyb
Differential Revision: https://phabricator.services.mozilla.com/D197794
2024-01-08 15:47:42 +00:00
Tooru Fujisawa 60ae165b14 Bug 1800641 - Part 11: Allocate script in ScriptLoadRequest::NoCacheEntryFound. r=nbp
Depends on D197848

Differential Revision: https://phabricator.services.mozilla.com/D197849
2024-01-08 14:57:40 +00:00
Tooru Fujisawa ed418d41dd Bug 1800641 - Part 10: Add ScriptLoadRequest::mLoadedScript. r=nbp
Depends on D197847

Differential Revision: https://phabricator.services.mozilla.com/D197848
2024-01-08 14:57:39 +00:00
Tooru Fujisawa c389c518db Bug 1800641 - Part 9: Add LoadedScript::mURI and call SetBaseURL separately. r=nbp
Depends on D197846

Differential Revision: https://phabricator.services.mozilla.com/D197847
2024-01-08 14:57:39 +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 9b4d6d328e Bug 1800641 - Part 7: Add ScriptLoadRequest::State::{CheckingCache,PendingFetchingError}. r=nbp
Depends on D197844

Differential Revision: https://phabricator.services.mozilla.com/D197845
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 bcb3790794 Bug 1800641 - Part 5: Add ScriptLoadRequest::DropBytecode. r=nbp
Depends on D197842

Differential Revision: https://phabricator.services.mozilla.com/D197843
2024-01-08 14:57:37 +00:00