Commit graph

770 commits

Author SHA1 Message Date
Tooru Fujisawa
373c7f77e9 Bug 1802525 - Do not perform serialization in GiveUpBytecodeEncoding. r=nbp
Differential Revision: https://phabricator.services.mozilla.com/D163424
2022-12-01 09:28:47 +00:00
Adam Vandolder
aad960043b Bug 1632975 - Run microtask checkpoint before processing script. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D162261
2022-11-17 20:11:23 +00:00
Cristian Tuns
eee0f3c4ff Backed out changeset dd72eb737d96 (bug 1632975) for causing Bug 1800981 CLOSED TREE 2022-11-16 19:15:14 -05:00
Adam Vandolder
d7e3ad7220 Bug 1632975 - Run microtask checkpoint before processing script. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D160988
2022-11-15 20:24:15 +00:00
Tom Schuster
b680625ab0 Bug 1797070 - CSP: Add a basic implementation of unsafe-hashes behind a flag. r=freddyb
Differential Revision: https://phabricator.services.mozilla.com/D160046
2022-11-07 17:56:23 +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
0d7b683b7a Bug 1778289 - Part 10: Update comments for 'register an import map'. r=jonco,yulia
Differential Revision: https://phabricator.services.mozilla.com/D152877
2022-10-07 13:56:26 +00:00
Yoshi Cheng-Hao Huang
61951dd873 Bug 1778289 - Part 9: Bail out early if adding an import map is disallowed. r=jonco,yulia
If an adding import map is disallowed, we bail out early to prevent creating a
ScriptLoadRequest.

Differential Revision: https://phabricator.services.mozilla.com/D152876
2022-10-07 13:56:26 +00:00
Yoshi Cheng-Hao Huang
9415beeaef Bug 1778289 - Part 6: Update comments for external import maps. r=jonco,yulia
Differential Revision: https://phabricator.services.mozilla.com/D152873
2022-10-07 13:56:25 +00:00
Yoshi Cheng-Hao Huang
1adff58d99 Bug 1778289 - Part 4: Don't call onerror if parsing import maps fails. r=jonco,yulia
script's result will be an import map parse result, which will never be
null.

See explanation from https://github.com/WICG/import-maps/issues/279

Differential Revision: https://phabricator.services.mozilla.com/D152871
2022-10-07 13:56:24 +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
Andreea Pavel
1e8bd660ee Backed out changeset 7cfadef6f30f (bug 1790765) for causing bug 1791309 2022-09-20 09:16:58 +03:00
Jon Coppeard
53b72f131f Bug 1790765 - Replace superstitious comment in ScriptLoader::MaybeMoveToLoadedList with release assertion r=smaug
An initial try is green with this change.

Differential Revision: https://phabricator.services.mozilla.com/D157304
2022-09-15 09:14:59 +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
63b0610c8f Bug 1788977 - Share stencil-instantiate code in JSExecutionContext. r=arai
Differential Revision: https://phabricator.services.mozilla.com/D156339
2022-09-06 12:01:36 +00:00
Tooru Fujisawa
a927c643ec Bug 1787529 - Align the conditions in ScriptLoadContext::MaybeCancelOffThreadScript to ScriptLoader::AttemptAsyncScriptCompile. r=jonco
Differential Revision: https://phabricator.services.mozilla.com/D155740
2022-08-31 22:38:21 +00:00
Bryan Thrall
f9c451035e Bug 1768679 - Expose cache fetch count as uint32_t r=dragana,necko-reviewers
The value is stored as uint32_t, and there doesn't seem to be a need to convert
it to int.

Differential Revision: https://phabricator.services.mozilla.com/D147888
2022-08-04 16:20:17 +00:00
Tom Schuster
0610723e31 Bug 1529337 - Implement CSP 'script-src-elem' and 'script-src-attr' directives. r=freddyb,webidl,smaug,dveditz
Differential Revision: https://phabricator.services.mozilla.com/D150965
2022-08-01 12:32:58 +00:00
Dianna Smith
54494382c7 Backed out 1 changesets (bug 1776205) for causing bug 1780426, a=backout
Backed out changeset 84c72c2fbfd6 (bug 1776205)
2022-07-26 14:34:59 -04:00
Dianna Smith
27fbc1c20a Backed out 1 changesets (bug 1776668) for causing bug 1780426, a=backout
Backed out changeset f3cd67fc1a50 (bug 1776668)
2022-07-26 14:30:18 -04:00
Nicolas B. Pierron
03fbdc6ade Bug 1776668 - ApplyDelazifyStrategy: Skip inline script sooner. r=arai
Differential Revision: https://phabricator.services.mozilla.com/D152091
2022-07-19 10:41:16 +00:00
smolnar
bd8c576702 Backed out 2 changesets (bug 1529337) for awaiting decision on implementing other CSP 3 features
Backed out changeset 12cd014c46e8 (bug 1529337)
Backed out changeset f1489d7cf1a1 (bug 1529337)
2022-07-18 11:09:25 +03:00
Tom Schuster
e8d99d0ef6 Bug 1529337 - Implement CSP 'script-src-elem' and 'script-src-attr' directives. r=freddyb,webidl,smaug
Differential Revision: https://phabricator.services.mozilla.com/D150965
2022-07-13 10:21:48 +00:00
Nicolas B. Pierron
49f29dc411 Bug 1776205 - Set the delazify option in all ScriptLoader code paths. r=arai
This patch move the ShouldApplyDelazificationStartegy as well as the
ApplyDelazificationStrategy under FillCompileOptionsForRequest.

As not all delazification strategies are capable of handling modules yet (Bug
1760334), and do not apply to cached-stencil, we have to add extra filters to
prevent ShouldApplyDelazificationStrategy to access custom delazification mode.

Differential Revision: https://phabricator.services.mozilla.com/D150118
2022-07-08 13:19:30 +00:00
Matthew Gaudet
cc218be0b6 Bug 1747059 - Add ShadowRealm module loader support to ScriptLoader r=yulia
Differential Revision: https://phabricator.services.mozilla.com/D147465
2022-06-28 22:04:18 +00:00
criss
460e05fa2d Backed out changeset a411b158a51e (bug 1776205) for causing ccov failures (bug 1776521) . CLOSED TREE 2022-06-28 11:40:20 +03:00
Csoregi Natalia
a6c7516d80 Backed out 9 changesets (bug 1747059, bug 1767525)for causing hazard failures on ShadowRealmGlobalScope.cpp. CLOSED TREE
Backed out changeset ed7aad37f2cf (bug 1747059)
Backed out changeset 40a257fb4788 (bug 1747059)
Backed out changeset f7b049ef3b8c (bug 1747059)
Backed out changeset aad38abc7139 (bug 1747059)
Backed out changeset 8115813e77a5 (bug 1747059)
Backed out changeset e06192e664fd (bug 1747059)
Backed out changeset a198b0893220 (bug 1767525)
Backed out changeset c083f0824619 (bug 1767525)
Backed out changeset 9a3bf794ec6d (bug 1767525)
2022-06-28 02:39:08 +03:00
Matthew Gaudet
c940e88de9 Bug 1747059 - Add ShadowRealm module loader support to ScriptLoader r=yulia
Differential Revision: https://phabricator.services.mozilla.com/D147465
2022-06-27 21:17:35 +00:00
Nicolas B. Pierron
5194fc0eef Bug 1776205 - Set the delazify option in all ScriptLoader code paths. r=arai
This patch move the ShouldApplyDelazificationStartegy as well as the
ApplyDelazificationStrategy under FillCompileOptionsForRequest.

As not all delazification strategies are capable of handling modules yet (Bug
1760334), and do not apply to cached-stencil, we have to add extra filters to
prevent ShouldApplyDelazificationStrategy to access custom delazification mode.

