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
--- 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",