Bug 1479354 - Null-check this.listener when reporting cached geolocation values. r=jdm a=lizzard
authorThi Huynh <so61pi.re@gmail.com>
Tue, 31 Jul 2018 20:23:24 +0700
changeset 478432 8c9fa6f809a8ccce4cc34f9283ce97aaae7e3e29
parent 478431 723b6cad1824f67f8f82c4affde44dca7e5d9dad
child 478433 7456a854852b074f61d83f9bfd9285a22c29a053
push id9666
push usercbrindusan@mozilla.com
push dateWed, 15 Aug 2018 10:01:01 +0000
treeherdermozilla-beta@486daac9c707 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjdm, lizzard
bugs1479354
milestone62.0
Bug 1479354 - Null-check this.listener when reporting cached geolocation values. r=jdm a=lizzard
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();