Commit graph

100 commits

Author SHA1 Message Date
Jon Coppeard
392b0cedb4 Bug 1860802 - Make non-parser-created inline module scripts with imports execute asynchronously r=smaug
This reverts to the previous behaviour where inline module scripts with
dependencies would complete asynchronously. Previously this would have been
internal to the module loader base class.

Differential Revision: https://phabricator.services.mozilla.com/D192321
2023-11-03 12:00:21 +00:00
Yoshi Cheng-Hao Huang
cd69bc3c65 Bug 1841859 - Part 1: Move ReferrerPolicy to ScriptLoadRequest and LoadedScript. r=jonco,smaug
Suggested by jonco during review,
https://phabricator.services.mozilla.com/D186944#inline-1036982

Differential Revision: https://phabricator.services.mozilla.com/D187385
2023-09-20 17:32:15 +00:00
Henri Sivonen
2ea4ba1cf2 Bug 1846178 - Use the async/defer (non-blocking) HTML parser code path for module scripts. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D185797
2023-09-15 07:53:16 +00:00
Tooru Fujisawa
70c40a1658 Bug 1845638 - Part 1: Use JS::FrontendContext APIs and TaskController in compilation and decode in ScriptLoader. r=smaug,bthrall
Differential Revision: https://phabricator.services.mozilla.com/D184896
2023-08-29 12:07:18 +00:00
Mirko Brodesser
2966a909e7 Bug 1839316: part 4) Add RequestPriority to ScriptFetchOptions and ScriptLoadRequest. r=smaug
The request priority isn't propagated from `ScriptFetchOptions`, so
setting it has no effect for end-users. That will be implemented in a
following part.

Differential Revision: https://phabricator.services.mozilla.com/D183483
2023-08-28 11:56:34 +00:00
Norisz Fay
c5e74dfe84 Backed out changeset 4a4d5e64aec5 (bug 1846178) for causing mochitest failures on test_script_loader_js_cache.html/cache_module.html CLOSED TREE 2023-08-23 11:19:39 +03:00
Henri Sivonen
acc51e7036 Bug 1846178 - Use the async/defer (non-blocking) HTML parser code path for module scripts. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D185797
2023-08-23 07:11:47 +00:00
Jon Coppeard
970aa448a4 Bug 1847813 - Process loaded modules asynchronously in DOM module loader r=smaug
Based on the explanation on the bug, the solution would seem to be to call the
ModuleLoaderBase::OnModuleLoadComplete hook from a microtask. This causes a ton
of test failures.

Instead this patch changes the DOM script loader to implement this hook with a
runnable. This fixes the problem (verified manually) and all tests pass.

(Replacing the runnable with a microtask just in the DOM script loader also
does not work and results in many test failures. I'm still trying to understand
why.)

The changes to ContinueDynamicImport are removed because they are also on this
path and we don't need a microtask as well.

This takes us closer to the state before bug 1842798 landed when all the module
loader used MozPromise internally and completions like this happened via
runnables.

I was not able to immediately come up with a test for this.

Differential Revision: https://phabricator.services.mozilla.com/D185830
2023-08-09 22:49:46 +00:00
Cosmin Sabou
c406bcf318 Backed out 5 changesets (bug 1839316) for causing bustages on ScriptLoader.cpp. CLOSED TREE
Backed out changeset 85f107e082ee (bug 1839316)
Backed out changeset 8c1e22518c3a (bug 1839316)
Backed out changeset a4c3dec0f34c (bug 1839316)
Backed out changeset 313ff15742dd (bug 1839316)
Backed out changeset fa200e26bbb1 (bug 1839316)
2023-08-09 20:16:06 +03:00
Mirko Brodesser
5cade38f47 Bug 1839316: part 4) Add RequestPriority to ScriptFetchOptions and ScriptLoadRequest. r=smaug
The request priority isn't propagated from `ScriptFetchOptions`, so
setting it has no effect for end-users. That will be implemented in a
following part.

Differential Revision: https://phabricator.services.mozilla.com/D183483
2023-08-09 13:50:28 +00:00
Cosmin Sabou
0058dbdd1c Backed out 5 changesets (bug 1839316) for causing leaks. CLOSED TREE
Backed out changeset 75edff380fee (bug 1839316)
Backed out changeset 6a622fd5cd91 (bug 1839316)
Backed out changeset 60908cc7c586 (bug 1839316)
Backed out changeset 7b9dd8875a9e (bug 1839316)
Backed out changeset b586915187c2 (bug 1839316)
2023-08-07 16:43:03 +03:00
Mirko Brodesser
5d091f10d0 Bug 1839316: part 4) Add RequestPriority to ScriptFetchOptions and ScriptLoadRequest. r=smaug
The request priority isn't propagated from `ScriptFetchOptions`, so
setting it has no effect for end-users. That will be implemented in a
following part.

Differential Revision: https://phabricator.services.mozilla.com/D183483
2023-08-07 11:46:19 +00:00
Jon Coppeard
80cac6bbb5 Bug 1843838 - Rename ScriptLoadRequest::IsReadyToRun to IsFinished since this returns true for cancelled requests r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D183740
2023-08-04 09:40:40 +00:00
Peter Van der Beken
3f4ffadbe1 Bug 1846277 - Untangle nsGlobalWindow*.h includes. r=dom-core,media-playback-reviewers,sessionstore-reviewers,padenot,farre
Differential Revision: https://phabricator.services.mozilla.com/D184978
2023-08-02 20:41:49 +00:00
Tom Schuster
ecff00a7ba Bug 1843002 - Add parser-metadata to ScriptFetchOptions. r=allstarschh,smaug
Differential Revision: https://phabricator.services.mozilla.com/D183366
2023-07-21 17:28:02 +00:00
Tom Schuster
936032fed3 Bug 1843002 - Add nonce to ScriptFetchOptions. r=allstarschh,smaug
Differential Revision: https://phabricator.services.mozilla.com/D183365
2023-07-21 17:28:02 +00:00
Stanca Serban
70ab9b117e Backed out 6 changesets (bug 1313937, bug 1843066, bug 1843002) for causing build bustages in ScriptLoadRequest.h. CLOSED TREE
Backed out changeset 84c2d1c04aa2 (bug 1313937)
Backed out changeset 7cab9a1ea25f (bug 1313937)
Backed out changeset affc7d1f130d (bug 1313937)
Backed out changeset e13aacfe7944 (bug 1843066)
Backed out changeset 21a9bee8f772 (bug 1843002)
Backed out changeset d381b6365111 (bug 1843002)
2023-07-21 17:41:04 +03:00
Tom Schuster
593c5e731b Bug 1843002 - Add parser-metadata to ScriptFetchOptions. r=allstarschh,smaug
Differential Revision: https://phabricator.services.mozilla.com/D183366
2023-07-21 12:31:23 +00:00
Tom Schuster
9df91ffb4d Bug 1843002 - Add nonce to ScriptFetchOptions. r=allstarschh,smaug
Differential Revision: https://phabricator.services.mozilla.com/D183365
2023-07-21 12:31:22 +00:00
Tooru Fujisawa
a788413945 Bug 1843030 - Part 4: Add PreallocatedCompilationGCOutput. r=nbp
Differential Revision: https://phabricator.services.mozilla.com/D183462
2023-07-14 08:27:01 +00:00
Em Zhan
b6b6fe577b Bug 1798319 - Implement modulepreload in early hints r=manuel,smaug,necko-reviewers,kershaw
The aEarlyHintPreloaderId parameter for StartLoad/StartLoadInternal is changed
to be a member variable of ScriptLoadRequest instead so that an initiator type
of early hints can be set for module requests. Before, ModuleLoader would always
pass in a zero value for the id since ModuleLoaderBase has no concept of early
hints when it calls StartFetch.

As a prerequisite for early hints support, this commit also implements
modulepreload in link headers (Bug 1773056).

Differential Revision: https://phabricator.services.mozilla.com/D180020
2023-06-26 10:49:53 +00:00
Sean Feng
b32e4554a9 Bug 1804086 - Allow classic script hint to be passed from content to parent r=smaug,necko-reviewers,kershaw
This is needed for doing content decoding for ORB.