Differential Revision: https://phabricator.services.mozilla.com/D150118
2022-06-24 12:16:04 +00:00
Nicolas B. Pierron
7d50cd5850 Bug 1774796 - Add largest-first delazification strategy. r=arai
This patch adds a new off-thread delazification strategy, which adds a bit of
overhead to queue function with a priority order, which put the largest function
as the first functions to be delazified.

The intent of this new strategy is to limit the usage of main-thread
delazification to the smallest function, in case where the main-thread would win
the delazification race.

Differential Revision: https://phabricator.services.mozilla.com/D149651
2022-06-20 13:33:49 +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
Yoshi Cheng-Hao Huang
4419c1b898 Bug 1773143 - Call SetAcquiringImportMaps(false) when loading inline modules. r=jonco
Differential Revision: https://phabricator.services.mozilla.com/D149048
2022-06-14 12:53:18 +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
Kagami Sascha Rosylight
3d0e3d5413 Bug 1769290 - Part 10: Apply mozilla-js-handle-rooted-typedef against remaining dom directories r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D148283
2022-06-05 20:55:00 +00:00
Bryan Thrall
23c45ca806 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
9dba8f9cc0 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
c49f9ffda3 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
Bryan Thrall
84ef677639 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-18 21:03:48 +00:00
Bryan Thrall
76e71f6f2c 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-18 21:03:47 +00:00
Sebastian Hengst
825a31e539 Backed out 6 changesets (bug 1757833) for Linux base toolchains build failure
Backed out changeset c8117edaf054 (bug 1757833)
Backed out changeset a46efd9967d0 (bug 1757833)
Backed out changeset f33955b6a7cc (bug 1757833)
Backed out changeset 71f1afa82581 (bug 1757833)
Backed out changeset 868407dccba9 (bug 1757833)
Backed out changeset 79873d83d02b (bug 1757833)
2022-05-17 19:46:50 +02:00
Bryan Thrall
c88e06a519 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-17 16:29:03 +00:00
Bryan Thrall
0fcf6504f4 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-17 16:29:03 +00:00
Nicolas B. Pierron
4d3d87d56e Bug 1756003 part 2 - Compare concurrent and on-demand delazification. r=arai
Adds a delazification mode, which spawn a concurrent depth-first delazification
of all function to fill the stencil cache, to later compare cached results with
stencils produced by on-demand delazification.

The delazification mode also works when being used from a main-thread top-level
compilation, in which case the delazification tasks are created and potentially
blocking the main thread, while the delazification is happening.

This way of doing help comparing on-demand delazification, based on instantiated
stencils with concurrent delazification, based on stencils. Which is a good
mode for fuzzing purposes.

Differential Revision: https://phabricator.services.mozilla.com/D145992
2022-05-17 10:53:04 +00:00
Iulian Moraru
aa0ddc72c9 Backed out 3 changesets (bug 1756003) for causing multiple thread sanitizer failures. CLOSED TREE
Backed out changeset cf1af3ce0798 (bug 1756003)
Backed out changeset 672e8694ef7d (bug 1756003)
Backed out changeset 3b6f96fb26fa (bug 1756003)
2022-05-14 04:00:29 +03:00
Nicolas B. Pierron
8a874a8014 Bug 1756003 part 2 - Compare concurrent and on-demand delazification. r=arai
Adds a delazification mode, which spawn a concurrent depth-first delazification
of all function to fill the stencil cache, to later compare cached results with
stencils produced by on-demand delazification.

The delazification mode also works when being used from a main-thread top-level
compilation, in which case the delazification tasks are created and potentially
blocking the main thread, while the delazification is happening.

This way of doing help comparing on-demand delazification, based on instantiated
stencils with concurrent delazification, based on stencils. Which is a good
mode for fuzzing purposes.

Differential Revision: https://phabricator.services.mozilla.com/D145992
2022-05-13 16:41:29 +00:00
Yoshi Cheng-Hao Huang
35d082390d Bug 1688879 - Part 8: Assert import maps won't be processed in ScriptLoader::EvaluateScriptElement. r=jonco,yulia
Differential Revision: https://phabricator.services.mozilla.com/D142076
2022-05-05 21:19:03 +00:00
Yoshi Cheng-Hao Huang
661d803eea Bug 1688879 - Part 7: External import maps aren't supported. r=jonco,yulia
External import maps aren't supported for now.
https://github.com/WICG/import-maps/issues/235

Differential Revision: https://phabricator.services.mozilla.com/D142075
2022-05-05 21:19:03 +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
Yoshi Cheng-Hao Huang
464384bf31 Bug 1688879 - Part 3: Parse and register an import map. r=jonco,yulia
Implement
https://wicg.github.io/import-maps/#parse-an-import-map-string,
and
https://wicg.github.io/import-maps/#register-an-import-map

Differential Revision: https://phabricator.services.mozilla.com/D142071
2022-05-05 21:19:01 +00:00
Yoshi Cheng-Hao Huang
afeda7dba0 Bug 1688879 - Part 2: Add support for import maps in ScriptElement/ScriptLoader/ScriptKind. r=jonco,yulia,smaug
Differential Revision: https://phabricator.services.mozilla.com/D142070
2022-05-05 21:19:01 +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
1268968c05 Bug 1688879 - Part 8: Assert import maps won't be processed in ScriptLoader::EvaluateScriptElement. r=jonco,yulia
Differential Revision: https://phabricator.services.mozilla.com/D142076
2022-05-05 16:03:18 +00:00
Yoshi Cheng-Hao Huang
e1830d8f12 Bug 1688879 - Part 7: External import maps aren't supported. r=jonco,yulia
External import maps aren't supported for now.
https://github.com/WICG/import-maps/issues/235

Differential Revision: https://phabricator.services.mozilla.com/D142075
2022-05-05 16:03:18 +00: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
Yoshi Cheng-Hao Huang
48be9bcaa2 Bug 1688879 - Part 3: Parse and register an import map. r=jonco,yulia
Implement
https://wicg.github.io/import-maps/#parse-an-import-map-string,
and
https://wicg.github.io/import-maps/#register-an-import-map

Differential Revision: https://phabricator.services.mozilla.com/D142071
2022-05-05 16:03:16 +00:00
Yoshi Cheng-Hao Huang
0cb3316eb7 Bug 1688879 - Part 2: Add support for import maps in ScriptElement/ScriptLoader/ScriptKind. r=jonco,yulia,smaug
Differential Revision: https://phabricator.services.mozilla.com/D142070
2022-05-05 16:03:16 +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
6f76444894 Bug 1688879 - Part 8: Assert import maps won't be processed in ScriptLoader::EvaluateScriptElement. r=jonco,yulia
Differential Revision: https://phabricator.services.mozilla.com/D142076
2022-05-04 21:02:52 +00:00
Yoshi Cheng-Hao Huang
04272902a4 Bug 1688879 - Part 7: External import maps aren't supported. r=jonco,yulia
External import maps aren't supported for now.
https://github.com/WICG/import-maps/issues/235

Differential Revision: https://phabricator.services.mozilla.com/D142075
2022-05-04 21:02:52 +00: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
Yoshi Cheng-Hao Huang
d9207c7020 Bug 1688879 - Part 3: Parse and register an import map. r=jonco,yulia
Implement
https://wicg.github.io/import-maps/#parse-an-import-map-string,
and
https://wicg.github.io/import-maps/#register-an-import-map

Differential Revision: https://phabricator.services.mozilla.com/D142071
2022-05-04 21:02:50 +00:00
Yoshi Cheng-Hao Huang
7b96af0e03 Bug 1688879 - Part 2: Add support for import maps in ScriptElement/ScriptLoader/ScriptKind. r=jonco,yulia,smaug
Differential Revision: https://phabricator.services.mozilla.com/D142070
2022-05-04 21:02:50 +00:00
Jon Coppeard
5d525af423 Bug 1766274 - Part 4: Change references to module trees to module graphs r=yulia
Module imports can be cyclic so it's more correct to refer to them as graphs.
The spec also uses this term.

