Bug 1208525 - don't fail to send LocationChange if the previous URI has no host r=margaret a=ritu
authorAndrzej Hunt <ahunt@mozilla.com>
Mon, 04 Jan 2016 14:36:22 -0800
changeset 305985 97c3b29fb4f6cd97e9e0b3f5b35e4e95f1125394
parent 305984 0780c87d33261c33e306c3ee39a5d97f3da311f1
child 305986 5e12b7992dbd4583962efddbdafd113630b75258
child 305988 8706cd66a9b422beacfef8da453b647d66f4306b
child 305989 d4f5cfb02dda48b85858d1b7a57eb944ea1e8f2c
push id1001
push userraliiev@mozilla.com
push dateMon, 18 Jan 2016 19:06:03 +0000
treeherdermozilla-release@8b89261f3ac4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmargaret, ritu
bugs1208525
milestone44.0
Bug 1208525 - don't fail to send LocationChange if the previous URI has no host r=margaret a=ritu
mobile/android/chrome/content/browser.js
--- a/mobile/android/chrome/content/browser.js
+++ b/mobile/android/chrome/content/browser.js
@@ -4560,17 +4560,23 @@ Tab.prototype = {
       } catch (e) {}
     }
 
     // If we are navigating to a new location with a different host,
     // 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 = Services.io.newURI(appOrigin, null, null).host;
+      let originHost = "";
+      try {
+        let originHost = Services.io.newURI(appOrigin, null, null).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) {
         // 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) {