mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-10 03:45:46 +00:00
Bug 1584031 - Allow non-http channels into on-may-change-process. r=kmag
Differential Revision: https://phabricator.services.mozilla.com/D53893 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
341fd8d73a
commit
4e9f06f73c
@ -5212,6 +5212,8 @@ var XULBrowserWindow = {
|
||||
return true;
|
||||
}
|
||||
|
||||
dump("shouldLoadURI: " + aURI.spec + "\n");
|
||||
|
||||
let browser = aDocShell
|
||||
.QueryInterface(Ci.nsIDocShellTreeItem)
|
||||
.sameTypeRootTreeItem.QueryInterface(Ci.nsIDocShell).chromeEventHandler;
|
||||
|
@ -54,7 +54,7 @@ const OBSERVING = [
|
||||
"browser:purge-session-history-for-domain",
|
||||
"idle-daily",
|
||||
"clear-origin-attributes-data",
|
||||
"http-on-may-change-process",
|
||||
"channel-on-may-change-process",
|
||||
];
|
||||
|
||||
// XUL Window properties to (re)store
|
||||
@ -222,6 +222,7 @@ function debug(aMsg) {
|
||||
aMsg = ("SessionStore: " + aMsg).replace(/\S{80}/g, "$&\n");
|
||||
Services.console.logStringMessage(aMsg);
|
||||
}
|
||||
dump(aMsg + "\n");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -902,7 +903,7 @@ var SessionStoreInternal = {
|
||||
this._forgetTabsWithUserContextId(userContextId);
|
||||
}
|
||||
break;
|
||||
case "http-on-may-change-process":
|
||||
case "channel-on-may-change-process":
|
||||
this.onMayChangeProcess(aSubject);
|
||||
break;
|
||||
}
|
||||
|
@ -17,6 +17,7 @@ function f()
|
||||
window.addEventListener("popstate", spin);
|
||||
window.close();
|
||||
window.location = "#c";
|
||||
window.opener.postMessage("finish", "*");
|
||||
finish();
|
||||
}
|
||||
|
||||
@ -32,6 +33,7 @@ function start()
|
||||
{
|
||||
var html = "<script>" + f + "<\/script><body onload=f()>";
|
||||
var win = window.open("data:text/html," + encodeURIComponent(html), null, "width=300,height=300");
|
||||
window.addEventListener("finish", () => { document.documentElement.removeAttribute("class"); }, false);
|
||||
win.finish = function() {
|
||||
SpecialPowers.clearUserPref("security.data_uri.unique_opaque_origin");
|
||||
document.documentElement.removeAttribute("class");
|
||||
|
@ -11,7 +11,7 @@ load 500328-1.html
|
||||
load 514779-1.xhtml
|
||||
load 614499-1.html
|
||||
load 678872-1.html
|
||||
skip-if(Android) pref(dom.disable_open_during_load,false) load 914521.html # Android bug 1584562
|
||||
skip pref(dom.disable_open_during_load,false) load 914521.html # Android bug 1584562, process selection bug 1599662.
|
||||
pref(browser.send_pings,true) asserts(0-2) load 1257730-1.html # bug 566159
|
||||
load 1331295.html
|
||||
load 1341657.html
|
||||
|
@ -26,7 +26,7 @@ interface nsIProcessSwitchRequestor : nsISupports
|
||||
* Instructs the callee to be loaded in a new process. Like 'redirectTo'
|
||||
* this can only be used on channels that have not yet called their
|
||||
* listener's OnStartRequest(). Can only be called during the
|
||||
* http-on-may-change-process observer notification.
|
||||
* channel-on-may-change-process observer notification.
|
||||
*
|
||||
* @param aTabPromise a promise which resolves to a nsIRemotTab object
|
||||
* which the load will proceed in.
|
||||
|
@ -613,7 +613,7 @@ void DocumentLoadListener::TriggerRedirectToRealChannel(
|
||||
|
||||
NS_IMETHODIMP
|
||||
DocumentLoadListener::OnStartRequest(nsIRequest* aRequest) {
|
||||
nsCOMPtr<nsHttpChannel> channel = do_QueryInterface(aRequest);
|
||||
RefPtr<nsHttpChannel> httpChannel = do_QueryObject(aRequest);
|
||||
mChannel = do_QueryInterface(aRequest);
|
||||
MOZ_DIAGNOSTIC_ASSERT(mChannel);
|
||||
|
||||
@ -643,19 +643,22 @@ DocumentLoadListener::OnStartRequest(nsIRequest* aRequest) {
|
||||
// also save the value so that when we do call
|
||||
// HttpChannelParent::OnStartRequest, we can have the value as it originally
|
||||
// was.
|
||||
if (channel) {
|
||||
Unused << channel->GetApplyConversion(&mOldApplyConversion);
|
||||
channel->SetApplyConversion(false);
|
||||
if (httpChannel) {
|
||||
Unused << httpChannel->GetApplyConversion(&mOldApplyConversion);
|
||||
httpChannel->SetApplyConversion(false);
|
||||
}
|
||||
|
||||
// notify "http-on-may-change-process" observers which is typically
|
||||
// SessionStore.jsm. This will determine if a new process needs to be
|
||||
// spawned and if so SwitchProcessTo() will be called which will set a
|
||||
// ContentProcessIdPromise.
|
||||
gHttpHandler->OnMayChangeProcess(this);
|
||||
if (mRedirectContentProcessIdPromise) {
|
||||
TriggerCrossProcessSwitch();
|
||||
return NS_OK;
|
||||
}
|
||||
// notify "channel-on-may-change-process" observers which is typically
|
||||
// SessionStore.jsm. This will determine if a new process needs to be
|
||||
// spawned and if so SwitchProcessTo() will be called which will set a
|
||||
// ContentProcessIdPromise.
|
||||
nsCOMPtr<nsIObserverService> obsService = services::GetObserverService();
|
||||
obsService->NotifyObservers(ToSupports(this), "channel-on-may-change-process",
|
||||
nullptr);
|
||||
|
||||
if (mRedirectContentProcessIdPromise) {
|
||||
TriggerCrossProcessSwitch();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
TriggerRedirectToRealChannel();
|
||||
|
@ -329,6 +329,10 @@ class DocumentLoadListener : public nsIInterfaceRequestor,
|
||||
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(DocumentLoadListener, DOCUMENT_LOAD_LISTENER_IID)
|
||||
|
||||
inline nsISupports* ToSupports(DocumentLoadListener* aObj) {
|
||||
return static_cast<nsIInterfaceRequestor*>(aObj);
|
||||
}
|
||||
|
||||
} // namespace net
|
||||
} // namespace mozilla
|
||||
|
||||
|
@ -7715,7 +7715,6 @@ nsHttpChannel::OnStartRequest(nsIRequest* request) {
|
||||
// new process.
|
||||
rv = NS_OK;
|
||||
if (!mCanceled) {
|
||||
// notify "http-on-may-change-process" observers
|
||||
rv = ComputeCrossOriginOpenerPolicyMismatch();
|
||||
|
||||
if (rv == NS_ERROR_BLOCKED_BY_POLICY) {
|
||||
|
@ -807,14 +807,6 @@ void nsHttpHandler::NotifyObservers(nsIChannel* chan, const char* event) {
|
||||
if (obsService) obsService->NotifyObservers(chan, event, nullptr);
|
||||
}
|
||||
|
||||
void nsHttpHandler::NotifyObservers(nsIProcessSwitchRequestor* request,
|
||||
const char* event) {
|
||||
LOG(("nsHttpHandler::NotifyObservers [request=%p event=\"%s\"]\n", request,
|
||||
event));
|
||||
nsCOMPtr<nsIObserverService> obsService = services::GetObserverService();
|
||||
if (obsService) obsService->NotifyObservers(request, event, nullptr);
|
||||
}
|
||||
|
||||
nsresult nsHttpHandler::AsyncOnChannelRedirect(
|
||||
nsIChannel* oldChan, nsIChannel* newChan, uint32_t flags,
|
||||
nsIEventTarget* mainThreadEventTarget) {
|
||||
|
@ -397,10 +397,6 @@ class nsHttpHandler final : public nsIHttpProtocolHandler,
|
||||
NotifyObservers(chan, NS_HTTP_ON_EXAMINE_CACHED_RESPONSE_TOPIC);
|
||||
}
|
||||
|
||||
void OnMayChangeProcess(nsIProcessSwitchRequestor* request) {
|
||||
NotifyObservers(request, NS_HTTP_ON_MAY_CHANGE_PROCESS_TOPIC);
|
||||
}
|
||||
|
||||
// Generates the host:port string for use in the Host: header as well as the
|
||||
// CONNECT line for proxies. This handles IPv6 literals correctly.
|
||||
static MOZ_MUST_USE nsresult GenerateHostPort(const nsCString& host,
|
||||
@ -479,7 +475,6 @@ class nsHttpHandler final : public nsIHttpProtocolHandler,
|
||||
MOZ_MUST_USE nsresult InitConnectionMgr();
|
||||
|
||||
void NotifyObservers(nsIChannel* chan, const char* event);
|
||||
void NotifyObservers(nsIProcessSwitchRequestor* request, const char* event);
|
||||
|
||||
void SetFastOpenOSSupport();
|
||||
|
||||
|
@ -173,14 +173,6 @@ interface nsIHttpProtocolHandler : nsIProxiedProtocolHandler
|
||||
*/
|
||||
#define NS_HTTP_ON_EXAMINE_CACHED_RESPONSE_TOPIC "http-on-examine-cached-response"
|
||||
|
||||
/**
|
||||
* The observer of this topic is notified before the response for a HTTP
|
||||
* load is available. The "subject" of the notification is the
|
||||
* nsIProcessSwitchRequestor instance. Observers may call "switchProcessTo" to
|
||||
* perform a process switch while this is being run.
|
||||
*/
|
||||
#define NS_HTTP_ON_MAY_CHANGE_PROCESS_TOPIC "http-on-may-change-process"
|
||||
|
||||
/**
|
||||
* This topic is notified for every http channel right after it called
|
||||
* OnStopRequest on its listener, regardless whether it was finished
|
||||
|
@ -395,6 +395,8 @@ var E10SUtils = {
|
||||
return NOT_REMOTE;
|
||||
}
|
||||
|
||||
dump(aURI.spec + "\n");
|
||||
|
||||
switch (aURI.scheme) {
|
||||
case "javascript":
|
||||
// javascript URIs can load in any, they apply to the current document.
|
||||
|
Loading…
Reference in New Issue
Block a user