зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset 463fa756b43b (bug 886110) for causing various regressions.
This commit is contained in:
Родитель
cae4a262ec
Коммит
e23e8b1d8f
|
@ -30,7 +30,7 @@ var gData = [
|
||||||
perm: ["wifi-manage"],
|
perm: ["wifi-manage"],
|
||||||
needParentPerm: true,
|
needParentPerm: true,
|
||||||
obj: "mozWifiManager",
|
obj: "mozWifiManager",
|
||||||
webidl: "MozWifiManager",
|
idl: "nsIDOMWifiManager",
|
||||||
verifier: verifier.toSource(),
|
verifier: verifier.toSource(),
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
|
@ -685,16 +685,8 @@ var interfaceNamesInGlobalScope =
|
||||||
{name: "MozVoicemailEvent", b2g: true, pref: "dom.voicemail.enabled"},
|
{name: "MozVoicemailEvent", b2g: true, pref: "dom.voicemail.enabled"},
|
||||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||||
{name: "MozWakeLock", b2g: true, pref: "dom.wakelock.enabled"},
|
{name: "MozWakeLock", b2g: true, pref: "dom.wakelock.enabled"},
|
||||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
|
||||||
{name: "MozWifiConnection", b2g: true, permission: "wifi-manage"},
|
|
||||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
|
||||||
{name: "MozWifiConnectionInfo", b2g: true, permission: "wifi-manage"},
|
|
||||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||||
{name: "MozWifiConnectionInfoEvent", b2g: true},
|
{name: "MozWifiConnectionInfoEvent", b2g: true},
|
||||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
|
||||||
{name: "MozWifiManager", b2g: true, permission: "wifi-manage"},
|
|
||||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
|
||||||
{name: "MozWifiNetwork", b2g: true, permission: "wifi-manage"},
|
|
||||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||||
{name: "MozWifiStatusChangeEvent", b2g: true},
|
{name: "MozWifiStatusChangeEvent", b2g: true},
|
||||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||||
|
|
|
@ -1,237 +0,0 @@
|
||||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
||||||
* 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/. */
|
|
||||||
|
|
||||||
enum WifiWPSMethod {
|
|
||||||
"pbc",
|
|
||||||
"pin",
|
|
||||||
"cancel"
|
|
||||||
};
|
|
||||||
|
|
||||||
enum ConnectionStatus {
|
|
||||||
"connecting",
|
|
||||||
"associated",
|
|
||||||
"connected",
|
|
||||||
"disconnected"
|
|
||||||
};
|
|
||||||
|
|
||||||
dictionary WifiWPSInfo {
|
|
||||||
WifiWPSMethod method;
|
|
||||||
DOMString? pin;
|
|
||||||
DOMString? bssid;
|
|
||||||
};
|
|
||||||
|
|
||||||
dictionary NetworkProperties {
|
|
||||||
DOMString ssid;
|
|
||||||
sequence<DOMString>? security;
|
|
||||||
sequence<DOMString>? capabilities;
|
|
||||||
boolean known;
|
|
||||||
boolean connected;
|
|
||||||
boolean hidden;
|
|
||||||
};
|
|
||||||
|
|
||||||
[Constructor(optional NetworkProperties properties),
|
|
||||||
JSImplementation="@mozilla.org/mozwifinetwork;1"]
|
|
||||||
interface MozWifiNetwork {
|
|
||||||
readonly attribute DOMString ssid;
|
|
||||||
readonly attribute any security;
|
|
||||||
readonly attribute any capabilities;
|
|
||||||
readonly attribute boolean known;
|
|
||||||
readonly attribute boolean connected;
|
|
||||||
readonly attribute boolean hidden;
|
|
||||||
|
|
||||||
attribute DOMString? bssid;
|
|
||||||
attribute DOMString? signalStrength;
|
|
||||||
attribute long? relSignalStrength;
|
|
||||||
attribute DOMString? psk;
|
|
||||||
attribute DOMString? keyManagement;
|
|
||||||
attribute DOMString? identity;
|
|
||||||
attribute DOMString? password;
|
|
||||||
attribute DOMString? phase1;
|
|
||||||
attribute DOMString? phase2;
|
|
||||||
attribute DOMString? eap;
|
|
||||||
attribute DOMString? pin;
|
|
||||||
};
|
|
||||||
|
|
||||||
[JSImplementation="@mozilla.org/mozwificonnection;1"]
|
|
||||||
interface MozWifiConnection {
|
|
||||||
readonly attribute ConnectionStatus status;
|
|
||||||
readonly attribute MozWifiNetwork? network;
|
|
||||||
};
|
|
||||||
|
|
||||||
[JSImplementation="@mozilla.org/mozwificonnectioninfo;1"]
|
|
||||||
interface MozWifiConnectionInfo {
|
|
||||||
readonly attribute short signalStrength;
|
|
||||||
readonly attribute short relSignalStrength;
|
|
||||||
readonly attribute long linkSpeed;
|
|
||||||
readonly attribute DOMString? ipAddress;
|
|
||||||
};
|
|
||||||
|
|
||||||
dictionary IPConfiguration {
|
|
||||||
boolean enabled;
|
|
||||||
DOMString ipaddr;
|
|
||||||
DOMString proxy;
|
|
||||||
short maskLength;
|
|
||||||
DOMString gateway;
|
|
||||||
DOMString dns1;
|
|
||||||
DOMString dns2;
|
|
||||||
};
|
|
||||||
|
|
||||||
[JSImplementation="@mozilla.org/wifimanager;1",
|
|
||||||
NavigatorProperty="mozWifiManager",
|
|
||||||
Func="Navigator::HasWifiManagerSupport"]
|
|
||||||
interface MozWifiManager : EventTarget {
|
|
||||||
/**
|
|
||||||
* Returns the list of currently available networks.
|
|
||||||
* onsuccess: We have obtained the current list of networks. request.value
|
|
||||||
* is an object whose property names are SSIDs and values are
|
|
||||||
* network objects.
|
|
||||||
* onerror: We were unable to obtain a list of property names.
|
|
||||||
*/
|
|
||||||
DOMRequest getNetworks();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the list of networks known to the system that will be
|
|
||||||
* automatically connected to if they're in range.
|
|
||||||
* onsuccess: request.value is an object whose property names are
|
|
||||||
* SSIDs and values are network objects.
|
|
||||||
* onerror: We were unable to obtain a list of known networks.
|
|
||||||
*/
|
|
||||||
DOMRequest getKnownNetworks();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Takes one of the networks returned from getNetworks and tries to
|
|
||||||
* connect to it.
|
|
||||||
* @param network A network object with information about the network,
|
|
||||||
* such as the SSID, key management desired, etc.
|
|
||||||
* onsuccess: We have started attempting to associate with the network.
|
|
||||||
* request.value is true.
|
|
||||||
* onerror: We were unable to select the network. This most likely means a
|
|
||||||
* configuration error.
|
|
||||||
*/
|
|
||||||
DOMRequest associate(MozWifiNetwork network);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Given a network, removes it from the list of networks that we'll
|
|
||||||
* automatically connect to. In order to re-connect to the network, it is
|
|
||||||
* necessary to call associate on it.
|
|
||||||
* @param network A network object with the SSID of the network to remove.
|
|
||||||
* onsuccess: We have removed this network. If we were previously
|
|
||||||
* connected to it, we have started reconnecting to the next
|
|
||||||
* network in the list.
|
|
||||||
* onerror: We were unable to remove the network.
|
|
||||||
*/
|
|
||||||
DOMRequest forget(MozWifiNetwork network);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Wi-Fi Protected Setup functionality.
|
|
||||||
* @param detail WPS detail which has 'method' and 'pin' field.
|
|
||||||
* The possible method field values are:
|
|
||||||
* - pbc: The Push Button Configuration.
|
|
||||||
* - pin: The PIN configuration.
|
|
||||||
* - cancel: Request to cancel WPS in progress.
|
|
||||||
* If method field is 'pin', 'pin' field can exist and has
|
|
||||||
* a PIN number.
|
|
||||||
* If method field is 'pin', 'bssid' field can exist and has
|
|
||||||
* a opposite BSSID.
|
|
||||||
* onsuccess: We have successfully started/canceled wps.
|
|
||||||
* onerror: We have failed to start/cancel wps.
|
|
||||||
*/
|
|
||||||
DOMRequest wps(optional WifiWPSInfo detail);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Turn on/off wifi power saving mode.
|
|
||||||
* @param enabled true or false.
|
|
||||||
* onsuccess: We have successfully turn on/off wifi power saving mode.
|
|
||||||
* onerror: We have failed to turn on/off wifi power saving mode.
|
|
||||||
*/
|
|
||||||
DOMRequest setPowerSavingMode(boolean enabled);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Given a network, configure using static IP instead of running DHCP
|
|
||||||
* @param network A network object with the SSID of the network to set static ip.
|
|
||||||
* @param info info should have following field:
|
|
||||||
* - enabled True to enable static IP, false to use DHCP
|
|
||||||
* - ipaddr configured static IP address
|
|
||||||
* - proxy configured proxy server address
|
|
||||||
* - maskLength configured mask length
|
|
||||||
* - gateway configured gateway address
|
|
||||||
* - dns1 configured first DNS server address
|
|
||||||
* - dns2 configured seconf DNS server address
|
|
||||||
* onsuccess: We have successfully configure the static ip mode.
|
|
||||||
* onerror: We have failed to configure the static ip mode.
|
|
||||||
*/
|
|
||||||
DOMRequest setStaticIpMode(MozWifiNetwork network, optional IPConfiguration info);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Given a network, configure http proxy when using wifi.
|
|
||||||
* @param network A network object with the SSID of the network to set http proxy.
|
|
||||||
* @param info info should have following field:
|
|
||||||
* - httpProxyHost ip address of http proxy.
|
|
||||||
* - httpProxyPort port of http proxy, set 0 to use default port 8080.
|
|
||||||
* set info to null to clear http proxy.
|
|
||||||
* onsuccess: We have successfully configure http proxy.
|
|
||||||
* onerror: We have failed to configure http proxy.
|
|
||||||
*/
|
|
||||||
DOMRequest setHttpProxy(MozWifiNetwork network, any info);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns whether or not wifi is currently enabled.
|
|
||||||
*/
|
|
||||||
readonly attribute boolean enabled;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the MAC address of the wifi adapter.
|
|
||||||
*/
|
|
||||||
readonly attribute DOMString macAddress;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* An non-null object containing the following information:
|
|
||||||
* - status ("disconnected", "connecting", "associated", "connected")
|
|
||||||
* - network
|
|
||||||
*
|
|
||||||
* Note that the object returned is read only. Any changes required must
|
|
||||||
* be done by calling other APIs.
|
|
||||||
*/
|
|
||||||
readonly attribute MozWifiConnection? connection;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A connectionInformation object with the same information found in an
|
|
||||||
* nsIDOMMozWifiConnectionInfoEvent (but without the network).
|
|
||||||
* If we are not currently connected to a network, this will be null.
|
|
||||||
*/
|
|
||||||
readonly attribute MozWifiConnectionInfo? connectionInformation;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* State notification listeners. These all take an
|
|
||||||
* nsIDOMMozWifiStatusChangeEvent with the new status and a network (which
|
|
||||||
* may be null).
|
|
||||||
*
|
|
||||||
* The possible statuses are:
|
|
||||||
* - connecting: Fires when we start the process of connecting to a
|
|
||||||
* network.
|
|
||||||
* - associated: Fires when we have connected to an access point but do
|
|
||||||
* not yet have an IP address.
|
|
||||||
* - connected: Fires once we are fully connected to an access point and
|
|
||||||
* can access the internet.
|
|
||||||
* - disconnected: Fires when we either fail to connect to an access
|
|
||||||
* point (transition: associated -> disconnected) or
|
|
||||||
* when we were connected to a network but have
|
|
||||||
* disconnected for any reason (transition: connected ->
|
|
||||||
* disconnected).
|
|
||||||
*/
|
|
||||||
attribute EventHandler onstatuschange;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* An event listener that is called with information about the signal
|
|
||||||
* strength and link speed every 5 seconds.
|
|
||||||
*/
|
|
||||||
attribute EventHandler onconnectionInfoUpdate;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* These two events fire when the wifi system is brought online or taken
|
|
||||||
* offline.
|
|
||||||
*/
|
|
||||||
attribute EventHandler onenabled;
|
|
||||||
attribute EventHandler ondisabled;
|
|
||||||
};
|
|
|
@ -556,7 +556,6 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk':
|
||||||
WEBIDL_FILES += [
|
WEBIDL_FILES += [
|
||||||
'MozSpeakerManager.webidl',
|
'MozSpeakerManager.webidl',
|
||||||
'MozWifiConnectionInfoEvent.webidl',
|
'MozWifiConnectionInfoEvent.webidl',
|
||||||
'MozWifiManager.webidl',
|
|
||||||
'MozWifiP2pManager.webidl',
|
'MozWifiP2pManager.webidl',
|
||||||
'MozWifiP2pStatusChangeEvent.webidl',
|
'MozWifiP2pStatusChangeEvent.webidl',
|
||||||
'MozWifiStatusChangeEvent.webidl',
|
'MozWifiStatusChangeEvent.webidl',
|
||||||
|
|
|
@ -15,74 +15,67 @@ Cu.import("resource://gre/modules/DOMRequestHelper.jsm");
|
||||||
const DEBUG = false; // set to false to suppress debug messages
|
const DEBUG = false; // set to false to suppress debug messages
|
||||||
|
|
||||||
const DOMWIFIMANAGER_CONTRACTID = "@mozilla.org/wifimanager;1";
|
const DOMWIFIMANAGER_CONTRACTID = "@mozilla.org/wifimanager;1";
|
||||||
const DOMWIFIMANAGER_CID = Components.ID("{c9b5f09e-25d2-40ca-aef4-c4d13d93c706}");
|
const DOMWIFIMANAGER_CID = Components.ID("{2cf775a7-1837-410c-9e26-323c42e076da}");
|
||||||
|
|
||||||
function MozWifiNetwork() {
|
|
||||||
}
|
|
||||||
|
|
||||||
MozWifiNetwork.prototype = {
|
|
||||||
|
|
||||||
init: function(aWindow) {
|
|
||||||
this._window = aWindow;
|
|
||||||
},
|
|
||||||
|
|
||||||
__init: function(obj) {
|
|
||||||
this.ssid = obj.ssid;
|
|
||||||
this.security = obj.security;
|
|
||||||
this.capabilities = obj.capabilities;
|
|
||||||
this.known = obj.known;
|
|
||||||
this.connected = obj.connected;
|
|
||||||
this.hidden = obj.hidden;
|
|
||||||
},
|
|
||||||
|
|
||||||
classID: Components.ID("{c01fd751-43c0-460a-8b64-abf652ec7220}"),
|
|
||||||
contractID: "@mozilla.org/mozwifinetwork;1",
|
|
||||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsISupports,
|
|
||||||
Ci.nsIDOMGlobalPropertyInitializer])
|
|
||||||
};
|
|
||||||
|
|
||||||
function MozWifiConnection(obj) {
|
|
||||||
this.status = obj.status;
|
|
||||||
this.network = obj.network;
|
|
||||||
}
|
|
||||||
|
|
||||||
MozWifiConnection.prototype = {
|
|
||||||
classID: Components.ID("{23579da4-201b-4319-bd42-9b7f337343ac}"),
|
|
||||||
contractID: "@mozilla.org/mozwificonnection;1",
|
|
||||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsISupports])
|
|
||||||
};
|
|
||||||
|
|
||||||
function MozWifiConnectionInfo(obj) {
|
|
||||||
this.signalStrength = obj.signalStrength;
|
|
||||||
this.relSignalStrength = obj.relSignalStrength;
|
|
||||||
this.linkSpeed = obj.linkSpeed;
|
|
||||||
this.ipAddress = obj.ipAddress;
|
|
||||||
}
|
|
||||||
|
|
||||||
MozWifiConnectionInfo.prototype = {
|
|
||||||
classID: Components.ID("{83670352-6ed4-4c35-8de9-402296a1959c}"),
|
|
||||||
contractID: "@mozilla.org/mozwificonnectioninfo;1",
|
|
||||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsISupports])
|
|
||||||
}
|
|
||||||
|
|
||||||
function DOMWifiManager() {
|
function DOMWifiManager() {
|
||||||
this.defineEventHandlerGetterSetter("onstatuschange");
|
}
|
||||||
this.defineEventHandlerGetterSetter("onconnectionInfoUpdate");
|
|
||||||
this.defineEventHandlerGetterSetter("onenabled");
|
function exposeCurrentNetwork(currentNetwork) {
|
||||||
this.defineEventHandlerGetterSetter("ondisabled");
|
currentNetwork.__exposedProps__ = exposeCurrentNetwork.currentNetworkApi;
|
||||||
|
}
|
||||||
|
|
||||||
|
exposeCurrentNetwork.currentNetworkApi = {
|
||||||
|
ssid: "r",
|
||||||
|
security: "r",
|
||||||
|
capabilities: "r",
|
||||||
|
known: "r"
|
||||||
|
};
|
||||||
|
|
||||||
|
// For smaller, read-only APIs, we expose any property that doesn't begin with
|
||||||
|
// an underscore.
|
||||||
|
function exposeReadOnly(obj) {
|
||||||
|
var exposedProps = {};
|
||||||
|
for (let i in obj) {
|
||||||
|
if (i[0] === "_")
|
||||||
|
continue;
|
||||||
|
exposedProps[i] = "r";
|
||||||
|
}
|
||||||
|
|
||||||
|
obj.__exposedProps__ = exposedProps;
|
||||||
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
DOMWifiManager.prototype = {
|
DOMWifiManager.prototype = {
|
||||||
__proto__: DOMRequestIpcHelper.prototype,
|
__proto__: DOMRequestIpcHelper.prototype,
|
||||||
classDescription: "DOMWifiManager",
|
|
||||||
classID: DOMWIFIMANAGER_CID,
|
classID: DOMWIFIMANAGER_CID,
|
||||||
|
classInfo: XPCOMUtils.generateCI({classID: DOMWIFIMANAGER_CID,
|
||||||
contractID: DOMWIFIMANAGER_CONTRACTID,
|
contractID: DOMWIFIMANAGER_CONTRACTID,
|
||||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsIDOMGlobalPropertyInitializer,
|
classDescription: "DOMWifiManager",
|
||||||
|
interfaces: [Ci.nsIDOMWifiManager],
|
||||||
|
flags: Ci.nsIClassInfo.DOM_OBJECT}),
|
||||||
|
|
||||||
|
QueryInterface: XPCOMUtils.generateQI([Ci.nsIDOMWifiManager,
|
||||||
|
Ci.nsIDOMGlobalPropertyInitializer,
|
||||||
Ci.nsISupportsWeakReference,
|
Ci.nsISupportsWeakReference,
|
||||||
Ci.nsIObserver]),
|
Ci.nsIObserver]),
|
||||||
|
|
||||||
// nsIDOMGlobalPropertyInitializer implementation
|
// nsIDOMGlobalPropertyInitializer implementation
|
||||||
init: function(aWindow) {
|
init: function(aWindow) {
|
||||||
|
let principal = aWindow.document.nodePrincipal;
|
||||||
|
let secMan = Cc["@mozilla.org/scriptsecuritymanager;1"].getService(Ci.nsIScriptSecurityManager);
|
||||||
|
|
||||||
|
let perm = principal == secMan.getSystemPrincipal()
|
||||||
|
? Ci.nsIPermissionManager.ALLOW_ACTION
|
||||||
|
: Services.perms.testExactPermissionFromPrincipal(principal, "wifi-manage");
|
||||||
|
|
||||||
|
// Only pages with perm set can use the wifi manager.
|
||||||
|
this._hasPrivileges = perm == Ci.nsIPermissionManager.ALLOW_ACTION;
|
||||||
|
|
||||||
|
if (!this._hasPrivileges) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
// Maintain this state for synchronous APIs.
|
// Maintain this state for synchronous APIs.
|
||||||
this._currentNetwork = null;
|
this._currentNetwork = null;
|
||||||
this._connectionStatus = "disconnected";
|
this._connectionStatus = "disconnected";
|
||||||
|
@ -108,8 +101,10 @@ DOMWifiManager.prototype = {
|
||||||
|
|
||||||
var state = this._mm.sendSyncMessage("WifiManager:getState")[0];
|
var state = this._mm.sendSyncMessage("WifiManager:getState")[0];
|
||||||
if (state) {
|
if (state) {
|
||||||
this._currentNetwork = this._convertWifiNetwork(state.network);
|
this._currentNetwork = state.network;
|
||||||
this._lastConnectionInfo = this._convertConnectionInfo(state.connectionInfo);
|
if (this._currentNetwork)
|
||||||
|
exposeCurrentNetwork(this._currentNetwork);
|
||||||
|
this._lastConnectionInfo = state.connectionInfo;
|
||||||
this._enabled = state.enabled;
|
this._enabled = state.enabled;
|
||||||
this._connectionStatus = state.status;
|
this._connectionStatus = state.status;
|
||||||
this._macAddress = state.macAddress;
|
this._macAddress = state.macAddress;
|
||||||
|
@ -122,40 +117,11 @@ DOMWifiManager.prototype = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_convertWifiNetworkToJSON: function(aNetwork) {
|
uninit: function() {
|
||||||
let json = {};
|
this._onStatusChange = null;
|
||||||
|
this._onConnectionInfoUpdate = null;
|
||||||
for (let key in aNetwork) {
|
this._onEnabled = null;
|
||||||
// In WifiWorker.js there are lots of check using "key in network".
|
this._onDisabled = null;
|
||||||
// So if the value of any property of WifiNetwork is undefined, do not clone it.
|
|
||||||
if (aNetwork[key] != undefined) {
|
|
||||||
json[key] = aNetwork[key];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return json;
|
|
||||||
},
|
|
||||||
|
|
||||||
_convertWifiNetwork: function(aNetwork) {
|
|
||||||
let network = aNetwork ? new this._window.MozWifiNetwork(aNetwork) : null;
|
|
||||||
return network;
|
|
||||||
},
|
|
||||||
|
|
||||||
_convertWifiNetworks: function(aNetworks) {
|
|
||||||
let networks = [];
|
|
||||||
for (let i in aNetworks) {
|
|
||||||
networks.push(this._convertWifiNetwork(aNetworks[i]));
|
|
||||||
}
|
|
||||||
return networks;
|
|
||||||
},
|
|
||||||
|
|
||||||
_convertConnection: function(aConn) {
|
|
||||||
let conn = aConn ? new MozWifiConnection(aConn) : null;
|
|
||||||
return conn;
|
|
||||||
},
|
|
||||||
|
|
||||||
_convertConnectionInfo: function(aInfo) {
|
|
||||||
let info = aInfo ? new MozWifiConnectionInfo(aInfo) : null;
|
|
||||||
return info;
|
|
||||||
},
|
},
|
||||||
|
|
||||||
_sendMessageForRequest: function(name, data, request) {
|
_sendMessageForRequest: function(name, data, request) {
|
||||||
|
@ -178,7 +144,7 @@ DOMWifiManager.prototype = {
|
||||||
|
|
||||||
switch (aMessage.name) {
|
switch (aMessage.name) {
|
||||||
case "WifiManager:getNetworks:Return:OK":
|
case "WifiManager:getNetworks:Return:OK":
|
||||||
Services.DOMRequest.fireSuccess(request, this._convertWifiNetworks(msg.data));
|
Services.DOMRequest.fireSuccess(request, exposeReadOnly(msg.data));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "WifiManager:getNetworks:Return:NO":
|
case "WifiManager:getNetworks:Return:NO":
|
||||||
|
@ -186,7 +152,7 @@ DOMWifiManager.prototype = {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "WifiManager:getKnownNetworks:Return:OK":
|
case "WifiManager:getKnownNetworks:Return:OK":
|
||||||
Services.DOMRequest.fireSuccess(request, this._convertWifiNetworks(msg.data));
|
Services.DOMRequest.fireSuccess(request, exposeReadOnly(msg.data));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "WifiManager:getKnownNetworks:Return:NO":
|
case "WifiManager:getKnownNetworks:Return:NO":
|
||||||
|
@ -210,7 +176,7 @@ DOMWifiManager.prototype = {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "WifiManager:wps:Return:OK":
|
case "WifiManager:wps:Return:OK":
|
||||||
Services.DOMRequest.fireSuccess(request, msg.data);
|
Services.DOMRequest.fireSuccess(request, exposeReadOnly(msg.data));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "WifiManager:wps:Return:NO":
|
case "WifiManager:wps:Return:NO":
|
||||||
|
@ -218,7 +184,7 @@ DOMWifiManager.prototype = {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "WifiManager:setPowerSavingMode:Return:OK":
|
case "WifiManager:setPowerSavingMode:Return:OK":
|
||||||
Services.DOMRequest.fireSuccess(request, msg.data);
|
Services.DOMRequest.fireSuccess(request, exposeReadOnly(msg.data));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "WifiManager:setPowerSavingMode:Return:NO":
|
case "WifiManager:setPowerSavingMode:Return:NO":
|
||||||
|
@ -226,7 +192,7 @@ DOMWifiManager.prototype = {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "WifiManager:setHttpProxy:Return:OK":
|
case "WifiManager:setHttpProxy:Return:OK":
|
||||||
Services.DOMRequest.fireSuccess(request, msg.data);
|
Services.DOMRequest.fireSuccess(request, exposeReadOnly(msg.data));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "WifiManager:setHttpProxy:Return:NO":
|
case "WifiManager:setHttpProxy:Return:NO":
|
||||||
|
@ -234,7 +200,7 @@ DOMWifiManager.prototype = {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "WifiManager:setStaticIpMode:Return:OK":
|
case "WifiManager:setStaticIpMode:Return:OK":
|
||||||
Services.DOMRequest.fireSuccess(request, msg.data);
|
Services.DOMRequest.fireSuccess(request, exposeReadOnly(msg.data));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "WifiManager:setStaticIpMode:Return:NO":
|
case "WifiManager:setStaticIpMode:Return:NO":
|
||||||
|
@ -254,19 +220,22 @@ DOMWifiManager.prototype = {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "WifiManager:onconnecting":
|
case "WifiManager:onconnecting":
|
||||||
this._currentNetwork = this._convertWifiNetwork(msg.network);
|
this._currentNetwork = msg.network;
|
||||||
|
exposeCurrentNetwork(this._currentNetwork);
|
||||||
this._connectionStatus = "connecting";
|
this._connectionStatus = "connecting";
|
||||||
this._fireStatusChangeEvent();
|
this._fireStatusChangeEvent();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "WifiManager:onassociate":
|
case "WifiManager:onassociate":
|
||||||
this._currentNetwork = this._convertWifiNetwork(msg.network);
|
this._currentNetwork = msg.network;
|
||||||
|
exposeCurrentNetwork(this._currentNetwork);
|
||||||
this._connectionStatus = "associated";
|
this._connectionStatus = "associated";
|
||||||
this._fireStatusChangeEvent();
|
this._fireStatusChangeEvent();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "WifiManager:onconnect":
|
case "WifiManager:onconnect":
|
||||||
this._currentNetwork = this._convertWifiNetwork(msg.network);
|
this._currentNetwork = msg.network;
|
||||||
|
exposeCurrentNetwork(this._currentNetwork);
|
||||||
this._connectionStatus = "connected";
|
this._connectionStatus = "connected";
|
||||||
this._fireStatusChangeEvent();
|
this._fireStatusChangeEvent();
|
||||||
break;
|
break;
|
||||||
|
@ -300,7 +269,7 @@ DOMWifiManager.prototype = {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "WifiManager:connectionInfoUpdate":
|
case "WifiManager:connectionInfoUpdate":
|
||||||
this._lastConnectionInfo = this._convertConnectionInfo(msg);
|
this._lastConnectionInfo = msg;
|
||||||
this._fireConnectionInfoUpdate(msg);
|
this._fireConnectionInfoUpdate(msg);
|
||||||
break;
|
break;
|
||||||
case "WifiManager:onconnectingfailed":
|
case "WifiManager:onconnectingfailed":
|
||||||
|
@ -313,115 +282,156 @@ DOMWifiManager.prototype = {
|
||||||
},
|
},
|
||||||
|
|
||||||
_fireStatusChangeEvent: function StatusChangeEvent() {
|
_fireStatusChangeEvent: function StatusChangeEvent() {
|
||||||
var event = new this._window.MozWifiStatusChangeEvent("statuschange",
|
if (this._onStatusChange) {
|
||||||
|
debug("StatusChangeEvent");
|
||||||
|
var event = new this._window.MozWifiStatusChangeEvent("statusChangeEvent",
|
||||||
{ network: this._currentNetwork,
|
{ network: this._currentNetwork,
|
||||||
status: this._connectionStatus
|
status: this._connectionStatus
|
||||||
});
|
});
|
||||||
this.__DOM_IMPL__.dispatchEvent(event);
|
this._onStatusChange.handleEvent(event);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_fireConnectionInfoUpdate: function onConnectionInfoUpdate(info) {
|
_fireConnectionInfoUpdate: function connectionInfoUpdate(info) {
|
||||||
var evt = new this._window.MozWifiConnectionInfoEvent("connectioninfoupdate",
|
if (this._onConnectionInfoUpdate) {
|
||||||
|
debug("ConnectionInfoEvent");
|
||||||
|
var evt = new this._window.MozWifiConnectionInfoEvent("connectionInfoEvent",
|
||||||
{ network: this._currentNetwork,
|
{ network: this._currentNetwork,
|
||||||
signalStrength: info.signalStrength,
|
signalStrength: info.signalStrength,
|
||||||
relSignalStrength: info.relSignalStrength,
|
relSignalStrength: info.relSignalStrength,
|
||||||
linkSpeed: info.linkSpeed,
|
linkSpeed: info.linkSpeed,
|
||||||
ipAddress: info.ipAddress,
|
ipAddress: info.ipAddress,
|
||||||
});
|
});
|
||||||
this.__DOM_IMPL__.dispatchEvent(evt);
|
this._onConnectionInfoUpdate.handleEvent(evt);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_fireEnabledOrDisabled: function enabledDisabled(enabled) {
|
_fireEnabledOrDisabled: function enabledDisabled(enabled) {
|
||||||
var evt = new this._window.Event(enabled ? "enabled" : "disabled");
|
var handler = enabled ? this._onEnabled : this._onDisabled;
|
||||||
this.__DOM_IMPL__.dispatchEvent(evt);
|
if (handler) {
|
||||||
|
var evt = new this._window.Event("WifiEnabled");
|
||||||
|
handler.handleEvent(evt);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
getNetworks: function getNetworks() {
|
// nsIDOMWifiManager
|
||||||
|
getNetworks: function nsIDOMWifiManager_getNetworks() {
|
||||||
|
if (!this._hasPrivileges)
|
||||||
|
throw new Components.Exception("Denied", Cr.NS_ERROR_FAILURE);
|
||||||
var request = this.createRequest();
|
var request = this.createRequest();
|
||||||
this._sendMessageForRequest("WifiManager:getNetworks", null, request);
|
this._sendMessageForRequest("WifiManager:getNetworks", null, request);
|
||||||
return request;
|
return request;
|
||||||
},
|
},
|
||||||
|
|
||||||
getKnownNetworks: function getKnownNetworks() {
|
getKnownNetworks: function nsIDOMWifiManager_getKnownNetworks() {
|
||||||
|
if (!this._hasPrivileges)
|
||||||
|
throw new Components.Exception("Denied", Cr.NS_ERROR_FAILURE);
|
||||||
var request = this.createRequest();
|
var request = this.createRequest();
|
||||||
this._sendMessageForRequest("WifiManager:getKnownNetworks", null, request);
|
this._sendMessageForRequest("WifiManager:getKnownNetworks", null, request);
|
||||||
return request;
|
return request;
|
||||||
},
|
},
|
||||||
|
|
||||||
associate: function associate(network) {
|
associate: function nsIDOMWifiManager_associate(network) {
|
||||||
|
if (!this._hasPrivileges)
|
||||||
|
throw new Components.Exception("Denied", Cr.NS_ERROR_FAILURE);
|
||||||
var request = this.createRequest();
|
var request = this.createRequest();
|
||||||
this._sendMessageForRequest("WifiManager:associate",
|
this._sendMessageForRequest("WifiManager:associate", network, request);
|
||||||
this._convertWifiNetworkToJSON(network), request);
|
|
||||||
return request;
|
return request;
|
||||||
},
|
},
|
||||||
|
|
||||||
forget: function forget(network) {
|
forget: function nsIDOMWifiManager_forget(network) {
|
||||||
|
if (!this._hasPrivileges)
|
||||||
|
throw new Components.Exception("Denied", Cr.NS_ERROR_FAILURE);
|
||||||
var request = this.createRequest();
|
var request = this.createRequest();
|
||||||
this._sendMessageForRequest("WifiManager:forget",
|
this._sendMessageForRequest("WifiManager:forget", network, request);
|
||||||
this._convertWifiNetworkToJSON(network), request);
|
|
||||||
return request;
|
return request;
|
||||||
},
|
},
|
||||||
|
|
||||||
wps: function wps(detail) {
|
wps: function nsIDOMWifiManager_wps(detail) {
|
||||||
|
if (!this._hasPrivileges)
|
||||||
|
throw new Components.Exception("Denied", Cr.NS_ERROR_FAILURE);
|
||||||
var request = this.createRequest();
|
var request = this.createRequest();
|
||||||
this._sendMessageForRequest("WifiManager:wps", detail, request);
|
this._sendMessageForRequest("WifiManager:wps", detail, request);
|
||||||
return request;
|
return request;
|
||||||
},
|
},
|
||||||
|
|
||||||
setPowerSavingMode: function setPowerSavingMode(enabled) {
|
setPowerSavingMode: function nsIDOMWifiManager_setPowerSavingMode(enabled) {
|
||||||
|
if (!this._hasPrivileges)
|
||||||
|
throw new Components.Exception("Denied", Cr.NS_ERROR_FAILURE);
|
||||||
var request = this.createRequest();
|
var request = this.createRequest();
|
||||||
this._sendMessageForRequest("WifiManager:setPowerSavingMode", enabled, request);
|
this._sendMessageForRequest("WifiManager:setPowerSavingMode", enabled, request);
|
||||||
return request;
|
return request;
|
||||||
},
|
},
|
||||||
|
|
||||||
setHttpProxy: function setHttpProxy(network, info) {
|
setHttpProxy: function nsIDOMWifiManager_setHttpProxy(network, info) {
|
||||||
|
if (!this._hasPrivileges)
|
||||||
|
throw new Components.Exception("Denied", Cr.NS_ERROR_FAILURE);
|
||||||
var request = this.createRequest();
|
var request = this.createRequest();
|
||||||
this._sendMessageForRequest("WifiManager:setHttpProxy",
|
this._sendMessageForRequest("WifiManager:setHttpProxy", {network:network, info:info}, request);
|
||||||
{ network: this._convertWifiNetworkToJSON(network), info:info}, request);
|
|
||||||
return request;
|
return request;
|
||||||
},
|
},
|
||||||
|
|
||||||
setStaticIpMode: function setStaticIpMode(network, info) {
|
setStaticIpMode: function nsIDOMWifiManager_setStaticIpMode(network, info) {
|
||||||
|
if (!this._hasPrivileges)
|
||||||
|
throw new Components.Exception("Denied", Cr.NS_ERROR_FAILURE);
|
||||||
var request = this.createRequest();
|
var request = this.createRequest();
|
||||||
this._sendMessageForRequest("WifiManager:setStaticIpMode",
|
this._sendMessageForRequest("WifiManager:setStaticIpMode", {network: network,info: info}, request);
|
||||||
{ network: this._convertWifiNetworkToJSON(network), info: info}, request);
|
|
||||||
return request;
|
return request;
|
||||||
},
|
},
|
||||||
|
|
||||||
get enabled() {
|
get enabled() {
|
||||||
|
if (!this._hasPrivileges)
|
||||||
|
throw new Components.Exception("Denied", Cr.NS_ERROR_FAILURE);
|
||||||
return this._enabled;
|
return this._enabled;
|
||||||
},
|
},
|
||||||
|
|
||||||
get macAddress() {
|
get macAddress() {
|
||||||
|
if (!this._hasPrivileges)
|
||||||
|
throw new Components.Exception("Denied", Cr.NS_ERROR_FAILURE);
|
||||||
return this._macAddress;
|
return this._macAddress;
|
||||||
},
|
},
|
||||||
|
|
||||||
get connection() {
|
get connection() {
|
||||||
let _connection = this._convertConnection({ status: this._connectionStatus,
|
if (!this._hasPrivileges)
|
||||||
network: this._currentNetwork,
|
throw new Components.Exception("Denied", Cr.NS_ERROR_FAILURE);
|
||||||
});
|
return exposeReadOnly({ status: this._connectionStatus,
|
||||||
return _connection;
|
network: this._currentNetwork });
|
||||||
},
|
},
|
||||||
|
|
||||||
get connectionInformation() {
|
get connectionInformation() {
|
||||||
return this._lastConnectionInfo;
|
if (!this._hasPrivileges)
|
||||||
|
throw new Components.Exception("Denied", Cr.NS_ERROR_FAILURE);
|
||||||
|
return this._lastConnectionInfo
|
||||||
|
? exposeReadOnly(this._lastConnectionInfo)
|
||||||
|
: null;
|
||||||
},
|
},
|
||||||
|
|
||||||
defineEventHandlerGetterSetter: function(name) {
|
set onstatuschange(callback) {
|
||||||
Object.defineProperty(this, name, {
|
if (!this._hasPrivileges)
|
||||||
get: function() {
|
throw new Components.Exception("Denied", Cr.NS_ERROR_FAILURE);
|
||||||
return this.__DOM_IMPL__.getEventHandler(name);
|
this._onStatusChange = callback;
|
||||||
},
|
},
|
||||||
set: function(handler) {
|
|
||||||
this.__DOM_IMPL__.setEventHandler(name, handler);
|
set connectionInfoUpdate(callback) {
|
||||||
|
if (!this._hasPrivileges)
|
||||||
|
throw new Components.Exception("Denied", Cr.NS_ERROR_FAILURE);
|
||||||
|
this._onConnectionInfoUpdate = callback;
|
||||||
|
},
|
||||||
|
|
||||||
|
set onenabled(callback) {
|
||||||
|
if (!this._hasPrivileges)
|
||||||
|
throw new Components.Exception("Denied", Cr.NS_ERROR_FAILURE);
|
||||||
|
this._onEnabled = callback;
|
||||||
|
},
|
||||||
|
|
||||||
|
set ondisabled(callback) {
|
||||||
|
if (!this._hasPrivileges)
|
||||||
|
throw new Components.Exception("Denied", Cr.NS_ERROR_FAILURE);
|
||||||
|
this._onDisabled = callback;
|
||||||
}
|
}
|
||||||
});
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
this.NSGetFactory = XPCOMUtils.generateNSGetFactory([
|
this.NSGetFactory = XPCOMUtils.generateNSGetFactory([DOMWifiManager]);
|
||||||
DOMWifiManager, MozWifiNetwork, MozWifiConnection, MozWifiConnectionInfo
|
|
||||||
]);
|
|
||||||
|
|
||||||
let debug;
|
let debug;
|
||||||
if (DEBUG) {
|
if (DEBUG) {
|
||||||
|
|
|
@ -1,12 +1,4 @@
|
||||||
# DOMWifiManager.js
|
# DOMWifiManager.js
|
||||||
component {c9b5f09e-25d2-40ca-aef4-c4d13d93c706} DOMWifiManager.js
|
component {2cf775a7-1837-410c-9e26-323c42e076da} DOMWifiManager.js
|
||||||
contract @mozilla.org/wifimanager;1 {c9b5f09e-25d2-40ca-aef4-c4d13d93c706}
|
contract @mozilla.org/wifimanager;1 {2cf775a7-1837-410c-9e26-323c42e076da}
|
||||||
|
category JavaScript-navigator-property mozWifiManager @mozilla.org/wifimanager;1
|
||||||
component {c01fd751-43c0-460a-8b64-abf652ec7220} DOMWifiManager.js
|
|
||||||
contract @mozilla.org/mozwifinetwork;1 {c01fd751-43c0-460a-8b64-abf652ec7220}
|
|
||||||
|
|
||||||
component {23579da4-201b-4319-bd42-9b7f337343ac} DOMWifiManager.js
|
|
||||||
contract @mozilla.org/mozwificonnection;1 {23579da4-201b-4319-bd42-9b7f337343ac}
|
|
||||||
|
|
||||||
component {83670352-6ed4-4c35-8de9-402296a1959c} DOMWifiManager.js
|
|
||||||
contract @mozilla.org/mozwificonnectioninfo;1 {83670352-6ed4-4c35-8de9-402296a1959c}
|
|
||||||
|
|
|
@ -58,3 +58,163 @@ interface nsIWifi : nsISupports
|
||||||
*/
|
*/
|
||||||
void getWifiScanResults(in nsIWifiScanResultsReady callback);
|
void getWifiScanResults(in nsIWifiScanResultsReady callback);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
[scriptable, uuid(e5a72295-1c5f-4848-9cbb-f1d3785c16c1)]
|
||||||
|
interface nsIDOMWifiManager : nsISupports
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Returns the list of currently available networks.
|
||||||
|
* onsuccess: We have obtained the current list of networks. request.value
|
||||||
|
* is an object whose property names are SSIDs and values are
|
||||||
|
* network objects.
|
||||||
|
* onerror: We were unable to obtain a list of property names.
|
||||||
|
*/
|
||||||
|
nsIDOMDOMRequest getNetworks();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the list of networks known to the system that will be
|
||||||
|
* automatically connected to if they're in range.
|
||||||
|
* onsuccess: request.value is an object whose property names are
|
||||||
|
* SSIDs and values are network objects.
|
||||||
|
* onerror: We were unable to obtain a list of known networks.
|
||||||
|
*/
|
||||||
|
nsIDOMDOMRequest getKnownNetworks();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Takes one of the networks returned from getNetworks and tries to
|
||||||
|
* connect to it.
|
||||||
|
* @param network A network object with information about the network,
|
||||||
|
* such as the SSID, key management desired, etc.
|
||||||
|
* onsuccess: We have started attempting to associate with the network.
|
||||||
|
* request.value is true.
|
||||||
|
* onerror: We were unable to select the network. This most likely means a
|
||||||
|
* configuration error.
|
||||||
|
*/
|
||||||
|
nsIDOMDOMRequest associate(in jsval network);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Given a network, removes it from the list of networks that we'll
|
||||||
|
* automatically connect to. In order to re-connect to the network, it is
|
||||||
|
* necessary to call associate on it.
|
||||||
|
* @param network A network object with the SSID of the network to remove.
|
||||||
|
* onsuccess: We have removed this network. If we were previously
|
||||||
|
* connected to it, we have started reconnecting to the next
|
||||||
|
* network in the list.
|
||||||
|
* onerror: We were unable to remove the network.
|
||||||
|
*/
|
||||||
|
nsIDOMDOMRequest forget(in jsval network);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Wi-Fi Protected Setup functionality.
|
||||||
|
* @param detail WPS detail which has 'method' and 'pin' field.
|
||||||
|
* The possible method field values are:
|
||||||
|
* - pbc: The Push Button Configuration.
|
||||||
|
* - pin: The PIN configuration.
|
||||||
|
* - cancel: Request to cancel WPS in progress.
|
||||||
|
* If method field is 'pin', 'pin' field can exist and has
|
||||||
|
* a PIN number.
|
||||||
|
* If method field is 'pin', 'bssid' field can exist and has
|
||||||
|
* a opposite BSSID.
|
||||||
|
* onsuccess: We have successfully started/canceled wps.
|
||||||
|
* onerror: We have failed to start/cancel wps.
|
||||||
|
*/
|
||||||
|
nsIDOMDOMRequest wps(in jsval detail);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Turn on/off wifi power saving mode.
|
||||||
|
* @param enabled true or false.
|
||||||
|
* onsuccess: We have successfully turn on/off wifi power saving mode.
|
||||||
|
* onerror: We have failed to turn on/off wifi power saving mode.
|
||||||
|
*/
|
||||||
|
nsIDOMDOMRequest setPowerSavingMode(in boolean enabled);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Given a network, configure using static IP instead of running DHCP
|
||||||
|
* @param network A network object with the SSID of the network to set static ip.
|
||||||
|
* @param info info should have following field:
|
||||||
|
* - enabled True to enable static IP, false to use DHCP
|
||||||
|
* - ipaddr configured static IP address
|
||||||
|
* - proxy configured proxy server address
|
||||||
|
* - maskLength configured mask length
|
||||||
|
* - gateway configured gateway address
|
||||||
|
* - dns1 configured first DNS server address
|
||||||
|
* - dns2 configured seconf DNS server address
|
||||||
|
* onsuccess: We have successfully configure the static ip mode.
|
||||||
|
* onerror: We have failed to configure the static ip mode.
|
||||||
|
*/
|
||||||
|
nsIDOMDOMRequest setStaticIpMode(in jsval network,
|
||||||
|
in jsval info);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Given a network, configure http proxy when using wifi.
|
||||||
|
* @param network A network object with the SSID of the network to set http proxy.
|
||||||
|
* @param info info should have following field:
|
||||||
|
* - httpProxyHost ip address of http proxy.
|
||||||
|
* - httpProxyPort port of http proxy, set 0 to use default port 8080.
|
||||||
|
* set info to null to clear http proxy.
|
||||||
|
* onsuccess: We have successfully configure http proxy.
|
||||||
|
* onerror: We have failed to configure http proxy.
|
||||||
|
*/
|
||||||
|
nsIDOMDOMRequest setHttpProxy(in jsval network,
|
||||||
|
in jsval info);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns whether or not wifi is currently enabled.
|
||||||
|
*/
|
||||||
|
readonly attribute boolean enabled;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the MAC address of the wifi adapter.
|
||||||
|
*/
|
||||||
|
readonly attribute DOMString macAddress;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An non-null object containing the following information:
|
||||||
|
* - status ("disconnected", "connecting", "associated", "connected")
|
||||||
|
* - network
|
||||||
|
*
|
||||||
|
* Note that the object returned is read only. Any changes required must
|
||||||
|
* be done by calling other APIs.
|
||||||
|
*/
|
||||||
|
readonly attribute jsval connection;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A connectionInformation object with the same information found in an
|
||||||
|
* nsIDOMMozWifiConnectionInfoEvent (but without the network).
|
||||||
|
* If we are not currently connected to a network, this will be null.
|
||||||
|
*/
|
||||||
|
readonly attribute jsval connectionInformation;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* State notification listeners. These all take an
|
||||||
|
* nsIDOMMozWifiStatusChangeEvent with the new status and a network (which
|
||||||
|
* may be null).
|
||||||
|
*
|
||||||
|
* The possible statuses are:
|
||||||
|
* - connecting: Fires when we start the process of connecting to a
|
||||||
|
* network.
|
||||||
|
* - associated: Fires when we have connected to an access point but do
|
||||||
|
* not yet have an IP address.
|
||||||
|
* - connected: Fires once we are fully connected to an access point and
|
||||||
|
* can access the internet.
|
||||||
|
* - disconnected: Fires when we either fail to connect to an access
|
||||||
|
* point (transition: associated -> disconnected) or
|
||||||
|
* when we were connected to a network but have
|
||||||
|
* disconnected for any reason (transition: connected ->
|
||||||
|
* disconnected).
|
||||||
|
*/
|
||||||
|
attribute nsIDOMEventListener onstatuschange;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An event listener that is called with information about the signal
|
||||||
|
* strength and link speed every 5 seconds.
|
||||||
|
*/
|
||||||
|
attribute nsIDOMEventListener connectionInfoUpdate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* These two events fire when the wifi system is brought online or taken
|
||||||
|
* offline.
|
||||||
|
*/
|
||||||
|
attribute nsIDOMEventListener onenabled;
|
||||||
|
attribute nsIDOMEventListener ondisabled;
|
||||||
|
};
|
||||||
|
|
Загрузка…
Ссылка в новой задаче