Bug 1417498 - Account for aRequest being null in onLocationChange. r=JanH a=gchang
authorJan Henning <jh+bugzilla@buttercookie.de>
Fri, 17 Nov 2017 19:50:04 +0100
changeset 442524 66c82ad8b8a95a90f09e969eadbe312ada5663f5
parent 442523 1b83e2c69374e442636a7c79619b2a173ef9ad0d
child 442525 fec9f5cba7c7cf809f604566f419d2d43e179fa5
push id8239
push userarchaeopteryx@coole-files.de
push dateMon, 27 Nov 2017 10:55:23 +0000
treeherdermozilla-beta@66c82ad8b8a9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersJanH, gchang
bugs1417498
milestone58.0
Bug 1417498 - Account for aRequest being null in onLocationChange. r=JanH a=gchang According to the documentation, aRequest may be null in some cases, and one such case is when the location change was caused by a page using the history API. MozReview-Commit-ID: AUlHBgzaKDX
mobile/android/chrome/content/browser.js
--- a/mobile/android/chrome/content/browser.js
+++ b/mobile/android/chrome/content/browser.js
@@ -4434,17 +4434,19 @@ Tab.prototype = {
 
     let fixedURI = aLocationURI;
     try {
       fixedURI = URIFixup.createExposableURI(aLocationURI);
     } catch (ex) { }
 
     // In restricted profiles, we refuse to let you open various urls.
     if (!ParentalControls.isAllowed(ParentalControls.BROWSE, fixedURI)) {
-      aRequest.cancel(Cr.NS_BINDING_ABORTED);
+      if (aRequest) {
+        aRequest.cancel(Cr.NS_BINDING_ABORTED);
+      }
 
       this.browser.docShell.displayLoadError(Cr.NS_ERROR_UNKNOWN_PROTOCOL, fixedURI, null);
     }
 
     let contentType = contentWin.document.contentType;
 
     // If fixedURI matches browser.lastURI, we assume this isn't a real location
     // change but rather a spurious addition like a wyciwyg URI prefix. See Bug 747883.
@@ -4499,17 +4501,17 @@ Tab.prototype = {
       }
     }
 
     // Update the page actions URI for helper apps.
     if (BrowserApp.selectedTab == this) {
       ExternalApps.updatePageActionUri(fixedURI);
     }
 
-    if (Components.isSuccessCode(aRequest.status) &&
+    if ((!aRequest || Components.isSuccessCode(aRequest.status)) &&
         !fixedURI.displaySpec.startsWith("about:neterror") && !this.isSearch) {
       // If this won't end up in an error page and the user isn't searching,
       // don't retain the typed entry.
       this.userRequested = "";
     }
 
     let message = {
       type: "Content:LocationChange",