diff --git a/glue.rs b/glue.rs index 275a50551..06a317863 100644 --- a/glue.rs +++ b/glue.rs @@ -175,4 +175,5 @@ pub fn GetProxyHandlerExtra(obj: *JSObject) -> *libc::c_void; pub fn GetProxyHandler(obj: *JSObject) -> *libc::c_void; pub fn InvokeGetOwnPropertyDescriptor(handler: *libc::c_void, cx: *JSContext, proxy: *JSObject, id: jsid, set: JSBool, desc: *mut JSPropertyDescriptor) -> JSBool; pub fn GetGlobalForObjectCrossCompartment(obj: *JSObject) -> *JSObject; +pub fn ReportError(cx: *JSContext, error: *c_char); } diff --git a/jsglue.cpp b/jsglue.cpp index b9d9b3bae..b27624a16 100644 --- a/jsglue.cpp +++ b/jsglue.cpp @@ -622,4 +622,15 @@ GetGlobalForObjectCrossCompartment(JSObject* obj) return js::GetGlobalForObjectCrossCompartment(obj); } +void +ReportError(JSContext* aCx, const char* aError) +{ +#ifdef DEBUG + for (const char* p = aError; *p; ++p) { + assert(*p != '%'); + } +#endif + JS_ReportError(aCx, aError); +} + } // extern "C"