diff options
author | Moonchild <moonchild@palemoon.org> | 2020-11-27 15:47:49 +0000 |
---|---|---|
committer | Moonchild <moonchild@palemoon.org> | 2020-11-27 15:47:49 +0000 |
commit | 15914ec5780e7867ab508a48a83311c56950f8a9 (patch) | |
tree | 80562c8ff9e25d119fde8725fa89d171ef20bb42 /js/src/builtin/ModuleObject.cpp | |
parent | b863bd2edc94c16498edc3274531f57fbfc30d3f (diff) | |
download | UXP-15914ec5780e7867ab508a48a83311c56950f8a9.tar UXP-15914ec5780e7867ab508a48a83311c56950f8a9.tar.gz UXP-15914ec5780e7867ab508a48a83311c56950f8a9.tar.lz UXP-15914ec5780e7867ab508a48a83311c56950f8a9.tar.xz UXP-15914ec5780e7867ab508a48a83311c56950f8a9.zip |
Issue #1691 - Part 1: Provide a way of associating a private value with a script
or module.
This is a prerequisite for dynamic import
Diffstat (limited to 'js/src/builtin/ModuleObject.cpp')
-rw-r--r-- | js/src/builtin/ModuleObject.cpp | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/js/src/builtin/ModuleObject.cpp b/js/src/builtin/ModuleObject.cpp index 2790b1c44..ae966c89a 100644 --- a/js/src/builtin/ModuleObject.cpp +++ b/js/src/builtin/ModuleObject.cpp @@ -725,6 +725,12 @@ ModuleObject::namespace_() return &value.toObject().as<ModuleNamespaceObject>(); } +ScriptSourceObject* +ModuleObject::scriptSourceObject() const +{ + return &getReservedSlot(ScriptSourceObjectSlot).toObject().as<ScriptSourceObject>(); +} + FunctionDeclarationVector* ModuleObject::functionDeclarations() { @@ -738,8 +744,10 @@ ModuleObject::functionDeclarations() void ModuleObject::init(HandleScript script) { + MOZ_ASSERT(script); initReservedSlot(ScriptSlot, PrivateValue(script)); initReservedSlot(StatusSlot, Int32Value(MODULE_STATUS_UNINSTANTIATED)); + initReservedSlot(ScriptSourceObjectSlot, ObjectValue(script->scriptSourceUnwrap())); } void @@ -868,18 +876,6 @@ ModuleObject::evaluationError() const return getReservedSlot(EvaluationErrorSlot); } -Value -ModuleObject::hostDefinedField() const -{ - return getReservedSlot(HostDefinedSlot); -} - -void -ModuleObject::setHostDefinedField(const JS::Value& value) -{ - setReservedSlot(HostDefinedSlot, value); -} - Scope* ModuleObject::enclosingScope() const { |