Bug 744417 - Fix mistakes in the initial implementation of forgetNetwork. r=mrbkap

--HG--
extra : rebase_source : 9ed43da50d6abc9701bfd09e5b3b788d2b947618
This commit is contained in:
Fabien Cazenave 2012-04-13 15:54:11 +08:00
Родитель 3bc26a52f0
Коммит dfd38c0284
2 изменённых файлов: 7 добавлений и 5 удалений

Просмотреть файл

@ -126,12 +126,12 @@ DOMWifiManager.prototype = {
break; break;
case "WifiManager:forget:Return:OK": case "WifiManager:forget:Return:OK":
request = this._takeRequest(msg.rid); request = this.takeRequest(msg.rid);
Services.DOMRequest.fireSuccess(request, true); Services.DOMRequest.fireSuccess(request, true);
break; break;
case "WifiManager:forget:Return:NO": case "WifiManager:forget:Return:NO":
request = this._takeRequest(msg.rid); request = this.takeRequest(msg.rid);
Services.DOMRequest.fireError(request, msg.data); Services.DOMRequest.fireError(request, msg.data);
break; break;
@ -221,7 +221,7 @@ DOMWifiManager.prototype = {
forget: function nsIDOMWifiManager_forget(network) { forget: function nsIDOMWifiManager_forget(network) {
if (!this._hasPrivileges) if (!this._hasPrivileges)
throw new Components.Exception("Denied", Cr.NS_ERROR_FAILURE); 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); this._sendMessageForRequest("WifiManager:forget", network, request);
return request; return request;
}, },

Просмотреть файл

@ -1093,7 +1093,8 @@ function WifiWorker() {
this._mm = Cc["@mozilla.org/parentprocessmessagemanager;1"].getService(Ci.nsIFrameMessageManager); this._mm = Cc["@mozilla.org/parentprocessmessagemanager;1"].getService(Ci.nsIFrameMessageManager);
const messages = ["WifiManager:setEnabled", "WifiManager:getNetworks", const messages = ["WifiManager:setEnabled", "WifiManager:getNetworks",
"WifiManager:associate", "WifiManager:getState"]; "WifiManager:associate", "WifiManager:forget",
"WifiManager:getState"];
messages.forEach((function(msgName) { messages.forEach((function(msgName) {
this._mm.addMessageListener(msgName, this); this._mm.addMessageListener(msgName, this);
@ -1681,7 +1682,8 @@ WifiWorker.prototype = {
let self = this; let self = this;
let configured = this.configuredNetworks[ssid]; 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) { WifiManager.removeNetwork(configured.netId, function(ok) {
if (!ok) { if (!ok) {
self._sendMessage(message, false, "Unable to remove the network", rid, mid); self._sendMessage(message, false, "Unable to remove the network", rid, mid);