Bug 445004. Make the base and document URI of document.written documents be the
base and document URI of the document on whose current context our code is running. r+sr=jst, r=dcamp Bug 465752. Fix Equals() to work right on javascript: URIs. r=dcamp, sr=jst. Both a=ss git-svn-id: svn://10.0.0.236/trunk@255943 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -2087,10 +2087,13 @@ nsHTMLDocument::OpenCommon(const nsACString& aContentType, PRBool aReplace)
|
||||
do_QueryInterface(nsContentUtils::GetDocumentFromContext());
|
||||
|
||||
// Grab a reference to the calling documents security info (if any)
|
||||
// and principal as it may be lost in the call to Reset().
|
||||
// and URIs as they may be lost in the call to Reset().
|
||||
nsCOMPtr<nsISupports> securityInfo;
|
||||
nsCOMPtr<nsIURI> uri, baseURI;
|
||||
if (callerDoc) {
|
||||
securityInfo = callerDoc->GetSecurityInfo();
|
||||
uri = callerDoc->GetDocumentURI();
|
||||
baseURI = callerDoc->GetBaseURI();
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIPrincipal> callerPrincipal;
|
||||
@@ -2121,18 +2124,6 @@ nsHTMLDocument::OpenCommon(const nsACString& aContentType, PRBool aReplace)
|
||||
return NS_ERROR_DOM_SECURITY_ERR;
|
||||
}
|
||||
|
||||
// The URI for the document after this call. Get it from the calling
|
||||
// principal (if available), or set it to "about:blank" if no
|
||||
// principal is reachable.
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
callerPrincipal->GetURI(getter_AddRefs(uri));
|
||||
|
||||
if (!uri) {
|
||||
rv = NS_NewURI(getter_AddRefs(uri),
|
||||
NS_LITERAL_CSTRING("about:blank"));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
// Stop current loads targeted at the window this document is in.
|
||||
if (mScriptGlobalObject) {
|
||||
nsCOMPtr<nsIContentViewer> cv;
|
||||
@@ -2164,6 +2155,9 @@ nsHTMLDocument::OpenCommon(const nsACString& aContentType, PRBool aReplace)
|
||||
return rv;
|
||||
}
|
||||
|
||||
// We can't depend on channels implementing property bags, so do our
|
||||
// base URI manually after reset.
|
||||
|
||||
// Set the caller principal, if any, on the channel so that we'll
|
||||
// make sure to use it when we reset.
|
||||
rv = channel->SetOwner(callerPrincipal);
|
||||
@@ -2236,6 +2230,9 @@ nsHTMLDocument::OpenCommon(const nsACString& aContentType, PRBool aReplace)
|
||||
// null.
|
||||
|
||||
Reset(channel, group);
|
||||
if (baseURI) {
|
||||
mDocumentBaseURI = baseURI;
|
||||
}
|
||||
|
||||
if (root) {
|
||||
// Tear down the frames for the root element.
|
||||
|
||||
Reference in New Issue
Block a user