Depends on D144599

Differential Revision: https://phabricator.services.mozilla.com/D144600
2022-04-26 12:40:48 +00:00
Jon Coppeard
7e3e0ea7fd Bug 1766274 - Part 1: Rename ProcessFetchedModuleSource to OnFetchComplete and pass an error code r=yulia
This renames the method to correspond to StartFetch and adds a status argument
so clients can call this rather than
SetModuleFetchFinishedAndResumeWaitingRequests on error.

Depends on D144595

Differential Revision: https://phabricator.services.mozilla.com/D144596
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
7b6ada3766 Bug 1763586 - Remove Element from LoadScript and child classes; r=jonco
Differential Revision: https://phabricator.services.mozilla.com/D143139
2022-04-21 09:53:34 +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
0190773604 Bug 1763586 - Remove Element from LoadScript and child classes; r=jonco
Differential Revision: https://phabricator.services.mozilla.com/D143139
2022-04-19 12:28:49 +00: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
2b9e84ae6c Bug 1763586 - Remove Element from LoadScript and child classes; r=jonco
Differential Revision: https://phabricator.services.mozilla.com/D143139
2022-04-13 16:29:36 +00: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
Yulia Startsev
ea5e3cbf1d Bug 1763586 - Remove Element from LoadScript and child classes; r=jonco
Differential Revision: https://phabricator.services.mozilla.com/D143139
2022-04-12 16:16:32 +00:00
Yulia Startsev
37530c6fda Bug 1763586 - Adjust ScriptFetchOptions to be more accurate; r=jonco
Differential Revision: https://phabricator.services.mozilla.com/D143137
2022-04-12 16:16:31 +00:00
Jon Coppeard
8907766025 Bug 1761938 - Part 6: Remove global from script load context r=smaug,yulia
This removes the global object field from the script load context and gets the
global from the script loader / module loader where necessary.

Differential Revision: https://phabricator.services.mozilla.com/D142833
2022-04-11 15:35:30 +00:00
Jon Coppeard
3b308851b4 Bug 1761938 - Part 5: Use module loader's global where possible and remove GetGlobalForRequest from script loader interface r=yulia
Differential Revision: https://phabricator.services.mozilla.com/D142832
2022-04-11 15:35:30 +00:00
Jon Coppeard
d4aae71cf3 Bug 1761938 - Part 4: Give module loaders a global object field r=smaug,yulia
This gives the module loader a field for the current global, since a module map
is only associated with a single global.

This adds a method to Document to tell the script loader when its global
changes. I'm not sure of when we do this exactly.

Differential Revision: https://phabricator.services.mozilla.com/D142831
2022-04-11 15:35:29 +00:00
Jon Coppeard
88d0d67d61 Bug 1761938 - Part 2: Give each web extension content script global its own module loader r=smaug,yulia
This gives the DOM module loader a kind and records content script module
loaders in an array on the script loader.

Differential Revision: https://phabricator.services.mozilla.com/D142829
2022-04-11 15:35:28 +00:00
Jon Coppeard
461cd542e9 Bug 1761938 - Part 1: Call into the module loader via the module load request object r=yulia
The script loader will need to deal with requests from more than one module
loader so this adds methods to the request which dispatch to the correct
loader.

Differential Revision: https://phabricator.services.mozilla.com/D142828
2022-04-11 15:35:28 +00:00
Jon Coppeard
9d8474b374 Bug 1759881 - Part 10: Move the generic parts of the StartLoad method to the module loader base r=yulia
StartModuleLoadImpl moves to the base class and uses to new virtual methods
CanStartLoad and StartFetch which are implemented by the derived class.

Differential Revision: https://phabricator.services.mozilla.com/D141736
2022-03-28 15:56:10 +00:00
Jon Coppeard
075e630cb9 Bug 1761432 - Part 4: Rename state accessor methods after the enum values r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D142044
2022-03-25 10:54:17 +00:00
Jon Coppeard
0d945e360c Bug 1761432 - Part 2: Split out script load request state for when we require loading from source r=smaug
This is used when we explicitly don't want to load cached bytecode. It is
better served by a separate flag in the request than a state.

Differential Revision: https://phabricator.services.mozilla.com/D142042
2022-03-25 10:54:16 +00:00
Jon Coppeard
880347ab90 Bug 1761432 - Part 1: Rename ScriptLoadRequest progress enum to 'State' r=smaug
This also renames 'loading' enum values to 'fetching' since this is more
specific. Loading covers the whole process of loading, which includes the other
states.

Enum values have the leading 'e' removed in line with the coding style for enum
classes.

Differential Revision: https://phabricator.services.mozilla.com/D142041
2022-03-25 10:54:16 +00:00
Tooru Fujisawa
887bb8ff86 Bug 1759206 - Part 2: Use ModuleObject instead of script for encoding module bytecode cache. r=nbp
Depends on D141743

Differential Revision: https://phabricator.services.mozilla.com/D141744
2022-03-23 12:51:39 +00:00
Jon Coppeard
54129e0662 Bug 1759881 - Part 5: Remove microtask checkpoints from the module loader in couple of places r=smaug
This removes the microtask checkpoint when instantiating modules and moves the
one when creating a module script to the the script loader.

Differential Revision: https://phabricator.services.mozilla.com/D141252
2022-03-17 15:22:18 +00:00
Jon Coppeard
3570cedee9 Bug 1759881 - Part 3: Don't pass a global to FillCompileOptionsForRequest r=yulia
This can work it out if it needs it by calling GetGlobalForRequest.

Depends on D141249

Differential Revision: https://phabricator.services.mozilla.com/D141250
2022-03-17 15:22:17 +00:00
Jon Coppeard
38f12fcc0d Bug 1759881 - Part 1: Make list of dynamic import requests private r=yulia
This restricts access to mDynamicImportRequests and adds the appropriate accessors.

Differential Revision: https://phabricator.services.mozilla.com/D141248
2022-03-17 15:22:16 +00:00
Tooru Fujisawa
141090b932 Bug 1436400 - Part 10: Support bytecode cache for module script. r=nbp
Differential Revision: https://phabricator.services.mozilla.com/D140297
2022-03-15 19:05:57 +00:00
Tooru Fujisawa
82b9ddf3a3 Bug 1436400 - Part 9: Support restarting module load request. r=jonco
After enabling bytecode cache for module script, we need to handle
the SRI mismatch on bytecode cache, that requires reloading the script source
again.

Differential Revision: https://phabricator.services.mozilla.com/D140551
2022-03-15 19:05:57 +00:00
Tooru Fujisawa
c963262d5c Bug 1436400 - Part 8: Add code path for bytecode encoding module scripts. r=nbp
The module scripts are scanned immediately before executing, and if the
module script is not yet executed, and it matches the requirement for encoding
(size, fetch count, etc), it's marked as encode,
and they're scanned again immediately after executing, and marked scripts are
queued for bytecode encoding.

This patch doesn't actually enable the encoding, given ShouldCacheBytecode
returns false because the caching is not enabled for the channel and
GetCacheTokenFetchCount fails.

Differential Revision: https://phabricator.services.mozilla.com/D140296
2022-03-15 19:05:56 +00:00
Tooru Fujisawa
1f7d1985f5 Bug 1436400 - Part 7: Split ScriptLoader::MaybePrepareForBytecodeEncoding into 2 parts. r=nbp
As a preparation to use the bytecode encoding in the module evaluation code,
ScriptLoader::MaybePrepareForBytecodeEncoding is split into 2 parts:
  * one for performing preparation before executing script
  * one for queuing the request for bytecode encoding after executing script

In module's case, the bytecode encoding handling must be done on the entire
import tree, and also the module object's ScriptSlot is cleared on execution.
So, the script reference must be copied to the corresponding script load request
field before execution, and the script source must be queued for bytecode
encoding after executing the top-level script, so that incremental encoding
reflects functions called there.

