Bug 480430 followup -- don't wrap when the scopes are actually the same (even if they don't have principals.

This commit is contained in:
Blake Kaplan 2009-03-03 16:45:59 -08:00
parent 69b42859dd
commit 471bb67580

View File

@ -731,12 +731,14 @@ xpc_NewSystemInheritingJSObject(JSContext *cx, JSClass *clasp, JSObject *proto,
inline JSBool
xpc_SameOrigin(XPCWrappedNativeScope *objectscope, XPCWrappedNativeScope *xpcscope)
{
PRBool sameOrigin;
if(objectscope == xpcscope)
return JS_TRUE;
nsIPrincipal *objectprincipal = objectscope->GetPrincipal();
nsIPrincipal *xpcprincipal = xpcscope->GetPrincipal();
if((!objectprincipal || !xpcprincipal) &&
(!(sameOrigin = objectscope == xpcscope) ||
NS_FAILED(objectprincipal->Equals(xpcprincipal, &sameOrigin))))
PRBool sameOrigin;
if(!objectprincipal || !xpcprincipal ||
NS_FAILED(objectprincipal->Equals(xpcprincipal, &sameOrigin)))
{
return JS_FALSE;
}