зеркало из https://github.com/mozilla/gecko-dev.git
Backed out 8 changesets (bug 1598516) for run startup hangs CLOSED TREE
Backed out changeset bc0035aa57fe (bug 1598516) Backed out changeset 33603b723337 (bug 1598516) Backed out changeset 31c11dd9146d (bug 1598516) Backed out changeset 4e269a638350 (bug 1598516) Backed out changeset 76b86080c868 (bug 1598516) Backed out changeset b6f84b01cbd9 (bug 1598516) Backed out changeset 74d136798dd3 (bug 1598516) Backed out changeset bf370938463e (bug 1598516)
This commit is contained in:
Родитель
87bd283c90
Коммит
0108d839e9
|
@ -853,6 +853,38 @@
|
|||
return rv;
|
||||
},
|
||||
|
||||
/**
|
||||
* Determine if a URI is an about: page pointing to a local resource.
|
||||
*/
|
||||
isLocalAboutURI(aURI, aResolvedURI) {
|
||||
if (!aURI.schemeIs("about")) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Specially handle about:blank as local
|
||||
if (aURI.pathQueryRef === "blank") {
|
||||
return true;
|
||||
}
|
||||
|
||||
try {
|
||||
// Use the passed in resolvedURI if we have one
|
||||
const resolvedURI =
|
||||
aResolvedURI ||
|
||||
Services.io.newChannelFromURI(
|
||||
aURI,
|
||||
null, // loadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(), // loadingPrincipal
|
||||
null, // triggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_ALLOW_CROSS_ORIGIN_DATA_IS_NULL, // securityFlags
|
||||
Ci.nsIContentPolicy.TYPE_OTHER // contentPolicyType
|
||||
).URI;
|
||||
return resolvedURI.schemeIs("jar") || resolvedURI.schemeIs("file");
|
||||
} catch (ex) {
|
||||
// aURI might be invalid.
|
||||
return false;
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Sets an icon for the tab if the URI is defined in FAVICON_DEFAULTS.
|
||||
*/
|
||||
|
@ -5535,7 +5567,7 @@
|
|||
// pointing to local resources.
|
||||
if (
|
||||
aRequest instanceof Ci.nsIChannel &&
|
||||
aRequest.originalURI.schemeIs("about")
|
||||
gBrowser.isLocalAboutURI(aRequest.originalURI, aRequest.URI)
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@ tags = audiochannel
|
|||
skip-if = (verify && debug && (os == 'linux'))
|
||||
support-files =
|
||||
test_bug1358314.html
|
||||
[browser_isLocalAboutURI.js]
|
||||
[browser_e10s_about_page_triggeringprincipal.js]
|
||||
skip-if = verify
|
||||
support-files =
|
||||
|
|
|
@ -0,0 +1,56 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* Unit tests for tabbrowser.isLocalAboutURI to make sure it returns the
|
||||
* appropriate values for various URIs as well as optional resolved URI.
|
||||
*/
|
||||
|
||||
add_task(function test_URI() {
|
||||
const check = (spec, expect, description) => {
|
||||
const URI = Services.io.newURI(spec);
|
||||
try {
|
||||
is(gBrowser.isLocalAboutURI(URI), expect, description);
|
||||
} catch (ex) {
|
||||
ok(false, "isLocalAboutURI should not throw");
|
||||
}
|
||||
};
|
||||
check("https://www.mozilla.org/", false, "https is not about");
|
||||
check("http://www.mozilla.org/", false, "http is not about");
|
||||
check("about:blank", true, "about:blank is local");
|
||||
check("about:about", true, "about:about is local");
|
||||
check("about:newtab", true, "about:newtab is local");
|
||||
check(
|
||||
"about:random-invalid-uri",
|
||||
false,
|
||||
"about:random-invalid-uri is invalid but should not throw"
|
||||
);
|
||||
});
|
||||
|
||||
add_task(function test_URI_with_resolved() {
|
||||
const check = (spec, resolvedSpec, expect, description) => {
|
||||
const URI = Services.io.newURI(spec);
|
||||
const resolvedURI = Services.io.newURI(resolvedSpec);
|
||||
is(gBrowser.isLocalAboutURI(URI, resolvedURI), expect, description);
|
||||
};
|
||||
check(
|
||||
"about:newtab",
|
||||
"jar:file:///Applications/Firefox.app/Contents/Resources/browser/omni.ja!/chrome/browser/res/activity-stream/prerendered/en-US/activity-stream.html",
|
||||
true,
|
||||
"about:newtab with jar is local"
|
||||
);
|
||||
check(
|
||||
"about:newtab",
|
||||
"file:///mozilla-central/browser/base/content/newtab/newTab.xhtml",
|
||||
true,
|
||||
"about:newtab with file is local"
|
||||
);
|
||||
check(
|
||||
"about:newtab",
|
||||
"https://www.mozilla.org/newtab",
|
||||
false,
|
||||
"about:newtab with https is not local"
|
||||
);
|
||||
});
|
|
@ -2622,13 +2622,11 @@ var SessionStoreInternal = {
|
|||
|
||||
// Check that the document has a corresponding BrowsingContext.
|
||||
let browsingContext;
|
||||
let isSubframe = false;
|
||||
let cp = channel.loadInfo.externalContentPolicyType;
|
||||
if (cp == Ci.nsIContentPolicy.TYPE_DOCUMENT) {
|
||||
browsingContext = channel.loadInfo.browsingContext;
|
||||
} else {
|
||||
browsingContext = channel.loadInfo.frameBrowsingContext;
|
||||
isSubframe = true;
|
||||
}
|
||||
|
||||
if (!browsingContext) {
|
||||
|
@ -2735,8 +2733,7 @@ var SessionStoreInternal = {
|
|||
true,
|
||||
useRemoteSubframes,
|
||||
preferredRemoteType,
|
||||
currentPrincipal,
|
||||
isSubframe
|
||||
currentPrincipal
|
||||
);
|
||||
|
||||
debug(
|
||||
|
@ -2981,7 +2978,7 @@ var SessionStoreInternal = {
|
|||
// waiting for data from the frame script. This throbber is disabled
|
||||
// if the URI is a local about: URI.
|
||||
let uriObj = aTab.linkedBrowser.currentURI;
|
||||
if (!uriObj || (uriObj && !uriObj.schemeIs("about"))) {
|
||||
if (!uriObj || (uriObj && !aWindow.gBrowser.isLocalAboutURI(uriObj))) {
|
||||
newTab.setAttribute("busy", "true");
|
||||
}
|
||||
|
||||
|
@ -3665,7 +3662,7 @@ var SessionStoreInternal = {
|
|||
// Start the throbber to pretend we're doing something while actually
|
||||
// waiting for data from the frame script. This throbber is disabled
|
||||
// if the URI is a local about: URI.
|
||||
if (!uriObj || (uriObj && !uriObj.schemeIs("about"))) {
|
||||
if (!uriObj || (uriObj && !window.gBrowser.isLocalAboutURI(uriObj))) {
|
||||
tab.setAttribute("busy", "true");
|
||||
}
|
||||
|
||||
|
|
|
@ -374,7 +374,9 @@ class AsyncTabSwitcher {
|
|||
// determined by the busy state on the tab element and checking
|
||||
// if the loaded URI is local.
|
||||
let isBusy = this.requestedTab.hasAttribute("busy");
|
||||
let isLocalAbout = requestedBrowser.currentURI.schemeIs("about");
|
||||
let isLocalAbout = this.tabbrowser.isLocalAboutURI(
|
||||
requestedBrowser.currentURI
|
||||
);
|
||||
let hasSufficientlyLoaded = !isBusy && !isLocalAbout;
|
||||
|
||||
let fl = requestedBrowser.frameLoader;
|
||||
|
|
|
@ -3687,9 +3687,6 @@ NS_IMETHODIMP
|
|||
nsDocShell::DisplayLoadError(nsresult aError, nsIURI* aURI,
|
||||
const char16_t* aURL, nsIChannel* aFailedChannel,
|
||||
bool* aDisplayedErrorPage) {
|
||||
MOZ_LOG(gDocShellLeakLog, LogLevel::Debug,
|
||||
("DOCSHELL %p DisplayLoadError %s\n", this,
|
||||
aURI ? aURI->GetSpecOrDefault().get() : ""));
|
||||
// If we have a cross-process parent document, we must notify it that we no
|
||||
// longer block its load event. This is necessary for OOP sub-documents
|
||||
// because error documents do not result in a call to
|
||||
|
@ -6217,9 +6214,6 @@ nsDocShell::OnContentBlockingEvent(nsIWebProgress* aWebProgress,
|
|||
|
||||
nsresult nsDocShell::EndPageLoad(nsIWebProgress* aProgress,
|
||||
nsIChannel* aChannel, nsresult aStatus) {
|
||||
MOZ_LOG(gDocShellLeakLog, LogLevel::Debug,
|
||||
("DOCSHELL %p EndPageLoad status: %" PRIx32 "\n", this,
|
||||
static_cast<uint32_t>(aStatus)));
|
||||
if (!aChannel) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
@ -6559,7 +6553,6 @@ nsresult nsDocShell::EndPageLoad(nsIWebProgress* aProgress,
|
|||
aStatus == NS_ERROR_PROXY_CONNECTION_REFUSED ||
|
||||
aStatus == NS_ERROR_PROXY_AUTHENTICATION_FAILED ||
|
||||
aStatus == NS_ERROR_PROXY_TOO_MANY_REQUESTS ||
|
||||
aStatus == NS_ERROR_MALFORMED_URI ||
|
||||
aStatus == NS_ERROR_BLOCKED_BY_POLICY) &&
|
||||
(isTopFrame || UseErrorPages())) {
|
||||
DisplayLoadError(aStatus, url, nullptr, aChannel);
|
||||
|
@ -9519,11 +9512,9 @@ static bool IsConsideredSameOriginForUIR(nsIPrincipal* aTriggeringPrincipal,
|
|||
}
|
||||
|
||||
static bool SchemeUsesDocChannel(nsIURI* aURI) {
|
||||
return !SchemeIsJavascript(aURI) && !SchemeIsViewSource(aURI) &&
|
||||
!NS_IsAboutBlank(aURI) &&
|
||||
!aURI->GetSpecOrDefault().EqualsLiteral("about:printpreview") &&
|
||||
!aURI->GetSpecOrDefault().EqualsLiteral("about:privatebrowsing") &&
|
||||
!aURI->GetSpecOrDefault().EqualsLiteral("about:crashcontent");
|
||||
return SchemeIsHTTP(aURI) || SchemeIsHTTPS(aURI) || aURI->SchemeIs("moz") ||
|
||||
SchemeIsData(aURI) || SchemeIsFile(aURI) || SchemeIsFTP(aURI) ||
|
||||
SchemeIsBlob(aURI);
|
||||
}
|
||||
|
||||
/* static */ bool nsDocShell::CreateChannelForLoadState(
|
||||
|
@ -9532,16 +9523,8 @@ static bool SchemeUsesDocChannel(nsIURI* aURI) {
|
|||
const nsString* aInitiatorType, nsLoadFlags aLoadFlags, uint32_t aLoadType,
|
||||
uint32_t aCacheKey, bool aIsActive, bool aIsTopLevelDoc,
|
||||
bool aHasNonEmptySandboxingFlags, nsresult& aRv, nsIChannel** aChannel) {
|
||||
nsAutoString srcdoc;
|
||||
bool isSrcdoc = aLoadState->HasLoadFlags(INTERNAL_LOAD_FLAGS_IS_SRCDOC);
|
||||
if (isSrcdoc) {
|
||||
srcdoc = aLoadState->SrcdocData();
|
||||
} else {
|
||||
srcdoc = VoidString();
|
||||
}
|
||||
|
||||
if (StaticPrefs::browser_tabs_documentchannel() && XRE_IsContentProcess() &&
|
||||
SchemeUsesDocChannel(aLoadState->URI()) && !isSrcdoc) {
|
||||
SchemeUsesDocChannel(aLoadState->URI())) {
|
||||
RefPtr<DocumentChannelChild> child = new DocumentChannelChild(
|
||||
aLoadState, aLoadInfo, aInitiatorType, aLoadFlags, aLoadType, aCacheKey,
|
||||
aIsActive, aIsTopLevelDoc, aHasNonEmptySandboxingFlags);
|
||||
|
@ -9552,6 +9535,14 @@ static bool SchemeUsesDocChannel(nsIURI* aURI) {
|
|||
}
|
||||
|
||||
nsCOMPtr<nsIChannel> channel;
|
||||
nsAutoString srcdoc;
|
||||
bool isSrcdoc = aLoadState->HasLoadFlags(INTERNAL_LOAD_FLAGS_IS_SRCDOC);
|
||||
if (isSrcdoc) {
|
||||
srcdoc = aLoadState->SrcdocData();
|
||||
} else {
|
||||
srcdoc = VoidString();
|
||||
}
|
||||
|
||||
nsIURI* baseURI = aLoadState->BaseURI();
|
||||
if (!isSrcdoc) {
|
||||
aRv = NS_NewChannelInternal(getter_AddRefs(channel), aLoadState->URI(),
|
||||
|
|
|
@ -3678,6 +3678,12 @@ mozilla::ipc::IPCResult ContentChild::RecvCrossProcessRedirect(
|
|||
nullptr, // aCallbacks
|
||||
aArgs.newLoadFlags());
|
||||
|
||||
RefPtr<nsIChildChannel> childChannel = do_QueryObject(newChannel);
|
||||
if (NS_FAILED(rv) || !childChannel) {
|
||||
MOZ_DIAGNOSTIC_ASSERT(false, "NS_NewChannelInternal failed");
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
// This is used to report any errors back to the parent by calling
|
||||
// CrossProcessRedirectFinished.
|
||||
RefPtr<HttpChannelChild> httpChild = do_QueryObject(newChannel);
|
||||
|
@ -3685,27 +3691,15 @@ mozilla::ipc::IPCResult ContentChild::RecvCrossProcessRedirect(
|
|||
if (httpChild) {
|
||||
rv = httpChild->CrossProcessRedirectFinished(rv);
|
||||
}
|
||||
Maybe<LoadInfoArgs> loadInfoArgs;
|
||||
if (newChannel && NS_SUCCEEDED(rv)) {
|
||||
nsCOMPtr<nsILoadInfo> loadInfo;
|
||||
MOZ_ALWAYS_SUCCEEDS(newChannel->GetLoadInfo(getter_AddRefs(loadInfo)));
|
||||
Maybe<LoadInfoArgs> loadInfoArgs;
|
||||
MOZ_ALWAYS_SUCCEEDS(
|
||||
mozilla::ipc::LoadInfoToLoadInfoArgs(loadInfo, &loadInfoArgs));
|
||||
}
|
||||
aResolve(
|
||||
Tuple<const nsresult&, const Maybe<LoadInfoArgs>&>(rv, loadInfoArgs));
|
||||
});
|
||||
|
||||
if (NS_FAILED(rv)) {
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
RefPtr<nsIChildChannel> childChannel = do_QueryObject(newChannel);
|
||||
if (!childChannel) {
|
||||
rv = NS_ERROR_UNEXPECTED;
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
if (httpChild) {
|
||||
rv = httpChild->SetChannelId(aArgs.channelId());
|
||||
if (NS_FAILED(rv)) {
|
||||
|
|
|
@ -163,6 +163,7 @@
|
|||
#include "nsINetworkLinkService.h"
|
||||
#include "nsIObserverService.h"
|
||||
#include "nsIParentChannel.h"
|
||||
#include "nsIRemoteWindowContext.h"
|
||||
#include "nsIScriptError.h"
|
||||
#include "nsIScriptSecurityManager.h"
|
||||
#include "nsISearchService.h"
|
||||
|
@ -1361,11 +1362,27 @@ void ContentParent::Init() {
|
|||
mScriptableHelper = new ScriptableCPInfo(this);
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
||||
class RemoteWindowContext final : public nsIRemoteWindowContext,
|
||||
public nsIInterfaceRequestor {
|
||||
public:
|
||||
explicit RemoteWindowContext(BrowserParent* aBrowserParent)
|
||||
: mBrowserParent(aBrowserParent) {}
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIINTERFACEREQUESTOR
|
||||
NS_DECL_NSIREMOTEWINDOWCONTEXT
|
||||
|
||||
private:
|
||||
~RemoteWindowContext();
|
||||
RefPtr<BrowserParent> mBrowserParent;
|
||||
};
|
||||
|
||||
NS_IMPL_ISUPPORTS(RemoteWindowContext, nsIRemoteWindowContext,
|
||||
nsIInterfaceRequestor)
|
||||
|
||||
RemoteWindowContext::RemoteWindowContext(BrowserParent* aBrowserParent)
|
||||
: mBrowserParent(aBrowserParent) {}
|
||||
RemoteWindowContext::~RemoteWindowContext() {}
|
||||
|
||||
NS_IMETHODIMP
|
||||
RemoteWindowContext::GetInterface(const nsIID& aIID, void** aSink) {
|
||||
|
@ -1385,6 +1402,8 @@ RemoteWindowContext::GetUsePrivateBrowsing(bool* aUsePrivateBrowsing) {
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
void ContentParent::MaybeAsyncSendShutDownMessage() {
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
MOZ_ASSERT(!TryToRecycle());
|
||||
|
|
|
@ -40,7 +40,6 @@
|
|||
#include "nsIThreadInternal.h"
|
||||
#include "nsIDOMGeoPositionCallback.h"
|
||||
#include "nsIDOMGeoPositionErrorCallback.h"
|
||||
#include "nsIRemoteWindowContext.h"
|
||||
#include "nsRefPtrHashtable.h"
|
||||
#include "PermissionMessageUtils.h"
|
||||
#include "DriverCrashGuard.h"
|
||||
|
@ -1410,20 +1409,6 @@ bool IsWebRemoteType(const nsAString& aContentProcessType);
|
|||
|
||||
bool IsWebCoopCoepRemoteType(const nsAString& aContentProcessType);
|
||||
|
||||
class RemoteWindowContext final : public nsIRemoteWindowContext,
|
||||
public nsIInterfaceRequestor {
|
||||
public:
|
||||
explicit RemoteWindowContext(BrowserParent* aBrowserParent);
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIINTERFACEREQUESTOR
|
||||
NS_DECL_NSIREMOTEWINDOWCONTEXT
|
||||
|
||||
private:
|
||||
~RemoteWindowContext() = default;
|
||||
RefPtr<BrowserParent> mBrowserParent;
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
|
|
|
@ -31,9 +31,6 @@
|
|||
using namespace mozilla::dom;
|
||||
using namespace mozilla::ipc;
|
||||
|
||||
extern mozilla::LazyLogModule gDocumentChannelLog;
|
||||
#define LOG(fmt) MOZ_LOG(gDocumentChannelLog, mozilla::LogLevel::Verbose, fmt)
|
||||
|
||||
namespace mozilla {
|
||||
namespace net {
|
||||
|
||||
|
@ -98,18 +95,12 @@ DocumentChannelChild::DocumentChannelChild(
|
|||
mLoadFlags(aLoadFlags),
|
||||
mURI(aLoadState->URI()),
|
||||
mLoadInfo(aLoadInfo) {
|
||||
LOG(("DocumentChannelChild ctor [this=%p, uri=%s]", this,
|
||||
aLoadState->URI()->GetSpecOrDefault().get()));
|
||||
RefPtr<nsHttpHandler> handler = nsHttpHandler::GetInstance();
|
||||
uint64_t channelId;
|
||||
Unused << handler->NewChannelId(channelId);
|
||||
mChannelId = channelId;
|
||||
}
|
||||
|
||||
DocumentChannelChild::~DocumentChannelChild() {
|
||||
LOG(("DocumentChannelChild dtor [this=%p]", this));
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
DocumentChannelChild::AsyncOpen(nsIStreamListener* aListener) {
|
||||
nsresult rv = NS_OK;
|
||||
|
@ -241,8 +232,6 @@ IPCResult DocumentChannelChild::RecvFailedAsyncOpen(
|
|||
}
|
||||
|
||||
void DocumentChannelChild::ShutdownListeners(nsresult aStatusCode) {
|
||||
LOG(("DocumentChannelChild ShutdownListeners [this=%p, status=%" PRIx32 "]",
|
||||
this, static_cast<uint32_t>(aStatusCode)));
|
||||
mStatus = aStatusCode;
|
||||
|
||||
nsCOMPtr<nsIStreamListener> l = mListener;
|
||||
|
@ -294,9 +283,6 @@ IPCResult DocumentChannelChild::RecvDeleteSelf() {
|
|||
IPCResult DocumentChannelChild::RecvRedirectToRealChannel(
|
||||
RedirectToRealChannelArgs&& aArgs,
|
||||
RedirectToRealChannelResolver&& aResolve) {
|
||||
LOG(("DocumentChannelChild RecvRedirectToRealChannel [this=%p, uri=%s]", this,
|
||||
aArgs.uri()->GetSpecOrDefault().get()));
|
||||
|
||||
RefPtr<dom::Document> loadingDocument;
|
||||
mLoadInfo->GetLoadingDocument(getter_AddRefs(loadingDocument));
|
||||
|
||||
|
@ -324,6 +310,13 @@ IPCResult DocumentChannelChild::RecvRedirectToRealChannel(
|
|||
nullptr, // aCallbacks
|
||||
aArgs.newLoadFlags());
|
||||
|
||||
RefPtr<HttpChannelChild> httpChild = do_QueryObject(newChannel);
|
||||
RefPtr<nsIChildChannel> childChannel = do_QueryObject(newChannel);
|
||||
if (NS_FAILED(rv)) {
|
||||
MOZ_DIAGNOSTIC_ASSERT(false, "NS_NewChannelInternal failed");
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
// This is used to report any errors back to the parent by calling
|
||||
// CrossProcessRedirectFinished.
|
||||
auto scopeExit = MakeScopeExit([&]() {
|
||||
|
@ -333,11 +326,6 @@ IPCResult DocumentChannelChild::RecvRedirectToRealChannel(
|
|||
mRedirectResolver = nullptr;
|
||||
});
|
||||
|
||||
if (NS_FAILED(rv)) {
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
RefPtr<HttpChannelChild> httpChild = do_QueryObject(newChannel);
|
||||
if (httpChild) {
|
||||
rv = httpChild->SetChannelId(aArgs.channelId());
|
||||
}
|
||||
|
@ -388,7 +376,6 @@ IPCResult DocumentChannelChild::RecvRedirectToRealChannel(
|
|||
}
|
||||
|
||||
// connect parent.
|
||||
nsCOMPtr<nsIChildChannel> childChannel = do_QueryInterface(newChannel);
|
||||
if (childChannel) {
|
||||
rv = childChannel->ConnectParent(
|
||||
aArgs.registrarId()); // creates parent channel
|
||||
|
@ -732,5 +719,3 @@ DocumentChannelChild::SetChannelId(uint64_t aChannelId) {
|
|||
|
||||
} // namespace net
|
||||
} // namespace mozilla
|
||||
|
||||
#undef LOG
|
||||
|
|
|
@ -74,7 +74,7 @@ class DocumentChannelChild final : public nsIIdentChannel,
|
|||
void ShutdownListeners(nsresult aStatusCode);
|
||||
nsDocShell* GetDocShell();
|
||||
|
||||
~DocumentChannelChild();
|
||||
~DocumentChannelChild() = default;
|
||||
|
||||
LastVisitInfo mLastVisitInfo;
|
||||
nsCOMPtr<nsIChannel> mRedirectChannel;
|
||||
|
|
|
@ -7,29 +7,12 @@
|
|||
|
||||
#include "DocumentChannelParent.h"
|
||||
|
||||
extern mozilla::LazyLogModule gDocumentChannelLog;
|
||||
#define LOG(fmt) MOZ_LOG(gDocumentChannelLog, mozilla::LogLevel::Verbose, fmt)
|
||||
|
||||
namespace mozilla {
|
||||
namespace net {
|
||||
|
||||
DocumentChannelParent::DocumentChannelParent(
|
||||
const dom::PBrowserOrId& aIframeEmbedding, nsILoadContext* aLoadContext,
|
||||
PBOverrideStatus aOverrideStatus) {
|
||||
LOG(("DocumentChannelParent ctor [this=%p]", this));
|
||||
mParent = new DocumentLoadListener(aIframeEmbedding, aLoadContext,
|
||||
aOverrideStatus, this);
|
||||
}
|
||||
|
||||
DocumentChannelParent::~DocumentChannelParent() {
|
||||
LOG(("DocumentChannelParent dtor [this=%p]", this));
|
||||
}
|
||||
|
||||
bool DocumentChannelParent::Init(const DocumentChannelCreationArgs& aArgs) {
|
||||
RefPtr<nsDocShellLoadState> loadState =
|
||||
new nsDocShellLoadState(aArgs.loadState());
|
||||
LOG(("DocumentChannelParent Init [this=%p, uri=%s]", this,
|
||||
loadState->URI()->GetSpecOrDefault().get()));
|
||||
|
||||
RefPtr<class LoadInfo> loadInfo;
|
||||
nsresult rv = mozilla::ipc::LoadInfoArgsToLoadInfo(Some(aArgs.loadInfo()),
|
||||
|
@ -60,5 +43,3 @@ DocumentChannelParent::RedirectToRealChannel(uint32_t aRedirectFlags,
|
|||
|
||||
} // namespace net
|
||||
} // namespace mozilla
|
||||
|
||||
#undef LOG
|
||||
|
|
|
@ -25,8 +25,10 @@ class DocumentChannelParent final : public ADocumentChannelBridge,
|
|||
|
||||
explicit DocumentChannelParent(const dom::PBrowserOrId& aIframeEmbedding,
|
||||
nsILoadContext* aLoadContext,
|
||||
PBOverrideStatus aOverrideStatus);
|
||||
|
||||
PBOverrideStatus aOverrideStatus) {
|
||||
mParent = new DocumentLoadListener(aIframeEmbedding, aLoadContext,
|
||||
aOverrideStatus, this);
|
||||
}
|
||||
bool Init(const DocumentChannelCreationArgs& aArgs);
|
||||
|
||||
// PDocumentChannelParent
|
||||
|
@ -68,7 +70,7 @@ class DocumentChannelParent final : public ADocumentChannelBridge,
|
|||
RefPtr<PDocumentChannelParent::RedirectToRealChannelPromise>
|
||||
RedirectToRealChannel(uint32_t aRedirectFlags, uint32_t aLoadFlags) override;
|
||||
|
||||
~DocumentChannelParent();
|
||||
~DocumentChannelParent() = default;
|
||||
|
||||
RefPtr<DocumentLoadListener> mParent;
|
||||
};
|
||||
|
|
|
@ -27,9 +27,6 @@
|
|||
#include "nsIPrompt.h"
|
||||
#include "nsIWindowWatcher.h"
|
||||
|
||||
mozilla::LazyLogModule gDocumentChannelLog("DocumentChannel");
|
||||
#define LOG(fmt) MOZ_LOG(gDocumentChannelLog, mozilla::LogLevel::Verbose, fmt)
|
||||
|
||||
using namespace mozilla::dom;
|
||||
|
||||
namespace mozilla {
|
||||
|
@ -55,7 +52,6 @@ DocumentLoadListener::DocumentLoadListener(const PBrowserOrId& aIframeEmbedding,
|
|||
PBOverrideStatus aOverrideStatus,
|
||||
ADocumentChannelBridge* aBridge)
|
||||
: mLoadContext(aLoadContext), mPBOverride(aOverrideStatus) {
|
||||
LOG(("DocumentLoadListener ctor [this=%p]", this));
|
||||
RefPtr<dom::BrowserParent> parent;
|
||||
if (aIframeEmbedding.type() == PBrowserOrId::TPBrowserParent) {
|
||||
parent =
|
||||
|
@ -65,10 +61,6 @@ DocumentLoadListener::DocumentLoadListener(const PBrowserOrId& aIframeEmbedding,
|
|||
mDocumentChannelBridge = aBridge;
|
||||
}
|
||||
|
||||
DocumentLoadListener::~DocumentLoadListener() {
|
||||
LOG(("DocumentLoadListener dtor [this=%p]", this));
|
||||
}
|
||||
|
||||
bool DocumentLoadListener::Open(
|
||||
nsDocShellLoadState* aLoadState, class LoadInfo* aLoadInfo,
|
||||
const nsString* aInitiatorType, nsLoadFlags aLoadFlags, uint32_t aLoadType,
|
||||
|
@ -77,8 +69,6 @@ bool DocumentLoadListener::Open(
|
|||
const Maybe<PrincipalInfo>& aContentBlockingAllowListPrincipal,
|
||||
const nsString& aCustomUserAgent, const uint64_t& aChannelId,
|
||||
const TimeStamp& aAsyncOpenTime, nsresult* aRv) {
|
||||
LOG(("DocumentLoadListener Open [this=%p, uri=%s]", this,
|
||||
aLoadState->URI()->GetSpecOrDefault().get()));
|
||||
if (!nsDocShell::CreateChannelForLoadState(
|
||||
aLoadState, aLoadInfo, mParentChannelListener, nullptr,
|
||||
aInitiatorType, aLoadFlags, aLoadType, aCacheKey, aIsActive,
|
||||
|
@ -153,8 +143,6 @@ bool DocumentLoadListener::Open(
|
|||
}
|
||||
|
||||
void DocumentLoadListener::DocumentChannelBridgeDisconnected() {
|
||||
LOG(("DocumentLoadListener DocumentChannelBridgeDisconnected [this=%p]",
|
||||
this));
|
||||
// The nsHttpChannel may have a reference to this parent, release it
|
||||
// to avoid circular references.
|
||||
RefPtr<nsHttpChannel> httpChannelImpl = do_QueryObject(mChannel);
|
||||
|
@ -183,10 +171,6 @@ void DocumentLoadListener::Resume() {
|
|||
}
|
||||
|
||||
void DocumentLoadListener::RedirectToRealChannelFinished(nsresult aRv) {
|
||||
LOG(
|
||||
("DocumentLoadListener RedirectToRealChannelFinished [this=%p, "
|
||||
"aRv=%" PRIx32 " ]",
|
||||
this, static_cast<uint32_t>(aRv)));
|
||||
if (NS_FAILED(aRv)) {
|
||||
FinishReplacementChannelSetup(false);
|
||||
return;
|
||||
|
@ -513,8 +497,6 @@ void DocumentLoadListener::TriggerCrossProcessSwitch() {
|
|||
MOZ_ASSERT(!mDoingProcessSwitch, "Already in the middle of switching?");
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
LOG(("DocumentLoadListener TriggerCrossProcessSwitch [this=%p]", this));
|
||||
|
||||
mDoingProcessSwitch = true;
|
||||
|
||||
RefPtr<DocumentLoadListener> self = this;
|
||||
|
@ -534,7 +516,6 @@ RefPtr<PDocumentChannelParent::RedirectToRealChannelPromise>
|
|||
DocumentLoadListener::RedirectToRealChannel(
|
||||
uint32_t aRedirectFlags, uint32_t aLoadFlags,
|
||||
const Maybe<uint64_t>& aDestinationProcess) {
|
||||
LOG(("DocumentLoadListener RedirectToRealChannel [this=%p]", this));
|
||||
if (aDestinationProcess) {
|
||||
dom::ContentParent* cp =
|
||||
dom::ContentProcessManager::GetSingleton()->GetContentProcessById(
|
||||
|
@ -631,7 +612,6 @@ void DocumentLoadListener::TriggerRedirectToRealChannel(
|
|||
|
||||
NS_IMETHODIMP
|
||||
DocumentLoadListener::OnStartRequest(nsIRequest* aRequest) {
|
||||
LOG(("DocumentLoadListener OnStartRequest [this=%p]", this));
|
||||
RefPtr<nsHttpChannel> httpChannel = do_QueryObject(aRequest);
|
||||
mChannel = do_QueryInterface(aRequest);
|
||||
MOZ_DIAGNOSTIC_ASSERT(mChannel);
|
||||
|
@ -651,19 +631,6 @@ DocumentLoadListener::OnStartRequest(nsIRequest* aRequest) {
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
// Generally we want to switch to a real channel even if the request failed,
|
||||
// since the listener might want to access protocol-specific data (like http
|
||||
// response headers) in its error handling.
|
||||
// An exception to this is when nsExtProtocolChannel handled the request and
|
||||
// returned NS_ERROR_NO_CONTENT, since creating a real one in the content
|
||||
// process will attempt to handle the URI a second time.
|
||||
nsresult status = NS_OK;
|
||||
aRequest->GetStatus(&status);
|
||||
if (status == NS_ERROR_NO_CONTENT) {
|
||||
mDocumentChannelBridge->DisconnectChildListeners(NS_ERROR_NO_CONTENT);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
mChannel->Suspend();
|
||||
mSuspendedChannel = true;
|
||||
|
||||
|
@ -701,7 +668,6 @@ DocumentLoadListener::OnStartRequest(nsIRequest* aRequest) {
|
|||
NS_IMETHODIMP
|
||||
DocumentLoadListener::OnStopRequest(nsIRequest* aRequest,
|
||||
nsresult aStatusCode) {
|
||||
LOG(("DocumentLoadListener OnStopRequest [this=%p]", this));
|
||||
mStopRequestValue = Some(aStatusCode);
|
||||
|
||||
return NS_OK;
|
||||
|
@ -711,7 +677,6 @@ NS_IMETHODIMP
|
|||
DocumentLoadListener::OnDataAvailable(nsIRequest* aRequest,
|
||||
nsIInputStream* aInputStream,
|
||||
uint64_t aOffset, uint32_t aCount) {
|
||||
LOG(("DocumentLoadListener OnDataAvailable [this=%p]", this));
|
||||
// This isn't supposed to happen, since we suspended the channel, but
|
||||
// sometimes Suspend just doesn't work. This can happen when we're routing
|
||||
// through nsUnknownDecoder to sniff the content type, and it doesn't handle
|
||||
|
@ -974,5 +939,3 @@ DocumentLoadListener::GetCrossOriginOpenerPolicy(
|
|||
|
||||
} // namespace net
|
||||
} // namespace mozilla
|
||||
|
||||
#undef LOG
|
||||
|
|
|
@ -153,7 +153,7 @@ class DocumentLoadListener : public nsIInterfaceRequestor,
|
|||
uint32_t aLoadFlags);
|
||||
|
||||
protected:
|
||||
virtual ~DocumentLoadListener();
|
||||
virtual ~DocumentLoadListener() = default;
|
||||
|
||||
// Initiates the switch from DocumentChannel to the real protocol-specific
|
||||
// channel, and ensures that RedirectToRealChannelFinished is called when
|
||||
|
|
|
@ -158,13 +158,6 @@ ParentChannelListener::GetInterface(const nsIID& aIID, void** result) {
|
|||
}
|
||||
}
|
||||
|
||||
if (aIID.Equals(NS_GET_IID(nsIRemoteWindowContext)) && mBrowserParent) {
|
||||
nsCOMPtr<nsIRemoteWindowContext> ctx(
|
||||
new dom::RemoteWindowContext(mBrowserParent));
|
||||
ctx.forget(result);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIInterfaceRequestor> ir;
|
||||
if (mNextListener && NS_SUCCEEDED(CallQueryInterface(mNextListener.get(),
|
||||
getter_AddRefs(ir)))) {
|
||||
|
|
|
@ -395,8 +395,7 @@ var E10SUtils = {
|
|||
aRemoteSubframes,
|
||||
aPreferredRemoteType = DEFAULT_REMOTE_TYPE,
|
||||
aCurrentUri = null,
|
||||
aResultPrincipal = null,
|
||||
aIsSubframe = false
|
||||
aResultPrincipal = null
|
||||
) {
|
||||
if (!aMultiProcess) {
|
||||
return NOT_REMOTE;
|
||||
|
@ -475,14 +474,9 @@ var E10SUtils = {
|
|||
return NOT_REMOTE;
|
||||
|
||||
case "moz-extension":
|
||||
if (WebExtensionPolicy.useRemoteWebExtensions) {
|
||||
// Extension iframes should load in the same process
|
||||
// as their outer frame, top-level ones should load
|
||||
// in the extension process.
|
||||
return aIsSubframe ? aPreferredRemoteType : EXTENSION_REMOTE_TYPE;
|
||||
}
|
||||
|
||||
return NOT_REMOTE;
|
||||
return WebExtensionPolicy.useRemoteWebExtensions
|
||||
? EXTENSION_REMOTE_TYPE
|
||||
: NOT_REMOTE;
|
||||
|
||||
default:
|
||||
// WebExtensions may set up protocol handlers for protocol names
|
||||
|
@ -533,8 +527,7 @@ var E10SUtils = {
|
|||
aMultiProcess,
|
||||
aRemoteSubframes,
|
||||
aPreferredRemoteType = DEFAULT_REMOTE_TYPE,
|
||||
aCurrentPrincipal,
|
||||
aIsSubframe
|
||||
aCurrentPrincipal
|
||||
) {
|
||||
if (!aMultiProcess) {
|
||||
return NOT_REMOTE;
|
||||
|
@ -572,8 +565,7 @@ var E10SUtils = {
|
|||
aRemoteSubframes,
|
||||
aPreferredRemoteType,
|
||||
currentURI,
|
||||
aPrincipal,
|
||||
aIsSubframe
|
||||
aPrincipal
|
||||
);
|
||||
},
|
||||
|
||||
|
|
|
@ -7,12 +7,8 @@
|
|||
/* eslint-env webextensions */
|
||||
|
||||
const Quitter = {
|
||||
async quit() {
|
||||
// This can be called before the background page has loaded,
|
||||
// so we need to wait for it.
|
||||
browser.runtime.sendMessage("quit").catch(() => {
|
||||
setTimeout(this.quit, 100);
|
||||
});
|
||||
quit() {
|
||||
browser.runtime.sendMessage("quit");
|
||||
},
|
||||
};
|
||||
|
||||
|
|
Двоичные данные
tools/quitter/quitter@mozilla.org.xpi
Двоичные данные
tools/quitter/quitter@mozilla.org.xpi
Двоичный файл не отображается.
Загрузка…
Ссылка в новой задаче