Bug 1121864 - Fix some minor nits in NetworkGeolocationProvider.js. r=garvank

This commit is contained in:
Chris Peterson 2015-01-14 20:28:27 -08:00
parent af543c1cd3
commit 1ab0ff809c

View File

@ -2,6 +2,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
Components.utils.import("resource://gre/modules/Services.jsm");
@ -318,13 +320,12 @@ WifiGeoPositionProvider.prototype = {
}
};
try {
Services.obs.addObserver(this, SETTINGS_CHANGED_TOPIC, false);
let settings = Cc["@mozilla.org/settingsService;1"].getService(Ci.nsISettingsService);
Services.obs.addObserver(this, SETTINGS_CHANGED_TOPIC, false);
let settingsService = Cc["@mozilla.org/settingsService;1"];
if (settingsService) {
let settings = settingsService.getService(Ci.nsISettingsService);
settings.createLock().get(SETTINGS_WIFI_ENABLED, settingsCallback);
settings.createLock().get(SETTINGS_DEBUG_ENABLED, settingsCallback);
} catch(ex) {
// This platform doesn't have the settings interface, and that is just peachy
}
if (gWifiScanningEnabled && Cc["@mozilla.org/wifi/monitor;1"]) {
@ -509,7 +510,7 @@ WifiGeoPositionProvider.prototype = {
[POSITION_UNAVAILABLE]);
}).bind(this);
xhr.onload = (function() {
LOG("gls returned status: " + xhr.status + " --> " + JSON.stringify(xhr.response));
LOG("server returned status: " + xhr.status + " --> " + JSON.stringify(xhr.response));
if ((xhr.channel instanceof Ci.nsIHttpChannel && xhr.status != 200) ||
!xhr.response || !xhr.response.location) {
this.notifyListener("notifyError",