Bug 1213693 - Repair view source tab for parent process only URLs. r=mconley draft
authorJ. Ryan Stinnett <jryans@gmail.com>
Thu, 15 Oct 2015 14:14:56 -0500
changeset 301172 bcf3ca0739f536a419217e5322bbbbbba7611fdc
parent 301171 563f4d2a7be35920d211de07169efa52069a3fdf
child 510187 a920f7accbee60b3a3b74007a91f741458a670ec
push id6405
push userjryans@gmail.com
push dateThu, 15 Oct 2015 19:23:56 +0000
reviewersmconley
bugs1213693
milestone44.0a1
Bug 1213693 - Repair view source tab for parent process only URLs. r=mconley
browser/base/content/browser.js
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -2340,24 +2340,34 @@ function BrowserViewSourceOfDocument(aAr
       // because no #content element exists.  For these cases, we need to find
       // the most recent browser window.
       // In the case of popups, we need to find a non-popup browser window.
       if (!tabBrowser || !window.toolbar.visible) {
         // This returns only non-popup browser windows by default.
         let browserWindow = RecentWindow.getMostRecentBrowserWindow();
         tabBrowser = browserWindow.gBrowser;
       }
+      // Some internal URLs (such as specific chrome: and about: URLs that are
+      // not yet remote ready) cannot be loaded in a remote browser.  View
+      // source in tab expects the new view source browser's remoteness to match
+      // that of the original URL, so disable remoteness if necessary for this
+      // URL.
+      let contentProcess = Ci.nsIXULRuntime.PROCESS_TYPE_CONTENT
+      let forceNotRemote =
+        gMultiProcessBrowser &&
+        !E10SUtils.canLoadURIInProcess(args.URL, contentProcess);
       // `viewSourceInBrowser` will load the source content from the page
       // descriptor for the tab (when possible) or fallback to the network if
       // that fails.  Either way, the view source module will manage the tab's
       // location, so use "about:blank" here to avoid unnecessary redundant
       // requests.
       let tab = tabBrowser.loadOneTab("about:blank", {
         relatedToCurrent: true,
-        inBackground: false
+        inBackground: false,
+        forceNotRemote,
       });
       args.viewSourceBrowser = tabBrowser.getBrowserForTab(tab);
       top.gViewSourceUtils.viewSourceInBrowser(args);
     } else {
       top.gViewSourceUtils.viewSource(args);
     }
   }