summaryrefslogtreecommitdiffstats
path: root/js/src/builtin/ModuleObject.h
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/builtin/ModuleObject.h')
-rw-r--r--js/src/builtin/ModuleObject.h19
1 files changed, 17 insertions, 2 deletions
diff --git a/js/src/builtin/ModuleObject.h b/js/src/builtin/ModuleObject.h
index cb74d67c40..3533201675 100644
--- a/js/src/builtin/ModuleObject.h
+++ b/js/src/builtin/ModuleObject.h
@@ -50,6 +50,21 @@ class ModuleObject;
class PromiseObject;
class ScriptSourceObject;
+class ImportAttribute {
+ const HeapPtr<JSAtom*> key_;
+ const HeapPtr<JSString*> value_;
+
+ public:
+ ImportAttribute(Handle<JSAtom*> key, Handle<JSString*> value);
+
+ JSAtom* key() const { return key_; }
+ JSString* value() const { return value_; }
+
+ void trace(JSTracer* trc);
+};
+
+using ImportAttributeVector = GCVector<ImportAttribute, 0, SystemAllocPolicy>;
+
class ModuleRequestObject : public NativeObject {
public:
enum { SpecifierSlot = 0, AttributesSlot, SlotCount };
@@ -58,10 +73,10 @@ class ModuleRequestObject : public NativeObject {
static bool isInstance(HandleValue value);
[[nodiscard]] static ModuleRequestObject* create(
JSContext* cx, Handle<JSAtom*> specifier,
- Handle<ArrayObject*> maybeAttributes);
+ MutableHandle<UniquePtr<ImportAttributeVector>> maybeAttributes);
JSAtom* specifier() const;
- ArrayObject* attributes() const;
+ mozilla::Span<const ImportAttribute> attributes() const;
bool hasAttributes() const;
static bool getModuleType(JSContext* cx,
const Handle<ModuleRequestObject*> moduleRequest,