Differential Revision: https://phabricator.services.mozilla.com/D172490
2023-03-22 14:21:39 +00:00
Noemi Erli
b4fa013c2d Backed out 3 changesets (bug 1804086) for causing failures in JSValidatorChild.cpp CLOSED TREE
Backed out changeset 12a40a80a975 (bug 1804086)
Backed out changeset 1bea9ea5e20d (bug 1804086)
Backed out changeset 00feb14e7824 (bug 1804086)
2023-03-22 03:33:43 +02:00
Sean Feng
078281d4c2 Bug 1804086 - Allow classic script hint to be passed from content to parent r=smaug,necko-reviewers,kershaw
This is needed for doing content decoding for ORB.

Differential Revision: https://phabricator.services.mozilla.com/D172490
2023-03-21 22:55:08 +00:00
Manuel Bucher
7681efff11 Bug 1771867 - Early Hints Phase 2 - Part 5: Pass early hint preload to script preloader r=necko-reviewers,valentin
Note that modules can't be specified in Link preloads with `rel=preload`,
only in `rel=modulepreload`.  We currently only support `rel=preload` in
early hints. See Bug 1798319 for updates on module preloads.

Differential Revision: https://phabricator.services.mozilla.com/D161175
2022-12-02 16:15:54 +00:00
Csoregi Natalia
5a260d61a4 Backed out 13 changesets (bug 1771867) for causing CanonicalBrowsingContext crashes. CLOSED TREE
Backed out changeset 120838b58449 (bug 1771867)
Backed out changeset aea7ca0bbd17 (bug 1771867)
Backed out changeset 2fe2afdee09d (bug 1771867)
Backed out changeset 8bdb1f682d22 (bug 1771867)
Backed out changeset a9f3158ed688 (bug 1771867)
Backed out changeset 1177913e1edf (bug 1771867)
Backed out changeset d33ccbbf407d (bug 1771867)
Backed out changeset 110ac12e16f5 (bug 1771867)
Backed out changeset 7f20525f5e94 (bug 1771867)
Backed out changeset b3d65b1aa872 (bug 1771867)
Backed out changeset 7cdf3cef2773 (bug 1771867)
Backed out changeset 5090eae24a5c (bug 1771867)
Backed out changeset f8a03d226c73 (bug 1771867)
2022-12-02 13:44:55 +02:00
Manuel Bucher
4ec279d231 Bug 1771867 - Early Hints Phase 2 - Part 5: Pass early hint preload to script preloader r=necko-reviewers,valentin
Note that modules can't be specified in Link preloads with `rel=preload`,
only in `rel=modulepreload`.  We currently only support `rel=preload` in
early hints. See Bug 1798319 for updates on module preloads.

Differential Revision: https://phabricator.services.mozilla.com/D161175
2022-12-02 09:45:25 +00:00
Jon Coppeard
f64d585ec0 Bug 1797166 - Don't assume an exception is always set if module compilation fails r=yulia
It would be nice to assume this but CompileFetchedModule can potentially fail for reasons that
are not JS-related.

Also check for the exception being |undefined| which would cause
ModuleScript::HasParseError to return false. Such an exception should never be
thrown by parsing but check for it just in case.

Add a diagnostic assert to check module script state is as we expect to
hopefully catch related problems sooner.

Differential Revision: https://phabricator.services.mozilla.com/D160788
2022-10-31 14:26:48 +00:00
Yoshi Cheng-Hao Huang
ee07ecaeec Bug 1778289 - Part 12: Update spec links as the PR is merged. r=jonco,yulia
The PR has been merged.
See https://html.spec.whatwg.org/multipage/webappapis.html#import-maps

Differential Revision: https://phabricator.services.mozilla.com/D158828
2022-10-07 13:56:27 +00:00
Yoshi Cheng-Hao Huang
77f6c4ae7e Bug 1778289 - Part 2: Rename to 'import maps allowed' and add 'disallow import maps'. r=jonco,yulia
Rename 'acquiring import maps' to 'import maps allowed'.

Old:
https://wicg.github.io/import-maps/#document-acquiring-import-maps

New:
https://whatpr.org/html/8075/webappapis.html#import-maps-allowed

