Bug 708215 - Report errors from the safe JS context. r=bent

This commit is contained in:
Blake Kaplan 2011-12-07 18:12:20 +08:00
parent a2b9f740f0
commit b25121961d

View File

@ -206,6 +206,11 @@ static JSClass global_class = {
JSCLASS_NO_OPTIONAL_MEMBERS
};
// We just use the same reporter as the component loader
// XXX #include angels cry.
extern void
mozJSLoaderErrorReporter(JSContext *cx, const char *message, JSErrorReport *rep);
/* attribute JSContext safeJSContext; */
NS_IMETHODIMP
XPCJSContextStack::GetSafeJSContext(JSContext * *aSafeJSContext)
@ -238,6 +243,8 @@ XPCJSContextStack::GetSafeJSContext(JSContext * *aSafeJSContext)
// scoped JS Request
JSAutoRequest req(mSafeJSContext);
JS_SetErrorReporter(mSafeJSContext, mozJSLoaderErrorReporter);
// Because we can run off the main thread, we create an MT
// global object. Our principal is the unique key.
JSCompartment *compartment;