Bug 1407188 - Don't fail to send locationChange if the next URI has no host. r?walkingice draft
authorJan Henning <jh+bugzilla@buttercookie.de>
Thu, 26 Oct 2017 15:49:38 +0200
changeset 686829 2d7e0ce0ac9a14fa19be7df57b4806cb505e3f7c
parent 686828 8480a0f8388542b2738e79d888e29439be848e6c
child 737488 ab1b207a2fdb540fea7fba8387f76f19c00751f0
push id86309
push usermozilla@buttercookie.de
push dateThu, 26 Oct 2017 13:52:15 +0000
reviewerswalkingice
bugs1407188
milestone58.0a1
Bug 1407188 - Don't fail to send locationChange if the next URI has no host. r?walkingice MozReview-Commit-ID: 6rRQ6K3wPwT
mobile/android/chrome/content/browser.js
--- a/mobile/android/chrome/content/browser.js
+++ b/mobile/android/chrome/content/browser.js
@@ -4483,20 +4483,26 @@ Tab.prototype = {
     // clear any URL origin that might have been pinned to this tab.
     let ss = Cc["@mozilla.org/browser/sessionstore;1"].getService(Ci.nsISessionStore);
     let appOrigin = ss.getTabValue(this, "appOrigin");
     if (appOrigin) {
       let originHost = "";
       try {
         originHost = Services.io.newURI(appOrigin).host;
       } catch (e if (e.result == Cr.NS_ERROR_FAILURE)) {
-        // NS_ERROR_FAILURE can be thrown by nsIURI.host if the URI scheme does not possess a host - in this case
-        // we just act as if we have an empty host.
-      }
-      if (originHost != aLocationURI.host) {
+        // NS_ERROR_FAILURE can be thrown by nsIURI.host if the URI scheme does not possess a host -
+        // in this case we just act as if we have an empty host.
+      }
+      let locationHost = "";
+      try {
+        locationHost = aLocationURI.host;
+      } catch (e if (e.result == Cr.NS_ERROR_FAILURE)) {
+        // Ditto.
+      }
+      if (originHost != locationHost || originHost == "") {
         // Note: going 'back' will not make this tab pinned again
         ss.deleteTabValue(this, "appOrigin");
       }
     }
 
     // Update the page actions URI for helper apps.
     if (BrowserApp.selectedTab == this) {
       ExternalApps.updatePageActionUri(fixedURI);