And add 'disallow further import maps':
https://whatpr.org/html/8075/webappapis.html#disallow-further-import-maps

Differential Revision: https://phabricator.services.mozilla.com/D152869
2022-10-07 13:56:23 +00:00
Jon Coppeard
bccb7ef6f3 Bug 1788532 - Block dynamic module load processing during sync XHR r=smaug
The problem is that synchronous XMLHttpRequest requests can spin the event loop
and cause us to process dynamic module loads (by calling
JS::FinishDynamicModuleImport) when we are already inside JS::ModuleEvaluate.
The module algorithms assume that they are not reentrant.

The patch changes dyammic module load processing to happen in the same way as
async script loads (of both classic scripts and modules), which are blocked
during sync XHR by Document::SuppressEventHandling calling
ScriptLoader::AddExecuteBlocker.

Differential Revision: https://phabricator.services.mozilla.com/D157218
2022-09-15 09:14:11 +00:00
Ted Campbell
a2bdf84358 Bug 1788977 - Consolidate methods for finishing off-thread JS parse/decode. r=arai
Off-thread parse and decode all generate JS::Stencils so the various
specializations are not needed for methods that collect the results back to
main-thread.

Depends on D156335

Differential Revision: https://phabricator.services.mozilla.com/D156336
2022-09-06 12:01:35 +00:00
Manuel Bucher
14dd2f26fc Bug 1761242 - Expose computing security flags for early hint preloader r=ckerschb,smaug
Differential Revision: https://phabricator.services.mozilla.com/D144798
2022-06-15 09:59:44 +00:00
Molnar Sandor
1fc858a96d Backed out 5 changesets (bug 1761242, bug 1744822, bug 1761252) for causing browser-chrome failures in netwerk/test/browser/browser_103_assets.js CLOSED TREE
Backed out changeset 33cc08eb51b3 (bug 1744822)
Backed out changeset b70697d24e75 (bug 1761252)
Backed out changeset 4a5e10110c6a (bug 1761242)
Backed out changeset 7cda175b833d (bug 1761242)
Backed out changeset 4f5ed111093b (bug 1761242)
2022-06-08 18:56:35 +03:00
Manuel Bucher
35abf46688 Bug 1761242 - Expose computing security flags for early hint preloader r=ckerschb,smaug
Differential Revision: https://phabricator.services.mozilla.com/D144798
2022-06-08 14:33:10 +00:00
Yoshi Cheng-Hao Huang
bf4ad5ae3e Bug 1688879 - Part 6: Acquiring import maps. r=jonco,yulia
Implement https://wicg.github.io/import-maps/#document-acquiring-import-maps

Differential Revision: https://phabricator.services.mozilla.com/D142074
2022-05-05 21:19:02 +00:00
Butkovits Atila
fb9f362af3 Backed out 11 changesets (bug 1688879) for causing build bustages. CLOSED TREE
Backed out changeset 350ddd17c7f5 (bug 1688879)
Backed out changeset 27984b95ed20 (bug 1688879)
Backed out changeset 6a5bb063965f (bug 1688879)
Backed out changeset d8edcfdb504b (bug 1688879)
Backed out changeset 77ab231310ec (bug 1688879)
Backed out changeset c2bce95a1aca (bug 1688879)
Backed out changeset f5862572ced8 (bug 1688879)
Backed out changeset 05e0a1bf32fc (bug 1688879)
Backed out changeset adeab05b7419 (bug 1688879)
Backed out changeset 0e60834e17e5 (bug 1688879)
Backed out changeset 877bb4c2ce66 (bug 1688879)
2022-05-05 19:52:05 +03:00
Yoshi Cheng-Hao Huang
2cff7e6f2a Bug 1688879 - Part 6: Acquiring import maps. r=jonco,yulia
Implement https://wicg.github.io/import-maps/#document-acquiring-import-maps

