Bug 1492648 - Move from nsDocShellLoadInfo to nsDocShellLoadState r=bzbarsky,nika
Creates the nsDocShellLoadState object, which is basically nsDocShellLoadInfo plus a few extra fields to make it usable as a single argument to nsDocShell::LoadURI (and eventually nsDocShell::InternalLoad). Subframe history handling is a huge logic block in nsDocShell::LoadURI, which is only used on history loads. This patch also extracts the logic out into its own function to make the body of LoadURI clearer. Differential Revision: https://phabricator.services.mozilla.com/D6944
This commit is contained in:
@@ -22,7 +22,7 @@
|
||||
#include "nsIBaseWindow.h"
|
||||
#include "nsIBrowserDOMWindow.h"
|
||||
#include "nsIDocShell.h"
|
||||
#include "nsDocShellLoadInfo.h"
|
||||
#include "nsDocShellLoadState.h"
|
||||
#include "nsIDocShellTreeItem.h"
|
||||
#include "nsIDocShellTreeOwner.h"
|
||||
#include "nsIDocumentLoader.h"
|
||||
@@ -325,7 +325,7 @@ nsWindowWatcher::OpenWindow(mozIDOMWindowProxy* aParent,
|
||||
/* navigate = */ true, argv,
|
||||
/* aIsPopupSpam = */ false,
|
||||
/* aForceNoOpener = */ false,
|
||||
/* aLoadInfo = */ nullptr,
|
||||
/* aLoadState = */ nullptr,
|
||||
aResult);
|
||||
}
|
||||
|
||||
@@ -391,7 +391,7 @@ nsWindowWatcher::OpenWindow2(mozIDOMWindowProxy* aParent,
|
||||
nsISupports* aArguments,
|
||||
bool aIsPopupSpam,
|
||||
bool aForceNoOpener,
|
||||
nsDocShellLoadInfo* aLoadInfo,
|
||||
nsDocShellLoadState* aLoadState,
|
||||
mozIDOMWindowProxy** aResult)
|
||||
{
|
||||
nsCOMPtr<nsIArray> argv = ConvertArgsToArray(aArguments);
|
||||
@@ -412,7 +412,7 @@ nsWindowWatcher::OpenWindow2(mozIDOMWindowProxy* aParent,
|
||||
return OpenWindowInternal(aParent, aUrl, aName, aFeatures,
|
||||
aCalledFromScript, dialog,
|
||||
aNavigate, argv, aIsPopupSpam,
|
||||
aForceNoOpener, aLoadInfo, aResult);
|
||||
aForceNoOpener, aLoadState, aResult);
|
||||
}
|
||||
|
||||
// This static function checks if the aDocShell uses an UserContextId equal to
|
||||
@@ -637,7 +637,7 @@ nsWindowWatcher::OpenWindowInternal(mozIDOMWindowProxy* aParent,
|
||||
nsIArray* aArgv,
|
||||
bool aIsPopupSpam,
|
||||
bool aForceNoOpener,
|
||||
nsDocShellLoadInfo* aLoadInfo,
|
||||
nsDocShellLoadState* aLoadState,
|
||||
mozIDOMWindowProxy** aResult)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
@@ -821,7 +821,7 @@ nsWindowWatcher::OpenWindowInternal(mozIDOMWindowProxy* aParent,
|
||||
sizeSpec.PositionSpecified(),
|
||||
sizeSpec.SizeSpecified(),
|
||||
uriToLoad, name, features, aForceNoOpener,
|
||||
aLoadInfo, &windowIsNew,
|
||||
aLoadState, &windowIsNew,
|
||||
getter_AddRefs(newWindow));
|
||||
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
@@ -1118,12 +1118,12 @@ nsWindowWatcher::OpenWindowInternal(mozIDOMWindowProxy* aParent,
|
||||
}
|
||||
}
|
||||
|
||||
RefPtr<nsDocShellLoadInfo> loadInfo = aLoadInfo;
|
||||
if (uriToLoad && aNavigate && !loadInfo) {
|
||||
loadInfo = new nsDocShellLoadInfo();
|
||||
RefPtr<nsDocShellLoadState> loadState = aLoadState;
|
||||
if (uriToLoad && aNavigate && !loadState) {
|
||||
loadState = new nsDocShellLoadState();
|
||||
|
||||
if (subjectPrincipal) {
|
||||
loadInfo->SetTriggeringPrincipal(subjectPrincipal);
|
||||
loadState->SetTriggeringPrincipal(subjectPrincipal);
|
||||
}
|
||||
|
||||
/* use the URL from the *extant* document, if any. The usual accessor
|
||||
@@ -1138,8 +1138,8 @@ nsWindowWatcher::OpenWindowInternal(mozIDOMWindowProxy* aParent,
|
||||
}
|
||||
if (doc) {
|
||||
// Set the referrer
|
||||
loadInfo->SetReferrer(doc->GetDocumentURI());
|
||||
loadInfo->SetReferrerPolicy(doc->GetReferrerPolicy());
|
||||
loadState->SetReferrer(doc->GetDocumentURI());
|
||||
loadState->SetReferrerPolicy(doc->GetReferrerPolicy());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1181,13 +1181,13 @@ nsWindowWatcher::OpenWindowInternal(mozIDOMWindowProxy* aParent,
|
||||
}
|
||||
|
||||
if (uriToLoad && aNavigate) {
|
||||
newDocShell->LoadURI(
|
||||
uriToLoad,
|
||||
loadInfo,
|
||||
windowIsNew ?
|
||||
loadState->SetURI(uriToLoad);
|
||||
loadState->SetLoadFlags(windowIsNew ?
|
||||
static_cast<uint32_t>(nsIWebNavigation::LOAD_FLAGS_FIRST_LOAD) :
|
||||
static_cast<uint32_t>(nsIWebNavigation::LOAD_FLAGS_NONE),
|
||||
true);
|
||||
static_cast<uint32_t>(nsIWebNavigation::LOAD_FLAGS_NONE));
|
||||
loadState->SetFirstParty(true);
|
||||
// Should this pay attention to errors returned by LoadURI?
|
||||
newDocShell->LoadURI(loadState);
|
||||
}
|
||||
|
||||
// Copy the current session storage for the current domain. Don't perform the
|
||||
|
||||
Reference in New Issue
Block a user