Bug 1479354 - Null-check this.listener when reporting cached geolocation values r=jdm
authorThi Huynh <so61pi.re@gmail.com>
Tue, 31 Jul 2018 20:23:24 +0700
changeset 430817 fb1e9182ad38dc4d34162d7bbaff875a3730f549
parent 430816 a35c331a4bbc5103df2553d6dc044f6f01399595
child 430818 435661644b2d2448563a71b4d5599278ed68f6b5
push id106280
push usernerli@mozilla.com
push dateThu, 09 Aug 2018 20:29:01 +0000
treeherdermozilla-inbound@fb1e9182ad38 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjdm
bugs1479354
milestone63.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1479354 - Null-check this.listener when reporting cached geolocation values r=jdm
dom/system/NetworkGeolocationProvider.js
--- a/dom/system/NetworkGeolocationProvider.js
+++ b/dom/system/NetworkGeolocationProvider.js
@@ -366,17 +366,19 @@ WifiGeoPositionProvider.prototype = {
 
     let useCached = isCachedRequestMoreAccurateThanServerRequest(data.cellTowers,
                                                                  data.wifiAccessPoints);
 
     LOG("Use request cache:" + useCached + " reason:" + gDebugCacheReasoning);
 
     if (useCached) {
       gCachedRequest.location.timestamp = Date.now();
-      this.listener.update(gCachedRequest.location);
+      if (this.listener) {
+        this.listener.update(gCachedRequest.location);
+      }
       return;
     }
 
     // From here on, do a network geolocation request //
     let url = Services.urlFormatter.formatURLPref("geo.wifi.uri");
     LOG("Sending request");
 
     let xhr = new XMLHttpRequest();