Fixing bug 253121. Make wyciwyg channels and documents carry the source channels security info. r=darin@meer.net, sr=bzbarsky@mit.edu
git-svn-id: svn://10.0.0.236/trunk@159942 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -723,6 +723,9 @@ nsHTMLDocument::StartDocumentLoad(const char* aCommand,
|
||||
return rv;
|
||||
}
|
||||
|
||||
// Store the security info for future use with wyciwyg channels.
|
||||
aChannel->GetSecurityInfo(getter_AddRefs(mSecurityInfo));
|
||||
|
||||
// Stash away a pointer to our channel (we need this for cookies)
|
||||
mChannel = aChannel;
|
||||
|
||||
@@ -1968,6 +1971,17 @@ nsHTMLDocument::OpenCommon(nsIURI* aSourceURI, const nsACString& aContentType,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDocument> callingDoc =
|
||||
do_QueryInterface(nsContentUtils::GetDocumentFromCaller());
|
||||
|
||||
// Grab a reference to the calling documents security info (if any)
|
||||
// as it may be lost in the call to Reset().
|
||||
nsCOMPtr<nsISupports> securityInfo;
|
||||
|
||||
if (callingDoc) {
|
||||
securityInfo = callingDoc->GetSecurityInfo();
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDocShell> docshell = do_QueryReferent(mDocumentContainer);
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
@@ -2073,6 +2087,10 @@ nsHTMLDocument::OpenCommon(nsIURI* aSourceURI, const nsACString& aContentType,
|
||||
mRootContent = root;
|
||||
}
|
||||
|
||||
// Store the security info of the caller now that we're done
|
||||
// resetting the document.
|
||||
mSecurityInfo = securityInfo;
|
||||
|
||||
mParser = do_CreateInstance(kCParserCID, &rv);
|
||||
|
||||
// This will be propagated to the parser when someone actually calls write()
|
||||
@@ -3507,11 +3525,14 @@ nsHTMLDocument::CreateAndAddWyciwygChannel(void)
|
||||
nsCOMPtr<nsIChannel> channel;
|
||||
// Create a wyciwyg Channel
|
||||
rv = NS_NewChannel(getter_AddRefs(channel), wcwgURI);
|
||||
if (NS_SUCCEEDED(rv) && channel) {
|
||||
mWyciwygChannel = do_QueryInterface(channel);
|
||||
// Inherit load flags from the original document's channel
|
||||
channel->SetLoadFlags(mLoadFlags);
|
||||
}
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
mWyciwygChannel = do_QueryInterface(channel);
|
||||
|
||||
mWyciwygChannel->SetSecurityInfo(mSecurityInfo);
|
||||
|
||||
// Inherit load flags from the original document's channel
|
||||
channel->SetLoadFlags(mLoadFlags);
|
||||
|
||||
nsCOMPtr<nsILoadGroup> loadGroup = GetDocumentLoadGroup();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user