diff --git a/dom/wifi/DOMWifiManager.js b/dom/wifi/DOMWifiManager.js index 42bcc8448ff7..97972cc78884 100644 --- a/dom/wifi/DOMWifiManager.js +++ b/dom/wifi/DOMWifiManager.js @@ -126,12 +126,12 @@ DOMWifiManager.prototype = { break; case "WifiManager:forget:Return:OK": - request = this._takeRequest(msg.rid); + request = this.takeRequest(msg.rid); Services.DOMRequest.fireSuccess(request, true); break; case "WifiManager:forget:Return:NO": - request = this._takeRequest(msg.rid); + request = this.takeRequest(msg.rid); Services.DOMRequest.fireError(request, msg.data); break; @@ -221,7 +221,7 @@ DOMWifiManager.prototype = { forget: function nsIDOMWifiManager_forget(network) { if (!this._hasPrivileges) throw new Components.Exception("Denied", Cr.NS_ERROR_FAILURE); - var request = Services.DOMRequest.createRequest(this._window); + var request = this.createRequest(); this._sendMessageForRequest("WifiManager:forget", network, request); return request; }, diff --git a/dom/wifi/WifiWorker.js b/dom/wifi/WifiWorker.js index 62772bc53c01..acc5842adf65 100644 --- a/dom/wifi/WifiWorker.js +++ b/dom/wifi/WifiWorker.js @@ -1093,7 +1093,8 @@ function WifiWorker() { this._mm = Cc["@mozilla.org/parentprocessmessagemanager;1"].getService(Ci.nsIFrameMessageManager); const messages = ["WifiManager:setEnabled", "WifiManager:getNetworks", - "WifiManager:associate", "WifiManager:getState"]; + "WifiManager:associate", "WifiManager:forget", + "WifiManager:getState"]; messages.forEach((function(msgName) { this._mm.addMessageListener(msgName, this); @@ -1681,7 +1682,8 @@ WifiWorker.prototype = { let self = this; let configured = this.configuredNetworks[ssid]; - this._reconnectOnDisconnect = (this._currentNetwork.ssid === ssid); + this._reconnectOnDisconnect = (this.currentNetwork && + (this.currentNetwork.ssid === ssid)); WifiManager.removeNetwork(configured.netId, function(ok) { if (!ok) { self._sendMessage(message, false, "Unable to remove the network", rid, mid);