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.
This commit is contained in:
Brian Smith authored and Moonchild committed 2023-12-10 23:57:54 +01:00
1 parent 0b625e624a
commit b8d1ee05c3
10 files changed
+100 -54

No files matched your search

+5 -3
View File
@@ -18,7 +18,8 @@ namespace dom {
class ScriptLoader;
void HostFinalizeTopLevelScript(JSFreeOp* aFop, const JS::Value& aPrivate);
void HostAddRefTopLevelScript(const JS::Value& aPrivate);
void HostReleaseTopLevelScript(const JS::Value& aPrivate);
class ClassicScript;
class ModuleScript;
@@ -63,7 +64,6 @@ class ClassicScript final : public LoadedScript
class ModuleScript final : public LoadedScript
{
JS::Heap<JSObject*> mModuleRecord;
JS::Heap<JS::Value> mParseError;
JS::Heap<JS::Value> mErrorToRethrow;
@@ -74,6 +74,8 @@ public:
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_INHERITED(ModuleScript,
LoadedScript)
JS::Heap<JSObject*> mModuleRecord;
ModuleScript(ScriptFetchOptions* aFetchOptions, nsIURI* aBaseURL);
void SetModuleRecord(JS::Handle<JSObject*> aModuleRecord);
@@ -89,7 +91,7 @@ public:
void UnlinkModuleRecord();
friend void HostFinalizeTopLevelScript(JSFreeOp*, const JS::Value&);
friend void CheckModuleScriptPrivate(LoadedScript*, const JS::Value&);
};
ClassicScript* LoadedScript::AsClassicScript() {