mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-07 16:28:38 +09:00
Issue #618 - Align module instantiation/errors with the updated spec.
Store and re-throw module instantiation and evaluation errors. Ref: BZ 1374239, 1394492
This commit is contained in:
parent
336347212b
commit
c7d195e633
16 changed files with 611 additions and 217 deletions
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue