Commit Graph

822 Commits

Author SHA1 Message Date
Tooru Fujisawa
d0e537de50 Bug 1899090 - Part 9: Rename *IncrementalEncoding public API to *CollectDelazifications. r=nbp
Differential Revision: https://phabricator.services.mozilla.com/D230385
2024-12-04 00:54:46 +00:00
Tooru Fujisawa
22a5b6727a Bug 1899090 - Part 3: Stop using JS::DuplicateStencil in ScriptLoader. r=nbp
Incremental-encoding API no longer requires exclusive ownership of JS::Stencil,
and the consumers no longer need to duplicate.

Differential Revision: https://phabricator.services.mozilla.com/D230379
2024-12-04 00:54:44 +00:00
Tooru Fujisawa
c1b8d7b50e Bug 1899090 - Part 2: Rebuild the incremental encoding with InitialStencilAndDelazifications. r=nbp
Create InitialStencilAndDelazifications and associate it to ScriptSourceObject,
and store on-demand delazifications into the InitialStencilAndDelazifications.

InitialStencilAndDelazifications is merged into single CompilationStencil when
finishing, but the JS::Stencil-based API is going to be rewritten later not
to merge.

Differential Revision: https://phabricator.services.mozilla.com/D230378
2024-12-04 00:54:44 +00:00
Bryan Thrall
5304755464 Bug 1929227 - Restore bytecode handling r=mgaudet
It was accidentally removed in 7b334fe58713.

Differential Revision: https://phabricator.services.mozilla.com/D228190
2024-11-06 16:06:39 +00:00
Bryan Thrall
e26f923c8e Bug 1724236 - Move InstantiateStencil() to ScriptLoader r=arai
Differential Revision: https://phabricator.services.mozilla.com/D222299
2024-10-30 13:41:48 +00:00
Bryan Thrall
3bacfd5034 Bug 1724236 - Rename JSExecutionUtils from JSExecutionContext r=arai
Differential Revision: https://phabricator.services.mozilla.com/D218458
2024-10-30 13:41:47 +00:00
Bryan Thrall
0b84b732ae Bug 1724236 - Remove JSExecutionContext r=arai
I think the constructor assertions don't need to be preserved, since the
locations where JSExecutionContext was constructed are obviously using a real
global on the main thread. I'm less confident in removing the check for
CycleCollectedJSContext::Get()->MicroTaskLevel(), but it should be ok since the
assertion wasn't failing already.

I'm leaving the profiler label "JSExecutionContext" intact for now so there's
no change in recorded profiles, but we should consider a better name for it in
the future.

Differential Revision: https://phabricator.services.mozilla.com/D218457
2024-10-30 13:41:46 +00:00
Bryan Thrall
34372a7a97 Bug 1724236 - Inline JoinOffThread r=arai
Differential Revision: https://phabricator.services.mozilla.com/D218456
2024-10-30 13:41:46 +00:00
Bryan Thrall
a85ba25a1c Bug 1724236 - Move JoinOffThread and InstantiateStencil out of JSExecutionContext r=arai
Differential Revision: https://phabricator.services.mozilla.com/D218455
2024-10-30 13:41:46 +00:00
Bryan Thrall
c04c306a9f Bug 1724236 - Pass debugger parameters as arguments instead of members r=arai
Differential Revision: https://phabricator.services.mozilla.com/D218454
2024-10-30 13:41:45 +00:00
Bryan Thrall
dd1514b033 Bug 1724236 - Move Decode to ScriptLoader r=arai
ScriptLoader is the only place that calls it, and inlining it made the call
site too hard to follow.

Differential Revision: https://phabricator.services.mozilla.com/D218453
2024-10-30 13:41:45 +00:00
Bryan Thrall
6f37de74e2 Bug 1724236 - Inline Compile(JS::SourceText) r=arai
The remaining Compile(nsAString) could be inlined as well, but it is only used
in nsJSThunk::EvaluateScript and WindowScriptTimeoutHandler::Call. Right now,
I'm just focusing on use by ScriptLoader.

Differential Revision: https://phabricator.services.mozilla.com/D218452
2024-10-30 13:41:44 +00:00
Bryan Thrall
8e00518582 Bug 1724236 - Inline ExecScript and move ExecScriptAndCoerceString to where it is used r=arai
ExecScript returning a value was only used in one place, and that call always
coerced the return value to a string.

