Bug 981218 - Stop using default compartment objects in nsJSUtils.cpp. r=bobowen

This commit is contained in:
Bobby Holley 2014-08-21 17:13:50 -07:00
parent 43e0dc6c0c
commit 3072f32a30

View File

@ -103,8 +103,7 @@ nsJSUtils::ReportPendingException(JSContext *aContext)
// otherwise default global) of aContext, so use that here.
nsIScriptContext* scx = GetScriptContextFromJSContext(aContext);
JS::Rooted<JSObject*> scope(aContext);
scope = scx ? scx->GetWindowProxy()
: js::DefaultObjectForContextOrNull(aContext);
scope = scx ? scx->GetWindowProxy() : nullptr;
if (!scope) {
// The SafeJSContext has no default object associated with it.
MOZ_ASSERT(NS_IsMainThread());
@ -319,8 +318,5 @@ JSObject* GetDefaultScopeFromJSContext(JSContext *cx)
// the cx, so in those cases we need to fetch it via the scx
// instead.
nsIScriptContext *scx = GetScriptContextFromJSContext(cx);
if (scx) {
return scx->GetWindowProxy();
}
return js::DefaultObjectForContextOrNull(cx);
return scx ? scx->GetWindowProxy() : nullptr;
}