Backed out 5 changesets (bug 1597154) for Mochitest error in docshell/test/mochitest/test_bug529119-2.html. CLOSED TREE
authorDorel Luca <dluca@mozilla.com>
Thu, 16 Jan 2020 07:44:40 +0200
changeset 510437 f41766fb940707b210530250d9017acca09ca40f
parent 510436 7f724ded7131469ea1264a47871de593cf189b11
child 510438 259b0925375efedccee0c478ac90bf6c78ff3618
push id37021
push userrmaries@mozilla.com
push dateThu, 16 Jan 2020 09:46:51 +0000
treeherdermozilla-central@7541d616ff87 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1597154, 529119
milestone74.0a1
backs out051d6f3a237c14a883a3712360dafddeaf23b6c2
8f8a663e3118e347f8fc68fdedef56cabf067541
1638767d4977b357556625ea59833e28ca183e31
cc9c332c22a66c3107ecf21038937cf3111cfaa0
9580b0a08782c3ba9586de8ececcfde1e01c9b14
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Backed out 5 changesets (bug 1597154) for Mochitest error in docshell/test/mochitest/test_bug529119-2.html. CLOSED TREE Backed out changeset 051d6f3a237c (bug 1597154) Backed out changeset 8f8a663e3118 (bug 1597154) Backed out changeset 1638767d4977 (bug 1597154) Backed out changeset cc9c332c22a6 (bug 1597154) Backed out changeset 9580b0a08782 (bug 1597154)
docshell/base/nsDocShell.cpp
toolkit/modules/E10SUtils.jsm
uriloader/exthandler/tests/mochitest/browser.ini
--- a/docshell/base/nsDocShell.cpp
+++ b/docshell/base/nsDocShell.cpp
@@ -8989,20 +8989,19 @@ nsresult nsDocShell::InternalLoad(nsDocS
     }
   }
 
   if (mTiming && isNotDownload) {
     mTiming->NotifyUnloadAccepted(mCurrentURI);
   }
 
   // Check if the webbrowser chrome wants the load to proceed; this can be
-  // used to cancel attempts to load URIs in the wrong process. use
-  // GetPendingRedirectedChannel() to avoid revisiting a redirect decision.
+  // used to cancel attempts to load URIs in the wrong process.
   nsCOMPtr<nsIWebBrowserChrome3> browserChrome3 = do_GetInterface(mTreeOwner);
-  if (browserChrome3 && !aLoadState->GetPendingRedirectedChannel()) {
+  if (browserChrome3) {
     bool shouldLoad;
     rv = browserChrome3->ShouldLoadURI(
         this, aLoadState->URI(), aLoadState->GetReferrerInfo(),
         !!aLoadState->PostDataStream(), aLoadState->TriggeringPrincipal(),
         aLoadState->Csp(), &shouldLoad);
     if (NS_SUCCEEDED(rv) && !shouldLoad) {
       return NS_OK;
     }
@@ -9369,19 +9368,17 @@ static bool IsConsideredSameOriginForUIR
     MOZ_ASSERT(isc);
     isc->SetBaseURI(aBaseURI);
   }
 
   channel.forget(aChannel);
   return NS_OK;
 }
 
