Bug 1417498 - Account for aRequest being null in onLocationChange. r?sebastian draft
authorJan Henning <jh+bugzilla@buttercookie.de>
Fri, 17 Nov 2017 19:50:04 +0100
changeset 699777 9630749dd79ddfb9ee8319bbeeb4c6bc4437643d
parent 699765 3def65414dba0d2e7a7ba443e4873a985f0ac893
child 740723 364b4f94e5461b9dd35fb1a9f2680af2d5e201a7
push id89676
push usermozilla@buttercookie.de
push dateFri, 17 Nov 2017 19:01:04 +0000
reviewerssebastian
bugs1417498
milestone59.0a1
Bug 1417498 - Account for aRequest being null in onLocationChange. r?sebastian 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
@@ -4433,17 +4433,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.
@@ -4498,17 +4500,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",