Commit Graph

57 Commits

Author SHA1 Message Date
roytam1 3ff47ae95f import from UXP: Issue #2229 Followup - Handle re-entrant module instantiation/evaluation during async module loads (6c67c6f6) 2026-02-11 23:49:04 +08:00
roytam1 79991b5228 import from UXP: Issue #2736 - Part 6: Re-work <script> src attribute. (1f638b22) 2025-05-14 15:26:21 +08:00
roytam1 3cc87110cf ported from UXP: Issue #2736 - Part 1: Provide more consistent principals to CSP. (9ad680cf) 2025-05-14 14:56:40 +08:00
roytam1 654dda938d ported from UXP: Issue #2692 - Part 6: Don't #include js/SourceBufferHolder.h in jsapi.h. (2e4620b5) 2025-03-14 00:25:15 +08:00
roytam1 36eaeed46c import from UXP: Issue #2686 - Don't rely on return value of ExecutionContext::Compile when the context may forbid running scripts (0590764f) 2025-01-29 12:53:04 +08:00
roytam1 021dffe98c import from custom branch of UXP: ported from mozilla: Bug 1460920 - Part 2 : Support referrerpolicy attribute in script HTMLScriptElement r=hsivonen (3309aa6d27) (ed16ab73) 2024-10-02 00:09:19 +08:00
roytam1 38c9abe854 import from UXP: Bug 1493449 - Change the default credentials mode for module scripts from 'omit' to 'same-origin' (32498a06) 2024-10-01 10:38:01 +08:00
roytam1 2c3a6cbb2f ported from UXP: Issue #2466 - Part 2: Implement script-src-elem and script-src-attr (ff01a35b) 2024-02-08 15:13:18 +08:00
roytam1 992c730480 ported from UXP: Issue #2466 - Part 1: Reduce nsContentPolicy type usage. (4ea2206c) 2024-02-08 15:04:27 +08:00
roytam1 1e9ebad9e0 ported from UXP: 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 (5b068f37) 2024-01-11 14:55:32 +08:00
roytam1 4e09c971d0 ported from UXP: Issue #2435 - Make CycleCollectedJSContext.h dependency explicit (73b14eae) 2024-01-09 14:15:59 +08:00
roytam1 3c23d39e03 import from UXP: 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. (eef37b2c) 2023-11-30 11:13:38 +08:00
roytam1 18f929f609 import from UXP: 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. (106de86d) 2023-05-25 09:12:55 +08:00
roytam1 03cce35b2f import from UXP: Issue #1691 - Follow-up: Fix videojs and potentially other problems. When rewriting the ExecutionContext code in ScriptLoader I accidentally removed some required code. (a1f787fc) 2023-05-03 00:07:06 +08:00
roytam1 9fdf527341 import from UXP: Issue #1691 - Part 12: Fix return value in ExecScript() and debug assert in ParseTask. M1331662 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. (a892a759) 2023-05-01 00:27:37 +08:00
roytam1 b83cfd9ba0 import from UXP: Issue #1691 - Part 10: Add and use method to annotate CC crashes with a class name. M1277260 Make PtrInfo into a class and mark it final. Also fix an erroneous debug assert because mBaseURL not set in one code path. (7e056a6f) 2023-05-01 00:20:28 +08:00
roytam1 d227ff5835 ported from UXP: Issue #1691 - Part 9: Make import() work when the active script is in another document. M1342012 Associate event handler with active script when they are compiled. (be916ef7) 2023-05-01 00:16:49 +08:00
roytam1 4e03b175f8 ported from UXP: Issue #1691 - Part 8: Fix --enable-debug builds and continue dynamic module import changes. M1342012 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. M1331662 Partial - Replace nsJSUtils::EvaluateString calls by ExecutionContext scopes. Left EvaluateString() in nsXBLProtoImplField.cpp until ExecutionContext errors can be fixed. (1109559a) 2023-05-01 00:13:14 +08:00
roytam1 587bcc0be9 import from UXP: Issue #1691 - Part 7f: Split up compile and execute so we can use ClassicScript. M1342012 Refactor nsJSUtils::ExecutionContext to separate compilation and execution steps and allow extraction of compiled JSScript. M1366773 Move buffer argument from JS::StartIncrementalEncoding to JS::FinishIncrementalEncoding. (c69a47c3) 2023-05-01 00:04:32 +08:00
roytam1 06bf205880 import from UXP: Issue #1691 - Part 7e: Dependencies for required to finish part 7d. M1331662 Reimplement EvaluateString using the ExecutionContext class. M1316078 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. M900784 Add nsJSUtils functions for encoding and decoding the bytecode. M1316081 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. M1334091 XDR function use the sourceObject instead of the enclosingScript as argument. (99347628) 2023-04-30 23:55:13 +08:00
roytam1 04c3941012 import from UXP: 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. M1342012 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. (d5d7bb5e) 2023-04-30 23:46:16 +08:00
roytam1 8597b9b315 import from UXP: Issue #1691 - Part 7b: Make load request element optional. M1342012 (ba01d99e) 2023-04-30 23:42:47 +08:00
roytam1 ad255fdb78 ported from UXP: 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. (9a19e9d1) 2023-04-30 23:21:59 +08:00
roytam1 abf9ba5235 ported from UXP: Issue #1691 - Part 6b: Initial browser support for dynamic import from module scripts. M1342012 Factor out script fetch options from script load request classes. M1480720 Remove support for version parameter from script loader. M1428745 (86e0057e) 2023-04-30 23:16:24 +08:00
roytam1 0781175904 ported from UXP: Issue #1691 - Part 3: Finish implementing import meta. M1427610 (3f4985ce) 2023-04-30 22:38:34 +08:00
roytam1 1022a63417 ported from UXP: Issue #1691 - Part 1: Provide a way of associating a private value with a script or module. (1a6b3a82) 2023-04-30 22:15:30 +08:00
roytam1 1649cd88a9 import from UXP: Issue #3058 - Try to deal with bad website scripting loading/unloading modules. (19e2f0fb) 2022-04-29 22:16:31 +08:00
roytam1 223aedb3c3 ported from UXP: Issue #618 - Clear the module map when changing a Document's global and add release build assertions for mismatching compartments. (ef11a4d7) 2022-04-16 00:26:02 +08:00
roytam1 1e6646ef3d import from UXP: Issue #618 - Make ES6 modules work for resource: URIs (7316d91b) 2022-04-16 00:23:14 +08:00
roytam1 2e2530121b import from UXP: Issue #618 - Implement preloading of module scripts. (1e87731c) 2022-04-16 00:22:00 +08:00
roytam1 e7e78b5d1a import from UXP:
- Issue #618 - Don't preload nomodule scripts when modules are enabled (6c8f24a7)
- Issue #618 - Regenerate the HTML Parser code for nomodule changes (527d5c62)
2022-04-16 00:04:30 +08:00
roytam1 1ed3ea1ee7 import from UXP: Issue #618 - (async) Implement async attribute for inline module scripts. (3781c4a6) 2022-04-15 23:58:11 +08:00
roytam1 868d3b6de1 import from UXP: Issue #618 - (async) Keep track of script modes in a single mode state. (29472168) 2022-04-15 23:51:10 +08:00
roytam1 f4d609a938 import from UXP: Issue #618 - (async, preload) Correctly pass info about async/defer to parser. (3fa4aabf) 2022-04-15 23:50:17 +08:00
roytam1 83c01dc5fe import from UXP: Issue #618 - (async) Split out function to add async request. (d8c2bc29) 2022-04-15 23:47:45 +08:00
roytam1 68fc0c9d6f import from UXP: Issue #618 - Rename some script load request flags to be more descriptive. (ecf9c7cf) 2022-04-15 23:45:45 +08:00
roytam1 1a76ff4883 import from UXP: Issue #618 - Make document.currentScript null in modules. (b7dbc3e7) 2022-04-15 23:41:05 +08:00
roytam1 b910e82063 import from UXP: Issue #618 - Fix processing of non-parser-generated module scripts. (d7889e2d) 2022-04-15 23:39:41 +08:00
roytam1 cc301c92f0 import from UXP: Issue #618 - Handle errors for inline module scripts and ensure we update the module map after fetch errors. (93d4766c) 2022-04-15 23:37:15 +08:00
roytam1 b8935d5c9c import from UXP: Issue #618 - Split SRI verification out from OnStreamComplete. (6c7ac2b8) 2022-04-15 23:35:08 +08:00
roytam1 2acff77359 import from UXP: Issue #618 - Split handling of load errors out from OnStreamComplete. (7e6cd5de) 2022-04-15 23:31:25 +08:00
roytam1 c1a945fa0c import from UXP: Issue #618 - Don't mute errors for module scripts because they always use CORS (75f3f09f) 2022-04-15 23:19:57 +08:00
roytam1 93d96988ab ported from UXP: Issue #618: Pass down referrer and referrer policy when fetching modules. (684f4824) 2022-04-15 23:18:01 +08:00
roytam1 00845d3829 import from UXP: Issue #618: Ignore 'event' and 'for' attributes for module scripts. (97617a3a) 2022-04-15 23:15:13 +08:00
roytam1 e30e38b739 import from UXP: Issue #618 - Simplify module resolve hook to be a function pointer (34db7617) 2022-04-15 18:02:37 +08:00
roytam1 8311e2490e import from UXP: Issue #618 - Keep track of which modules in a graph have been fetched using a visited set (6639e9cd) 2022-04-15 16:07:28 +08:00
roytam1 f88d0aec81 import from UXP: Issue #618 - Simplify module map interface (f0d6e293) 2022-04-15 16:06:08 +08:00
roytam1 6c1168aa22 import from UXP: Issue #618 - Record module dependency before starting fetch so that error handling works correctly (40017437) 2022-04-15 16:02:22 +08:00
roytam1 65b9c2362b ported from UXP: Issue #618 - Align error handling for module scripts with the spec (again) (0d874713) 2022-04-15 15:55:43 +08:00
roytam1 d171ffbfd5 import from UXP: Issue #618 - Further align error handling for module scripts with the spec (743bdc04) 2022-04-15 15:46:05 +08:00