From d40336857f3b35a8c8d49b92de80a422b6b573e1 Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Thu, 5 Dec 2013 16:03:09 +0100 Subject: [PATCH] Implement a ReportError for the no-variadic-arguments form of JS_ReportError. --- glue.rs | 1 + jsglue.cpp | 11 +++++++++++ 2 files changed, 12 insertions(+) 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"