Differential Revision: https://phabricator.services.mozilla.com/D140295
2022-03-15 19:05:56 +00:00
Tooru Fujisawa
227d00d1e1 Bug 1436400 - Part 5: Add bytecode MIME type for regular script and module. r=nbp
Differential Revision: https://phabricator.services.mozilla.com/D140293
2022-03-15 19:05:55 +00:00
Tooru Fujisawa
0aaa5686d0 Bug 1436400 - Part 4: Add ScriptLoader::BytecodeMimeTypeFor static method to get bytecode MIME type for given request. r=nbp
Module bytecode should use different MIME type, to avoid mixing up script/module
bytecodes for single JS file.

This patch adds a static method that simply returns the current bytecode MIME
type.
The later patch adds a new MIME type for module bytecode and modify the
ScriptLoader::BytecodeMimeTypeFor method to return corresponding MIME type.

Differential Revision: https://phabricator.services.mozilla.com/D140292
2022-03-15 19:05:55 +00:00
Tooru Fujisawa
ee8432f073 Bug 1436400 - Part 1: Remove Unused parameter from ExecuteCompiledScript. r=jonco
Differential Revision: https://phabricator.services.mozilla.com/D140289
2022-03-15 19:05:54 +00:00
Tooru Fujisawa
45afe7d97e Bug 1757597 - Rename ScriptLoadRequest.mScript to mScriptForBytecodeEncoding. r=jonco
mScript field is used only for bytecode encoding, and this field is used as a
flag for whether the script load request has bytecode-encoding-related
references.

Differential Revision: https://phabricator.services.mozilla.com/D140288
2022-03-15 19:05:53 +00:00
Csoregi Natalia
6ae31a2e64 Backed out 15 changesets (bug 1757597, bug 1436400) for causing mochitest failures on test_bug1656248.html. CLOSED TREE
Backed out changeset 4be29c1eb5bc (bug 1436400)
Backed out changeset ffd9ddcef6b0 (bug 1436400)
Backed out changeset 5ac844508d8b (bug 1436400)
Backed out changeset 561aeb550892 (bug 1436400)
Backed out changeset 6f473bcf809a (bug 1436400)
Backed out changeset c33620854115 (bug 1436400)
Backed out changeset 8f894ea40eb2 (bug 1436400)
Backed out changeset cce080064d82 (bug 1436400)
Backed out changeset 001d8528ff96 (bug 1436400)
Backed out changeset dd2bb1b46f75 (bug 1436400)
Backed out changeset b1c2084042fa (bug 1436400)
Backed out changeset dd0fea93bcd7 (bug 1436400)
Backed out changeset e38a959648e1 (bug 1436400)
Backed out changeset 40b474d430e9 (bug 1436400)
Backed out changeset 5bef21ef1ba2 (bug 1757597)
2022-03-15 07:23:29 +02:00
Tooru Fujisawa
d09fb8acd5 Bug 1436400 - Part 10: Support bytecode cache for module script. r=nbp
Differential Revision: https://phabricator.services.mozilla.com/D140297
2022-03-15 04:24:52 +00:00
Tooru Fujisawa
4d4aa8001e Bug 1436400 - Part 9: Support restarting module load request. r=jonco
After enabling bytecode cache for module script, we need to handle
the SRI mismatch on bytecode cache, that requires reloading the script source
again.

Differential Revision: https://phabricator.services.mozilla.com/D140551
2022-03-15 04:24:52 +00:00
Tooru Fujisawa
bd3852013b Bug 1436400 - Part 8: Add code path for bytecode encoding module scripts. r=nbp
The module scripts are scanned immediately before executing, and if the
module script is not yet executed, and it matches the requirement for encoding
(size, fetch count, etc), it's marked as encode,
and they're scanned again immediately after executing, and marked scripts are
queued for bytecode encoding.

This patch doesn't actually enable the encoding, given ShouldCacheBytecode
returns false because the caching is not enabled for the channel and
GetCacheTokenFetchCount fails.

Differential Revision: https://phabricator.services.mozilla.com/D140296
2022-03-15 04:24:51 +00:00
Tooru Fujisawa
5c2b6e6337 Bug 1436400 - Part 7: Split ScriptLoader::MaybePrepareForBytecodeEncoding into 2 parts. r=nbp
As a preparation to use the bytecode encoding in the module evaluation code,
ScriptLoader::MaybePrepareForBytecodeEncoding is split into 2 parts:
  * one for performing preparation before executing script
  * one for queuing the request for bytecode encoding after executing script

In module's case, the bytecode encoding handling must be done on the entire
import tree, and also the module object's ScriptSlot is cleared on execution.
So, the script reference must be copied to the corresponding script load request
field before execution, and the script source must be queued for bytecode
encoding after executing the top-level script, so that incremental encoding
reflects functions called there.

Differential Revision: https://phabricator.services.mozilla.com/D140295
2022-03-15 04:24:51 +00:00
Tooru Fujisawa
6aec9a0a75 Bug 1436400 - Part 5: Add bytecode MIME type for regular script and module. r=nbp
Differential Revision: https://phabricator.services.mozilla.com/D140293
2022-03-15 04:24:50 +00:00
Tooru Fujisawa
ea5bbd2533 Bug 1436400 - Part 4: Add ScriptLoader::BytecodeMimeTypeFor static method to get bytecode MIME type for given request. r=nbp
Module bytecode should use different MIME type, to avoid mixing up script/module
bytecodes for single JS file.

This patch adds a static method that simply returns the current bytecode MIME
type.
The later patch adds a new MIME type for module bytecode and modify the
ScriptLoader::BytecodeMimeTypeFor method to return corresponding MIME type.

Differential Revision: https://phabricator.services.mozilla.com/D140292
2022-03-15 04:24:50 +00:00
Tooru Fujisawa
d02a32e588 Bug 1436400 - Part 1: Remove Unused parameter from ExecuteCompiledScript. r=jonco
Differential Revision: https://phabricator.services.mozilla.com/D140289
2022-03-15 04:24:49 +00:00
Tooru Fujisawa
bc93412a17 Bug 1757597 - Rename ScriptLoadRequest.mScript to mScriptForBytecodeEncoding. r=jonco
mScript field is used only for bytecode encoding, and this field is used as a
flag for whether the script load request has bytecode-encoding-related
references.

Differential Revision: https://phabricator.services.mozilla.com/D140288
2022-03-15 04:24:48 +00:00
Nicolas B. Pierron
c21376a6c8 Bug 1753709 - Add test case to verify delazification strategy is used. r=arai
Differential Revision: https://phabricator.services.mozilla.com/D138541
2022-03-01 15:00:04 +00:00
Nicolas B. Pierron
95eb456ef7 Bug 1753709 - JavaScript: Add a preference to switch between delazification strategies. r=arai
This patch changes the way we parse JavaScript coming from Necko while loading
web pages, by adding an about:config flag named
javascript.options.delazification.strategy which is used to select between:

 0 - On Demand
 1 - Concurrent Depth First
 255 - Parse Everything Eagerly

Previously, we moved from On-demand delazification, to parsing everything
eagerly to improve responsiveness of the browser, but we knew that more room for
optimization exists.

This toogle is meant to explore the space of delazification strategies, such
that we can parse functions of JavaScript files on an helper thread, while the
JavaScript file is being executed on the main thread. The space of
delazification strategies goes from ordering the order in which functions are
processed, as well as filtering functions which are processed. Not all functions
have to be delazified, and if the main thread needs a function which is not
parsed yet, it will fallback to parsing it on-demand.

