author | Johnny Stenback <jst@mozilla.com> |
Thu, 06 Jan 2011 18:07:46 -0800 | |
changeset 60103 | f93c5678d642e3791ec1e9edaed3bccf672b24c5 |
parent 60102 | 190141eeebaaa5d452fee1079bc6f79fe4aaab06 |
child 60104 | 40d3ac45451f9dd045ad801e57bbf2046e1db9f3 |
push id | 17863 |
push user | jst@mozilla.com |
push date | Fri, 07 Jan 2011 05:29:39 +0000 |
treeherder | mozilla-central@f93c5678d642 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | bzbarsky, blocker |
bugs | 606058 |
milestone | 2.0b9pre |
first release with | nightly linux32
f93c5678d642
/
4.0b9pre
/
20110107030356
/
files
nightly linux64
f93c5678d642
/
4.0b9pre
/
20110107030356
/
files
nightly mac
f93c5678d642
/
4.0b9pre
/
20110107030356
/
files
nightly win32
f93c5678d642
/
4.0b9pre
/
20110107030356
/
files
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
releases | nightly linux32
4.0b9pre
/
20110107030356
/
pushlog to previous
nightly linux64
4.0b9pre
/
20110107030356
/
pushlog to previous
nightly mac
4.0b9pre
/
20110107030356
/
pushlog to previous
nightly win32
4.0b9pre
/
20110107030356
/
pushlog to previous
|
--- a/content/xul/document/src/nsXULDocument.cpp +++ b/content/xul/document/src/nsXULDocument.cpp @@ -2771,17 +2771,29 @@ nsXULDocument::LoadOverlayInternal(nsIUR if (! parserObserver) return NS_ERROR_OUT_OF_MEMORY; NS_ADDREF(parserObserver); parser->Parse(aURI, parserObserver); NS_RELEASE(parserObserver); nsCOMPtr<nsILoadGroup> group = do_QueryReferent(mDocumentLoadGroup); - rv = NS_OpenURI(listener, nsnull, aURI, nsnull, group); + nsCOMPtr<nsIChannel> channel; + rv = NS_NewChannel(getter_AddRefs(channel), aURI, nsnull, group); + + if (NS_SUCCEEDED(rv)) { + // Set the owner of the channel to be our principal so + // that the overlay's JSObjects etc end up being created + // with the right principal and in the correct + // compartment. + channel->SetOwner(NodePrincipal()); + + rv = channel->AsyncOpen(listener, nsnull); + } + if (NS_FAILED(rv)) { // Abandon this prototype mCurrentPrototype = nsnull; // The parser won't get an OnStartRequest and // OnStopRequest, so it needs a Terminate. parser->Terminate(); @@ -4526,17 +4538,17 @@ nsXULDocument::ParserObserver::OnStartRe if (mPrototype) { nsCOMPtr<nsIChannel> channel = do_QueryInterface(request); nsIScriptSecurityManager* secMan = nsContentUtils::GetSecurityManager(); if (channel && secMan) { nsCOMPtr<nsIPrincipal> principal; secMan->GetChannelPrincipal(channel, getter_AddRefs(principal)); // Failure there is ok -- it'll just set a (safe) null principal - mPrototype->SetDocumentPrincipal(principal); + mPrototype->SetDocumentPrincipal(principal); } // Make sure to avoid cycles mPrototype = nsnull; } return NS_OK; }