зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1578624 - P4: Add an option to set mIsNavigating on the docshell when loading using BrowsingContext. r=kmag
Differential Revision: https://phabricator.services.mozilla.com/D44760 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
cf962d7a54
Коммит
1696b97a9f
|
@ -806,7 +806,8 @@ void BrowsingContext::Location(JSContext* aCx,
|
|||
}
|
||||
|
||||
nsresult BrowsingContext::LoadURI(BrowsingContext* aAccessor,
|
||||
nsDocShellLoadState* aLoadState) {
|
||||
nsDocShellLoadState* aLoadState,
|
||||
bool aSetNavigating) {
|
||||
// Per spec, most load attempts are silently ignored when a BrowsingContext is
|
||||
// null (which in our code corresponds to discarded), so we simply fail
|
||||
// silently in those cases. Regardless, we cannot trigger loads in/from
|
||||
|
@ -816,12 +817,12 @@ nsresult BrowsingContext::LoadURI(BrowsingContext* aAccessor,
|
|||
}
|
||||
|
||||
if (mDocShell) {
|
||||
return mDocShell->LoadURI(aLoadState);
|
||||
return mDocShell->LoadURI(aLoadState, aSetNavigating);
|
||||
}
|
||||
|
||||
if (!aAccessor && XRE_IsParentProcess()) {
|
||||
Unused << Canonical()->GetCurrentWindowGlobal()->SendLoadURIInChild(
|
||||
aLoadState);
|
||||
aLoadState, aSetNavigating);
|
||||
} else {
|
||||
MOZ_DIAGNOSTIC_ASSERT(aAccessor);
|
||||
MOZ_DIAGNOSTIC_ASSERT(aAccessor->Group() == Group());
|
||||
|
@ -830,7 +831,7 @@ nsresult BrowsingContext::LoadURI(BrowsingContext* aAccessor,
|
|||
MOZ_DIAGNOSTIC_ASSERT(win);
|
||||
if (WindowGlobalChild* wgc =
|
||||
win->GetCurrentInnerWindow()->GetWindowGlobalChild()) {
|
||||
wgc->SendLoadURI(this, aLoadState);
|
||||
wgc->SendLoadURI(this, aLoadState, aSetNavigating);
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
|
|
|
@ -185,7 +185,8 @@ class BrowsingContext : public nsWrapperCache, public BrowsingContextBase {
|
|||
// Triggers a load in the process which currently owns this BrowsingContext.
|
||||
// aAccessor is the context which initiated the load, and may be null only for
|
||||
// in-process BrowsingContexts.
|
||||
nsresult LoadURI(BrowsingContext* aAccessor, nsDocShellLoadState* aLoadState);
|
||||
nsresult LoadURI(BrowsingContext* aAccessor, nsDocShellLoadState* aLoadState,
|
||||
bool aSetNavigating = false);
|
||||
|
||||
// Determine if the current BrowsingContext was 'cached' by the logic in
|
||||
// CacheChildren.
|
||||
|
|
|
@ -689,7 +689,7 @@ nsDocShell::SetCancelContentJSEpoch(int32_t aEpoch) {
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocShell::LoadURI(nsDocShellLoadState* aLoadState) {
|
||||
nsDocShell::LoadURI(nsDocShellLoadState* aLoadState, bool aSetNavigating) {
|
||||
MOZ_ASSERT(aLoadState, "Must have a valid load state!");
|
||||
MOZ_ASSERT(
|
||||
(aLoadState->LoadFlags() & INTERNAL_LOAD_FLAGS_LOADURI_SETUP_FLAGS) == 0,
|
||||
|
@ -704,6 +704,13 @@ nsDocShell::LoadURI(nsDocShellLoadState* aLoadState) {
|
|||
}
|
||||
}
|
||||
|
||||
bool oldIsNavigating = mIsNavigating;
|
||||
auto cleanupIsNavigating =
|
||||
MakeScopeExit([&]() { mIsNavigating = oldIsNavigating; });
|
||||
if (aSetNavigating) {
|
||||
mIsNavigating = true;
|
||||
}
|
||||
|
||||
PopupBlocker::PopupControlState popupState;
|
||||
if (aLoadState->LoadFlags() & LOAD_FLAGS_ALLOW_POPUPS) {
|
||||
popupState = PopupBlocker::openAllowed;
|
||||
|
@ -3848,8 +3855,7 @@ nsresult nsDocShell::LoadURI(const nsAString& aURI,
|
|||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
rv = LoadURI(loadState);
|
||||
return rv;
|
||||
return LoadURI(loadState, true);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -5740,7 +5746,7 @@ nsDocShell::ForceRefreshURI(nsIURI* aURI, nsIPrincipal* aPrincipal,
|
|||
* LoadURI(...) will cancel all refresh timers... This causes the
|
||||
* Timer and its refreshData instance to be released...
|
||||
*/
|
||||
LoadURI(loadState);
|
||||
LoadURI(loadState, false);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -84,9 +84,11 @@ interface nsIDocShell : nsIDocShellTreeItem
|
|||
* however, the URL dispatcher will go through its normal process of content
|
||||
* loading.
|
||||
*
|
||||
* @param loadState - This is the extended load info for this load.
|
||||
* @param aLoadState This is the extended load info for this load.
|
||||
* @param aSetNavigating If we should set isNavigating to true while initiating
|
||||
* the load.
|
||||
*/
|
||||
[noscript]void loadURI(in nsDocShellLoadStatePtr loadState);
|
||||
[noscript]void loadURI(in nsDocShellLoadStatePtr aLoadState, in boolean aSetNavigating);
|
||||
|
||||
/**
|
||||
* Do either a history.pushState() or history.replaceState() operation,
|
||||
|
|
|
@ -1482,5 +1482,5 @@ nsresult nsSHistory::InitiateLoad(nsISHEntry* aFrameEntry,
|
|||
loadState->SetCsp(csp);
|
||||
|
||||
// Time to initiate a document load
|
||||
return aFrameDS->LoadURI(loadState);
|
||||
return aFrameDS->LoadURI(loadState, false);
|
||||
}
|
||||
|
|
|
@ -667,7 +667,7 @@ nsresult nsFrameLoader::ReallyStartLoadingInternal() {
|
|||
mNeedsAsyncDestroy = true;
|
||||
loadState->SetLoadFlags(flags);
|
||||
loadState->SetFirstParty(false);
|
||||
rv = GetDocShell()->LoadURI(loadState);
|
||||
rv = GetDocShell()->LoadURI(loadState, false);
|
||||
mNeedsAsyncDestroy = tmpState;
|
||||
mURIToLoad = nullptr;
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
|
|
@ -238,7 +238,7 @@ RefPtr<ClientOpPromise> ClientNavigateOpChild::DoNavigate(
|
|||
loadState->SetSourceDocShell(docShell);
|
||||
loadState->SetLoadFlags(nsIWebNavigation::LOAD_FLAGS_NONE);
|
||||
loadState->SetFirstParty(true);
|
||||
rv = docShell->LoadURI(loadState);
|
||||
rv = docShell->LoadURI(loadState, false);
|
||||
if (NS_FAILED(rv)) {
|
||||
return ClientOpPromise::CreateAndReject(rv, __func__);
|
||||
}
|
||||
|
|
|
@ -53,7 +53,7 @@ child:
|
|||
*/
|
||||
async GetSecurityInfo() returns(nsCString? serializedSecInfo);
|
||||
|
||||
async LoadURIInChild(nsDocShellLoadState aLoadState);
|
||||
async LoadURIInChild(nsDocShellLoadState aLoadState, bool aSetNavigating);
|
||||
|
||||
both:
|
||||
async RawMessage(JSWindowActorMessageMeta aMetadata, ClonedMessageData aData);
|
||||
|
@ -62,7 +62,7 @@ parent:
|
|||
// Load the given URI load state into the current owner process of the given
|
||||
// BrowsingContext. aTargetBC must be in the same BrowsingContextGroup as this
|
||||
// window global.
|
||||
async LoadURI(BrowsingContext aTargetBC, nsDocShellLoadState aLoadState);
|
||||
async LoadURI(BrowsingContext aTargetBC, nsDocShellLoadState aLoadState, bool aSetNavigating);
|
||||
|
||||
/// Update the URI of the document in this WindowGlobal.
|
||||
async UpdateDocumentURI(nsIURI aUri);
|
||||
|
|
|
@ -234,8 +234,11 @@ void WindowGlobalChild::Destroy() {
|
|||
}
|
||||
|
||||
mozilla::ipc::IPCResult WindowGlobalChild::RecvLoadURIInChild(
|
||||
nsDocShellLoadState* aLoadState) {
|
||||
mWindowGlobal->GetDocShell()->LoadURI(aLoadState);
|
||||
nsDocShellLoadState* aLoadState, bool aSetNavigating) {
|
||||
mWindowGlobal->GetDocShell()->LoadURI(aLoadState, aSetNavigating);
|
||||
if (aSetNavigating) {
|
||||
mWindowGlobal->GetBrowserChild()->NotifyNavigationFinished();
|
||||
}
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
|
|
|
@ -114,7 +114,8 @@ class WindowGlobalChild final : public WindowGlobalActor,
|
|||
mozilla::ipc::IPCResult RecvRawMessage(const JSWindowActorMessageMeta& aMeta,
|
||||
const ClonedMessageData& aData);
|
||||
|
||||
mozilla::ipc::IPCResult RecvLoadURIInChild(nsDocShellLoadState* aLoadState);
|
||||
mozilla::ipc::IPCResult RecvLoadURIInChild(nsDocShellLoadState* aLoadState,
|
||||
bool aSetNavigating);
|
||||
|
||||
mozilla::ipc::IPCResult RecvChangeFrameRemoteness(
|
||||
dom::BrowsingContext* aBc, const nsString& aRemoteType,
|
||||
|
|
|
@ -175,7 +175,8 @@ bool WindowGlobalParent::IsProcessRoot() {
|
|||
}
|
||||
|
||||
mozilla::ipc::IPCResult WindowGlobalParent::RecvLoadURI(
|
||||
dom::BrowsingContext* aTargetBC, nsDocShellLoadState* aLoadState) {
|
||||
dom::BrowsingContext* aTargetBC, nsDocShellLoadState* aLoadState,
|
||||
bool aSetNavigating) {
|
||||
if (!aTargetBC || aTargetBC->IsDiscarded()) {
|
||||
MOZ_LOG(
|
||||
BrowsingContext::GetLog(), LogLevel::Debug,
|
||||
|
@ -200,7 +201,7 @@ mozilla::ipc::IPCResult WindowGlobalParent::RecvLoadURI(
|
|||
return IPC_OK();
|
||||
}
|
||||
|
||||
Unused << wgp->SendLoadURIInChild(aLoadState);
|
||||
Unused << wgp->SendLoadURIInChild(aLoadState, aSetNavigating);
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
|
|
|
@ -140,7 +140,8 @@ class WindowGlobalParent final : public WindowGlobalActor,
|
|||
|
||||
// IPC messages
|
||||
mozilla::ipc::IPCResult RecvLoadURI(dom::BrowsingContext* aTargetBC,
|
||||
nsDocShellLoadState* aLoadState);
|
||||
nsDocShellLoadState* aLoadState,
|
||||
bool aSetNavigating);
|
||||
mozilla::ipc::IPCResult RecvUpdateDocumentURI(nsIURI* aURI);
|
||||
mozilla::ipc::IPCResult RecvSetIsInitialDocument(bool aIsInitialDocument) {
|
||||
mIsInitialDocument = aIsInitialDocument;
|
||||
|
|
Загрузка…
Ссылка в новой задаче