summaryrefslogtreecommitdiff
path: root/js/src/jsapi.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/jsapi.cpp')
-rw-r--r--js/src/jsapi.cpp23
1 files changed, 19 insertions, 4 deletions
diff --git a/js/src/jsapi.cpp b/js/src/jsapi.cpp
index dab4c25a43..4fb33464a6 100644
--- a/js/src/jsapi.cpp
+++ b/js/src/jsapi.cpp
@@ -4729,13 +4729,28 @@ JS::GetRequestedModules(JSContext* cx, JS::HandleObject moduleArg)
return &moduleArg->as<ModuleObject>().requestedModules();
}
-JS_PUBLIC_API(JSScript*)
-JS::GetModuleScript(JSContext* cx, JS::HandleObject moduleArg)
+JS_PUBLIC_API(JSString*)
+JS::GetRequestedModuleSpecifier(JSContext* cx, JS::HandleValue value)
{
AssertHeapIsIdle(cx);
CHECK_REQUEST(cx);
- assertSameCompartment(cx, moduleArg);
- return moduleArg->as<ModuleObject>().script();
+ assertSameCompartment(cx, value);
+ JSObject* obj = &value.toObject();
+ return obj->as<RequestedModuleObject>().moduleSpecifier();
+}
+
+JS_PUBLIC_API(void)
+JS::GetRequestedModuleSourcePos(JSContext* cx, JS::HandleValue value,
+ uint32_t* lineNumber, uint32_t* columnNumber)
+{
+ AssertHeapIsIdle(cx);
+ CHECK_REQUEST(cx);
+ assertSameCompartment(cx, value);
+ MOZ_ASSERT(lineNumber);
+ MOZ_ASSERT(columnNumber);
+ auto& requested = value.toObject().as<RequestedModuleObject>();
+ *lineNumber = requested.lineNumber();
+ *columnNumber = requested.columnNumber();
}
JS_PUBLIC_API(JSObject*)