Backed out 6 changesets (bug 1598516) for Mn and pgo failures on a CLOSED TREE

Backed out changeset 63a84cdfd937 (bug 1598516)
Backed out changeset 894aaa4bc62e (bug 1598516)
Backed out changeset e19ada9e8b30 (bug 1598516)
Backed out changeset 72f2256ae171 (bug 1598516)
Backed out changeset 6ba74ff735ba (bug 1598516)
Backed out changeset b235cf22b0e4 (bug 1598516)
This commit is contained in:
Coroiu Cristina 2019-11-26 04:40:35 +02:00
Родитель 62da09d5c5
Коммит b55f6bda39
16 изменённых файлов: 152 добавлений и 146 удалений

Просмотреть файл

@ -853,6 +853,38 @@
return rv; 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. * Sets an icon for the tab if the URI is defined in FAVICON_DEFAULTS.
*/ */
@ -5535,7 +5567,7 @@
// pointing to local resources. // pointing to local resources.
if ( if (
aRequest instanceof Ci.nsIChannel && aRequest instanceof Ci.nsIChannel &&
aRequest.originalURI.schemeIs("about") gBrowser.isLocalAboutURI(aRequest.originalURI, aRequest.URI)
) { ) {
return false; return false;
} }

Просмотреть файл

@ -24,6 +24,7 @@ tags = audiochannel
skip-if = (verify && debug && (os == 'linux')) skip-if = (verify && debug && (os == 'linux'))
support-files = support-files =
test_bug1358314.html test_bug1358314.html
[browser_isLocalAboutURI.js]
[browser_e10s_about_page_triggeringprincipal.js] [browser_e10s_about_page_triggeringprincipal.js]
skip-if = verify skip-if = verify
support-files = 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"
);
});

Просмотреть файл

@ -2978,7 +2978,7 @@ var SessionStoreInternal = {
// waiting for data from the frame script. This throbber is disabled // waiting for data from the frame script. This throbber is disabled
// if the URI is a local about: URI. // if the URI is a local about: URI.
let uriObj = aTab.linkedBrowser.currentURI; let uriObj = aTab.linkedBrowser.currentURI;
if (!uriObj || (uriObj && !uriObj.schemeIs("about"))) { if (!uriObj || (uriObj && !aWindow.gBrowser.isLocalAboutURI(uriObj))) {
newTab.setAttribute("busy", "true"); newTab.setAttribute("busy", "true");
} }
@ -3662,7 +3662,7 @@ var SessionStoreInternal = {
// Start the throbber to pretend we're doing something while actually // Start the throbber to pretend we're doing something while actually
// waiting for data from the frame script. This throbber is disabled // waiting for data from the frame script. This throbber is disabled
// if the URI is a local about: URI. // 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"); tab.setAttribute("busy", "true");
} }

Просмотреть файл