Differential Revision: https://phabricator.services.mozilla.com/D218451
2024-10-30 13:41:44 +00:00
Bryan Thrall
e859d8b8d0 Bug 1724236 - Move Compile and Decode out of JSExecutionContext r=arai
Differential Revision: https://phabricator.services.mozilla.com/D218450
2024-10-30 13:41:44 +00:00
Bryan Thrall
b9d1574361 Bug 1724236 - Move stencil duplication out of JoinOffThread, Decode, Compile r=arai
In InstantiateClassicScriptFromMaybeEncodedSource(), I need to use a local
ErrorResult because calling `aRv.NoteJSContextException(aCx)` must be followed
by an immediate return, but that would avoid adding the compile time to
mMainThreadParseTime.

Differential Revision: https://phabricator.services.mozilla.com/D222301
2024-10-30 13:41:43 +00:00
Bryan Thrall
38fb4a0034 Bug 1724236 - Move InstantiateStencil call out of JoinOffThread r=arai
Differential Revision: https://phabricator.services.mozilla.com/D225361
2024-10-30 13:41:43 +00:00
Bryan Thrall
e6436b95c3 Bug 1724236 - Move InstantiateStencil out of Compile and Decode r=arai
Differential Revision: https://phabricator.services.mozilla.com/D218449
2024-10-30 13:41:42 +00:00
Bryan Thrall
ffd49dfc27 Bug 1724236 - Move ExecScript out of JSExecutionContext r=arai
Differential Revision: https://phabricator.services.mozilla.com/D218448
2024-10-30 13:41:42 +00:00
Bryan Thrall
930e0cf266 Bug 1724236 - Pass cx as function argument instead of member r=arai
Differential Revision: https://phabricator.services.mozilla.com/D218447
2024-10-30 13:41:42 +00:00
Bryan Thrall
c9529870d4 Bug 1724236 - Pass script as function argument instead of member r=arai
Differential Revision: https://phabricator.services.mozilla.com/D218446
2024-10-30 13:41:41 +00:00
Bryan Thrall
54137eb0a0 Bug 1724236 - Check options directly if script wants return value r=arai
Differential Revision: https://phabricator.services.mozilla.com/D218445
2024-10-30 13:41:41 +00:00
Bryan Thrall
2f6237583a Bug 1724236 - Move profiler label and JSAutoRealm out of JSExecutionContext r=arai
Differential Revision: https://phabricator.services.mozilla.com/D218444
2024-10-30 13:41:40 +00:00
Bryan Thrall
2a63e2261f Bug 1724236 - Get encodeBytecode and coerceToString from function arguments instead of members r=arai
Differential Revision: https://phabricator.services.mozilla.com/D218443
2024-10-30 13:41:40 +00:00
Bryan Thrall
b6fd76662b Bug 1724236 - Get CompileOptions from function arguments instead of member r=arai
Differential Revision: https://phabricator.services.mozilla.com/D218442
2024-10-30 13:41:40 +00:00
Bryan Thrall
190d6b921b Bug 1724236 - Simplify error handling via ErrorResult r=arai
Differential Revision: https://phabricator.services.mozilla.com/D224548
2024-10-30 13:41:39 +00:00
Bryan Thrall
79ae9289a9 Bug 1724236 - Move error tracking to JSExecutionContext callers r=arai
Using ErrorResult should go away by the end of the patch stack for this bug.

I needed to use some failure error code to indicate when
xpc::Scriptability::Allowed() failed so that callers can skip further use of
JSExecutionContext, and also return NS_OK. NS_ERROR_DOM_NOT_ALLOWED_ERR seemed
a reasonable choice, but it is temporary.

ExecScript(aRetValue) is only called by nsJSThunk::EvaluateScript(), which
initializes the JS::Value parameter to JS::Undefined. You can see in the caller
that it will still be JS::Undefined if any errors happen through use of
JSExecutionContext. Therefore, setting the value to JS::Undefined if `mSkip` at
the beginning of ExecScript() isn't needed any more.

