From b43d7a2d3687f211590a337503b1dbac8ce0ff29 Mon Sep 17 00:00:00 2001 From: Bobby Holley Date: Wed, 5 Sep 2012 11:32:07 -0700 Subject: [PATCH] Bug 771354 - Don't special-case principal assignment for chrome windows in nsGlobalWindow.cpp. r=bz --- dom/base/nsGlobalWindow.cpp | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/dom/base/nsGlobalWindow.cpp b/dom/base/nsGlobalWindow.cpp index 8f9db9f301e9..c52042e67e7b 100644 --- a/dom/base/nsGlobalWindow.cpp +++ b/dom/base/nsGlobalWindow.cpp @@ -1697,7 +1697,6 @@ static nsresult CreateNativeGlobalForInner(JSContext* aCx, nsGlobalWindow* aNewInner, nsIURI* aURI, - bool aIsChrome, nsIPrincipal* aPrincipal, JSObject** aNativeGlobal, nsIXPConnectJSObjectHolder** aHolder) @@ -1711,18 +1710,10 @@ CreateNativeGlobalForInner(JSContext* aCx, nsIXPConnect* xpc = nsContentUtils::XPConnect(); - nsCOMPtr systemPrincipal; - if (aIsChrome) { - nsIScriptSecurityManager* ssm = nsContentUtils::GetSecurityManager(); - ssm->GetSystemPrincipal(getter_AddRefs(systemPrincipal)); - MOZ_ASSERT(systemPrincipal); - } - nsRefPtr jsholder; nsresult rv = xpc->InitClassesWithNewWrappedGlobal( aCx, static_cast(aNewInner), - aIsChrome ? systemPrincipal.get() : aPrincipal, 0, - getter_AddRefs(jsholder)); + aPrincipal, 0, getter_AddRefs(jsholder)); NS_ENSURE_SUCCESS(rv, rv); MOZ_ASSERT(jsholder); @@ -1845,8 +1836,6 @@ nsGlobalWindow::SetNewDocument(nsIDocument* aDocument, bool thisChrome = IsChromeWindow(); - bool isChrome = false; - nsCxPusher cxPusher; if (!cxPusher.Push(cx)) { return NS_ERROR_FAILURE; @@ -1899,7 +1888,6 @@ nsGlobalWindow::SetNewDocument(nsIDocument* aDocument, NS_ASSERTION(newInnerWindow, "Got a state without inner window"); } else if (thisChrome) { newInnerWindow = new nsGlobalChromeWindow(this); - isChrome = true; } else if (mIsModalContentWindow) { newInnerWindow = new nsGlobalModalWindow(this); } else { @@ -1924,7 +1912,7 @@ nsGlobalWindow::SetNewDocument(nsIDocument* aDocument, // Every script context we are initialized with must create a // new global. rv = CreateNativeGlobalForInner(cx, newInnerWindow, - aDocument->GetDocumentURI(), isChrome, + aDocument->GetDocumentURI(), aDocument->NodePrincipal(), &newInnerWindow->mJSObject, getter_AddRefs(mInnerWindowHolder));