mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1050678 - Provide network info for state change event. r=hchang
This commit is contained in:
parent
36e97f53e6
commit
a7003009f4
@ -345,47 +345,47 @@ DOMWifiManager.prototype = {
|
||||
case "WifiManager:onconnecting":
|
||||
this._currentNetwork = this._convertWifiNetwork(msg.network);
|
||||
this._connectionStatus = "connecting";
|
||||
this._fireStatusChangeEvent();
|
||||
this._fireStatusChangeEvent(msg.network);
|
||||
break;
|
||||
|
||||
case "WifiManager:onassociate":
|
||||
this._currentNetwork = this._convertWifiNetwork(msg.network);
|
||||
this._connectionStatus = "associated";
|
||||
this._fireStatusChangeEvent();
|
||||
this._fireStatusChangeEvent(msg.network);
|
||||
break;
|
||||
|
||||
case "WifiManager:onconnect":
|
||||
this._currentNetwork = this._convertWifiNetwork(msg.network);
|
||||
this._connectionStatus = "connected";
|
||||
this._fireStatusChangeEvent();
|
||||
this._fireStatusChangeEvent(msg.network);
|
||||
break;
|
||||
|
||||
case "WifiManager:ondisconnect":
|
||||
this._currentNetwork = null;
|
||||
this._connectionStatus = "disconnected";
|
||||
this._lastConnectionInfo = null;
|
||||
this._fireStatusChangeEvent();
|
||||
this._fireStatusChangeEvent(msg.network);
|
||||
break;
|
||||
|
||||
case "WifiManager:onwpstimeout":
|
||||
this._currentNetwork = null;
|
||||
this._connectionStatus = "wps-timedout";
|
||||
this._lastConnectionInfo = null;
|
||||
this._fireStatusChangeEvent();
|
||||
this._fireStatusChangeEvent(msg.network);
|
||||
break;
|
||||
|
||||
case "WifiManager:onwpsfail":
|
||||
this._currentNetwork = null;
|
||||
this._connectionStatus = "wps-failed";
|
||||
this._lastConnectionInfo = null;
|
||||
this._fireStatusChangeEvent();
|
||||
this._fireStatusChangeEvent(msg.network);
|
||||
break;
|
||||
|
||||
case "WifiManager:onwpsoverlap":
|
||||
this._currentNetwork = null;
|
||||
this._connectionStatus = "wps-overlapped";
|
||||
this._lastConnectionInfo = null;
|
||||
this._fireStatusChangeEvent();
|
||||
this._fireStatusChangeEvent(msg.network);
|
||||
break;
|
||||
|
||||
case "WifiManager:connectioninfoupdate":
|
||||
@ -396,12 +396,12 @@ DOMWifiManager.prototype = {
|
||||
this._currentNetwork = null;
|
||||
this._connectionStatus = "connectingfailed";
|
||||
this._lastConnectionInfo = null;
|
||||
this._fireStatusChangeEvent();
|
||||
this._fireStatusChangeEvent(msg.network);
|
||||
break;
|
||||
case "WifiManager:onauthenticating":
|
||||
this._currentNetwork = msg.network;
|
||||
this._currentNetwork = this._convertWifiNetwork(msg.network);
|
||||
this._connectionStatus = "authenticating";
|
||||
this._fireStatusChangeEvent();
|
||||
this._fireStatusChangeEvent(msg.network);
|
||||
break;
|
||||
case "WifiManager:stationinfoupdate":
|
||||
this._stationNumber = msg.station;
|
||||
@ -410,9 +410,9 @@ DOMWifiManager.prototype = {
|
||||
}
|
||||
},
|
||||
|
||||
_fireStatusChangeEvent: function StatusChangeEvent() {
|
||||
_fireStatusChangeEvent: function StatusChangeEvent(aNetwork) {
|
||||
var event = new this._window.MozWifiStatusChangeEvent("statuschange",
|
||||
{ network: this._currentNetwork,
|
||||
{ network: this._convertWifiNetwork(aNetwork),
|
||||
status: this._connectionStatus
|
||||
});
|
||||
this.__DOM_IMPL__.dispatchEvent(event);
|
||||
|
@ -1842,6 +1842,9 @@ function WifiWorker() {
|
||||
// Given a connection status network, takes a network from
|
||||
// self.configuredNetworks and prepares it for the DOM.
|
||||
netToDOM = function(net) {
|
||||
if (!net) {
|
||||
return null;
|
||||
}
|
||||
var ssid = dequote(net.ssid);
|
||||
var security = (net.key_mgmt === "NONE" && net.wep_key0) ? ["WEP"] :
|
||||
(net.key_mgmt && net.key_mgmt !== "NONE") ? [net.key_mgmt.split(" ")[0]] :
|
||||
@ -2026,7 +2029,7 @@ function WifiWorker() {
|
||||
WifiManager.disableNetwork(netId, function() {});
|
||||
}
|
||||
});
|
||||
self._fireEvent("onconnectingfailed", {network: self.currentNetwork});
|
||||
self._fireEvent("onconnectingfailed", {network: netToDOM(self.currentNetwork)});
|
||||
}
|
||||
|
||||
WifiManager.onstatechange = function() {
|
||||
@ -2069,7 +2072,10 @@ function WifiWorker() {
|
||||
}
|
||||
|
||||
self.currentNetwork.netId = this.id;
|
||||
WifiManager.getNetworkConfiguration(self.currentNetwork, function (){});
|
||||
WifiManager.getNetworkConfiguration(self.currentNetwork, function (){
|
||||
// Notify again because we get complete network information.
|
||||
self._fireEvent("onconnecting", { network: netToDOM(self.currentNetwork) });
|
||||
});
|
||||
break;
|
||||
case "COMPLETED":
|
||||
// Now that we've successfully completed the connection, re-enable the
|
||||
@ -2082,27 +2088,32 @@ function WifiWorker() {
|
||||
self._needToEnableNetworks = false;
|
||||
}
|
||||
|
||||
var _oncompleted = function() {
|
||||
// Update http proxy when connected to network.
|
||||
let netConnect = WifiManager.getHttpProxyNetwork(self.currentNetwork);
|
||||
if (netConnect)
|
||||
WifiManager.setHttpProxy(netConnect);
|
||||
|
||||
// The full authentication process is completed, reset the count.
|
||||
WifiManager.authenticationFailuresCount = 0;
|
||||
WifiManager.loopDetectionCount = 0;
|
||||
self._startConnectionInfoTimer();
|
||||
self._fireEvent("onassociate", { network: netToDOM(self.currentNetwork) });
|
||||
};
|
||||
|
||||
// We get the ASSOCIATED event when we've associated but not connected, so
|
||||
// wait until the handshake is complete.
|
||||
if (this.fromStatus || !self.currentNetwork) {
|
||||
// In this case, we connected to an already-connected wpa_supplicant,
|
||||
// because of that we need to gather information about the current
|
||||
// network here.
|
||||
self.currentNetwork = { ssid: quote(WifiManager.connectionInfo.ssid),
|
||||
self.currentNetwork = { bssid: WifiManager.connectionInfo.bssid,
|
||||
ssid: quote(WifiManager.connectionInfo.ssid),
|
||||
netId: WifiManager.connectionInfo.id };
|
||||
WifiManager.getNetworkConfiguration(self.currentNetwork, function(){});
|
||||
WifiManager.getNetworkConfiguration(self.currentNetwork, _oncompleted);
|
||||
} else {
|
||||
_oncompleted();
|
||||
}
|
||||
|
||||
// Update http proxy when connected to network.
|
||||
let netConnect = WifiManager.getHttpProxyNetwork(self.currentNetwork);
|
||||
if (netConnect)
|
||||
WifiManager.setHttpProxy(netConnect);
|
||||
|
||||
// The full authentication process is completed, reset the count.
|
||||
WifiManager.authenticationFailuresCount = 0;
|
||||
WifiManager.loopDetectionCount = 0;
|
||||
self._startConnectionInfoTimer();
|
||||
self._fireEvent("onassociate", { network: netToDOM(self.currentNetwork) });
|
||||
break;
|
||||
case "CONNECTED":
|
||||
// BSSID is read after connected, update it.
|
||||
@ -2121,7 +2132,7 @@ function WifiWorker() {
|
||||
return;
|
||||
}
|
||||
|
||||
self._fireEvent("ondisconnect", {});
|
||||
self._fireEvent("ondisconnect", {network: netToDOM(self.currentNetwork)});
|
||||
|
||||
// When disconnected, clear the http proxy setting if it exists.
|
||||
// Temporarily set http proxy to empty and restore user setting after setHttpProxy.
|
||||
|
Loading…
Reference in New Issue
Block a user