Differential Revision: https://phabricator.services.mozilla.com/D138034
2022-03-01 15:00:03 +00:00
Cristian Tuns
c82feaecab Backed out 3 changesets (bug 1753709) for causing mochitest failures on test_delazification_strategy.html CLOSED TREE
Backed out changeset b908fc38d2d3 (bug 1753709)
Backed out changeset 56a169a692b9 (bug 1753709)
Backed out changeset 224f4cf66993 (bug 1753709)
2022-02-22 11:44:40 -05:00
Nicolas B. Pierron
fc8f1af2cf Bug 1753709 - Add test case to verify delazification strategy is used. r=arai
Differential Revision: https://phabricator.services.mozilla.com/D138541
2022-02-22 14:59:18 +00:00
Nicolas B. Pierron
01430ae030 Bug 1753709 - JavaScript: Add a preference to switch between delazification strategies. r=arai
This patch changes the way we parse JavaScript coming from Necko while loading
web pages, by adding an about:config flag named
javascript.options.delazification.strategy which is used to select between:

 0 - On Demand
 1 - Concurrent Depth First
 255 - Parse Everything Eagerly

Previously, we moved from On-demand delazification, to parsing everything
eagerly to improve responsiveness of the browser, but we knew that more room for
optimization exists.

This toogle is meant to explore the space of delazification strategies, such
that we can parse functions of JavaScript files on an helper thread, while the
JavaScript file is being executed on the main thread. The space of
delazification strategies goes from ordering the order in which functions are
processed, as well as filtering functions which are processed. Not all functions
have to be delazified, and if the main thread needs a function which is not
parsed yet, it will fallback to parsing it on-demand.

Differential Revision: https://phabricator.services.mozilla.com/D138034
2022-02-22 14:59:17 +00:00
Marian-Vasile Laza
3f7e0b2d4f Backed out 3 changesets (bug 1753709) for causing build bustages on ScriptLoader.cpp. CLOSED TREE
Backed out changeset eb7704e8a30c (bug 1753709)
Backed out changeset 193409767cf2 (bug 1753709)
Backed out changeset 891174ee20ee (bug 1753709)
2022-02-21 09:45:40 -08:00
Nicolas B. Pierron
a5888fac59 Bug 1753709 - Add test case to verify delazification strategy is used. r=arai
Differential Revision: https://phabricator.services.mozilla.com/D138541
2022-02-21 17:26:03 +00:00
Nicolas B. Pierron
e6b364b472 Bug 1753709 - JavaScript: Add a preference to switch between delazification strategies. r=arai
This patch changes the way we parse JavaScript coming from Necko while loading
web pages, by adding an about:config flag named
javascript.options.delazification.strategy which is used to select between:

 0 - On Demand
 1 - Concurrent Depth First
 255 - Parse Everything Eagerly

Previously, we moved from On-demand delazification, to parsing everything
eagerly to improve responsiveness of the browser, but we knew that more room for
optimization exists.

This toogle is meant to explore the space of delazification strategies, such
that we can parse functions of JavaScript files on an helper thread, while the
JavaScript file is being executed on the main thread. The space of
delazification strategies goes from ordering the order in which functions are
processed, as well as filtering functions which are processed. Not all functions
have to be delazified, and if the main thread needs a function which is not
parsed yet, it will fallback to parsing it on-demand.

Differential Revision: https://phabricator.services.mozilla.com/D138034
2022-02-21 17:26:03 +00:00
Yulia Startsev
79409316d1 Bug 1742437 - re-scope all generic module/script loader files under js/loader; r=jonco
Differential Revision: https://phabricator.services.mozilla.com/D138133
2022-02-21 15:39:09 +00:00
Yulia Startsev
7ee758a2f5 Bug 1742437 - move DOM script context into own file and rename it; r=jonco
Differential Revision: https://phabricator.services.mozilla.com/D138132
2022-02-21 15:39:08 +00:00
Yulia Startsev
65b14f6546 Bug 1742437 - move DOM module loader into own file; r=jonco
Differential Revision: https://phabricator.services.mozilla.com/D137531
2022-02-21 15:39:08 +00:00
Yulia Startsev
720155230b Bug 1742437 - Create DOM specific Module Loader; r=jonco
Differential Revision: https://phabricator.services.mozilla.com/D137298
2022-02-21 15:39:07 +00:00
Yulia Startsev
43fff76dda Bug 1742437 - move FireScript.* methods from DOMScriptLoadContext to ScriptLoader;r=jonco,smaug
Differential Revision: https://phabricator.services.mozilla.com/D137441
2022-02-21 15:39:07 +00:00
Yulia Startsev
02bed72c31 Bug 1742437 - clean up DOMScriptLoadRequest creation; r=jonco,smaug
Differential Revision: https://phabricator.services.mozilla.com/D136746
2022-02-21 15:39:06 +00:00
Yulia Startsev
baceff6905 Bug 1742437 - move mLineNo from ScriptLoadRequest to DOMScriptLoadContext; r=jonco,smaug
Differential Revision: https://phabricator.services.mozilla.com/D136745
2022-02-21 15:39:06 +00:00
Yulia Startsev
3bf222c5c4 Bug 1742437 - move mWebExtGlobal from ScriptLoadRequest to DOMScriptLoadContext; r=jonco,smaug
Differential Revision: https://phabricator.services.mozilla.com/D136744
2022-02-21 15:39:06 +00:00
Yulia Startsev
03e65d88dc Bug 1742437 - move mIsPreload from ScriptFetchOptions to DOMScriptLoadContext, and introduce GetRootModule; r=jonco,smaug
Differential Revision: https://phabricator.services.mozilla.com/D136743
2022-02-21 15:39:05 +00:00
Yulia Startsev
f1640d290a Bug 1742437 - move mElement from ScriptFetchOptions to DOMScriptLoadContext; r=jonco,smaug
Differential Revision: https://phabricator.services.mozilla.com/D136742
2022-02-21 15:39:05 +00:00
Yulia Startsev
7ded97bc1a Bug 1742437 - Split ScriptLoadRequest into ScriptLoadRequest and DOMScriptLoadContext; r=jonco,smaug
Differential Revision: https://phabricator.services.mozilla.com/D134041
2022-02-21 15:39:04 +00:00
Norisz Fay
4c85ac47c5 Backed out 12 changesets (bug 1742437) for causing Bp-hybrid bustages on ModuleLoader.obj
Backed out changeset 7d5683180ac3 (bug 1742437)
Backed out changeset a48aff5f2555 (bug 1742437)
Backed out changeset 7e54a223001d (bug 1742437)
Backed out changeset 3a34d557d474 (bug 1742437)
Backed out changeset f29451ea18dc (bug 1742437)
Backed out changeset c0bd1d29be62 (bug 1742437)
Backed out changeset 8b970fb6e4e6 (bug 1742437)
Backed out changeset 729c48e34d6b (bug 1742437)
Backed out changeset 9355004c7f6a (bug 1742437)
Backed out changeset 0a5f61274aed (bug 1742437)
Backed out changeset a50f60a612d3 (bug 1742437)
Backed out changeset 0ac6d9d26e2b (bug 1742437)
2022-02-18 00:00:41 +02:00
Yulia Startsev
499559431e Bug 1742437 - re-scope all generic module/script loader files under js/loader; r=jonco
Differential Revision: https://phabricator.services.mozilla.com/D138133
2022-02-17 15:57:52 +00:00
Yulia Startsev
6b6405ccec Bug 1742437 - move DOM script context into own file and rename it; r=jonco
Differential Revision: https://phabricator.services.mozilla.com/D138132
2022-02-17 15:57:51 +00:00
Yulia Startsev
7393cf9895 Bug 1742437 - move DOM module loader into own file; r=jonco
Differential Revision: https://phabricator.services.mozilla.com/D137531
2022-02-17 15:57:51 +00:00
Yulia Startsev
9d88a43372 Bug 1742437 - Create DOM specific Module Loader; r=jonco
Differential Revision: https://phabricator.services.mozilla.com/D137298
2022-02-17 15:57:50 +00:00
Yulia Startsev
268109ff63 Bug 1742437 - move FireScript.* methods from DOMScriptLoadContext to ScriptLoader;r=jonco,smaug
Differential Revision: https://phabricator.services.mozilla.com/D137441
2022-02-17 15:57:50 +00:00
Yulia Startsev
be5ee22d2a Bug 1742437 - clean up DOMScriptLoadRequest creation; r=jonco,smaug
Differential Revision: https://phabricator.services.mozilla.com/D136746
2022-02-17 15:57:50 +00:00
Yulia Startsev
0ff9a66992 Bug 1742437 - move mLineNo from ScriptLoadRequest to DOMScriptLoadContext; r=jonco,smaug
Differential Revision: https://phabricator.services.mozilla.com/D136745
2022-02-17 15:57:49 +00:00
Yulia Startsev
7d30713e74 Bug 1742437 - move mWebExtGlobal from ScriptLoadRequest to DOMScriptLoadContext; r=jonco,smaug
Differential Revision: https://phabricator.services.mozilla.com/D136744
2022-02-17 15:57:49 +00:00
Yulia Startsev
c413fa305d Bug 1742437 - move mIsPreload from ScriptFetchOptions to DOMScriptLoadContext, and introduce GetRootModule; r=jonco,smaug
Differential Revision: https://phabricator.services.mozilla.com/D136743
2022-02-17 15:57:48 +00:00
Yulia Startsev
09f0828968 Bug 1742437 - move mElement from ScriptFetchOptions to DOMScriptLoadContext; r=jonco,smaug
Differential Revision: https://phabricator.services.mozilla.com/D136742
2022-02-17 15:57:48 +00:00
Yulia Startsev
f212e8a1c1 Bug 1742437 - Split ScriptLoadRequest into ScriptLoadRequest and DOMScriptLoadContext; r=jonco,smaug
Differential Revision: https://phabricator.services.mozilla.com/D134041
2022-02-17 15:57:48 +00:00
Marian-Vasile Laza
28f5fc0dc0 Backed out 3 changesets (bug 1753709) for causing build bustages on ScriptLoader.cpp. CLOSED TREE
Backed out changeset 8d2f548f2b46 (bug 1753709)
Backed out changeset 9d41db9f2e17 (bug 1753709)
Backed out changeset 13dbf5b806ec (bug 1753709)
2022-02-16 18:51:37 +02:00
Nicolas B. Pierron
3671196620 Bug 1753709 - Add test case to verify delazification strategy is used. r=arai
Differential Revision: https://phabricator.services.mozilla.com/D138541
2022-02-16 11:01:33 +00:00
Nicolas B. Pierron
85b56fc607 Bug 1753709 - JavaScript: Add a preference to switch between delazification strategies. r=arai
This patch changes the way we parse JavaScript coming from Necko while loading
web pages, by adding an about:config flag named
javascript.options.delazification.strategy which is used to select between:

 0 - On Demand
 1 - Concurrent Depth First
 255 - Parse Everything Eagerly

