Bug 723808 followup: fix shared builds by avoiding use of nsContentUtils::IsSystemPrincipal, r=bz, a=bustage CAMINO_2_1_2_MINIBRANCH CAMINO_2_1_2_RELEASE
authorGavin Sharp <gavin@gavinsharp.com>
Tue, 06 Mar 2012 11:19:40 -0800
branchCAMINO_2_1_2_MINIBRANCH
changeset 35286 7e57b6f4d41bcc52da96282d0886fda1e88579d4
parent 35285 26f18d41a88a546635db903f8d8ae617b84dfecf
child 35287 1057d77f1d4907827af95b3fa3b9d1fd17ee6289
push id2036
push useralqahira@ardisson.org
push dateFri, 09 Mar 2012 02:38:48 +0000
reviewersbz, bustage
bugs723808
milestone1.9.2.28
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;
 }