Bug 1226781 - only manually switch remoteness if we were trying to switch remoteness to begin with, r=mconley draft
authorGijs Kruitbosch <gijskruitbosch@gmail.com>
Fri, 22 Jan 2016 11:27:06 +0000
changeset 325835 d591dce10c87d85ec39af6aed2e73d5ece016260
parent 325834 28c1f92fcabe8a46fe40e805a763f7a508b592c0
child 325836 e0a35d135113e461047859fd66fd580b86c3a06c
push id10057
push usergijskruitbosch@gmail.com
push dateTue, 26 Jan 2016 16:27:52 +0000
reviewersmconley
bugs1226781
milestone47.0a1
Bug 1226781 - only manually switch remoteness if we were trying to switch remoteness to begin with, r=mconley
browser/base/content/browser.js
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -848,24 +848,29 @@ function _loadURIWithFlags(browser, uri,
         uri: uri,
         flags: flags,
         referrer: referrer ? referrer.spec : null,
         referrerPolicy: referrerPolicy,
         postData: postData,
       });
     }
   } catch (e) {
-    // If anything goes wrong just switch remoteness manually and load the URI.
+    // If anything goes wrong when switching remoteness, just switch remoteness
+    // manually and load the URI.
     // We might lose history that way but at least the browser loaded a page.
     // This might be necessary if SessionStore wasn't initialized yet i.e.
     // when the homepage is a non-remote page.
-    Cu.reportError(e);
-    gBrowser.updateBrowserRemotenessByURL(browser, uri);
-    browser.webNavigation.loadURIWithOptions(uri, flags, referrer, referrerPolicy,
-                                             postData, null, null);
+    if (mustChangeProcess) {
+      Cu.reportError(e);
+      gBrowser.updateBrowserRemotenessByURL(browser, uri);
+      browser.webNavigation.loadURIWithOptions(uri, flags, referrer, referrerPolicy,
+                                               postData, null, null);
+    } else {
+      throw e;
+    }
   } finally {
     if (browser.userTypedClear) {
       browser.userTypedClear--;
     }
   }
 }
 
 // Starts a new load in the browser first switching the browser to the correct