This patch will look for functions during instantiation that have bytecode and jit hints and will eagerly dispatch baseline compilations off the main thread when present.
Differential Revision: https://phabricator.services.mozilla.com/D261939
This avoids the small overhead and potential for bugs from the previous
approach of assuming all `const char*` arguments passed to `nsITimer`
initializers are string literals, by instead requiring the argument to be a
`const nsACString&`. This involves changing all callsites to pass a `""_ns`
string literal down instead of a bare string literal.
It appears that while there were currently no buggy callers which
would've provided a dynamic string, there was at least one piece of code
(nsRepeatService::Start) which did pass down a raw char* which may be
dynamically allocated (all callers pass down `nsLiteralCString` so we're
actually OK here right now, but this was a footgun).
Differential Revision: https://phabricator.services.mozilla.com/D261032
This reverts commit 8c929cc018.
Revert "Bug 1979013 - Part 2: Require nsITimer API callers to provide a nsACString, r=xpcom-reviewers,media-playback-reviewers,webrtc-reviewers,profiler-reviewers,dom-storage-reviewers,toolkit-telemetry-reviewers,firefox-style-system-reviewers,mstange,emz,bwc,janv,emilio,padenot"
This reverts commit e01c0a6a32.
Revert "Bug 1979013 - Part 1: Eagerly fetch name for timer callbacks, r=xpcom-reviewers,mccr8"
This reverts commit 9f8e73c163.
This avoids the small overhead and potential for bugs from the previous
approach of assuming all `const char*` arguments passed to `nsITimer`
initializers are string literals, by instead requiring the argument to be a
`const nsACString&`. This involves changing all callsites to pass a `""_ns`
string literal down instead of a bare string literal.
It appears that while there were currently no buggy callers which
would've provided a dynamic string, there was at least one piece of code
(nsRepeatService::Start) which did pass down a raw char* which may be
dynamically allocated (all callers pass down `nsLiteralCString` so we're
actually OK here right now, but this was a footgun).
Differential Revision: https://phabricator.services.mozilla.com/D261032
JS::FinishCollectingDelazifications with TranscodeBuffer is the equivalent of
JS::FinishCollectingDelazifications with stencil and JS::EncodeStencil, and
nothing is optimized (e.g. skip some allocation etc).
Differential Revision: https://phabricator.services.mozilla.com/D260912
There are shared path between "save bytecode" vs "cache stencil".
This patch just renames everything, and the subsequent bugs and patches will
split the flag and methods.
Differential Revision: https://phabricator.services.mozilla.com/D260911
As a preparation to calculate the "bytecode encoding" separately than "do cache"
for the navigation cache, we should always calculate the flag.
Differential Revision: https://phabricator.services.mozilla.com/D260910
With the InitialStencilAndDelazifications structure,
JS::FinishCollectingDelazifications returns the same stencil as what's passed
to JS::StartCollectingDelazifications.
Differential Revision: https://phabricator.services.mozilla.com/D260909
If the navigation cache is enabled, the modules case should also take a
dedicate path, so that the bytecode encoding doesn't happen unexpectedly.
Differential Revision: https://phabricator.services.mozilla.com/D260908
Most changes are automated. Relevant bit is dom/.clang-format. I had to
manually disable clang-format in a few places where importing external
files and so on that aren't self-contained, and fix a couple includes /
forward declarations.
Differential Revision: https://phabricator.services.mozilla.com/D256800
In mochitest-browser tests, it's possible for the about:neterror page to
load. This triggers aboutNetError.html, which in turn loads
aboutNetError.mjs, eventually importing pkijs.js. The pkijs.js module is
compiled off-thread.
However, when the test framework proceeds to the next test, the
associated document may be detached before the off-thread compilation of
pkijs.js completes. If this happens while TaskController is shutting
down, the compilation task may never finish.
Currently, ScriptLoader only tracks top-level off-thread compilation
requests, not submodules involved in those tasks. To address this, we
now call CancelFetchingModules when ScriptLoader cancels ongoing
requests, ensuring submodule fetches are also properly aborted.
Differential Revision: https://phabricator.services.mozilla.com/D257677
Since the module graph is now traversed within the JS engine itself, the
related data structures in the host layer are no longer necessary.
Differential Revision: https://phabricator.services.mozilla.com/D255129
- Move UpdateReferrerPolicy from ScriptLoadRequest to ModuleLoadRequest,
as this can only happend for a module load.
- Add UpdateReferrerPolicy method to ModuleScript.
Introduces a new UpdateReferrerPolicy method for ModuleScript,
allowing the referrer policy to be updated based on the associated
ModuleLoadRequest.
Differential Revision: https://phabricator.services.mozilla.com/D255127
In mochitest-browser tests, it's possible for the about:neterror page to
load. This triggers aboutNetError.html, which in turn loads
aboutNetError.mjs, eventually importing pkijs.js. The pkijs.js module is
compiled off-thread.
However, when the test framework proceeds to the next test, the
associated document may be detached before the off-thread compilation of
pkijs.js completes. If this happens while TaskController is shutting
down, the compilation task may never finish.
Currently, ScriptLoader only tracks top-level off-thread compilation
requests, not submodules involved in those tasks. To address this, we
now call CancelFetchingModules when ScriptLoader cancels ongoing
requests, ensuring submodule fetches are also properly aborted.
Differential Revision: https://phabricator.services.mozilla.com/D257677
Since the module graph is now traversed within the JS engine itself, the
related data structures in the host layer are no longer necessary.
Differential Revision: https://phabricator.services.mozilla.com/D255129
- Move UpdateReferrerPolicy from ScriptLoadRequest to ModuleLoadRequest,
as this can only happend for a module load.
- Add UpdateReferrerPolicy method to ModuleScript.
Introduces a new UpdateReferrerPolicy method for ModuleScript,
allowing the referrer policy to be updated based on the associated
ModuleLoadRequest.
Differential Revision: https://phabricator.services.mozilla.com/D255127
We are making changes to many files. Very huge chunk of the changes are just renaming CSP -> PolicyContainer. Part 1 and part 2 are solely separated as frontend and backend. The unfortunate thing is, I mistakenly placed IDL changes in part 1, and many of those IDL changes affect frontend code too. I'm sorry for this inconvinience and hard to review patch(es).
(FWIW before this rewrite we had another patch stack. It is 25 patches and I believe isn't as comprehensive as this one. It also didn't replace CSP's inheritance but was copied alongside with CSP, but we decided to change our method and make policy conttainer contain CSP and copy it around after some discussion and reviews)
Differential Revision: https://phabricator.services.mozilla.com/D249248
I checked every `HttpBaseChannel::SetupReplacementChannel` call (including calls to overrides) and we always create a copy of the existing loadinfo, usually with `CloneLoadInfoForRedirect`, except for TRR, it just calls `TRRLoadInfo::Clone`.
Differential Revision: https://phabricator.services.mozilla.com/D255316
ModuleLoadRequest::mImports is going to be removed in bug 1820594.
In order to operate on dependency modules, we need to collect them in
a separate list, until they're queued for bytecode encoding.
This list and encoding queue should be removed in bug 1902951,
by refactoring how the bytecode encoding works.
The SharedScriptCache should already be holding the requests.
Differential Revision: https://phabricator.services.mozilla.com/D254652
This reverts commit 99ce61fb4e.
Revert "Bug 1973206 - Part 5: Remove unused variable in ScriptLoader::MaybePrepareModuleForBytecodeEncodingBeforeExecute. r=nbp"
This reverts commit 73dd64fbdc.
Revert "Bug 1973206 - Part 4: Filter out JSON modules earlier in ScriptLoader::CalculateBytecodeCacheFlag. r=nbp"
This reverts commit 5c8d191154.
Revert "Bug 1973206 - Part 3: Move CalculateBytecodeCacheFlag to instance method as a preparation for the subsequent patches. r=nbp"
This reverts commit 2e9c7ce88a.
Revert "Bug 1973206 - Part 2: Verify the list in IsAlreadyHandledForBytecodeEncodingPreparation. r=nbp"
This reverts commit 64d3a74e4d.
ModuleLoadRequest::mImports is going to be removed in bug 1820594.
In order to operate on dependency modules, we need to collect them in
a separate list, until they're queued for bytecode encoding.
This list and encoding queue should be removed in bug 1902951,
by refactoring how the bytecode encoding works.
The SharedScriptCache should already be holding the requests.
Differential Revision: https://phabricator.services.mozilla.com/D254652