diff --git a/mozilla/content/html/document/src/nsHTMLDocument.cpp b/mozilla/content/html/document/src/nsHTMLDocument.cpp
index 22bdbfd6c77..cc033dec199 100644
--- a/mozilla/content/html/document/src/nsHTMLDocument.cpp
+++ b/mozilla/content/html/document/src/nsHTMLDocument.cpp
@@ -1826,21 +1826,6 @@ nsHTMLDocument::SetCookie(const nsAString& aCookie)
return NS_OK;
}
-// static
-nsIPrincipal *
-nsHTMLDocument::GetCallerPrincipal()
-{
- // XXX This will fail on non-DOM contexts :(
- nsIDOMDocument *domDoc = nsContentUtils::GetDocumentFromCaller();
-
- nsCOMPtr doc(do_QueryInterface(domDoc));
- if (!doc) {
- return nsnull; // No document in the window
- }
-
- return doc->GetPrincipal();
-}
-
// XXX TBI: accepting arguments to the open method.
nsresult
nsHTMLDocument::OpenCommon(const nsACString& aContentType, PRBool aReplace)
@@ -1868,7 +1853,9 @@ nsHTMLDocument::OpenCommon(const nsACString& aContentType, PRBool aReplace)
if (callerDoc) {
securityInfo = callerDoc->GetSecurityInfo();
- callerPrincipal = GetCallerPrincipal();
+
+ nsContentUtils::GetSecurityManager()->
+ GetSubjectPrincipal(getter_AddRefs(callerPrincipal));
}
// The URI for the document after this call. Get it from the calling
diff --git a/mozilla/content/html/document/src/nsHTMLDocument.h b/mozilla/content/html/document/src/nsHTMLDocument.h
index 4d70dfca015..46b79d6e616 100644
--- a/mozilla/content/html/document/src/nsHTMLDocument.h
+++ b/mozilla/content/html/document/src/nsHTMLDocument.h
@@ -229,8 +229,6 @@ protected:
static PRBool MatchNameAttribute(nsIContent* aContent, PRInt32 aNamespaceID,
nsIAtom* aAtom, const nsAString& aData);
- static nsIPrincipal *GetCallerPrincipal();
-
static void DocumentWriteTerminationFunc(nsISupports *aRef);
PRBool GetBodyContent();