Bug 723808 followup: fix shared builds by avoiding use of nsContentUtils::IsSystemPrincipal, r=bz, a=bustage default
authorGavin Sharp <gavin@gavinsharp.com>
Tue, 06 Mar 2012 11:19:40 -0800
changeset 35281 c00a4ef21ac24f47702571b6274039655ab5bb07
parent 35280 0fec8d30c3914ce6b743cac47ac5ac32e261532d
child 35288 d0c0f3cb8ba67593b229bf279463702c5c79d28b
push id2033
push usergsharp@mozilla.com
push dateTue, 06 Mar 2012 19:36:36 +0000
reviewersbz, bustage
bugs723808
milestone1.9.2.29pre
Bug 723808 followup: fix shared builds by avoiding use of nsContentUtils::IsSystemPrincipal, r=bz, a=bustage
docshell/base/nsDocShell.cpp
--- a/docshell/base/nsDocShell.cpp
+++ b/docshell/base/nsDocShell.cpp
@@ -8125,20 +8125,27 @@ nsDocShell::GetInheritedPrincipal(PRBool
     }
 
     //-- Get the document's principal
     if (document) {
         nsIPrincipal *docPrincipal = document->NodePrincipal();
 
         // Don't allow loads in typeContent docShells to inherit the system
         // principal from existing documents.
-        if (inheritedFromCurrent &&
-            mItemType == typeContent &&
-            nsContentUtils::IsSystemPrincipal(docPrincipal)) {
-            return nsnull;
+        if (inheritedFromCurrent && mItemType == typeContent) {
+            PRBool isSystem;
+            nsresult rv;
+            nsCOMPtr<nsIScriptSecurityManager> secMan =
+                do_GetService(NS_SCRIPTSECURITYMANAGER_CONTRACTID, &rv);
+            NS_ENSURE_SUCCESS(rv, nsnull);
+            rv = secMan->IsSystemPrincipal(docPrincipal, &isSystem);
+            NS_ENSURE_SUCCESS(rv, nsnull);
+
+            if (isSystem)
+                return nsnull;
         }
 
         return docPrincipal;
     }
 
     return nsnull;
 }