We need to leave any exception on the JSContext for AutoJSAPI to handle, or
those exceptions won't propagate properly. For example, tests like
testing/mochitest/tests/Harness_sanity/test_sanityException.html will fail.

Differential Revision: https://phabricator.services.mozilla.com/D218441
2024-10-30 13:41:39 +00:00
Tooru Fujisawa
4cdfcf314d Bug 1915626 - Part 3: Cache HTTP response headers for the JS. r=bthrall
Differential Revision: https://phabricator.services.mozilla.com/D223967
2024-10-08 11:38:07 +00:00
Tooru Fujisawa
84727f2cc6 Bug 1916635 - Part 1: Create PerformanceResourceTiming entry for SharedScriptCache. r=bthrall
Differential Revision: https://phabricator.services.mozilla.com/D223357
2024-10-01 12:17:26 +00:00
Tooru Fujisawa
2081de56bb Bug 1916635 - Part 0: Fix the assertion around the cached request with a stencil. r=bthrall
Differential Revision: https://phabricator.services.mozilla.com/D223980
2024-10-01 12:17:26 +00:00
Valentin Gosu
533ec6637b Bug 1900561 - Set nsIClassOfService::fetchPriority where callers use nsISupportsPriority.adjustPriority r=acreskey
Differential Revision: https://phabricator.services.mozilla.com/D221958
2024-09-25 18:42:52 +00:00
Butkovits Atila
e6ce34045f Backed out 3 changesets (bug 1900561, bug 1919158) for causing bustages at ipc_message_utils.h. CLOSED TREE
Backed out changeset a2a4a88ef8d1 (bug 1919158)
Backed out changeset ecb590690d2e (bug 1900561)
Backed out changeset ef92a69ff2d1 (bug 1900561)
2024-09-24 18:58:08 +03:00
Valentin Gosu
ebbb22fc8b Bug 1900561 - Set nsIClassOfService::fetchPriority where callers use nsISupportsPriority.adjustPriority r=acreskey
Depends on D221957

Differential Revision: https://phabricator.services.mozilla.com/D221958
2024-09-24 12:29:08 +00:00
Tooru Fujisawa
e0f0fc0ca5 Bug 1916960 - Part 10: Trigger notification for the cached script load. r=bthrall
Differential Revision: https://phabricator.services.mozilla.com/D222452
2024-09-24 08:05:54 +00:00
Iulian Moraru
1e7ea75f9b Backed out 2 changesets (bug 1900561) for causing windows build bustages. CLOSED TREE
Backed out changeset 474e1a3ab5f0 (bug 1900561)
Backed out changeset 7a0bb5fa195e (bug 1900561)
2024-09-19 14:52:47 +03:00
Valentin Gosu
86dd18c852 Bug 1900561 - Set nsIClassOfService::fetchPriority where callers use nsISupportsPriority.adjustPriority r=acreskey
Differential Revision: https://phabricator.services.mozilla.com/D221958
2024-09-19 10:24:22 +00:00
Olli Pettay
a420032817 Bug 1917389, make it less likely to run non-parser-blocking scripts while there is parser blocking script pending, r=hsivonen
Differential Revision: https://phabricator.services.mozilla.com/D222220
2024-09-17 15:50:34 +00:00
Jonatan Klemets
4d18cba1b0 Bug 1877792 - Part 16: Disable off-thread compilaton for JSON modules r=spidermonkey-reviewers,jonco
This is something we may want to investigate and implement, but it felt out of
scope for the initial implementation.

