Bug 979481 - Don't depend on the default global for the SafeJSContext in nsJSUtils::ReportPendingException. r=bz

This commit is contained in:
Bobby Holley 2014-03-26 10:59:03 -03:00
parent 2eb7cd279e
commit ed41a09c4d

View File

@ -120,6 +120,12 @@ nsJSUtils::ReportPendingException(JSContext *aContext)
JS::Rooted<JSObject*> scope(aContext);
scope = scx ? scx->GetWindowProxy()
: js::DefaultObjectForContextOrNull(aContext);
if (!scope) {
// The SafeJSContext has no default object associated with it.
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(aContext == nsContentUtils::GetSafeJSContext());
scope = xpc::GetSafeJSContextGlobal();
}
JSAutoCompartment ac(aContext, scope);
JS_ReportPendingException(aContext);
}