Backed out changeset 37357ffceb05 (bug 802366)
authorJustin Lebar <justin.lebar@gmail.com>
Tue, 30 Oct 2012 21:36:32 -0400
changeset 111984 2729e28870beae00ee11f722dba6ef45151e34b5
parent 111983 039573154dcf70dfcfe4caca559a0846cff04cd4
child 111985 b103561f6a8b232c6acd6f9fd15d928174db67e3
push id93
push usernmatsakis@mozilla.com
push dateWed, 31 Oct 2012 21:26:57 +0000
bugs802366
milestone19.0a1
backs out37357ffceb05b6bfad93f1c150feceb4b02977c8
Backed out changeset 37357ffceb05 (bug 802366)
caps/src/nsScriptSecurityManager.cpp
--- a/caps/src/nsScriptSecurityManager.cpp
+++ b/caps/src/nsScriptSecurityManager.cpp
@@ -330,25 +330,29 @@ nsScriptSecurityManager::GetChannelPrinc
     }
 
     // OK, get the principal from the URI.  Make sure this does the same thing
     // as nsDocument::Reset and nsXULDocument::StartDocumentLoad.
     nsCOMPtr<nsIURI> uri;
     nsresult rv = NS_GetFinalChannelURI(aChannel, getter_AddRefs(uri));
     NS_ENSURE_SUCCESS(rv, rv);
 
+    uint32_t appId = UNKNOWN_APP_ID;
+    bool isInBrowserElement = false;
+
     nsCOMPtr<nsIDocShell> docShell;
     NS_QueryNotificationCallbacks(aChannel, docShell);
 
     if (docShell) {
-        return GetDocShellCodebasePrincipal(uri, docShell, aPrincipal);
+        docShell->GetAppId(&appId);
+        docShell->GetIsInBrowserElement(&isInBrowserElement);
     }
 
-    return GetCodebasePrincipalInternal(uri, UNKNOWN_APP_ID,
-        /* isInBrowserElement */ false, aPrincipal);
+    return GetCodebasePrincipalInternal(uri, appId, isInBrowserElement,
+                                        aPrincipal);
 }
 
 NS_IMETHODIMP
 nsScriptSecurityManager::IsSystemPrincipal(nsIPrincipal* aPrincipal,
                                            bool* aIsSystem)
 {
     *aIsSystem = (aPrincipal == mSystemPrincipal);
     return NS_OK;
@@ -1889,19 +1893,24 @@ nsScriptSecurityManager::GetAppCodebaseP
   return GetCodebasePrincipalInternal(aURI, aAppId, aInMozBrowser, aPrincipal);
 }
 
 NS_IMETHODIMP
 nsScriptSecurityManager::GetDocShellCodebasePrincipal(nsIURI* aURI,
                                                       nsIDocShell* aDocShell,
                                                       nsIPrincipal** aPrincipal)
 {
-  return GetCodebasePrincipalInternal(aURI,
-                                      aDocShell->GetAppId(),
-                                      aDocShell->GetIsInBrowserElement(),
+  MOZ_ASSERT(aDocShell);
+
+  uint32_t appId;
+  bool isInBrowserElement;
+  aDocShell->GetAppId(&appId);
+  aDocShell->GetIsInBrowserElement(&isInBrowserElement);
+
+  return GetCodebasePrincipalInternal(aURI, appId, isInBrowserElement,
                                       aPrincipal);
 }
 
 nsresult
 nsScriptSecurityManager::GetCodebasePrincipalInternal(nsIURI *aURI,
                                                       uint32_t aAppId,
                                                       bool aInMozBrowser,
                                                       nsIPrincipal **result)