roytam1
956cd0a5cc
Merge remote-tracking branch 'origin/tracking' into custom
2026-03-27 07:27:37 +08:00
Moonchild
fdee9737a8
Issue #3020 - Clear currentScript after running microtasks
...
Per HTML spec:
`document.currentScript` Returns null if the Document is not currently
executing a script or SVG script element (e.g., because the running
script is an event handler, or a timeout), or if the currently executing
script or SVG script element represents a module script.
2026-03-27 07:18:44 +08:00
Moonchild
eee99b32cc
Issue #3020 - Update currentScript when dealing with shadow DOM.
...
`currentScript` should be null when evaluating scripts from shadow DOM.
2026-03-27 07:18:27 +08:00
Moonchild
94ffd74cab
Issue #3020 - document.currentScript should be null in modules
...
This is done correctly in `EvaluateScript`, but `CreateModuleScript` was
still setting currentScript to an element.
2026-03-27 07:18:15 +08:00
roytam1
745f2ed97a
Merge remote-tracking branch 'origin/tracking' into custom
2026-02-11 23:39:01 +08:00
Basilisk-Dev
6c67c6f665
Issue #2229 Followup - Handle re-entrant module instantiation/evaluation during async module loads
2026-02-11 23:38:37 +08:00
roytam1
e72f8a3a81
Merge remote-tracking branch 'origin/tracking' into custom
2025-05-14 14:36:05 +08:00
Moonchild
1f638b22ec
Issue #2736 - Part 6: Re-work <script> src attribute.
...
Use subject principal as triggering principal in <script> "src" attribute.
2025-05-14 14:26:06 +08:00
Moonchild
9ad680cfc4
Issue #2736 - Part 1: Provide more consistent principals to CSP.
...
We're currently fairly vague and inconsistent about the values we provide to
content policy implementations for requestOrigin and requestPrincipal. In some
cases they're the triggering principal, sometimes the loading principal,
sometimes the channel principal.
Our existing content policy implementations which require or expect a
loading principal currently retrieve it from the context node.
Since no current callers require the principal to be the loading
principal, and some already expect it to be the triggering principal
(which there's currently no other way to retrieve), a choice was made
to pass the triggering principal whenever possible, but use the loading
principal to determine the origin URL.
2025-05-14 14:21:46 +08:00
roytam1
2a53c574f6
Merge remote-tracking branch 'origin/tracking' into custom
2025-03-13 23:05:24 +08:00
Moonchild
2e4620b5af
Issue #2692 - Part 6: Don't #include js/SourceBufferHolder.h in jsapi.h.
...
Instead, require users to do so. This is a minor translation-unit size
improvement for anyone who never has to use SourceBufferHolder other than
by reference.
2025-03-13 23:01:46 +08:00
roytam1
bf90272692
Merge remote-tracking branch 'origin/tracking' into custom
2025-01-29 12:26:22 +08:00
Martok
0590764f1f
Issue #2686 - Don't rely on return value of ExecutionContext::Compile when the context may forbid running scripts
...
This is relevant if scripting is terminated due to execution timeout but there are setTimeout/Interval callbacks pending
or if scripting is disabled altogether.
2025-01-29 12:23:50 +08:00
roytam1
904406a497
Merge remote-tracking branch 'origin/tracking' into custom
2025-01-20 21:13:46 +08:00
Moonchild
139e7a7ac6
Issue #2678 - Remove NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED
...
This no longer does anything at this point, except add indirection.
2025-01-20 21:12:18 +08:00
roytam1
7df6fa1c80
Merge remote-tracking branch 'origin/tracking' into custom
2024-10-24 07:39:14 +08:00
Moonchild
f6f046930d
Issue #2641 - Speculative load changes for referrerpolicy
2024-10-24 07:37:15 +08:00
roytam1
ed16ab739e
ported from mozilla: Bug 1460920 - Part 2 : Support referrerpolicy attribute in script HTMLScriptElement r=hsivonen (3309aa6d27)
2024-10-01 11:59:37 +08:00
roytam1
687f52e183
Merge remote-tracking branch 'origin/tracking' into custom
2024-10-01 10:28:33 +08:00
Boris Zbarsky
32498a0694
Bug 1493449 - Change the default credentials mode for module scripts from 'omit' to 'same-origin'
...
Resolves #2642
2024-10-01 10:27:55 +08:00
roytam1
523b9df9db
Merge remote-tracking branch 'origin/tracking' into custom
2024-02-08 14:34:40 +08:00
Moonchild
ff01a35bdb
Issue #2466 - Part 2: Implement script-src-elem and script-src-attr
2024-02-08 14:33:43 +08:00
Moonchild
4ea2206c15
Issue #2466 - Part 1: Reduce nsContentPolicy type usage.
...
Use CSPDirective instead, since it directly deals with CSP anyway.
This cleanup prepares for the following changes.
2024-02-08 14:33:28 +08:00
roytam1
80c4f1d745
Merge remote-tracking branch 'origin/tracking' into custom
2024-01-11 09:52:46 +08:00
Brian Smith
5b068f3726
Issue #2402 - CSP Violation events should have the correct sample for inline contexts. https://bugzilla.mozilla.org/show_bug.cgi?id=1473587 Add preference to increase max length of CSP report source sample. https://bugzilla.mozilla.org/show_bug.cgi?id=1415352 Return valid columnNumber value in CSP violation events. https://bugzilla.mozilla.org/show_bug.cgi?id=1418246
2024-01-11 09:50:12 +08:00
roytam1
d4a80aa2c4
Merge remote-tracking branch 'origin/tracking' into custom
2024-01-09 12:01:14 +08:00
Martok
f059bb0a59
Issue #2240 - Align Microtasks and promises scheduling with spec
...
Microtasks, resolved Promises and Observers are handled after the sync
task that caused them, in the order they were generated.
Also simplifies reentrancy handling.
Based-on: m-c 1193394
2024-01-09 11:59:32 +08:00
Martok
73b14eae31
Issue #2435 - Make CycleCollectedJSContext.h dependency explicit
2024-01-09 11:59:09 +08:00
roytam1
c889903081
Merge remote-tracking branch 'origin/tracking' into custom
2023-11-30 10:05:11 +08:00
Brian Smith
3e9fd21a38
Issue #2387 - Remove a missed AddRef() which could cause leaks. Update comments explaining how the reference counting works.
2023-11-30 09:52:07 +08:00
Brian Smith
eef37b2cd5
Issue #2387 - Collection of fixes related to a crash while canceling a dynamic import. Add AddRef/Release hooks for embedding's script or module private value and set this script source object where appropriate. https://bugzilla.mozilla.org/show_bug.cgi?id=1519140 Partial, no Value passing changes. Clear the list of dynamic import requests after cancelling them in ScriptLoader::ParsingComplete as we do for other requests. https://bugzilla.mozilla.org/show_bug.cgi?id=1291535 ScriptLoader::OnStreamComplete never returns a failure. https://bugzilla.mozilla.org/show_bug.cgi?id=1627275 Also cancel the correct kind of parser for Modules.
2023-11-30 09:51:50 +08:00
roytam1
96e3781bd9
Merge remote-tracking branch 'origin/tracking' into custom
2023-05-24 09:03:14 +08:00
Brian Smith
106de86dc4
Issue #2252 - Prevent crash when attempting to load a script with execution disallowed. This issue is due to the ExecutionContext added in Issue #1691 not handling GetScript() in a context where script execution is not allowed. This expressed itself in crashes when playing MP4s with the NoScript extension installed and enabled.
2023-05-24 09:02:56 +08:00
roytam1
f0dfd9ac73
Merge remote-tracking branch 'origin/tracking' into custom
2023-05-02 23:56:43 +08:00
Brian Smith
a1f787fc8c
Issue #1691 - Follow-up: Fix videojs and potentially other problems. When rewriting the ExecutionContext code in ScriptLoader I accidentally removed some required code.
2023-05-02 23:53:33 +08:00
roytam1
80d11ebc38
follow-up Issue #1691 - Part 6b, fix code that codepath is removed by upstream but remaining here
2023-04-30 21:45:57 +08:00
Brian Smith
a892a75903
Issue #1691 - Part 12: Fix return value in ExecScript() and debug assert in ParseTask. https://bugzilla.mozilla.org/show_bug.cgi?id=1331662 Replace nsJSUtils::EvaluateString calls by ExecutionContext scopes. ExecutionContext: The mRetValue is not used even though it is checked in various asserts. This is how it is in the Mozilla code even years later, only the passed in value is used. ParseTask: JoinDecode() and JoinCompile() run the same code but the type is different causing a debug assert when it checks the type Script vs ScriptDecode.
...
(cherry picked from commit 8f577428b7834b7d0f0d5afacbe060fbb1ff2136)
2023-04-30 21:22:00 +08:00
Brian Smith
edb82ec9f2
Issue #1691 - Part 11: Fix incorrect reference counting in ModuleScript class.
...
(cherry picked from commit 4ef1fa98c9518f5c107424667229ddb6f9f97767)
2023-04-30 21:21:45 +08:00
Brian Smith
7e056a6f72
Issue #1691 - Part 10: Add and use method to annotate CC crashes with a class name. https://bugzilla.mozilla.org/show_bug.cgi?id=1277260 Make PtrInfo into a class and mark it final. Also fix an erroneous debug assert because mBaseURL not set in one code path.
...
(cherry picked from commit a1890054011adf0cf87be0d56047418c9f201420)
2023-04-30 21:21:31 +08:00
Brian Smith
be916ef7ca
Issue #1691 - Part 9: Make import() work when the active script is in another document. https://bugzilla.mozilla.org/show_bug.cgi?id=1342012 Associate event handler with active script when they are compiled.
...
(cherry picked from commit 1a3cc5d6828a05a6309d959fad3c7e959ab9eb8d)
2023-04-30 21:21:19 +08:00
Brian Smith
1109559a5d
Issue #1691 - Part 8: Fix --enable-debug builds and continue dynamic module import changes. https://bugzilla.mozilla.org/show_bug.cgi?id=1342012 Support import from timeout handlers by associating the initiating script with the compiled JSScript. Fix error message that covers all import() failures that don't throw a JS exception. https://bugzilla.mozilla.org/show_bug.cgi?id=1331662 Partial - Replace nsJSUtils::EvaluateString calls by ExecutionContext scopes. Left EvaluateString() in nsXBLProtoImplField.cpp until ExecutionContext errors can be fixed.
...
(cherry picked from commit 22fcfc77971a9bb204df664c474681f4dcf54211)
2023-04-30 21:21:06 +08:00
Brian Smith
c69a47c393
Issue #1691 - Part 7f: Split up compile and execute so we can use ClassicScript. https://bugzilla.mozilla.org/show_bug.cgi?id=1342012 Refactor nsJSUtils::ExecutionContext to separate compilation and execution steps and allow extraction of compiled JSScript. https://bugzilla.mozilla.org/show_bug.cgi?id=1366773 Move buffer argument from JS::StartIncrementalEncoding to JS::FinishIncrementalEncoding.
...
(cherry picked from commit d4b520b08b958e116dfeeffdc61f3425610d1ce9)
2023-04-30 21:20:47 +08:00
Brian Smith
993476283d
Issue #1691 - Part 7e: Dependencies for required to finish part 7d. https://bugzilla.mozilla.org/show_bug.cgi?id=1331662 Reimplement EvaluateString using the ExecutionContext class. https://bugzilla.mozilla.org/show_bug.cgi?id=1316078 Extract redudant code into StartOffThreadParseTask. Use an ExclusiveContext instead of a JSContext in XDR functions. Add a script decoder as a valid off-main-thread parse-task. https://bugzilla.mozilla.org/show_bug.cgi?id=900784 Add nsJSUtils functions for encoding and decoding the bytecode. https://bugzilla.mozilla.org/show_bug.cgi?id=1316081 Add XDRIncrementalEncoder to replace delazified LazyScript in the encoded XDR buffer. Add an XDRIncrementalEncoder instance on the ScriptSource. Expose a new JSAPI to incrementally encode bytecode when it is generated. https://bugzilla.mozilla.org/show_bug.cgi?id=1334091 XDR function use the sourceObject instead of the enclosingScript as argument.
...
(cherry picked from commit d6de9a669f4b2f5115670bd771cd53d7cfb3956a)
2023-04-30 21:20:33 +08:00
Brian Smith
d5d7bb5e47
Issue #1691 - Part 7d: Allow dynamic import in cases where there's no referencing script or module. Support dynamic import from classic scripts by creating ClassicScript objects and associating them with the compiled. https://bugzilla.mozilla.org/show_bug.cgi?id=1342012 This patch is incomplete, some code in ScriptLoader::EvaluateScript() could not be applied for missing dependencies. Part 7e will apply the missing dependencies and finish the patch.
...
(cherry picked from commit ce31a906e801b72f06385b0755710317ccf3658b)
2023-04-30 21:20:19 +08:00
Brian Smith
41eda05e57
Issue #1691 - Part 7c: Refactor ModuleScript into ClassicScript class and LoadedScript base class so we can represent all scripts that can perform dynamic import. https://bugzilla.mozilla.org/show_bug.cgi?id=1342012
...
(cherry picked from commit c37b8b55231f6609c87e49c84edf7e94a1bf5518)
2023-04-30 21:20:05 +08:00
Brian Smith
ba01d99e31
Issue #1691 - Part 7b: Make load request element optional. https://bugzilla.mozilla.org/show_bug.cgi?id=1342012
...
(cherry picked from commit 169bb5d2ada59026fb6407716a7b3862810c9b97)
2023-04-30 21:19:50 +08:00
Brian Smith
9a19e9d165
Issue #1691 - Part 6c: Fix a few issues with the earlier commits. Need PNK_CALL_IMPORT and PNK_IMPORT_META in the node children list or it will abort. When porting ScriptFetchOptions support, I had 2 constructors, I picked the wrong one. Missed adding the preference javascript.options.dynamicImport to all.js.
...
(cherry picked from commit b95ccb711dc41b343d02ae69b3dc4747bbbe86fb)
2023-04-30 21:18:24 +08:00
Brian Smith
86e0057ea7
Issue #1691 - Part 6b: Initial browser support for dynamic import from module scripts. https://bugzilla.mozilla.org/show_bug.cgi?id=1342012 Factor out script fetch options from script load request classes. https://bugzilla.mozilla.org/show_bug.cgi?id=1480720 Remove support for version parameter from script loader. https://bugzilla.mozilla.org/show_bug.cgi?id=1428745
...
(cherry picked from commit 3ec2529aa6303f6950622e3cb91a23580649c73b)
2023-04-30 21:18:11 +08:00
Brian Smith
3f4985ce6c
Issue #1691 - Part 3: Finish implementing import meta. https://bugzilla.mozilla.org/show_bug.cgi?id=1427610
...
(cherry picked from commit a8625238ac846fb7eb103646ddb8634a5860f067)
2023-04-30 21:17:00 +08:00
Brian Smith
1a6b3a822c
Issue #1691 - Part 1: Provide a way of associating a private value with a script or module.
...
This is a prerequisite for dynamic import
(cherry picked from commit 2e2972647ee29340df51a804f05e40fc1da2c89b)
2023-04-30 21:16:28 +08:00