From 498b1ab0c8db07784badbd2148f372027ef8cc27 Mon Sep 17 00:00:00 2001 From: Moonchild Date: Wed, 8 Jul 2020 12:58:30 +0000 Subject: Issue #618 - Align error handling for module scripts with the spec (again) This updates module implementation to match spec regarding handling of instantiation errors, after it was changed yet again, this time to not remember instantiation errors, but instead immediately rethrow applicable ones. Ref: BZ 1420420 --- js/src/jsapi.h | 6 ------ 1 file changed, 6 deletions(-) (limited to 'js/src/jsapi.h') diff --git a/js/src/jsapi.h b/js/src/jsapi.h index 9c3bf8151..76781cf06 100644 --- a/js/src/jsapi.h +++ b/js/src/jsapi.h @@ -4395,12 +4395,6 @@ GetRequestedModules(JSContext* cx, JS::HandleObject moduleRecord); extern JS_PUBLIC_API(JSScript*) GetModuleScript(JSContext* cx, JS::HandleObject moduleRecord); -extern JS_PUBLIC_API(bool) -IsModuleErrored(JSObject* moduleRecord); - -extern JS_PUBLIC_API(JS::Value) -GetModuleError(JSObject* moduleRecord); - } /* namespace JS */ extern JS_PUBLIC_API(bool) -- cgit v1.2.3 From 1012dbe9e5b2d00f967b0523f94ac8cc7ed3118d Mon Sep 17 00:00:00 2001 From: Moonchild Date: Thu, 6 Aug 2020 18:27:32 +0000 Subject: [js] Add some utility functions to get the current JS runtime. --- js/src/jsapi.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'js/src/jsapi.h') diff --git a/js/src/jsapi.h b/js/src/jsapi.h index 76781cf06..c6299e3f5 100644 --- a/js/src/jsapi.h +++ b/js/src/jsapi.h @@ -995,6 +995,9 @@ JS_NewContext(uint32_t maxbytes, extern JS_PUBLIC_API(void) JS_DestroyContext(JSContext* cx); +extern JS_PUBLIC_API(JSRuntime*) +JS_GetRuntime(JSContext* cx); + typedef double (*JS_CurrentEmbedderTimeFunction)(); /** -- cgit v1.2.3 From 10a10fd3757374123eb5e3aab1e4720f86575f47 Mon Sep 17 00:00:00 2001 From: Moonchild Date: Thu, 6 Aug 2020 18:31:36 +0000 Subject: Issue #618 - Simplify module resolve hook to be a function pointer This is an ahead-of time port to try and address #1624. This is based on BZ 1461751 and Jon Coppeard's work in it. --- js/src/jsapi.h | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'js/src/jsapi.h') diff --git a/js/src/jsapi.h b/js/src/jsapi.h index c6299e3f5..5cdfd958e 100644 --- a/js/src/jsapi.h +++ b/js/src/jsapi.h @@ -4325,17 +4325,19 @@ extern JS_PUBLIC_API(bool) Evaluate(JSContext* cx, const ReadOnlyCompileOptions& options, const char* filename, JS::MutableHandleValue rval); +using ModuleResolveHook = JSObject* (*)(JSContext*, HandleObject, HandleString); + /** - * Get the HostResolveImportedModule hook for a global. + * Get the HostResolveImportedModule hook for the runtime. */ -extern JS_PUBLIC_API(JSFunction*) -GetModuleResolveHook(JSContext* cx); +extern JS_PUBLIC_API(ModuleResolveHook) +GetModuleResolveHook(JSRuntime* rt); /** - * Set the HostResolveImportedModule hook for a global to the given function. + * Set the HostResolveImportedModule hook for the runtime to the given function. */ extern JS_PUBLIC_API(void) -SetModuleResolveHook(JSContext* cx, JS::HandleFunction func); +SetModuleResolveHook(JSRuntime* rt, ModuleResolveHook func); /** * Parse the given source buffer as a module in the scope of the current global -- cgit v1.2.3