Differential Revision: https://phabricator.services.mozilla.com/D218563
2024-09-03 08:10:54 +00:00
Jonatan Klemets
5bb3af7ad5 Bug 1877792 - Part 11: Only allow expected mime types r=dom-worker-reviewers,asuth
Differential Revision: https://phabricator.services.mozilla.com/D218558
2024-09-03 08:10:52 +00:00
Cristina Horotan
a842adb0d9 Backed out 20 changesets (bug 1877792) for causing wpt failures at importscripts_mime_local.any.sharedworker.html CLOSED TREE
Backed out changeset 19d78d0b6ee4 (bug 1877792)
Backed out changeset 14f104e5ce51 (bug 1877792)
Backed out changeset 662eb52b2a6f (bug 1877792)
Backed out changeset 48dc4035a14f (bug 1877792)
Backed out changeset d98ecddf2f59 (bug 1877792)
Backed out changeset 1234a31ff88f (bug 1877792)
Backed out changeset a3b5b0cde6ce (bug 1877792)
Backed out changeset a1f494b9592a (bug 1877792)
Backed out changeset a4d7565218f3 (bug 1877792)
Backed out changeset fe179004423b (bug 1877792)
Backed out changeset 39a20aee3942 (bug 1877792)
Backed out changeset 95b20763e650 (bug 1877792)
Backed out changeset d763241fccaf (bug 1877792)
Backed out changeset 0674cf646120 (bug 1877792)
Backed out changeset bd23c96418b6 (bug 1877792)
Backed out changeset 5b1e29e4c597 (bug 1877792)
Backed out changeset 3cead4149e6b (bug 1877792)
Backed out changeset d73a9f57f03c (bug 1877792)
Backed out changeset 82a58a80f58a (bug 1877792)
Backed out changeset 4c7182604e4f (bug 1877792)
2024-08-22 19:23:15 +03:00
Jonatan Klemets
72a54fd53e Bug 1877792 - Part 16: Disable off-thread compilaton for JSON modules r=spidermonkey-reviewers,jonco
This is something we may want to investigate and implement, but it felt out of
scope for the initial implementation.

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

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

Differential Revision: https://phabricator.services.mozilla.com/D218114
2024-08-01 17:12:48 +00:00
Tooru Fujisawa
3f46be92f0 Bug 1896709 - Part 13: Use SharedSubResourceCache in ScriptLoader. r=nbp
Differential Revision: https://phabricator.services.mozilla.com/D215882
2024-07-18 21:58:14 +00:00
Tooru Fujisawa
85f4805168 Bug 1896709 - Part 12: Add SharedScriptCache field to ScriptLoader. r=nbp
Differential Revision: https://phabricator.services.mozilla.com/D215881
2024-07-18 21:58:14 +00:00
Tooru Fujisawa
6924910f83 Bug 1896709 - Part 10: Add SharedScriptCache. r=nbp
Differential Revision: https://phabricator.services.mozilla.com/D215879
2024-07-18 21:58:13 +00:00
Tooru Fujisawa
16292d50d1 Bug 1896709 - Part 4: Accumulate cache expiration time in script load. r=nbp
Differential Revision: https://phabricator.services.mozilla.com/D215873
2024-07-18 21:58:11 +00:00
Norisz Fay
471367226c Backed out 17 changesets (bug 1896709) for causing build bustage and mochitest failures CLOSED TREE
Backed out changeset 046f0f522ce7 (bug 1896709)
Backed out changeset 0271e50308e6 (bug 1896709)
Backed out changeset 26fac760de19 (bug 1896709)
Backed out changeset 6fa3424dfc40 (bug 1896709)
Backed out changeset b7bcb9904435 (bug 1896709)
Backed out changeset c6878c5fdde4 (bug 1896709)
Backed out changeset 8ca8a4082e44 (bug 1896709)
Backed out changeset 20ff83806cc6 (bug 1896709)
Backed out changeset 6c9338852a19 (bug 1896709)
Backed out changeset e8615b5d82ab (bug 1896709)
Backed out changeset 842f2047a4bd (bug 1896709)
Backed out changeset 54eea04a7342 (bug 1896709)
Backed out changeset 220b544127cb (bug 1896709)
Backed out changeset 52ce0ebfb29a (bug 1896709)
Backed out changeset 34fc79dc1ad7 (bug 1896709)
Backed out changeset 50b0f6a23e3c (bug 1896709)
Backed out changeset 89c4c6bb465a (bug 1896709)
2024-07-18 14:48:46 +03:00
Tooru Fujisawa
309452cddc Bug 1896709 - Part 13: Use SharedSubResourceCache in ScriptLoader. r=nbp
Differential Revision: https://phabricator.services.mozilla.com/D215882
2024-07-18 09:15:28 +00:00
Tooru Fujisawa
de3ba3568c Bug 1896709 - Part 12: Add SharedScriptCache field to ScriptLoader. r=nbp
Differential Revision: https://phabricator.services.mozilla.com/D215881
2024-07-18 09:15:28 +00:00