@ -374,7 +374,9 @@ class AsyncTabSwitcher {
// determined by the busy state on the tab element and checking // determined by the busy state on the tab element and checking
// if the loaded URI is local. // if the loaded URI is local.
let isBusy = this.requestedTab.hasAttribute("busy"); let isBusy = this.requestedTab.hasAttribute("busy");
let isLocalAbout = requestedBrowser.currentURI.schemeIs("about"); let isLocalAbout = this.tabbrowser.isLocalAboutURI(
requestedBrowser.currentURI
);
let hasSufficientlyLoaded = !isBusy && !isLocalAbout; let hasSufficientlyLoaded = !isBusy && !isLocalAbout;
let fl = requestedBrowser.frameLoader; let fl = requestedBrowser.frameLoader;

Просмотреть файл

@ -3685,9 +3685,6 @@ NS_IMETHODIMP
nsDocShell::DisplayLoadError(nsresult aError, nsIURI* aURI, nsDocShell::DisplayLoadError(nsresult aError, nsIURI* aURI,
const char16_t* aURL, nsIChannel* aFailedChannel, const char16_t* aURL, nsIChannel* aFailedChannel,
bool* aDisplayedErrorPage) { 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 // 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 // longer block its load event. This is necessary for OOP sub-documents
// because error documents do not result in a call to // because error documents do not result in a call to
@ -6223,9 +6220,6 @@ nsDocShell::OnContentBlockingEvent(nsIWebProgress* aWebProgress,
nsresult nsDocShell::EndPageLoad(nsIWebProgress* aProgress, nsresult nsDocShell::EndPageLoad(nsIWebProgress* aProgress,
nsIChannel* aChannel, nsresult aStatus) { nsIChannel* aChannel, nsresult aStatus) {
MOZ_LOG(gDocShellLeakLog, LogLevel::Debug,
("DOCSHELL %p EndPageLoad status: %" PRIx32 "\n", this,
static_cast<uint32_t>(aStatus)));
if (!aChannel) { if (!aChannel) {
return NS_ERROR_NULL_POINTER; return NS_ERROR_NULL_POINTER;
} }
@ -6570,7 +6564,6 @@ nsresult nsDocShell::EndPageLoad(nsIWebProgress* aProgress,
aStatus == NS_ERROR_PROXY_CONNECTION_REFUSED || aStatus == NS_ERROR_PROXY_CONNECTION_REFUSED ||
aStatus == NS_ERROR_PROXY_AUTHENTICATION_FAILED || aStatus == NS_ERROR_PROXY_AUTHENTICATION_FAILED ||
aStatus == NS_ERROR_PROXY_TOO_MANY_REQUESTS || aStatus == NS_ERROR_PROXY_TOO_MANY_REQUESTS ||
aStatus == NS_ERROR_MALFORMED_URI ||
aStatus == NS_ERROR_BLOCKED_BY_POLICY) && aStatus == NS_ERROR_BLOCKED_BY_POLICY) &&
(isTopFrame || UseErrorPages())) { (isTopFrame || UseErrorPages())) {
DisplayLoadError(aStatus, url, nullptr, aChannel); DisplayLoadError(aStatus, url, nullptr, aChannel);
@ -9530,9 +9523,9 @@ static bool IsConsideredSameOriginForUIR(nsIPrincipal* aTriggeringPrincipal,
} }
static bool SchemeUsesDocChannel(nsIURI* aURI) { static bool SchemeUsesDocChannel(nsIURI* aURI) {
return !SchemeIsJavascript(aURI) && !SchemeIsViewSource(aURI) && return SchemeIsHTTP(aURI) || SchemeIsHTTPS(aURI) || aURI->SchemeIs("moz") ||
!NS_IsAboutBlank(aURI) && SchemeIsData(aURI) || SchemeIsFile(aURI) || SchemeIsFTP(aURI) ||
!aURI->GetSpecOrDefault().EqualsLiteral("about:printpreview"); SchemeIsBlob(aURI);
} }
/* static */ bool nsDocShell::CreateChannelForLoadState( /* static */ bool nsDocShell::CreateChannelForLoadState(
@ -9541,16 +9534,8 @@ static bool SchemeUsesDocChannel(nsIURI* aURI) {
const nsString* aInitiatorType, nsLoadFlags aLoadFlags, uint32_t aLoadType, const nsString* aInitiatorType, nsLoadFlags aLoadFlags, uint32_t aLoadType,
uint32_t aCacheKey, bool aIsActive, bool aIsTopLevelDoc, uint32_t aCacheKey, bool aIsActive, bool aIsTopLevelDoc,
bool aHasNonEmptySandboxingFlags, nsresult& aRv, nsIChannel** aChannel) { 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() && if (StaticPrefs::browser_tabs_documentchannel() && XRE_IsContentProcess() &&
SchemeUsesDocChannel(aLoadState->URI()) && !isSrcdoc) { SchemeUsesDocChannel(aLoadState->URI())) {
RefPtr<DocumentChannelChild> child = new DocumentChannelChild( RefPtr<DocumentChannelChild> child = new DocumentChannelChild(
aLoadState, aLoadInfo, aInitiatorType, aLoadFlags, aLoadType, aCacheKey, aLoadState, aLoadInfo, aInitiatorType, aLoadFlags, aLoadType, aCacheKey,
aIsActive, aIsTopLevelDoc, aHasNonEmptySandboxingFlags); aIsActive, aIsTopLevelDoc, aHasNonEmptySandboxingFlags);
@ -9561,6 +9546,14 @@ static bool SchemeUsesDocChannel(nsIURI* aURI) {
} }
nsCOMPtr<nsIChannel> channel; 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(); nsIURI* baseURI = aLoadState->BaseURI();
if (!isSrcdoc) { if (!isSrcdoc) {
aRv = NS_NewChannelInternal(getter_AddRefs(channel), aLoadState->URI(), aRv = NS_NewChannelInternal(getter_AddRefs(channel), aLoadState->URI(),

Просмотреть файл

@ -3677,6 +3677,12 @@ mozilla::ipc::IPCResult ContentChild::RecvCrossProcessRedirect(
nsCOMPtr<nsIChannel> newChannel; nsCOMPtr<nsIChannel> newChannel;
rv = NS_NewChannelInternal(getter_AddRefs(newChannel), aArgs.uri(), loadInfo); rv = NS_NewChannelInternal(getter_AddRefs(newChannel), aArgs.uri(), loadInfo);
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 // This is used to report any errors back to the parent by calling
// CrossProcessRedirectFinished. // CrossProcessRedirectFinished.
RefPtr<HttpChannelChild> httpChild = do_QueryObject(newChannel); RefPtr<HttpChannelChild> httpChild = do_QueryObject(newChannel);
@ -3684,27 +3690,15 @@ mozilla::ipc::IPCResult ContentChild::RecvCrossProcessRedirect(
if (httpChild) { if (httpChild) {
rv = httpChild->CrossProcessRedirectFinished(rv); rv = httpChild->CrossProcessRedirectFinished(rv);
} }
nsCOMPtr<nsILoadInfo> loadInfo;
MOZ_ALWAYS_SUCCEEDS(newChannel->GetLoadInfo(getter_AddRefs(loadInfo)));
Maybe<LoadInfoArgs> loadInfoArgs; Maybe<LoadInfoArgs> loadInfoArgs;
if (newChannel && NS_SUCCEEDED(rv)) { MOZ_ALWAYS_SUCCEEDS(
nsCOMPtr<nsILoadInfo> loadInfo; mozilla::ipc::LoadInfoToLoadInfoArgs(loadInfo, &loadInfoArgs));
MOZ_ALWAYS_SUCCEEDS(newChannel->GetLoadInfo(getter_AddRefs(loadInfo)));
MOZ_ALWAYS_SUCCEEDS(
mozilla::ipc::LoadInfoToLoadInfoArgs(loadInfo, &loadInfoArgs));
}
aResolve( aResolve(
Tuple<const nsresult&, const Maybe<LoadInfoArgs>&>(rv, loadInfoArgs)); 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) { if (httpChild) {
rv = httpChild->SetChannelId(aArgs.channelId()); rv = httpChild->SetChannelId(aArgs.channelId());
if (NS_FAILED(rv)) { if (NS_FAILED(rv)) {

Просмотреть файл

@ -166,6 +166,7 @@
#include "nsINetworkLinkService.h" #include "nsINetworkLinkService.h"
#include "nsIObserverService.h" #include "nsIObserverService.h"
#include "nsIParentChannel.h" #include "nsIParentChannel.h"
#include "nsIRemoteWindowContext.h"
#include "nsIScriptError.h" #include "nsIScriptError.h"
#include "nsIScriptSecurityManager.h" #include "nsIScriptSecurityManager.h"
#include "nsISearchService.h" #include "nsISearchService.h"
@ -1364,11 +1365,27 @@ void ContentParent::Init() {
mScriptableHelper = new ScriptableCPInfo(this); 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, NS_IMPL_ISUPPORTS(RemoteWindowContext, nsIRemoteWindowContext,
nsIInterfaceRequestor) nsIInterfaceRequestor)
RemoteWindowContext::RemoteWindowContext(BrowserParent* aBrowserParent) RemoteWindowContext::~RemoteWindowContext() {}
: mBrowserParent(aBrowserParent) {}
NS_IMETHODIMP NS_IMETHODIMP
RemoteWindowContext::GetInterface(const nsIID& aIID, void** aSink) { RemoteWindowContext::GetInterface(const nsIID& aIID, void** aSink) {
@ -1388,6 +1405,8 @@ RemoteWindowContext::GetUsePrivateBrowsing(bool* aUsePrivateBrowsing) {
return NS_OK; return NS_OK;
} }
} // namespace
void ContentParent::MaybeAsyncSendShutDownMessage() { void ContentParent::MaybeAsyncSendShutDownMessage() {
MOZ_ASSERT(NS_IsMainThread()); MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(!TryToRecycle()); MOZ_ASSERT(!TryToRecycle());

Просмотреть файл

@ -39,7 +39,6 @@
#include "nsIThreadInternal.h" #include "nsIThreadInternal.h"
#include "nsIDOMGeoPositionCallback.h" #include "nsIDOMGeoPositionCallback.h"
#include "nsIDOMGeoPositionErrorCallback.h" #include "nsIDOMGeoPositionErrorCallback.h"
#include "nsIRemoteWindowContext.h"
#include "nsRefPtrHashtable.h" #include "nsRefPtrHashtable.h"
#include "PermissionMessageUtils.h" #include "PermissionMessageUtils.h"
#include "DriverCrashGuard.h" #include "DriverCrashGuard.h"
@ -1401,20 +1400,6 @@ bool IsWebRemoteType(const nsAString& aContentProcessType);
bool IsWebCoopCoepRemoteType(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 dom
} // namespace mozilla } // namespace mozilla

Просмотреть файл

@ -31,9 +31,6 @@
using namespace mozilla::dom; using namespace mozilla::dom;
using namespace mozilla::ipc; using namespace mozilla::ipc;
extern mozilla::LazyLogModule gDocumentChannelLog;
#define LOG(fmt) MOZ_LOG(gDocumentChannelLog, mozilla::LogLevel::Verbose, fmt)
namespace mozilla { namespace mozilla {
namespace net { namespace net {
@ -77,18 +74,12 @@ DocumentChannelChild::DocumentChannelChild(
mLoadFlags(aLoadFlags), mLoadFlags(aLoadFlags),
mURI(aLoadState->URI()), mURI(aLoadState->URI()),
mLoadInfo(aLoadInfo) { mLoadInfo(aLoadInfo) {
LOG(("DocumentChannelChild ctor [this=%p, uri=%s]", this,
aLoadState->URI()->GetSpecOrDefault().get()));
RefPtr<nsHttpHandler> handler = nsHttpHandler::GetInstance(); RefPtr<nsHttpHandler> handler = nsHttpHandler::GetInstance();
uint64_t channelId; uint64_t channelId;
Unused << handler->NewChannelId(channelId); Unused << handler->NewChannelId(channelId);
mChannelId = channelId; mChannelId = channelId;
} }
DocumentChannelChild::~DocumentChannelChild() {
LOG(("DocumentChannelChild dtor [this=%p]", this));
}
NS_IMETHODIMP NS_IMETHODIMP
DocumentChannelChild::AsyncOpen(nsIStreamListener* aListener) { DocumentChannelChild::AsyncOpen(nsIStreamListener* aListener) {
nsresult rv = NS_OK; nsresult rv = NS_OK;
@ -213,8 +204,6 @@ IPCResult DocumentChannelChild::RecvFailedAsyncOpen(
} }
void DocumentChannelChild::ShutdownListeners(nsresult aStatusCode) { void DocumentChannelChild::ShutdownListeners(nsresult aStatusCode) {
LOG(("DocumentChannelChild ShutdownListeners [this=%p, status=%" PRIx32 "]",
this, static_cast<uint32_t>(aStatusCode)));
mStatus = aStatusCode; mStatus = aStatusCode;
nsCOMPtr<nsIStreamListener> l = mListener; nsCOMPtr<nsIStreamListener> l = mListener;
@ -266,9 +255,6 @@ IPCResult DocumentChannelChild::RecvDeleteSelf() {
IPCResult DocumentChannelChild::RecvRedirectToRealChannel( IPCResult DocumentChannelChild::RecvRedirectToRealChannel(
const RedirectToRealChannelArgs& aArgs, const RedirectToRealChannelArgs& aArgs,
RedirectToRealChannelResolver&& aResolve) { RedirectToRealChannelResolver&& aResolve) {
LOG(("DocumentChannelChild RecvRedirectToRealChannel [this=%p, uri=%s]", this,
aArgs.uri()->GetSpecOrDefault().get()));
RefPtr<dom::Document> loadingDocument; RefPtr<dom::Document> loadingDocument;
mLoadInfo->GetLoadingDocument(getter_AddRefs(loadingDocument)); mLoadInfo->GetLoadingDocument(getter_AddRefs(loadingDocument));
@ -295,6 +281,13 @@ IPCResult DocumentChannelChild::RecvRedirectToRealChannel(
nullptr, // aCallbacks nullptr, // aCallbacks
aArgs.newLoadFlags()); 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 // This is used to report any errors back to the parent by calling
// CrossProcessRedirectFinished. // CrossProcessRedirectFinished.
auto scopeExit = MakeScopeExit([&]() { auto scopeExit = MakeScopeExit([&]() {
@ -304,11 +297,6 @@ IPCResult DocumentChannelChild::RecvRedirectToRealChannel(
mRedirectResolver = nullptr; mRedirectResolver = nullptr;
}); });
if (NS_FAILED(rv)) {
return IPC_OK();
}
RefPtr<HttpChannelChild> httpChild = do_QueryObject(newChannel);
if (httpChild) { if (httpChild) {
rv = httpChild->SetChannelId(aArgs.channelId()); rv = httpChild->SetChannelId(aArgs.channelId());
} }
@ -362,7 +350,6 @@ IPCResult DocumentChannelChild::RecvRedirectToRealChannel(
} }
// connect parent. // connect parent.
nsCOMPtr<nsIChildChannel> childChannel = do_QueryInterface(newChannel);
if (childChannel) { if (childChannel) {
rv = childChannel->ConnectParent( rv = childChannel->ConnectParent(
aArgs.registrarId()); // creates parent channel aArgs.registrarId()); // creates parent channel
@ -706,5 +693,3 @@ DocumentChannelChild::SetChannelId(uint64_t aChannelId) {
} // namespace net } // namespace net
} // namespace mozilla } // namespace mozilla
#undef LOG

Просмотреть файл

@ -70,7 +70,7 @@ class DocumentChannelChild final : public nsHashPropertyBag,
private: private:
void ShutdownListeners(nsresult aStatusCode); void ShutdownListeners(nsresult aStatusCode);
~DocumentChannelChild(); ~DocumentChannelChild() = default;
nsCOMPtr<nsIChannel> mRedirectChannel; nsCOMPtr<nsIChannel> mRedirectChannel;
nsTArray<DocumentChannelRedirect> mRedirects; nsTArray<DocumentChannelRedirect> mRedirects;

Просмотреть файл

@ -7,29 +7,12 @@
#include "DocumentChannelParent.h" #include "DocumentChannelParent.h"
extern mozilla::LazyLogModule gDocumentChannelLog;
#define LOG(fmt) MOZ_LOG(gDocumentChannelLog, mozilla::LogLevel::Verbose, fmt)
namespace mozilla { namespace mozilla {
namespace net { 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) { bool DocumentChannelParent::Init(const DocumentChannelCreationArgs& aArgs) {
RefPtr<nsDocShellLoadState> loadState = RefPtr<nsDocShellLoadState> loadState =
new nsDocShellLoadState(aArgs.loadState()); new nsDocShellLoadState(aArgs.loadState());
LOG(("DocumentChannelParent Init [this=%p, uri=%s]", this,
loadState->URI()->GetSpecOrDefault().get()));
RefPtr<class LoadInfo> loadInfo; RefPtr<class LoadInfo> loadInfo;
nsresult rv = mozilla::ipc::LoadInfoArgsToLoadInfo(Some(aArgs.loadInfo()), nsresult rv = mozilla::ipc::LoadInfoArgsToLoadInfo(Some(aArgs.loadInfo()),
@ -60,5 +43,3 @@ DocumentChannelParent::RedirectToRealChannel(uint32_t aRedirectFlags,
} // namespace net } // namespace net
} // namespace mozilla } // namespace mozilla
#undef LOG

Просмотреть файл

@ -25,8 +25,10 @@ class DocumentChannelParent final : public ADocumentChannelBridge,
explicit DocumentChannelParent(const dom::PBrowserOrId& aIframeEmbedding, explicit DocumentChannelParent(const dom::PBrowserOrId& aIframeEmbedding,
nsILoadContext* aLoadContext, nsILoadContext* aLoadContext,
PBOverrideStatus aOverrideStatus); PBOverrideStatus aOverrideStatus) {
mParent = new DocumentLoadListener(aIframeEmbedding, aLoadContext,
aOverrideStatus, this);
}
bool Init(const DocumentChannelCreationArgs& aArgs); bool Init(const DocumentChannelCreationArgs& aArgs);
// PDocumentChannelParent // PDocumentChannelParent
@ -68,7 +70,7 @@ class DocumentChannelParent final : public ADocumentChannelBridge,
RefPtr<PDocumentChannelParent::RedirectToRealChannelPromise> RefPtr<PDocumentChannelParent::RedirectToRealChannelPromise>
RedirectToRealChannel(uint32_t aRedirectFlags, uint32_t aLoadFlags) override; RedirectToRealChannel(uint32_t aRedirectFlags, uint32_t aLoadFlags) override;
~DocumentChannelParent(); ~DocumentChannelParent() = default;
RefPtr<DocumentLoadListener> mParent; RefPtr<DocumentLoadListener> mParent;
}; };

Просмотреть файл

@ -27,9 +27,6 @@
#include "nsIPrompt.h" #include "nsIPrompt.h"
#include "nsIWindowWatcher.h" #include "nsIWindowWatcher.h"
mozilla::LazyLogModule gDocumentChannelLog("DocumentChannel");
#define LOG(fmt) MOZ_LOG(gDocumentChannelLog, mozilla::LogLevel::Verbose, fmt)
using namespace mozilla::dom; using namespace mozilla::dom;
namespace mozilla { namespace mozilla {
@ -55,7 +52,6 @@ DocumentLoadListener::DocumentLoadListener(const PBrowserOrId& aIframeEmbedding,
PBOverrideStatus aOverrideStatus, PBOverrideStatus aOverrideStatus,
ADocumentChannelBridge* aBridge) ADocumentChannelBridge* aBridge)
: mLoadContext(aLoadContext), mPBOverride(aOverrideStatus) { : mLoadContext(aLoadContext), mPBOverride(aOverrideStatus) {
LOG(("DocumentLoadListener ctor [this=%p]", this));
RefPtr<dom::BrowserParent> parent; RefPtr<dom::BrowserParent> parent;
if (aIframeEmbedding.type() == PBrowserOrId::TPBrowserParent) { if (aIframeEmbedding.type() == PBrowserOrId::TPBrowserParent) {
parent = parent =
@ -65,10 +61,6 @@ DocumentLoadListener::DocumentLoadListener(const PBrowserOrId& aIframeEmbedding,
mDocumentChannelBridge = aBridge; mDocumentChannelBridge = aBridge;
} }
DocumentLoadListener::~DocumentLoadListener() {
LOG(("DocumentLoadListener dtor [this=%p]", this));
}
bool DocumentLoadListener::Open( bool DocumentLoadListener::Open(
nsDocShellLoadState* aLoadState, class LoadInfo* aLoadInfo, nsDocShellLoadState* aLoadState, class LoadInfo* aLoadInfo,
const nsString* aInitiatorType, nsLoadFlags aLoadFlags, uint32_t aLoadType, const nsString* aInitiatorType, nsLoadFlags aLoadFlags, uint32_t aLoadType,
@ -77,8 +69,6 @@ bool DocumentLoadListener::Open(
const Maybe<PrincipalInfo>& aContentBlockingAllowListPrincipal, const Maybe<PrincipalInfo>& aContentBlockingAllowListPrincipal,
const nsString& aCustomUserAgent, const uint64_t& aChannelId, const nsString& aCustomUserAgent, const uint64_t& aChannelId,
const TimeStamp& aAsyncOpenTime, nsresult* aRv) { const TimeStamp& aAsyncOpenTime, nsresult* aRv) {
LOG(("DocumentLoadListener Open [this=%p, uri=%s]", this,
aLoadState->URI()->GetSpecOrDefault().get()));
if (!nsDocShell::CreateChannelForLoadState( if (!nsDocShell::CreateChannelForLoadState(
aLoadState, aLoadInfo, mParentChannelListener, nullptr, aLoadState, aLoadInfo, mParentChannelListener, nullptr,
aInitiatorType, aLoadFlags, aLoadType, aCacheKey, aIsActive, aInitiatorType, aLoadFlags, aLoadType, aCacheKey, aIsActive,
@ -154,8 +144,6 @@ bool DocumentLoadListener::Open(
} }
void DocumentLoadListener::DocumentChannelBridgeDisconnected() { void DocumentLoadListener::DocumentChannelBridgeDisconnected() {
LOG(("DocumentLoadListener DocumentChannelBridgeDisconnected [this=%p]",
this));
// The nsHttpChannel may have a reference to this parent, release it // The nsHttpChannel may have a reference to this parent, release it
// to avoid circular references. // to avoid circular references.
RefPtr<nsHttpChannel> httpChannelImpl = do_QueryObject(mChannel); RefPtr<nsHttpChannel> httpChannelImpl = do_QueryObject(mChannel);
@ -184,10 +172,6 @@ void DocumentLoadListener::Resume() {
} }
void DocumentLoadListener::RedirectToRealChannelFinished(nsresult aRv) { void DocumentLoadListener::RedirectToRealChannelFinished(nsresult aRv) {
LOG(
("DocumentLoadListener RedirectToRealChannelFinished [this=%p, "
"aRv=%" PRIx32 " ]",
this, static_cast<uint32_t>(aRv)));
if (NS_FAILED(aRv)) { if (NS_FAILED(aRv)) {
FinishReplacementChannelSetup(false); FinishReplacementChannelSetup(false);
return; return;
@ -508,8 +492,6 @@ void DocumentLoadListener::TriggerCrossProcessSwitch() {
MOZ_ASSERT(!mDoingProcessSwitch, "Already in the middle of switching?"); MOZ_ASSERT(!mDoingProcessSwitch, "Already in the middle of switching?");
MOZ_ASSERT(NS_IsMainThread()); MOZ_ASSERT(NS_IsMainThread());
LOG(("DocumentLoadListener TriggerCrossProcessSwitch [this=%p]", this));
mDoingProcessSwitch = true; mDoingProcessSwitch = true;
RefPtr<DocumentLoadListener> self = this; RefPtr<DocumentLoadListener> self = this;
@ -529,7 +511,6 @@ RefPtr<PDocumentChannelParent::RedirectToRealChannelPromise>
DocumentLoadListener::RedirectToRealChannel( DocumentLoadListener::RedirectToRealChannel(
uint32_t aRedirectFlags, uint32_t aLoadFlags, uint32_t aRedirectFlags, uint32_t aLoadFlags,
const Maybe<uint64_t>& aDestinationProcess) { const Maybe<uint64_t>& aDestinationProcess) {
LOG(("DocumentLoadListener RedirectToRealChannel [this=%p]", this));
if (aDestinationProcess) { if (aDestinationProcess) {
dom::ContentParent* cp = dom::ContentParent* cp =
dom::ContentProcessManager::GetSingleton()->GetContentProcessById( dom::ContentProcessManager::GetSingleton()->GetContentProcessById(
@ -626,7 +607,6 @@ void DocumentLoadListener::TriggerRedirectToRealChannel(
NS_IMETHODIMP NS_IMETHODIMP
DocumentLoadListener::OnStartRequest(nsIRequest* aRequest) { DocumentLoadListener::OnStartRequest(nsIRequest* aRequest) {
LOG(("DocumentLoadListener OnStartRequest [this=%p]", this));
nsCOMPtr<nsHttpChannel> channel = do_QueryInterface(aRequest); nsCOMPtr<nsHttpChannel> channel = do_QueryInterface(aRequest);
mChannel = do_QueryInterface(aRequest); mChannel = do_QueryInterface(aRequest);
MOZ_DIAGNOSTIC_ASSERT(mChannel); MOZ_DIAGNOSTIC_ASSERT(mChannel);
@ -646,19 +626,6 @@ DocumentLoadListener::OnStartRequest(nsIRequest* aRequest) {
return NS_OK; 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(); mChannel->Suspend();
mSuspendedChannel = true; mSuspendedChannel = true;
@ -693,7 +660,6 @@ DocumentLoadListener::OnStartRequest(nsIRequest* aRequest) {
NS_IMETHODIMP NS_IMETHODIMP
DocumentLoadListener::OnStopRequest(nsIRequest* aRequest, DocumentLoadListener::OnStopRequest(nsIRequest* aRequest,
nsresult aStatusCode) { nsresult aStatusCode) {
LOG(("DocumentLoadListener OnStopRequest [this=%p]", this));
mStopRequestValue = Some(aStatusCode); mStopRequestValue = Some(aStatusCode);
return NS_OK; return NS_OK;
@ -703,7 +669,6 @@ NS_IMETHODIMP
DocumentLoadListener::OnDataAvailable(nsIRequest* aRequest, DocumentLoadListener::OnDataAvailable(nsIRequest* aRequest,
nsIInputStream* aInputStream, nsIInputStream* aInputStream,
uint64_t aOffset, uint32_t aCount) { uint64_t aOffset, uint32_t aCount) {
LOG(("DocumentLoadListener OnDataAvailable [this=%p]", this));
// This isn't supposed to happen, since we suspended the channel, but // 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 // 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 // through nsUnknownDecoder to sniff the content type, and it doesn't handle
@ -970,5 +935,3 @@ DocumentLoadListener::GetCrossOriginOpenerPolicy(
} // namespace net } // namespace net
} // namespace mozilla } // namespace mozilla
#undef LOG

Просмотреть файл

@ -153,7 +153,7 @@ class DocumentLoadListener : public nsIInterfaceRequestor,
uint32_t aLoadFlags); uint32_t aLoadFlags);
protected: protected:
virtual ~DocumentLoadListener(); virtual ~DocumentLoadListener() = default;
// Initiates the switch from DocumentChannel to the real protocol-specific // Initiates the switch from DocumentChannel to the real protocol-specific
// channel, and ensures that RedirectToRealChannelFinished is called when // channel, and ensures that RedirectToRealChannelFinished is called when

Просмотреть файл

@ -156,13 +156,6 @@ ParentChannelListener::GetInterface(const nsIID& aIID, void** result) {
} }
} }
if (aIID.Equals(NS_GET_IID(nsIRemoteWindowContext)) && mBrowserParent) {
nsCOMPtr<nsIRemoteWindowContext> ctx(
new RemoteWindowContext(mBrowserParent));
ctx.forget(result);
return NS_OK;
}
nsCOMPtr<nsIInterfaceRequestor> ir; nsCOMPtr<nsIInterfaceRequestor> ir;
if (mNextListener && NS_SUCCEEDED(CallQueryInterface(mNextListener.get(), if (mNextListener && NS_SUCCEEDED(CallQueryInterface(mNextListener.get(),
getter_AddRefs(ir)))) { getter_AddRefs(ir)))) {