summaryrefslogtreecommitdiffstats
path: root/js/src/builtin/ModuleObject.h
diff options
context:
space:
mode:
authorMoonchild <moonchild@palemoon.org>2020-07-03 13:56:49 +0000
committerMoonchild <moonchild@palemoon.org>2020-07-10 18:29:33 +0000
commit3f25d0c8e4d9296f0d45c85c251eab71f076937b (patch)
tree2d5d342b0ea6f7b7cfcedc6bf3349ca3ff6cf418 /js/src/builtin/ModuleObject.h
parentab0501702637f3448ec16a188a050e5b9f688787 (diff)
downloadUXP-3f25d0c8e4d9296f0d45c85c251eab71f076937b.tar
UXP-3f25d0c8e4d9296f0d45c85c251eab71f076937b.tar.gz
UXP-3f25d0c8e4d9296f0d45c85c251eab71f076937b.tar.lz
UXP-3f25d0c8e4d9296f0d45c85c251eab71f076937b.tar.xz
UXP-3f25d0c8e4d9296f0d45c85c251eab71f076937b.zip
Issue #618 - Align module instantiation/errors with the updated spec.
Store and re-throw module instantiation and evaluation errors. Ref: BZ 1374239, 1394492
Diffstat (limited to 'js/src/builtin/ModuleObject.h')
-rw-r--r--js/src/builtin/ModuleObject.h30
1 files changed, 20 insertions, 10 deletions
diff --git a/js/src/builtin/ModuleObject.h b/js/src/builtin/ModuleObject.h
index 22db762ac..365fcd4bf 100644
--- a/js/src/builtin/ModuleObject.h
+++ b/js/src/builtin/ModuleObject.h
@@ -192,8 +192,8 @@ struct FunctionDeclaration
using FunctionDeclarationVector = GCVector<FunctionDeclaration, 0, ZoneAllocPolicy>;
-// Possible values for ModuleState are defined in SelfHostingDefines.h.
-using ModuleState = int32_t;
+// Possible values for ModuleStatus are defined in SelfHostingDefines.h.
+using ModuleStatus = int32_t;
class ModuleObject : public NativeObject
{
@@ -204,7 +204,8 @@ class ModuleObject : public NativeObject
InitialEnvironmentSlot,
EnvironmentSlot,
NamespaceSlot,
- StateSlot,
+ StatusSlot,
+ ErrorSlot,
HostDefinedSlot,
RequestedModulesSlot,
ImportEntriesSlot,
@@ -215,11 +216,21 @@ class ModuleObject : public NativeObject
NamespaceExportsSlot,
NamespaceBindingsSlot,
FunctionDeclarationsSlot,
+ DFSIndexSlot,
+ DFSAncestorIndexSlot,
SlotCount
};
static_assert(EnvironmentSlot == MODULE_OBJECT_ENVIRONMENT_SLOT,
"EnvironmentSlot must match self-hosting define");
+ static_assert(StatusSlot == MODULE_OBJECT_STATUS_SLOT,
+ "StatusSlot must match self-hosting define");
+ static_assert(ErrorSlot == MODULE_OBJECT_ERROR_SLOT,
+ "ErrorSlot must match self-hosting define");
+ static_assert(DFSIndexSlot == MODULE_OBJECT_DFS_INDEX_SLOT,
+ "DFSIndexSlot must match self-hosting define");
+ static_assert(DFSAncestorIndexSlot == MODULE_OBJECT_DFS_ANCESTOR_INDEX_SLOT,
+ "DFSAncestorIndexSlot must match self-hosting define");
static const Class class_;
@@ -244,7 +255,8 @@ class ModuleObject : public NativeObject
ModuleEnvironmentObject& initialEnvironment() const;
ModuleEnvironmentObject* environment() const;
ModuleNamespaceObject* namespace_();
- ModuleState state() const;
+ ModuleStatus status() const;
+ Value error() const;
Value hostDefinedField() const;
ArrayObject& requestedModules() const;
ArrayObject& importEntries() const;
@@ -255,8 +267,8 @@ class ModuleObject : public NativeObject
JSObject* namespaceExports();
IndirectBindingMap* namespaceBindings();
- static bool DeclarationInstantiation(JSContext* cx, HandleModuleObject self);
- static bool Evaluation(JSContext* cx, HandleModuleObject self);
+ static bool Instantiate(JSContext* cx, HandleModuleObject self);
+ static bool Evaluate(JSContext* cx, HandleModuleObject self);
void setHostDefinedField(const JS::Value& value);
@@ -269,10 +281,8 @@ class ModuleObject : public NativeObject
// For intrinsic_InstantiateModuleFunctionDeclarations.
static bool instantiateFunctionDeclarations(JSContext* cx, HandleModuleObject self);
- void setState(ModuleState newState);
-
- // For intrinsic_EvaluateModule.
- static bool evaluate(JSContext* cx, HandleModuleObject self, MutableHandleValue rval);
+ // For intrinsic_ExecuteModule.
+ static bool execute(JSContext* cx, HandleModuleObject self, MutableHandleValue rval);
// For intrinsic_NewModuleNamespace.
static ModuleNamespaceObject* createNamespace(JSContext* cx, HandleModuleObject self,