diff options
author | Moonchild <moonchild@palemoon.org> | 2020-11-28 10:17:43 +0000 |
---|---|---|
committer | Moonchild <moonchild@palemoon.org> | 2020-11-28 10:17:43 +0000 |
commit | e6b9d9cbeae7d90a7f368517c67775c0d72c6445 (patch) | |
tree | b10c4075973d3949a47d60becd9db46b8e505fe4 /js/src/jsapi.cpp | |
parent | b863bd2edc94c16498edc3274531f57fbfc30d3f (diff) | |
download | uxp-e6b9d9cbeae7d90a7f368517c67775c0d72c6445.tar.gz |
Issue #1624 - Add missing error handling and bail on null specifier.modulefix
Diffstat (limited to 'js/src/jsapi.cpp')
-rw-r--r-- | js/src/jsapi.cpp | 23 |
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*) |