Previously, we moved from On-demand delazification, to parsing everything
eagerly to improve responsiveness of the browser, but we knew that more room for
optimization exists.

This toogle is meant to explore the space of delazification strategies, such
that we can parse functions of JavaScript files on an helper thread, while the
JavaScript file is being executed on the main thread. The space of
delazification strategies goes from ordering the order in which functions are
processed, as well as filtering functions which are processed. Not all functions
have to be delazified, and if the main thread needs a function which is not
parsed yet, it will fallback to parsing it on-demand.

Differential Revision: https://phabricator.services.mozilla.com/D138034
2022-02-16 11:01:33 +00:00
Kagami Sascha Rosylight
d5c873e8f4 Bug 1539884 - Part 17: Mark nsIScriptLoaderObserver::scriptEvaluated as can_run_script r=masayuki
Depends on D134107

Differential Revision: https://phabricator.services.mozilla.com/D134108
2021-12-17 13:27:52 +00:00
Yulia Startsev
8e87e45a45 Bug 1745626 - Dynamic import should always try to unblock onload event in DOM context; r=jonco
Differential Revision: https://phabricator.services.mozilla.com/D133629
2021-12-14 10:53:58 +00:00
Tooru Fujisawa
fbb9c44cf3 Bug 1734098 - Part 11: Add JS::DecodeStencilOffThread. r=tcampbell
Also make JS::CanDecodeOffThread to receive JS::DecodeOptions.

Differential Revision: https://phabricator.services.mozilla.com/D133052
2021-12-10 04:28:29 +00:00
Tooru Fujisawa
c98888fc04 Bug 1734098 - Part 7: Add JS::CompileModuleToStencilOffThread. r=tcampbell
Differential Revision: https://phabricator.services.mozilla.com/D133048
2021-12-10 04:28:28 +00:00
Tooru Fujisawa
86c24b48de Bug 1734098 - Part 3: Use JS::CompileToStencilOffThread instead of JS::CompileOffThread in ScriptLoader. r=nbp
Differential Revision: https://phabricator.services.mozilla.com/D133044
2021-12-10 04:28:26 +00:00
Iulian Moraru
777ce42897 Backed out 17 changesets (bug 1744178, bug 1734098) for causing leaks. CLOSED TREE
Backed out changeset 08070838c7d2 (bug 1734098)
Backed out changeset cfdf7ed9a5a2 (bug 1734098)
Backed out changeset 02d7ca7fc45c (bug 1734098)
Backed out changeset 7b7c59fc644b (bug 1734098)
Backed out changeset 630055366dac (bug 1734098)
Backed out changeset da83b4571cf2 (bug 1734098)
Backed out changeset 323af9d3e0e1 (bug 1734098)
Backed out changeset cf458ad5345a (bug 1734098)
Backed out changeset a85846f79eb5 (bug 1734098)
Backed out changeset 0d07931e6bc8 (bug 1734098)
Backed out changeset ffd72fa3fc59 (bug 1734098)
Backed out changeset 3174f1ecfd03 (bug 1734098)
Backed out changeset cfb19671fd4e (bug 1734098)
Backed out changeset c3b9c8221059 (bug 1734098)
Backed out changeset 532328aedaaa (bug 1734098)
Backed out changeset 48aa5ca15135 (bug 1734098)
Backed out changeset 6ca5bceb693c (bug 1744178)
2021-12-09 23:36:34 +02:00
Tooru Fujisawa
7238b56ae6 Bug 1734098 - Part 11: Add JS::DecodeStencilOffThread. r=tcampbell
Also make JS::CanDecodeOffThread to receive JS::DecodeOptions.

Differential Revision: https://phabricator.services.mozilla.com/D133052
2021-12-09 18:21:13 +00:00
Tooru Fujisawa
3eadfe0416 Bug 1734098 - Part 7: Add JS::CompileModuleToStencilOffThread. r=tcampbell
Differential Revision: https://phabricator.services.mozilla.com/D133048
2021-12-09 18:21:12 +00:00
Tooru Fujisawa
2fdc0ae73e Bug 1734098 - Part 3: Use JS::CompileToStencilOffThread instead of JS::CompileOffThread in ScriptLoader. r=nbp
Differential Revision: https://phabricator.services.mozilla.com/D133044
2021-12-09 18:21:10 +00:00
Yulia Startsev
598c3cb599 Bug 1311726 - Split ScriptLoader into ScriptLoader and ModuleLoader; r=jonco
Differential Revision: https://phabricator.services.mozilla.com/D132683
2021-12-09 13:26:21 +00:00
Yulia Startsev
05b2c1af0b Bug 1311726 - Create ScriptLoaderInterface; r=jonco
Differential Revision: https://phabricator.services.mozilla.com/D132614
2021-12-09 13:26:20 +00:00
Yulia Startsev
8b86490809 Bug 1311726 - Move GetProfilerLabelForRequest to ScriptLoadRequest; r=jonco
Differential Revision: https://phabricator.services.mozilla.com/D132951
2021-12-09 13:26:20 +00:00
Yulia Startsev
a578ef834d Bug 1311726 - Move getScriptSource to ScriptLoadRequest; r=jonco
Differential Revision: https://phabricator.services.mozilla.com/D132950
2021-12-09 13:26:19 +00:00
Yulia Startsev
2746eb0099 Bug 1311726 - Move Module Evaluation into ModuleLoader; r=jonco
Module evaluation is independent of it's context. We just need the globalObject to set up the
execution environment.

