Pull the fix for bug 387979 into the Firefox/Tbird 2.0.0.5 release. r,sr,a=dveditz, sr=jst
git-svn-id: svn://10.0.0.236/branches/GECKO181_20070712_RELBRANCH@229920 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -7594,7 +7594,7 @@ nsDocShell::AddToSessionHistory(nsIURI * aURI,
|
||||
#endif
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
nsCOMPtr<nsISHEntry> entry;
|
||||
nsCOMPtr<nsISHEntry_MOZILLA_1_8_BRANCH> entry;
|
||||
PRBool shouldPersist;
|
||||
|
||||
shouldPersist = ShouldAddToSessionHistory(aURI);
|
||||
@@ -7610,7 +7610,7 @@ nsDocShell::AddToSessionHistory(nsIURI * aURI,
|
||||
if (LOAD_TYPE_HAS_FLAGS(mLoadType, LOAD_FLAGS_REPLACE_HISTORY) &&
|
||||
root != NS_STATIC_CAST(nsIDocShellTreeItem *, this)) {
|
||||
// This is a subframe
|
||||
entry = mOSHE;
|
||||
entry = do_QueryInterface(mOSHE);
|
||||
nsCOMPtr<nsISHContainer> shContainer(do_QueryInterface(entry));
|
||||
if (shContainer) {
|
||||
PRInt32 childCount = 0;
|
||||
@@ -7638,6 +7638,7 @@ nsDocShell::AddToSessionHistory(nsIURI * aURI,
|
||||
nsCOMPtr<nsIURI> referrerURI;
|
||||
nsCOMPtr<nsISupports> cacheKey;
|
||||
nsCOMPtr<nsISupports> cacheToken;
|
||||
nsCOMPtr<nsISupports> owner;
|
||||
PRBool expired = PR_FALSE;
|
||||
PRBool discardLayoutState = PR_FALSE;
|
||||
if (aChannel) {
|
||||
@@ -7665,15 +7666,17 @@ nsDocShell::AddToSessionHistory(nsIURI * aURI,
|
||||
|
||||
discardLayoutState = ShouldDiscardLayoutState(httpChannel);
|
||||
}
|
||||
aChannel->GetOwner(getter_AddRefs(owner));
|
||||
}
|
||||
|
||||
//Title is set in nsDocShell::SetTitle()
|
||||
entry->Create(aURI, // uri
|
||||
EmptyString(), // Title
|
||||
inputStream, // Post data stream
|
||||
nsnull, // LayoutHistory state
|
||||
cacheKey, // CacheKey
|
||||
mContentTypeHint); // Content-type
|
||||
entry->Create_MOZILLA_1_8_BRANCH(aURI, // uri
|
||||
EmptyString(), // Title
|
||||
inputStream, // Post data stream
|
||||
nsnull, // LayoutHistory state
|
||||
cacheKey, // CacheKey
|
||||
mContentTypeHint, // Content-type
|
||||
owner); // Channel owner
|
||||
entry->SetReferrerURI(referrerURI);
|
||||
/* If cache got a 'no-store', ask SH not to store
|
||||
* HistoryLayoutState. By default, SH will set this
|
||||
@@ -7751,6 +7754,7 @@ nsDocShell::LoadHistoryEntry(nsISHEntry * aEntry, PRUint32 aLoadType)
|
||||
nsCOMPtr<nsIInputStream> postData;
|
||||
nsCOMPtr<nsIURI> referrerURI;
|
||||
nsCAutoString contentType;
|
||||
nsCOMPtr<nsISupports> owner;
|
||||
|
||||
NS_ENSURE_TRUE(aEntry, NS_ERROR_FAILURE);
|
||||
|
||||
@@ -7761,6 +7765,13 @@ nsDocShell::LoadHistoryEntry(nsISHEntry * aEntry, PRUint32 aLoadType)
|
||||
NS_ERROR_FAILURE);
|
||||
NS_ENSURE_SUCCESS(aEntry->GetContentType(contentType), NS_ERROR_FAILURE);
|
||||
|
||||
nsCOMPtr<nsISHEntry_MOZILLA_1_8_BRANCH> branchEntry =
|
||||
do_QueryInterface(aEntry);
|
||||
NS_ENSURE_TRUE(branchEntry, NS_ERROR_UNEXPECTED);
|
||||
NS_ENSURE_SUCCESS(branchEntry->GetOwner(getter_AddRefs(owner)),
|
||||
NS_ERROR_FAILURE);
|
||||
|
||||
|
||||
PRBool isJavaScript, isViewSource, isData;
|
||||
// Calling CreateAboutBlankContentViewer can set mOSHE to null, and if
|
||||
// that's the only thing holding a ref to aEntry that will cause aEntry to
|
||||
@@ -7784,6 +7795,20 @@ nsDocShell::LoadHistoryEntry(nsISHEntry * aEntry, PRUint32 aLoadType)
|
||||
// user prevented it). Interrupt the history load.
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if (!owner) {
|
||||
// Ensure that we have an owner, just to make sure that nothing
|
||||
// reuses the principal of the about:blank page that just got
|
||||
// created.
|
||||
nsCOMPtr<nsIScriptSecurityManager> secMan =
|
||||
do_GetService(NS_SCRIPTSECURITYMANAGER_CONTRACTID, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIPrincipal> prin;
|
||||
secMan->GetCodebasePrincipal(uri, getter_AddRefs(prin));
|
||||
owner = prin;
|
||||
NS_ENSURE_TRUE(owner, NS_ERROR_OUT_OF_MEMORY);
|
||||
}
|
||||
}
|
||||
|
||||
/* If there is a valid postdata *and* the user pressed
|
||||
@@ -7816,7 +7841,7 @@ nsDocShell::LoadHistoryEntry(nsISHEntry * aEntry, PRUint32 aLoadType)
|
||||
|
||||
rv = InternalLoad(uri,
|
||||
referrerURI,
|
||||
nsnull, // No owner
|
||||
owner,
|
||||
INTERNAL_LOAD_FLAGS_NONE, // Do not inherit owner from document (security-critical!)
|
||||
nsnull, // No window target
|
||||
contentType.get(), // Type hint
|
||||
|
||||
Reference in New Issue
Block a user