-// Changes here should also be made in
-// E10SUtils.documentChannelPermittedForURI().
-static bool URIUsesDocChannel(nsIURI* aURI) {
+static bool SchemeUsesDocChannel(nsIURI* aURI) {
   if (SchemeIsJavascript(aURI) || NS_IsAboutBlank(aURI)) {
     return false;
   }
 
   nsCString spec = aURI->GetSpecOrDefault();
 
   if (spec.EqualsLiteral("about:printpreview") ||
       spec.EqualsLiteral("about:privatebrowsing") ||
@@ -9980,17 +9977,17 @@ nsresult nsDocShell::DoURILoad(nsDocShel
 
   // We want to use DocumentChannel if we're using a supported scheme, or if
   // we're a sandboxed srcdoc load. Non-sandboxed srcdoc loads need to share
   // the same principal object as their outer document (and must load in the
   // same process), which breaks if we serialize to the parent process.
   bool canUseDocumentChannel =
       aLoadState->HasLoadFlags(INTERNAL_LOAD_FLAGS_IS_SRCDOC)
           ? (sandboxFlags & SANDBOXED_ORIGIN)
-          : URIUsesDocChannel(aLoadState->URI());
+          : SchemeUsesDocChannel(aLoadState->URI());
 
   if (StaticPrefs::browser_tabs_documentchannel() && XRE_IsContentProcess() &&
       canUseDocumentChannel) {
     channel = new DocumentChannelChild(aLoadState, loadInfo, initiatorType,
                                        loadFlags, mLoadType, cacheKey, isActive,
                                        isTopLevelDoc, sandboxFlags);
     channel->SetNotificationCallbacks(this);
   } else if (!CreateAndConfigureRealChannelForLoadState(
--- a/toolkit/modules/E10SUtils.jsm
+++ b/toolkit/modules/E10SUtils.jsm
@@ -132,31 +132,17 @@ const kSafeSchemes = [
   "ssh",
   "tel",
   "urn",
   "webcal",
   "wtai",
   "xmpp",
 ];
 
-const kDocumentChannelDeniedSchemes = ["javascript"];
-const kDocumentChannelDeniedURIs = [
-  "about:blank",
-  "about:printpreview",
-  "about:privatebrowsing",
-  "about:crashcontent",
-];
-
-// Changes here should also be made in URIUsesDocChannel in nsDocShell.cpp.
-function documentChannelPermittedForURI(aURI) {
-  return (
-    !kDocumentChannelDeniedSchemes.includes(aURI.scheme) &&
-    !kDocumentChannelDeniedURIs.includes(aURI.spec)
-  );
-}
+const kDocumentChannelAllowedSchemes = ["http", "https", "ftp", "data"];
 
 // Note that even if the scheme fits the criteria for a web-handled scheme
 // (ie it is compatible with the checks registerProtocolHandler uses), it may
 // not be web-handled - it could still be handled via the OS by another app.
 function hasPotentiallyWebHandledScheme({ scheme }) {
   // Note that `scheme` comes from a URI object so is already lowercase.
   if (kSafeSchemes.includes(scheme)) {
     return true;
@@ -733,20 +719,19 @@ var E10SUtils = {
 
     let mustChangeProcess = requiredRemoteType != currentRemoteType;
 
     // If we already have a content process, and the load will be
     // handled using DocumentChannel, then we can skip switching
     // for now, and let DocumentChannel do it during the response.
     if (
       currentRemoteType != NOT_REMOTE &&
-      requiredRemoteType != NOT_REMOTE &&
       uriObject &&
       (remoteSubframes || documentChannel) &&
-      documentChannelPermittedForURI(uriObject)
+      kDocumentChannelAllowedSchemes.includes(uriObject.scheme)
     ) {
       mustChangeProcess = false;
     }
     let newFrameloader = false;
     if (
       browser.getAttribute("preloadedState") === "consumed" &&
       uri != "about:newtab"
     ) {
@@ -798,16 +783,30 @@ var E10SUtils = {
       // This is possibly a preloaded browser and we're about to navigate away for
       // the first time. On the child side there is no way to tell for sure if that
       // is the case, so let's redirect this request to the parent to decide if a new
       // process is needed. But we don't currently properly handle POST data in
       // redirects (bug 1457520), so if there is POST data, don't return false here.
       return false;
     }
 
+    // If we are performing HTTP response process selection, and are loading an
+    // HTTP URI, we can start the load in the current process, and then perform
+    // the switch later-on using the RedirectProcessChooser mechanism.
+    //
+    // We should never be sending a POST request from the parent process to a
+    // http(s) uri, so make sure we switch if we're currently in that process.
+    if (
+      Services.appinfo.remoteType != NOT_REMOTE &&
+      (useRemoteSubframes || documentChannel) &&
+      kDocumentChannelAllowedSchemes.includes(aURI.scheme)
+    ) {
+      return true;
+    }
+
     // If we are in a Large-Allocation process, and it wouldn't be content visible
     // to change processes, we want to load into a new process so that we can throw
     // this one out. We don't want to move into a new process if we have post data,
     // because we would accidentally throw out that data.
     let isOnlyToplevelBrowsingContext =
       !aDocShell.browsingContext.parent &&
       aDocShell.browsingContext.group.getToplevels().length == 1;
     if (
@@ -839,35 +838,16 @@ var E10SUtils = {
           true,
           useRemoteSubframes,
           remoteType,
           webNav.currentURI
         )
       );
     }
 
-    // If we are using DocumentChannel or remote subframes (fission), we
-    // can start the load in the current process, and then perform the
-    // switch later-on using the nsIProcessSwitchRequestor mechanism.
-    let wantRemoteType = this.getRemoteTypeForURIObject(
-      aURI,
-      true,
-      useRemoteSubframes,
-      Services.appinfo.remoteType,
-      webNav.currentURI
-    );
-    if (
-      (useRemoteSubframes || documentChannel) &&
-      Services.appinfo.remoteType != NOT_REMOTE &&
-      wantRemoteType != NOT_REMOTE &&
-      documentChannelPermittedForURI(aURI)
-    ) {
-      return true;
-    }
-
     // If the URI can be loaded in the current process then continue
     return this.shouldLoadURIInThisProcess(aURI, useRemoteSubframes);
   },
 
   redirectLoad(
     aDocShell,
     aURI,
     aReferrerInfo,
--- a/uriloader/exthandler/tests/mochitest/browser.ini
+++ b/uriloader/exthandler/tests/mochitest/browser.ini
@@ -7,10 +7,11 @@ support-files =
 run-if = e10s # test relies on e10s behavior
 support-files =
   download_page.html
   download.bin
   download.sjs
 [browser_download_always_ask_preferred_app.js]
 [browser_download_privatebrowsing.js]
 [browser_protocolhandler_loop.js]
+skip-if = fission # Bug 1597154
 [browser_remember_download_option.js]
 [browser_web_protocol_handlers.js]