Differential Revision: https://phabricator.services.mozilla.com/D132678
2021-12-09 13:26:19 +00:00
Yulia Startsev
6074bbfaf3 Bug 1311726 - Move module hook instantiation to ModuleLoader constructor; r=jonco
Differential Revision: https://phabricator.services.mozilla.com/D132677
2021-12-09 13:26:19 +00:00
Yulia Startsev
5b69203cf1 Bug 1311726 - ModuleLoadRequest loader is a ModuleLoader; r=jonco
Differential Revision: https://phabricator.services.mozilla.com/D132825
2021-12-09 13:26:18 +00:00
Yulia Startsev
93e166bd7d Bug 1311726 - Move Dynamic Import Methods to ModuleLoader; r=jonco
Differential Revision: https://phabricator.services.mozilla.com/D132613
2021-12-09 13:26:18 +00:00
Yulia Startsev
b7b6684dd0 Bug 1311726 - Move CheckModuleDependeciesLoaded to ModuleLoadRequest; r=jonco
Differential Revision: https://phabricator.services.mozilla.com/D132612
2021-12-09 13:26:17 +00:00
Yulia Startsev
453d007f20 Bug 1311726 - Move methods related to resolution and error handling to ModuleLoader;r=jonco
Differential Revision: https://phabricator.services.mozilla.com/D132611
2021-12-09 13:26:17 +00:00
Yulia Startsev
b015eed4e9 Bug 1311726 - Move methods related to instantiating the module tree to ModuleLoader;r=jonco
Differential Revision: https://phabricator.services.mozilla.com/D132610
2021-12-09 13:26:17 +00:00
Yulia Startsev
df9a671ebb Bug 1311726 - Create ModuleLoader Class; r=jonco
Differential Revision: https://phabricator.services.mozilla.com/D132609
2021-12-09 13:26:16 +00:00
Yulia Startsev
dab56eff57 Bug 1311726 - Pass JSContext instead of JSAPI to FillCompileOptionsForRequest; r=jonco
Differential Revision: https://phabricator.services.mozilla.com/D132608
2021-12-09 13:26:16 +00:00
Yulia Startsev
c4e62d3282 Bug 1311726 - Split EvaluateScript into EvaluateScript and EvaluateModule; r=jonco
Differential Revision: https://phabricator.services.mozilla.com/D132607
2021-12-09 13:26:16 +00:00
Yulia Startsev
55c10abdff Bug 1311726 - Remove second initialization of currentScript in EvaluateScript; r=jonco
first initialization is on line 3140 and covers the module case.

Differential Revision: https://phabricator.services.mozilla.com/D132606
2021-12-09 13:26:15 +00:00
Yulia Startsev
645b855eb8 Bug 1311726 - Split StartLoad into StartClassicLoad, StartModuleLoad, StartLoadInternal; r=jonco
The goal of splitting classic script loading from module script loading was to keep a minimum
selection of methods for other script loaders to implement. In addition, the security
flags were distinct for the two cases, and had no overlap.

Caching behavior was left as shared, as it is likely modules will have this soon.

Differential Revision: https://phabricator.services.mozilla.com/D132605
2021-12-09 13:26:15 +00:00
Yulia Startsev
a5414cfdca Bug 1311726 - Switch MarkerInnerWindowIdFromDocShell to MarkerInnerWindowIdFromJSContext; r=canaltinova
The Scriptloader will be shared by multiple modules, not all of them have ready access to the
 docshell (MozJSComponentLoader currently uses the JSContext for this purpose. Workers and worklets
 are not tracking performance yet). Our profiling code relies on the docShell present in the script loader. This changes the
 current profiling code to use the JSContext instead.

Differential Revision: https://phabricator.services.mozilla.com/D132604
2021-12-09 13:26:14 +00:00
Yulia Startsev
7ca951440d Bug 1311726 - Only set "ProcessingScript" tag when executing; r=jonco
Previously, we were setting the ProcessingScriptTag for Module compilation as well as script
execution. This patch creates a helper function (GetGlobalWithContext) and removes a superfluous
setting of the "ProcessingScriptTag".

ProcessingScriptTag should be set when a script is executing, as it helps correct our behavior
around history replacement during JS execution: https://searchfox.org/mozilla-central/rev/e9cd2997be1071b9bb76fc14df0f01a2bd721c30/dom/base/LocationBase.cpp#223-231

Differential Revision: https://phabricator.services.mozilla.com/D132603
2021-12-09 13:26:14 +00:00
Butkovits Atila
98978d8670 Backed out 18 changesets (bug 1311726) for causing Hazard failures at ScriptLoader.cpp:. CLOSED TREE
Backed out changeset 0e1179305bc2 (bug 1311726)
Backed out changeset fd3a9e4f5e5e (bug 1311726)
Backed out changeset d6f6a7d13dc2 (bug 1311726)
Backed out changeset 7b266f1fbbff (bug 1311726)
Backed out changeset 9ecb9ac4f2f7 (bug 1311726)
Backed out changeset 2deb35690efb (bug 1311726)
Backed out changeset a151ddb7068d (bug 1311726)
Backed out changeset 79aac20615b8 (bug 1311726)
Backed out changeset 258188246118 (bug 1311726)
Backed out changeset 0ef6c06dac5b (bug 1311726)
Backed out changeset 340bd3d73849 (bug 1311726)
Backed out changeset d130a9772d31 (bug 1311726)
Backed out changeset 15df1b7e0208 (bug 1311726)
Backed out changeset ebc87f932050 (bug 1311726)
Backed out changeset 68ab853d072d (bug 1311726)
Backed out changeset eac12c9d76b7 (bug 1311726)
Backed out changeset beb9e9b17522 (bug 1311726)
Backed out changeset bfea110e6afe (bug 1311726)
2021-12-09 02:23:18 +02:00
Yulia Startsev
29f1022620 Bug 1311726 - Split ScriptLoader into ScriptLoader and ModuleLoader; r=jonco
Differential Revision: https://phabricator.services.mozilla.com/D132683
2021-12-08 16:57:23 +00:00
Yulia Startsev
abc7789e21 Bug 1311726 - Create ScriptLoaderInterface; r=jonco
Differential Revision: https://phabricator.services.mozilla.com/D132614
2021-12-08 16:57:22 +00:00
Yulia Startsev
2a9a7fae3b Bug 1311726 - Move GetProfilerLabelForRequest to ScriptLoadRequest; r=jonco
Differential Revision: https://phabricator.services.mozilla.com/D132951
2021-12-08 16:57:21 +00:00
Yulia Startsev
41bcae4c62 Bug 1311726 - Move getScriptSource to ScriptLoadRequest; r=jonco
Differential Revision: https://phabricator.services.mozilla.com/D132950
2021-12-08 16:57:21 +00:00
Yulia Startsev
01a27f4163 Bug 1311726 - Move Module Evaluation into ModuleLoader; r=jonco
Module evaluation is independent of it's context. We just need the globalObject to set up the
execution environment.

