summaryrefslogtreecommitdiffstats
path: root/dom
diff options
context:
space:
mode:
authorMoonchild <moonchild@palemoon.org>2020-11-28 10:18:10 +0000
committerMoonchild <moonchild@palemoon.org>2020-11-28 10:18:10 +0000
commit060e3eb0c8163698b52d59e333d9c4496c78a2c2 (patch)
tree7f23ae89939b79400774643c0e7a658b0ce7cb36 /dom
parent15914ec5780e7867ab508a48a83311c56950f8a9 (diff)
downloadUXP-060e3eb0c8163698b52d59e333d9c4496c78a2c2.tar
UXP-060e3eb0c8163698b52d59e333d9c4496c78a2c2.tar.gz
UXP-060e3eb0c8163698b52d59e333d9c4496c78a2c2.tar.lz
UXP-060e3eb0c8163698b52d59e333d9c4496c78a2c2.tar.xz
UXP-060e3eb0c8163698b52d59e333d9c4496c78a2c2.zip
Revert "Issue #1691 - Part 1: Provide a way of associating a private value with a script"
This reverts commit 15914ec5780e7867ab508a48a83311c56950f8a9.
Diffstat (limited to 'dom')
-rw-r--r--dom/script/ModuleScript.cpp6
-rw-r--r--dom/script/ScriptLoader.cpp8
-rw-r--r--dom/script/ScriptLoader.h5
3 files changed, 9 insertions, 10 deletions
diff --git a/dom/script/ModuleScript.cpp b/dom/script/ModuleScript.cpp
index b2a72e628..9f7fe9ab9 100644
--- a/dom/script/ModuleScript.cpp
+++ b/dom/script/ModuleScript.cpp
@@ -58,9 +58,9 @@ ModuleScript::UnlinkModuleRecord()
{
// Remove module's back reference to this object request if present.
if (mModuleRecord) {
- MOZ_ASSERT(JS::GetModulePrivate(mModuleRecord).toPrivate() ==
+ MOZ_ASSERT(JS::GetModuleHostDefinedField(mModuleRecord).toPrivate() ==
this);
- JS::SetModulePrivate(mModuleRecord, JS::UndefinedValue());
+ JS::SetModuleHostDefinedField(mModuleRecord, JS::UndefinedValue());
mModuleRecord = nullptr;
}
}
@@ -83,7 +83,7 @@ ModuleScript::SetModuleRecord(JS::Handle<JSObject*> aModuleRecord)
// Make module's host defined field point to this module script object.
// This is cleared in the UnlinkModuleRecord().
- JS::SetModulePrivate(mModuleRecord, JS::PrivateValue(this));
+ JS::SetModuleHostDefinedField(mModuleRecord, JS::PrivateValue(this));
HoldJSObjects(this);
}
diff --git a/dom/script/ScriptLoader.cpp b/dom/script/ScriptLoader.cpp
index 8058c8caa..5b7bea8d2 100644
--- a/dom/script/ScriptLoader.cpp
+++ b/dom/script/ScriptLoader.cpp
@@ -798,13 +798,13 @@ ScriptLoader::StartFetchingModuleAndDependencies(ModuleLoadRequest* aParent,
// 8.1.3.8.1 HostResolveImportedModule(referencingModule, specifier)
JSObject*
-HostResolveImportedModule(JSContext* aCx,
- JS::Handle<JS::Value> aReferencingPrivate,
+HostResolveImportedModule(JSContext* aCx, JS::Handle<JSObject*> aModule,
JS::Handle<JSString*> aSpecifier)
{
// Let referencing module script be referencingModule.[[HostDefined]].
- auto script = static_cast<ModuleScript*>(aReferencingPrivate.toPrivate());
- MOZ_ASSERT(JS::GetModulePrivate(script->ModuleRecord()) == aReferencingPrivate);
+ JS::Value value = JS::GetModuleHostDefinedField(aModule);
+ auto script = static_cast<ModuleScript*>(value.toPrivate());
+ MOZ_ASSERT(script->ModuleRecord() == aModule);
// Let url be the result of resolving a module specifier given referencing
// module script and specifier.
diff --git a/dom/script/ScriptLoader.h b/dom/script/ScriptLoader.h
index 8cbcf7b96..ec9524f14 100644
--- a/dom/script/ScriptLoader.h
+++ b/dom/script/ScriptLoader.h
@@ -630,9 +630,8 @@ private:
ModuleScript* GetFetchedModule(nsIURI* aURL) const;
friend JSObject*
- HostResolveImportedModule(JSContext* aCx,
- JS::Handle<JS::Value> aReferencingPrivate,
- JS::Handle<JSString*> aSpecifier);
+ HostResolveImportedModule(JSContext* aCx, JS::Handle<JSObject*> aModule,
+ JS::Handle<JSString*> aSpecifier);
nsresult CreateModuleScript(ModuleLoadRequest* aRequest);
nsresult ProcessFetchedModuleSource(ModuleLoadRequest* aRequest);