Граф коммитов

788 Коммитов

Автор SHA1 Сообщение Дата
Jan-Niklas Jaeschke 4265f72859 Bug 1777925: Replaced MutationObserver array container type with linked list. r=smaug
Deletion of mutation observers from a list resulted in O(n^2) behavior and could lead to massive freezes.
This is resolved by using a LinkedList instead, reducing complexity to O(n).

A safely iterable doubly linked list was implemented based on `mozilla::DoublyLinkedList`,
allowing to insert and remove elements while iterating the list.

Due to the nature of `mozilla::DoublyLinkedList`, every Mutation Observer now inherits `mozilla::DoublyLinkedListElement<T>`.
This implies that a Mutation Observer can only be part of one DoublyLinkedList.
This conflicts with some Mutation Observers, which are being added to multiple `nsINode`s.
To continue supporting this, new MutationObserver base classes `nsMultiMutationObserver` and `nsStubMultiMutationObserver` are introduced,
which create `MutationObserverWrapper` objects each time they are added to a `nsINode`.
The wrapper objects forward every call to the actual observer.

Differential Revision: https://phabricator.services.mozilla.com/D157031
2022-09-21 11:31:44 +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
Olli Pettay 93acdfad59 Bug 1777574, automate CC zone handling, r=mccr8
Differential Revision: https://phabricator.services.mozilla.com/D155084
2022-09-07 11:22:51 +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
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
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
Yulia Startsev d82f1773f0 Bug 1742438 - Part 8: Use mScriptData instead of custom load context field; r=arai,asuth
This is the most substantial change in the transition from ScriptLoadInfo to ScriptLoadRequest with
regards to data representation. ScriptLoadRequests can have their data incrementally loaded,
so it is already fully decoded and ready to go by the time that we create the source buffer for
worker scripts. This simplifies some of the code, and we can add incremental loading when we are ready.

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

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

Differential Revision: https://phabricator.services.mozilla.com/D146178
2022-07-14 17:07:26 +00:00
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 d27ba71b5a Bug 1747059 - Correctly select microtask queue when enquing a job in a ShadowRealm in a worker. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D150410
2022-06-28 22:04:19 +00:00
Matthew Gaudet 580a35d01e Bug 1747059 - Gecko support for ShadowRealms r=peterv,smaug
This connects [Exposed=*] in WebIDL to ShadowRealms

Differential Revision: https://phabricator.services.mozilla.com/D146349
2022-06-28 22:04:18 +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 c7369b95e1 Bug 1747059 - Correctly select microtask queue when enquing a job in a ShadowRealm in a worker. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D150410
2022-06-27 21:17:37 +00:00
Matthew Gaudet f8b7719e44 Bug 1747059 - Gecko support for ShadowRealms r=peterv,smaug
This connects [Exposed=*] in WebIDL to ShadowRealms

Differential Revision: https://phabricator.services.mozilla.com/D146349
2022-06-27 21:17:36 +00: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 edc0fa2360 Bug 1757833 - Add PerfStat probes for bytecode cache reads, writes, compression, and decompression r=nbp,necko-reviewers,kershaw
Differential Revision: https://phabricator.services.mozilla.com/D145012
2022-05-20 18:25:42 +00:00
Bryan Thrall 93bf2e27d6 Bug 1757833 - Add Profiler markers to track compression cost r=nbp
Differential Revision: https://phabricator.services.mozilla.com/D144738
2022-05-20 18:25:41 +00:00
Bryan Thrall 1eca5e0f2d Bug 1757833 - Add browser.cache.jsbc_compression_level static preference r=nbp
This simplifies profiling since now we can see the results within a single build
based on the preference (though there is still a slight cost to copying the
bytecode).

Setting to (the default) 0 disables compression.

Differential Revision: https://phabricator.services.mozilla.com/D144737
2022-05-20 18:25:41 +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 98850ac71c Bug 1757833 - Add PerfStat probes for bytecode cache reads, writes, compression, and decompression r=nbp,necko-reviewers,kershaw
Differential Revision: https://phabricator.services.mozilla.com/D145012
2022-05-18 21:03:49 +00:00
Bryan Thrall c5b7120ac1 Bug 1757833 - Add Profiler markers to track compression cost r=nbp
Differential Revision: https://phabricator.services.mozilla.com/D144738
2022-05-18 21:03:49 +00:00
Bryan Thrall 21d03287f5 Bug 1757833 - Add browser.cache.jsbc_compression_level static preference r=nbp
This simplifies profiling since now we can see the results within a single build
based on the preference (though there is still a slight cost to copying the
bytecode).

Setting to (the default) 0 disables compression.

Differential Revision: https://phabricator.services.mozilla.com/D144737
2022-05-18 21:03:48 +00: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 47bd5772df Bug 1757833 - Add PerfStat probes for bytecode cache reads, writes, compression, and decompression r=nbp,necko-reviewers,kershaw
Differential Revision: https://phabricator.services.mozilla.com/D145012
2022-05-17 16:29:05 +00:00
Bryan Thrall 7713c8dd36 Bug 1757833 - Add Profiler markers to track compression cost r=nbp
Differential Revision: https://phabricator.services.mozilla.com/D144738
2022-05-17 16:29:04 +00:00
Bryan Thrall 91ba7a42fa Bug 1757833 - Add browser.cache.jsbc_compression_level static preference r=nbp
This simplifies profiling since now we can see the results within a single build
based on the preference (though there is still a slight cost to copying the
bytecode).

Setting to (the default) 0 disables compression.

Differential Revision: https://phabricator.services.mozilla.com/D144737
2022-05-17 16:29:04 +00: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