Differential Revision: https://phabricator.services.mozilla.com/D132678
2021-12-08 16:57:21 +00:00
Yulia Startsev
4437eb66e3 Bug 1311726 - Move module hook instantiation to ModuleLoader constructor; r=jonco
Differential Revision: https://phabricator.services.mozilla.com/D132677
2021-12-08 16:57:20 +00:00
Yulia Startsev
b99ae84f56 Bug 1311726 - ModuleLoadRequest loader is a ModuleLoader; r=jonco
Differential Revision: https://phabricator.services.mozilla.com/D132825
2021-12-08 16:57:20 +00:00
Yulia Startsev
5636bc7506 Bug 1311726 - Move Dynamic Import Methods to ModuleLoader; r=jonco
Differential Revision: https://phabricator.services.mozilla.com/D132613
2021-12-08 16:57:19 +00:00
Yulia Startsev
a36b884c58 Bug 1311726 - Move CheckModuleDependeciesLoaded to ModuleLoadRequest; r=jonco
Differential Revision: https://phabricator.services.mozilla.com/D132612
2021-12-08 16:57:19 +00:00
Yulia Startsev
35e623cf0c Bug 1311726 - Move methods related to resolution and error handling to ModuleLoader;r=jonco
Differential Revision: https://phabricator.services.mozilla.com/D132611
2021-12-08 16:57:19 +00:00
Yulia Startsev
ea65368a13 Bug 1311726 - Move methods related to instantiating the module tree to ModuleLoader;r=jonco
Differential Revision: https://phabricator.services.mozilla.com/D132610
2021-12-08 16:57:18 +00:00
Yulia Startsev
43278ebc5a Bug 1311726 - Create ModuleLoader Class; r=jonco
Differential Revision: https://phabricator.services.mozilla.com/D132609
2021-12-08 16:57:18 +00:00
Yulia Startsev
ccde25e131 Bug 1311726 - Pass JSContext instead of JSAPI to FillCompileOptionsForRequest; r=jonco
Differential Revision: https://phabricator.services.mozilla.com/D132608
2021-12-08 16:57:17 +00:00
Yulia Startsev
a18e270dd9 Bug 1311726 - Split EvaluateScript into EvaluateScript and EvaluateModule; r=jonco
Differential Revision: https://phabricator.services.mozilla.com/D132607
2021-12-08 16:57:17 +00:00
Yulia Startsev
3d669259a1 Bug 1311726 - Remove second initialization of currentScript in EvaluateScript; r=jonco
first initialization is on line 3140 and covers the module case.

Differential Revision: https://phabricator.services.mozilla.com/D132606
2021-12-08 16:57:17 +00:00
Yulia Startsev
b31e96faf2 Bug 1311726 - Split StartLoad into StartClassicLoad, StartModuleLoad, StartLoadInternal; r=jonco
The goal of splitting classic script loading from module script loading was to keep a minimum
selection of methods for other script loaders to implement. In addition, the security
flags were distinct for the two cases, and had no overlap.

Caching behavior was left as shared, as it is likely modules will have this soon.

Differential Revision: https://phabricator.services.mozilla.com/D132605
2021-12-08 16:57:16 +00:00
Yulia Startsev
30323cd365 Bug 1311726 - Switch MarkerInnerWindowIdFromDocShell to MarkerInnerWindowIdFromJSContext; r=canaltinova
The Scriptloader will be shared by multiple modules, not all of them have ready access to the
 docshell (MozJSComponentLoader currently uses the JSContext for this purpose. Workers and worklets
 are not tracking performance yet). Our profiling code relies on the docShell present in the script loader. This changes the
 current profiling code to use the JSContext instead.

Differential Revision: https://phabricator.services.mozilla.com/D132604
2021-12-08 16:57:16 +00:00
Yulia Startsev
f291451846 Bug 1311726 - Only set "ProcessingScript" tag when executing; r=jonco
Previously, we were setting the ProcessingScriptTag for Module compilation as well as script
execution. This patch creates a helper function (GetGlobalWithContext) and removes a superfluous
setting of the "ProcessingScriptTag".

ProcessingScriptTag should be set when a script is executing, as it helps correct our behavior
around history replacement during JS execution: https://searchfox.org/mozilla-central/rev/e9cd2997be1071b9bb76fc14df0f01a2bd721c30/dom/base/LocationBase.cpp#223-231

Differential Revision: https://phabricator.services.mozilla.com/D132603
2021-12-08 16:57:15 +00:00
Narcis Beleuzu
ff5735371d Backed out 18 changesets (bug 1311726) for failures on test_script_loader_js_cache.html . CLOSED TREE
Backed out changeset 1f9c13be6642 (bug 1311726)
Backed out changeset 2f4e89d930b0 (bug 1311726)
Backed out changeset 03f767c08221 (bug 1311726)
Backed out changeset b21e580a778f (bug 1311726)
Backed out changeset 4597b327e9be (bug 1311726)
Backed out changeset 558fec312301 (bug 1311726)
Backed out changeset b758abeed4cc (bug 1311726)
Backed out changeset a909be9fa973 (bug 1311726)
Backed out changeset 8db98e65b147 (bug 1311726)
Backed out changeset ee2e01e59950 (bug 1311726)
Backed out changeset 40c635fb36eb (bug 1311726)
Backed out changeset 6ba119a4e33e (bug 1311726)
Backed out changeset 1ad7d1308b5f (bug 1311726)
Backed out changeset dd2dbe11315d (bug 1311726)
Backed out changeset a8279e757309 (bug 1311726)
Backed out changeset 1de8b528723e (bug 1311726)
Backed out changeset f1e4c9199289 (bug 1311726)
Backed out changeset 23ea474c05ec (bug 1311726)
2021-12-08 12:46:07 +02:00
Yulia Startsev
e33460fcd0 Bug 1311726 - Split ScriptLoader into ScriptLoader and ModuleLoader; r=jonco
Differential Revision: https://phabricator.services.mozilla.com/D132683
2021-12-08 09:44:14 +00:00
Yulia Startsev
b37eb59838 Bug 1311726 - Create ScriptLoaderInterface; r=jonco
Differential Revision: https://phabricator.services.mozilla.com/D132614
2021-12-08 09:44:13 +00:00
Yulia Startsev
e0f5c1b284 Bug 1311726 - Move GetProfilerLabelForRequest to ScriptLoadRequest; r=jonco
Differential Revision: https://phabricator.services.mozilla.com/D132951
2021-12-08 09:44:13 +00:00
Yulia Startsev
4a879a389d Bug 1311726 - Move getScriptSource to ScriptLoadRequest; r=jonco
Differential Revision: https://phabricator.services.mozilla.com/D132950
2021-12-08 09:44:12 +00:00
Yulia Startsev
0cfaecf34e Bug 1311726 - Move Module Evaluation into ModuleLoader; r=jonco
Module evaluation is independent of it's context. We just need the globalObject to set up the
execution environment.

Differential Revision: https://phabricator.services.mozilla.com/D132678
2021-12-08 09:44:12 +00:00
Yulia Startsev
6be15af67a Bug 1311726 - Move module hook instantiation to ModuleLoader constructor; r=jonco
Differential Revision: https://phabricator.services.mozilla.com/D132677
2021-12-08 09:44:12 +00:00
Yulia Startsev
ee7e04d0e4 Bug 1311726 - ModuleLoadRequest loader is a ModuleLoader; r=jonco
Differential Revision: https://phabricator.services.mozilla.com/D132825
2021-12-08 09:44:11 +00:00
Yulia Startsev
b72431af17 Bug 1311726 - Move Dynamic Import Methods to ModuleLoader; r=jonco
Differential Revision: https://phabricator.services.mozilla.com/D132613
2021-12-08 09:44:11 +00:00
Yulia Startsev
4390c6bbe9 Bug 1311726 - Move CheckModuleDependeciesLoaded to ModuleLoadRequest; r=jonco
Differential Revision: https://phabricator.services.mozilla.com/D132612
2021-12-08 09:44:11 +00:00
Yulia Startsev
5359ecaee6 Bug 1311726 - Move methods related to resolution and error handling to ModuleLoader;r=jonco
Differential Revision: https://phabricator.services.mozilla.com/D132611
2021-12-08 09:44:10 +00:00
Yulia Startsev
0d64ee28d9 Bug 1311726 - Move methods related to instantiating the module tree to ModuleLoader;r=jonco
Differential Revision: https://phabricator.services.mozilla.com/D132610
2021-12-08 09:44:10 +00:00