Differential Revision: https://phabricator.services.mozilla.com/D142074
2022-05-05 16:03:17 +00:00
Narcis Beleuzu
a92a200e76 Backed out 9 changesets (bug 1688879) for bustages on ImportMap.cpp
Backed out changeset 44e9abe72a5e (bug 1688879)
Backed out changeset 0503d2d2ae01 (bug 1688879)
Backed out changeset 2cf08a51b184 (bug 1688879)
Backed out changeset 6f0276c3ab0e (bug 1688879)
Backed out changeset f16b14d8f677 (bug 1688879)
Backed out changeset 03b772e02d07 (bug 1688879)
Backed out changeset 39ed48a5ecc2 (bug 1688879)
Backed out changeset d7b42d8312bb (bug 1688879)
Backed out changeset 5e695bf5dd0d (bug 1688879)
2022-05-05 03:41:31 +03:00
Yoshi Cheng-Hao Huang
5abb2d6785 Bug 1688879 - Part 6: Acquiring import maps. r=jonco,yulia
Implement https://wicg.github.io/import-maps/#document-acquiring-import-maps

Differential Revision: https://phabricator.services.mozilla.com/D142074
2022-05-04 21:02:51 +00:00
Jon Coppeard
77609d6143 Bug 1766274 - Part 3: Rename CompileOrFinishModuleScript to CompileFetchedModule r=yulia
I was less sure of this one, but I think 'finish' is confusing here. Better names welcome.

Depends on D144597

Differential Revision: https://phabricator.services.mozilla.com/D144599
2022-04-26 12:40:48 +00:00
Jon Coppeard
f8a095fc91 Bug 1766274 - Part 2: Rename ProcessLoadedModuleTree to OnModuleLoadComplete r=yulia
Depends on D144596

Differential Revision: https://phabricator.services.mozilla.com/D144597
2022-04-26 12:40:47 +00:00
Jon Coppeard
1aeb55dd59 Bug 1766276 - Give MaybeOneOf a map method r=jandem
There are a few places where we call one of two overloads of a fuction based on
the contents of a MaybeOneOf. We can simplify this code by giving the class a
map method.

Differential Revision: https://phabricator.services.mozilla.com/D144595
2022-04-26 12:29:24 +00:00
Yulia Startsev
a996a1aca2 Bug 1763372 - Rename GetLoadContext to GetScriptLoadContext; r=jonco
Depends on D143068

Differential Revision: https://phabricator.services.mozilla.com/D143037
2022-04-22 13:24:10 +00:00
Yulia Startsev
9c4d96a57d Bug 1763586 - Adjust ScriptFetchOptions to be more accurate; r=jonco
Differential Revision: https://phabricator.services.mozilla.com/D143137
2022-04-21 09:53:33 +00:00
criss
1a5e600ac1 Backed out 4 changesets (bug 1763586) for causing mochitest failures on test_Debugger.Source.prototype.elementAttribute.html. CLOSED TREE
Backed out changeset 8da9574159d3 (bug 1763586)
Backed out changeset 8f964a9e2f31 (bug 1763586)
Backed out changeset 420105516ec3 (bug 1763586)
Backed out changeset 68cd444d018e (bug 1763586)
2022-04-19 16:28:30 +03:00
Yulia Startsev
edce198b19 Bug 1763586 - Adjust ScriptFetchOptions to be more accurate; r=jonco
Differential Revision: https://phabricator.services.mozilla.com/D143137
2022-04-19 12:28:48 +00:00
Iulian Moraru
2844dc6b1f Backed out 3 changesets (bug 1763586) for causing mochitest-chrome failures on test_Debugger.Source.prototype.element.html.
Backed out changeset f6b6ccfce3d1 (bug 1763586)
Backed out changeset ca0157c919a9 (bug 1763586)
Backed out changeset e0294a6f9f9f (bug 1763586)
2022-04-13 21:53:34 +03:00
Yulia Startsev
dce170ffad Bug 1763586 - Adjust ScriptFetchOptions to be more accurate; r=jonco
Differential Revision: https://phabricator.services.mozilla.com/D143137
2022-04-13 16:29:36 +00:00
Marian-Vasile Laza
05a897ed46 Backed out 3 changesets (bug 1763586) foar causing sm bustages. CLOSED TREE
Backed out changeset 02a961432a49 (bug 1763586)
Backed out changeset 3fc84237decb (bug 1763586)
Backed out changeset 365eff56ce0f (bug 1763586)
2022-04-12 09:49:21 -07:00