mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-21 01:05:45 +00:00
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:
parent
62da09d5c5
commit
b55f6bda39
@ -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 =
|
||||
|
56
browser/base/content/test/tabs/browser_isLocalAboutURI.js
Normal file
56
browser/base/content/test/tabs/browser_isLocalAboutURI.js
Normal file
@ -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
|
||||
// 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");
|
||||
}
|
||||
|
||||
@ -3662,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;
|
||||
|
@ -3685,9 +3685,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
|
||||
@ -6223,9 +6220,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;
|
||||
}
|
||||
@ -6570,7 +6564,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);
|
||||
@ -9530,9 +9523,9 @@ static bool IsConsideredSameOriginForUIR(nsIPrincipal* aTriggeringPrincipal,
|
||||
}
|
||||
|
||||
static bool SchemeUsesDocChannel(nsIURI* aURI) {
|
||||
return !SchemeIsJavascript(aURI) && !SchemeIsViewSource(aURI) &&
|
||||
!NS_IsAboutBlank(aURI) &&
|
||||
!aURI->GetSpecOrDefault().EqualsLiteral("about:printpreview");
|
||||
return SchemeIsHTTP(aURI) || SchemeIsHTTPS(aURI) || aURI->SchemeIs("moz") ||
|
||||
SchemeIsData(aURI) || SchemeIsFile(aURI) || SchemeIsFTP(aURI) ||
|
||||
SchemeIsBlob(aURI);
|
||||
}
|
||||
|
||||
/* static */ bool nsDocShell::CreateChannelForLoadState(
|
||||
@ -9541,16 +9534,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);
|
||||
@ -9561,6 +9546,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(),
|
||||
|
@ -3677,6 +3677,12 @@ mozilla::ipc::IPCResult ContentChild::RecvCrossProcessRedirect(
|
||||
nsCOMPtr<nsIChannel> newChannel;
|
||||
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
|
||||
// CrossProcessRedirectFinished.
|
||||
RefPtr<HttpChannelChild> httpChild = do_QueryObject(newChannel);
|
||||
@ -3684,27 +3690,15 @@ mozilla::ipc::IPCResult ContentChild::RecvCrossProcessRedirect(
|
||||
if (httpChild) {
|
||||
rv = httpChild->CrossProcessRedirectFinished(rv);
|
||||
}
|
||||
nsCOMPtr<nsILoadInfo> loadInfo;
|
||||
MOZ_ALWAYS_SUCCEEDS(newChannel->GetLoadInfo(getter_AddRefs(loadInfo)));
|
||||
Maybe<LoadInfoArgs> loadInfoArgs;
|
||||
if (newChannel && NS_SUCCEEDED(rv)) {
|
||||
nsCOMPtr<nsILoadInfo> loadInfo;
|
||||
MOZ_ALWAYS_SUCCEEDS(newChannel->GetLoadInfo(getter_AddRefs(loadInfo)));
|
||||
MOZ_ALWAYS_SUCCEEDS(
|
||||
mozilla::ipc::LoadInfoToLoadInfoArgs(loadInfo, &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)) {
|
||||
|
@ -166,6 +166,7 @@
|
||||
#include "nsINetworkLinkService.h"
|
||||
#include "nsIObserverService.h"
|
||||
#include "nsIParentChannel.h"
|
||||
#include "nsIRemoteWindowContext.h"
|
||||
#include "nsIScriptError.h"
|
||||
#include "nsIScriptSecurityManager.h"
|
||||
#include "nsISearchService.h"
|
||||
@ -1364,11 +1365,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) {
|
||||
@ -1388,6 +1405,8 @@ RemoteWindowContext::GetUsePrivateBrowsing(bool* aUsePrivateBrowsing) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
void ContentParent::MaybeAsyncSendShutDownMessage() {
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
MOZ_ASSERT(!TryToRecycle());
|
||||
|
@ -39,7 +39,6 @@
|
||||
#include "nsIThreadInternal.h"
|
||||
#include "nsIDOMGeoPositionCallback.h"
|
||||
#include "nsIDOMGeoPositionErrorCallback.h"
|
||||
#include "nsIRemoteWindowContext.h"
|
||||
#include "nsRefPtrHashtable.h"
|
||||
#include "PermissionMessageUtils.h"
|
||||
#include "DriverCrashGuard.h"
|
||||
@ -1401,20 +1400,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 {
|
||||
|
||||
@ -77,18 +74,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;
|
||||
@ -213,8 +204,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;
|
||||
@ -266,9 +255,6 @@ IPCResult DocumentChannelChild::RecvDeleteSelf() {
|
||||
IPCResult DocumentChannelChild::RecvRedirectToRealChannel(
|
||||
const 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));
|
||||
|
||||
@ -295,6 +281,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([&]() {
|
||||
@ -304,11 +297,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());
|
||||
}
|
||||
@ -362,7 +350,6 @@ IPCResult DocumentChannelChild::RecvRedirectToRealChannel(
|
||||
}
|
||||
|
||||
// connect parent.
|
||||
nsCOMPtr<nsIChildChannel> childChannel = do_QueryInterface(newChannel);
|
||||
if (childChannel) {
|
||||
rv = childChannel->ConnectParent(
|
||||
aArgs.registrarId()); // creates parent channel
|
||||
@ -706,5 +693,3 @@ DocumentChannelChild::SetChannelId(uint64_t aChannelId) {
|
||||
|
||||
} // namespace net
|
||||
} // namespace mozilla
|
||||
|
||||
#undef LOG
|
||||
|
@ -70,7 +70,7 @@ class DocumentChannelChild final : public nsHashPropertyBag,
|
||||
private:
|
||||
void ShutdownListeners(nsresult aStatusCode);
|
||||
|
||||
~DocumentChannelChild();
|
||||
~DocumentChannelChild() = default;
|
||||
|
||||
nsCOMPtr<nsIChannel> mRedirectChannel;
|
||||
nsTArray<DocumentChannelRedirect> mRedirects;
|
||||
|
@ -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,
|
||||
@ -154,8 +144,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);
|
||||
@ -184,10 +172,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;
|
||||
@ -508,8 +492,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;
|
||||
@ -529,7 +511,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(
|
||||
@ -626,7 +607,6 @@ void DocumentLoadListener::TriggerRedirectToRealChannel(
|
||||
|
||||
NS_IMETHODIMP
|
||||
DocumentLoadListener::OnStartRequest(nsIRequest* aRequest) {
|
||||
LOG(("DocumentLoadListener OnStartRequest [this=%p]", this));
|
||||
nsCOMPtr<nsHttpChannel> channel = do_QueryInterface(aRequest);
|
||||
mChannel = do_QueryInterface(aRequest);
|
||||
MOZ_DIAGNOSTIC_ASSERT(mChannel);
|
||||
@ -646,19 +626,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;
|
||||
|
||||
@ -693,7 +660,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;
|
||||
@ -703,7 +669,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
|
||||
@ -970,5 +935,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
|
||||
|
@ -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;
|
||||
if (mNextListener && NS_SUCCEEDED(CallQueryInterface(mNextListener.get(),
|
||||
getter_AddRefs(ir)))) {
|
||||
|
Loading…
Reference in New Issue
Block a user