зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1602318 - Make RemoteWebProgress:stop also stop any current loads in the parent process. r=nika
Differential Revision: https://phabricator.services.mozilla.com/D70626
This commit is contained in:
Родитель
028f5ca869
Коммит
8c122b6d22
|
@ -96,8 +96,7 @@ BrowserElementWebNavigation.prototype = {
|
|||
},
|
||||
|
||||
stop(flags) {
|
||||
// No equivalent in the current BrowserElement API
|
||||
this._sendMessage("WebNavigation:Stop", { flags });
|
||||
this._browser.browsingContext.stop(flags);
|
||||
},
|
||||
|
||||
get document() {
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
#include "mozilla/ipc/ProtocolUtils.h"
|
||||
#include "mozilla/NullPrincipal.h"
|
||||
#include "mozilla/net/DocumentLoadListener.h"
|
||||
#include "nsIWebNavigation.h"
|
||||
|
||||
#include "nsGlobalWindowOuter.h"
|
||||
|
||||
|
@ -282,6 +283,25 @@ void CanonicalBrowsingContext::LoadURI(const nsAString& aURI,
|
|||
LoadURI(loadState, true);
|
||||
}
|
||||
|
||||
void CanonicalBrowsingContext::Stop(uint32_t aStopFlags) {
|
||||
if (IsDiscarded()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Stop any known network loads if necessary.
|
||||
if (mCurrentLoad && (aStopFlags & nsIWebNavigation::STOP_NETWORK)) {
|
||||
mCurrentLoad->Cancel(NS_BINDING_ABORTED);
|
||||
}
|
||||
|
||||
// Ask the docshell to stop to handle loads that haven't
|
||||
// yet reached here, as well as non-network activity.
|
||||
if (GetDocShell()) {
|
||||
nsDocShell::Cast(GetDocShell())->Stop(aStopFlags);
|
||||
} else if (ContentParent* cp = GetContentParent()) {
|
||||
Unused << cp->SendStopLoad(this, aStopFlags);
|
||||
}
|
||||
}
|
||||
|
||||
void CanonicalBrowsingContext::PendingRemotenessChange::Complete(
|
||||
ContentParent* aContentParent) {
|
||||
if (!mPromise) {
|
||||
|
|
|
@ -104,6 +104,7 @@ class CanonicalBrowsingContext final : public BrowsingContext {
|
|||
using BrowsingContext::LoadURI;
|
||||
void LoadURI(const nsAString& aURI, const LoadURIOptions& aOptions,
|
||||
ErrorResult& aError);
|
||||
void Stop(uint32_t aStopFlags);
|
||||
|
||||
using RemotenessPromise = MozPromise<RefPtr<BrowserParent>, nsresult, false>;
|
||||
RefPtr<RemotenessPromise> ChangeFrameRemoteness(const nsAString& aRemoteType,
|
||||
|
|
|
@ -102,6 +102,8 @@ interface CanonicalBrowsingContext : BrowsingContext {
|
|||
[Throws]
|
||||
void loadURI(DOMString aURI, optional LoadURIOptions aOptions = {});
|
||||
|
||||
void stop(unsigned long aStopFlags);
|
||||
|
||||
[Throws]
|
||||
Promise<unsigned long long> changeFrameRemoteness(
|
||||
DOMString remoteType, unsigned long long pendingSwitchId);
|
||||
|
|
|
@ -4167,6 +4167,21 @@ mozilla::ipc::IPCResult ContentChild::RecvDisplayLoadError(
|
|||
return IPC_OK();
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult ContentChild::RecvStopLoad(
|
||||
const MaybeDiscarded<BrowsingContext>& aContext,
|
||||
const uint32_t aStopFlags) {
|
||||
if (aContext.IsNullOrDiscarded()) {
|
||||
return IPC_OK();
|
||||
}
|
||||
BrowsingContext* context = aContext.get();
|
||||
|
||||
if (nsIDocShell* docShell = context->GetDocShell()) {
|
||||
nsDocShell::Cast(docShell)->Stop(aStopFlags);
|
||||
}
|
||||
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
#if defined(MOZ_SANDBOX) && defined(MOZ_DEBUG) && defined(ENABLE_TESTS)
|
||||
mozilla::ipc::IPCResult ContentChild::RecvInitSandboxTesting(
|
||||
Endpoint<PSandboxTestingChild>&& aEndpoint) {
|
||||
|
|
|
@ -797,6 +797,10 @@ class ContentChild final
|
|||
mozilla::ipc::IPCResult RecvDisplayLoadError(
|
||||
const MaybeDiscarded<BrowsingContext>& aContext, const nsAString& aURI);
|
||||
|
||||
mozilla::ipc::IPCResult RecvStopLoad(
|
||||
const MaybeDiscarded<BrowsingContext>& aContext,
|
||||
const uint32_t aStopFlags);
|
||||
|
||||
#ifdef NIGHTLY_BUILD
|
||||
virtual PContentChild::Result OnMessageReceived(const Message& aMsg) override;
|
||||
#else
|
||||
|
|
|
@ -844,6 +844,8 @@ child:
|
|||
|
||||
async DisplayLoadError(MaybeDiscardedBrowsingContext aContext, nsString aURI);
|
||||
|
||||
async StopLoad(MaybeDiscardedBrowsingContext aContext, uint32_t aStopFlags);
|
||||
|
||||
// Tell aContext's docshell to update its mOSHE and mLSHE entries
|
||||
async UpdateSHEntriesInDocShell(CrossProcessSHEntry aOldEntry,
|
||||
CrossProcessSHEntry aNewEntry,
|
||||
|
|
|
@ -25,9 +25,6 @@ class WebNavigationChild extends JSWindowActorChild {
|
|||
case "WebNavigation:Reload":
|
||||
this.reload(message.data.loadFlags);
|
||||
break;
|
||||
case "WebNavigation:Stop":
|
||||
this.stop(message.data.loadFlags);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -79,8 +76,4 @@ class WebNavigationChild extends JSWindowActorChild {
|
|||
reload(loadFlags) {
|
||||
this.webNavigation.reload(loadFlags);
|
||||
}
|
||||
|
||||
stop(loadFlags) {
|
||||
this.webNavigation.stop(loadFlags);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -106,7 +106,7 @@ class RemoteWebNavigation {
|
|||
Ci.nsIRemoteTab.NAVIGATE_URL,
|
||||
{ uri }
|
||||
);
|
||||
this._browser.frameLoader.browsingContext.loadURI(aURI, {
|
||||
this._browser.browsingContext.loadURI(aURI, {
|
||||
...aLoadURIOptions,
|
||||
cancelContentJSEpoch,
|
||||
});
|
||||
|
@ -115,7 +115,7 @@ class RemoteWebNavigation {
|
|||
this._sendMessage("WebNavigation:Reload", { loadFlags: aReloadFlags });
|
||||
}
|
||||
stop(aStopFlags) {
|
||||
this._sendMessage("WebNavigation:Stop", { loadFlags: aStopFlags });
|
||||
this._browser.browsingContext.stop(aStopFlags);
|
||||
}
|
||||
|
||||
get document() {
|
||||
|
|
Загрузка…
Ссылка в новой задаче