mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Merge m-c to fx-team.
This commit is contained in:
commit
fc07527abe
@ -19,7 +19,7 @@
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="cc13cdff437c3df45374f5622094a3565a414d5b"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="db91804c290f7ed40ba5386a73ae3c23b393000c"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="266bca6e60dad43e395f38b66edabe8bdc882334"/>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="d11f524d00cacf5ba0dfbf25e4aa2158b1c3a036"/>
|
||||
|
@ -17,7 +17,7 @@
|
||||
</project>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="cc13cdff437c3df45374f5622094a3565a414d5b"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="db91804c290f7ed40ba5386a73ae3c23b393000c"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="266bca6e60dad43e395f38b66edabe8bdc882334"/>
|
||||
<project name="moztt" path="external/moztt" remote="b2g" revision="cb16958e41105d7c551d9941f522db97b8312538"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="485846b2a40d8ac7d6c1c5f8af6d15b0c10af19d"/>
|
||||
|
@ -15,7 +15,7 @@
|
||||
<project name="platform_build" path="build" remote="b2g" revision="a9e08b91e9cd1f0930f16cfc49ec72f63575d5fe">
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="cc13cdff437c3df45374f5622094a3565a414d5b"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="db91804c290f7ed40ba5386a73ae3c23b393000c"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="266bca6e60dad43e395f38b66edabe8bdc882334"/>
|
||||
<project name="moztt" path="external/moztt" remote="b2g" revision="cb16958e41105d7c551d9941f522db97b8312538"/>
|
||||
|
@ -19,7 +19,7 @@
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="cc13cdff437c3df45374f5622094a3565a414d5b"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="db91804c290f7ed40ba5386a73ae3c23b393000c"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="266bca6e60dad43e395f38b66edabe8bdc882334"/>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="d11f524d00cacf5ba0dfbf25e4aa2158b1c3a036"/>
|
||||
|
@ -4,6 +4,6 @@
|
||||
"branch": "",
|
||||
"revision": ""
|
||||
},
|
||||
"revision": "3045bf73d5cc752ba8c548d82ea567987743c3bd",
|
||||
"revision": "1265e2a0f5007f0107b2032dfb5d19d5182608fb",
|
||||
"repo_path": "/integration/gaia-central"
|
||||
}
|
||||
|
@ -17,7 +17,7 @@
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="cc13cdff437c3df45374f5622094a3565a414d5b"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="db91804c290f7ed40ba5386a73ae3c23b393000c"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="266bca6e60dad43e395f38b66edabe8bdc882334"/>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="1f6a1fe07f81c5bc5e1d079c9b60f7f78ca2bf4f"/>
|
||||
|
@ -15,7 +15,7 @@
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="cc13cdff437c3df45374f5622094a3565a414d5b"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="db91804c290f7ed40ba5386a73ae3c23b393000c"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="266bca6e60dad43e395f38b66edabe8bdc882334"/>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="1f6a1fe07f81c5bc5e1d079c9b60f7f78ca2bf4f"/>
|
||||
|
@ -19,7 +19,7 @@
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="cc13cdff437c3df45374f5622094a3565a414d5b"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="db91804c290f7ed40ba5386a73ae3c23b393000c"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="266bca6e60dad43e395f38b66edabe8bdc882334"/>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="1f6a1fe07f81c5bc5e1d079c9b60f7f78ca2bf4f"/>
|
||||
|
@ -17,7 +17,7 @@
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="cc13cdff437c3df45374f5622094a3565a414d5b"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="db91804c290f7ed40ba5386a73ae3c23b393000c"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="266bca6e60dad43e395f38b66edabe8bdc882334"/>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="1f6a1fe07f81c5bc5e1d079c9b60f7f78ca2bf4f"/>
|
||||
|
@ -17,7 +17,7 @@
|
||||
</project>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="cc13cdff437c3df45374f5622094a3565a414d5b"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="db91804c290f7ed40ba5386a73ae3c23b393000c"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="266bca6e60dad43e395f38b66edabe8bdc882334"/>
|
||||
<project name="moztt" path="external/moztt" remote="b2g" revision="cb16958e41105d7c551d9941f522db97b8312538"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="485846b2a40d8ac7d6c1c5f8af6d15b0c10af19d"/>
|
||||
|
@ -17,7 +17,7 @@
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="cc13cdff437c3df45374f5622094a3565a414d5b"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="db91804c290f7ed40ba5386a73ae3c23b393000c"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="266bca6e60dad43e395f38b66edabe8bdc882334"/>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="1f6a1fe07f81c5bc5e1d079c9b60f7f78ca2bf4f"/>
|
||||
|
@ -81,7 +81,7 @@ this.DownloadsIPC = {
|
||||
|
||||
receiveMessage: function(aMessage) {
|
||||
let download = aMessage.data;
|
||||
debug("message: " + aMessage.name + " " + download.id);
|
||||
debug("message: " + aMessage.name);
|
||||
switch(aMessage.name) {
|
||||
case "Downloads:GetList:Return":
|
||||
this._updateDownloadsArray(download);
|
||||
|
@ -6,6 +6,7 @@ support-files =
|
||||
[test_downloads_navigator_object.html]
|
||||
[test_downloads_basic.html]
|
||||
[test_downloads_large.html]
|
||||
[test_downloads_bad_file.html]
|
||||
[test_downloads_pause_remove.html]
|
||||
[test_downloads_pause_resume.html]
|
||||
skip-if = toolkit=='gonk' # b2g(bug 947167) b2g-debug(bug 947167)
|
||||
|
93
dom/downloads/tests/test_downloads_bad_file.html
Normal file
93
dom/downloads/tests/test_downloads_bad_file.html
Normal file
@ -0,0 +1,93 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=960749
|
||||
-->
|
||||
<head>
|
||||
<title>Test for Bug 960749 Downloads API</title>
|
||||
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=960749">Mozilla Bug 960749</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
</div>
|
||||
<a href="serve_file.sjs?contentType=application/octet-stream&size=1024" download=".<.EVIL.>\ / : * ? " |file.bin" id="download1">Download #1</a>
|
||||
<pre id="test">
|
||||
<script class="testbody" type="text/javascript;version=1.7">
|
||||
|
||||
// Testing a simple download, waiting for it to be done.
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var index = -1;
|
||||
var expected = "_.EVIL.__ _ _ _ _ _ _file.bin";
|
||||
|
||||
function next() {
|
||||
index += 1;
|
||||
if (index >= steps.length) {
|
||||
ok(false, "Shouldn't get here!");
|
||||
return;
|
||||
}
|
||||
try {
|
||||
steps[index]();
|
||||
} catch(ex) {
|
||||
ok(false, "Caught exception", ex);
|
||||
}
|
||||
}
|
||||
|
||||
function checkTargetFilename(download) {
|
||||
ok(download.path.endsWith(expected),
|
||||
"Download path leaf name '" + download.path +
|
||||
"' should match '" + expected + "' filename.");
|
||||
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
function downloadChange(evt) {
|
||||
var download = evt.download;
|
||||
|
||||
if (download.state === "succeeded") {
|
||||
checkTargetFilename(download);
|
||||
}
|
||||
}
|
||||
|
||||
function downloadStart(evt) {
|
||||
var download = evt.download;
|
||||
download.onstatechange = downloadChange;
|
||||
}
|
||||
|
||||
var steps = [
|
||||
// Start by setting the pref to true.
|
||||
function() {
|
||||
SpecialPowers.pushPrefEnv({
|
||||
set: [["dom.mozDownloads.enabled", true]]
|
||||
}, next);
|
||||
},
|
||||
|
||||
// Setup the event listeners.
|
||||
function() {
|
||||
SpecialPowers.pushPermissions([
|
||||
{type: "downloads", allow: true, context: document}
|
||||
], function() {
|
||||
navigator.mozDownloadManager.ondownloadstart = downloadStart;
|
||||
next();
|
||||
});
|
||||
},
|
||||
|
||||
// Click on the <a download> to start the download.
|
||||
function() {
|
||||
document.getElementById("download1").click();
|
||||
}
|
||||
];
|
||||
|
||||
next();
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -30,7 +30,7 @@ var gData = [
|
||||
perm: ["wifi-manage"],
|
||||
needParentPerm: true,
|
||||
obj: "mozWifiManager",
|
||||
webidl: "MozWifiManager",
|
||||
idl: "nsIDOMWifiManager",
|
||||
verifier: verifier.toSource(),
|
||||
},
|
||||
]
|
||||
|
@ -685,16 +685,8 @@ var interfaceNamesInGlobalScope =
|
||||
{name: "MozVoicemailEvent", b2g: true, pref: "dom.voicemail.enabled"},
|
||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||
{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!
|
||||
{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!
|
||||
{name: "MozWifiStatusChangeEvent", b2g: true},
|
||||
// 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 += [
|
||||
'MozSpeakerManager.webidl',
|
||||
'MozWifiConnectionInfoEvent.webidl',
|
||||
'MozWifiManager.webidl',
|
||||
'MozWifiP2pManager.webidl',
|
||||
'MozWifiP2pStatusChangeEvent.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 DOMWIFIMANAGER_CONTRACTID = "@mozilla.org/wifimanager;1";
|
||||
const DOMWIFIMANAGER_CID = Components.ID("{c9b5f09e-25d2-40ca-aef4-c4d13d93c706}");
|
||||
|
||||
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])
|
||||
}
|
||||
const DOMWIFIMANAGER_CID = Components.ID("{2cf775a7-1837-410c-9e26-323c42e076da}");
|
||||
|
||||
function DOMWifiManager() {
|
||||
this.defineEventHandlerGetterSetter("onstatuschange");
|
||||
this.defineEventHandlerGetterSetter("onconnectionInfoUpdate");
|
||||
this.defineEventHandlerGetterSetter("onenabled");
|
||||
this.defineEventHandlerGetterSetter("ondisabled");
|
||||
}
|
||||
|
||||
function exposeCurrentNetwork(currentNetwork) {
|
||||
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 = {
|
||||
__proto__: DOMRequestIpcHelper.prototype,
|
||||
classDescription: "DOMWifiManager",
|
||||
classID: DOMWIFIMANAGER_CID,
|
||||
contractID: DOMWIFIMANAGER_CONTRACTID,
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsIDOMGlobalPropertyInitializer,
|
||||
|
||||
classID: DOMWIFIMANAGER_CID,
|
||||
classInfo: XPCOMUtils.generateCI({classID: DOMWIFIMANAGER_CID,
|
||||
contractID: DOMWIFIMANAGER_CONTRACTID,
|
||||
classDescription: "DOMWifiManager",
|
||||
interfaces: [Ci.nsIDOMWifiManager],
|
||||
flags: Ci.nsIClassInfo.DOM_OBJECT}),
|
||||
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsIDOMWifiManager,
|
||||
Ci.nsIDOMGlobalPropertyInitializer,
|
||||
Ci.nsISupportsWeakReference,
|
||||
Ci.nsIObserver]),
|
||||
|
||||
// nsIDOMGlobalPropertyInitializer implementation
|
||||
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.
|
||||
this._currentNetwork = null;
|
||||
this._connectionStatus = "disconnected";
|
||||
@ -108,8 +101,10 @@ DOMWifiManager.prototype = {
|
||||
|
||||
var state = this._mm.sendSyncMessage("WifiManager:getState")[0];
|
||||
if (state) {
|
||||
this._currentNetwork = this._convertWifiNetwork(state.network);
|
||||
this._lastConnectionInfo = this._convertConnectionInfo(state.connectionInfo);
|
||||
this._currentNetwork = state.network;
|
||||
if (this._currentNetwork)
|
||||
exposeCurrentNetwork(this._currentNetwork);
|
||||
this._lastConnectionInfo = state.connectionInfo;
|
||||
this._enabled = state.enabled;
|
||||
this._connectionStatus = state.status;
|
||||
this._macAddress = state.macAddress;
|
||||
@ -122,40 +117,11 @@ DOMWifiManager.prototype = {
|
||||
}
|
||||
},
|
||||
|
||||
_convertWifiNetworkToJSON: function(aNetwork) {
|
||||
let json = {};
|
||||
|
||||
for (let key in aNetwork) {
|
||||
// In WifiWorker.js there are lots of check using "key in network".
|
||||
// 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;
|
||||
uninit: function() {
|
||||
this._onStatusChange = null;
|
||||
this._onConnectionInfoUpdate = null;
|
||||
this._onEnabled = null;
|
||||
this._onDisabled = null;
|
||||
},
|
||||
|
||||
_sendMessageForRequest: function(name, data, request) {
|
||||
@ -178,7 +144,7 @@ DOMWifiManager.prototype = {
|
||||
|
||||
switch (aMessage.name) {
|
||||
case "WifiManager:getNetworks:Return:OK":
|
||||
Services.DOMRequest.fireSuccess(request, this._convertWifiNetworks(msg.data));
|
||||
Services.DOMRequest.fireSuccess(request, exposeReadOnly(msg.data));
|
||||
break;
|
||||
|
||||
case "WifiManager:getNetworks:Return:NO":
|
||||
@ -186,7 +152,7 @@ DOMWifiManager.prototype = {
|
||||
break;
|
||||
|
||||
case "WifiManager:getKnownNetworks:Return:OK":
|
||||
Services.DOMRequest.fireSuccess(request, this._convertWifiNetworks(msg.data));
|
||||
Services.DOMRequest.fireSuccess(request, exposeReadOnly(msg.data));
|
||||
break;
|
||||
|
||||
case "WifiManager:getKnownNetworks:Return:NO":
|
||||
@ -210,7 +176,7 @@ DOMWifiManager.prototype = {
|
||||
break;
|
||||
|
||||
case "WifiManager:wps:Return:OK":
|
||||
Services.DOMRequest.fireSuccess(request, msg.data);
|
||||
Services.DOMRequest.fireSuccess(request, exposeReadOnly(msg.data));
|
||||
break;
|
||||
|
||||
case "WifiManager:wps:Return:NO":
|
||||
@ -218,7 +184,7 @@ DOMWifiManager.prototype = {
|
||||
break;
|
||||
|
||||
case "WifiManager:setPowerSavingMode:Return:OK":
|
||||
Services.DOMRequest.fireSuccess(request, msg.data);
|
||||
Services.DOMRequest.fireSuccess(request, exposeReadOnly(msg.data));
|
||||
break;
|
||||
|
||||
case "WifiManager:setPowerSavingMode:Return:NO":
|
||||
@ -226,7 +192,7 @@ DOMWifiManager.prototype = {
|
||||
break;
|
||||
|
||||
case "WifiManager:setHttpProxy:Return:OK":
|
||||
Services.DOMRequest.fireSuccess(request, msg.data);
|
||||
Services.DOMRequest.fireSuccess(request, exposeReadOnly(msg.data));
|
||||
break;
|
||||
|
||||
case "WifiManager:setHttpProxy:Return:NO":
|
||||
@ -234,7 +200,7 @@ DOMWifiManager.prototype = {
|
||||
break;
|
||||
|
||||
case "WifiManager:setStaticIpMode:Return:OK":
|
||||
Services.DOMRequest.fireSuccess(request, msg.data);
|
||||
Services.DOMRequest.fireSuccess(request, exposeReadOnly(msg.data));
|
||||
break;
|
||||
|
||||
case "WifiManager:setStaticIpMode:Return:NO":
|
||||
@ -254,19 +220,22 @@ DOMWifiManager.prototype = {
|
||||
break;
|
||||
|
||||
case "WifiManager:onconnecting":
|
||||
this._currentNetwork = this._convertWifiNetwork(msg.network);
|
||||
this._currentNetwork = msg.network;
|
||||
exposeCurrentNetwork(this._currentNetwork);
|
||||
this._connectionStatus = "connecting";
|
||||
this._fireStatusChangeEvent();
|
||||
break;
|
||||
|
||||
case "WifiManager:onassociate":
|
||||
this._currentNetwork = this._convertWifiNetwork(msg.network);
|
||||
this._currentNetwork = msg.network;
|
||||
exposeCurrentNetwork(this._currentNetwork);
|
||||
this._connectionStatus = "associated";
|
||||
this._fireStatusChangeEvent();
|
||||
break;
|
||||
|
||||
case "WifiManager:onconnect":
|
||||
this._currentNetwork = this._convertWifiNetwork(msg.network);
|
||||
this._currentNetwork = msg.network;
|
||||
exposeCurrentNetwork(this._currentNetwork);
|
||||
this._connectionStatus = "connected";
|
||||
this._fireStatusChangeEvent();
|
||||
break;
|
||||
@ -300,7 +269,7 @@ DOMWifiManager.prototype = {
|
||||
break;
|
||||
|
||||
case "WifiManager:connectionInfoUpdate":
|
||||
this._lastConnectionInfo = this._convertConnectionInfo(msg);
|
||||
this._lastConnectionInfo = msg;
|
||||
this._fireConnectionInfoUpdate(msg);
|
||||
break;
|
||||
case "WifiManager:onconnectingfailed":
|
||||
@ -313,115 +282,156 @@ DOMWifiManager.prototype = {
|
||||
},
|
||||
|
||||
_fireStatusChangeEvent: function StatusChangeEvent() {
|
||||
var event = new this._window.MozWifiStatusChangeEvent("statuschange",
|
||||
{ network: this._currentNetwork,
|
||||
status: this._connectionStatus
|
||||
});
|
||||
this.__DOM_IMPL__.dispatchEvent(event);
|
||||
if (this._onStatusChange) {
|
||||
debug("StatusChangeEvent");
|
||||
var event = new this._window.MozWifiStatusChangeEvent("statusChangeEvent",
|
||||
{ network: this._currentNetwork,
|
||||
status: this._connectionStatus
|
||||
});
|
||||
this._onStatusChange.handleEvent(event);
|
||||
}
|
||||
},
|
||||
|
||||
_fireConnectionInfoUpdate: function onConnectionInfoUpdate(info) {
|
||||
var evt = new this._window.MozWifiConnectionInfoEvent("connectioninfoupdate",
|
||||
{ network: this._currentNetwork,
|
||||
signalStrength: info.signalStrength,
|
||||
relSignalStrength: info.relSignalStrength,
|
||||
linkSpeed: info.linkSpeed,
|
||||
ipAddress: info.ipAddress,
|
||||
});
|
||||
this.__DOM_IMPL__.dispatchEvent(evt);
|
||||
_fireConnectionInfoUpdate: function connectionInfoUpdate(info) {
|
||||
if (this._onConnectionInfoUpdate) {
|
||||
debug("ConnectionInfoEvent");
|
||||
var evt = new this._window.MozWifiConnectionInfoEvent("connectionInfoEvent",
|
||||
{ network: this._currentNetwork,
|
||||
signalStrength: info.signalStrength,
|
||||
relSignalStrength: info.relSignalStrength,
|
||||
linkSpeed: info.linkSpeed,
|
||||
ipAddress: info.ipAddress,
|
||||
});
|
||||
this._onConnectionInfoUpdate.handleEvent(evt);
|
||||
}
|
||||
},
|
||||
|
||||
_fireEnabledOrDisabled: function enabledDisabled(enabled) {
|
||||
var evt = new this._window.Event(enabled ? "enabled" : "disabled");
|
||||
this.__DOM_IMPL__.dispatchEvent(evt);
|
||||
var handler = enabled ? this._onEnabled : this._onDisabled;
|
||||
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();
|
||||
this._sendMessageForRequest("WifiManager:getNetworks", null, 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();
|
||||
this._sendMessageForRequest("WifiManager:getKnownNetworks", null, 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();
|
||||
this._sendMessageForRequest("WifiManager:associate",
|
||||
this._convertWifiNetworkToJSON(network), request);
|
||||
this._sendMessageForRequest("WifiManager:associate", network, 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();
|
||||
this._sendMessageForRequest("WifiManager:forget",
|
||||
this._convertWifiNetworkToJSON(network), request);
|
||||
this._sendMessageForRequest("WifiManager:forget", network, 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();
|
||||
this._sendMessageForRequest("WifiManager:wps", detail, 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();
|
||||
this._sendMessageForRequest("WifiManager:setPowerSavingMode", enabled, 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();
|
||||
this._sendMessageForRequest("WifiManager:setHttpProxy",
|
||||
{ network: this._convertWifiNetworkToJSON(network), info:info}, request);
|
||||
this._sendMessageForRequest("WifiManager:setHttpProxy", {network:network, info:info}, 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();
|
||||
this._sendMessageForRequest("WifiManager:setStaticIpMode",
|
||||
{ network: this._convertWifiNetworkToJSON(network), info: info}, request);
|
||||
this._sendMessageForRequest("WifiManager:setStaticIpMode", {network: network,info: info}, request);
|
||||
return request;
|
||||
},
|
||||
|
||||
get enabled() {
|
||||
if (!this._hasPrivileges)
|
||||
throw new Components.Exception("Denied", Cr.NS_ERROR_FAILURE);
|
||||
return this._enabled;
|
||||
},
|
||||
|
||||
get macAddress() {
|
||||
if (!this._hasPrivileges)
|
||||
throw new Components.Exception("Denied", Cr.NS_ERROR_FAILURE);
|
||||
return this._macAddress;
|
||||
},
|
||||
|
||||
get connection() {
|
||||
let _connection = this._convertConnection({ status: this._connectionStatus,
|
||||
network: this._currentNetwork,
|
||||
});
|
||||
return _connection;
|
||||
if (!this._hasPrivileges)
|
||||
throw new Components.Exception("Denied", Cr.NS_ERROR_FAILURE);
|
||||
return exposeReadOnly({ status: this._connectionStatus,
|
||||
network: this._currentNetwork });
|
||||
},
|
||||
|
||||
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) {
|
||||
Object.defineProperty(this, name, {
|
||||
get: function() {
|
||||
return this.__DOM_IMPL__.getEventHandler(name);
|
||||
},
|
||||
set: function(handler) {
|
||||
this.__DOM_IMPL__.setEventHandler(name, handler);
|
||||
}
|
||||
});
|
||||
set onstatuschange(callback) {
|
||||
if (!this._hasPrivileges)
|
||||
throw new Components.Exception("Denied", Cr.NS_ERROR_FAILURE);
|
||||
this._onStatusChange = callback;
|
||||
},
|
||||
|
||||
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([
|
||||
DOMWifiManager, MozWifiNetwork, MozWifiConnection, MozWifiConnectionInfo
|
||||
]);
|
||||
this.NSGetFactory = XPCOMUtils.generateNSGetFactory([DOMWifiManager]);
|
||||
|
||||
let debug;
|
||||
if (DEBUG) {
|
||||
|
@ -1,12 +1,4 @@
|
||||
# DOMWifiManager.js
|
||||
component {c9b5f09e-25d2-40ca-aef4-c4d13d93c706} DOMWifiManager.js
|
||||
contract @mozilla.org/wifimanager;1 {c9b5f09e-25d2-40ca-aef4-c4d13d93c706}
|
||||
|
||||
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}
|
||||
component {2cf775a7-1837-410c-9e26-323c42e076da} DOMWifiManager.js
|
||||
contract @mozilla.org/wifimanager;1 {2cf775a7-1837-410c-9e26-323c42e076da}
|
||||
category JavaScript-navigator-property mozWifiManager @mozilla.org/wifimanager;1
|
||||
|
@ -58,3 +58,163 @@ interface nsIWifi : nsISupports
|
||||
*/
|
||||
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;
|
||||
};
|
||||
|
@ -318,6 +318,11 @@ CompositableParentManager::ReturnTextureDataIfNecessary(CompositableHost* aCompo
|
||||
aCompositable->GetCompositableBackendSpecificData()->GetPendingReleaseFenceTextureList();
|
||||
// Return pending Texture data
|
||||
for (size_t i = 0; i < textureList.size(); i++) {
|
||||
// File descriptor number is limited to 4 per IPC message.
|
||||
// See Bug 986253
|
||||
if (mPrevFenceHandles.size() >= 4) {
|
||||
break;
|
||||
}
|
||||
TextureHostOGL* hostOGL = textureList[i]->AsHostOGL();
|
||||
PTextureParent* actor = textureList[i]->GetIPDLActor();
|
||||
if (!hostOGL || !actor) {
|
||||
|
@ -1238,8 +1238,8 @@ nsExternalAppHandler::nsExternalAppHandler(nsIMIMEInfo * aMIMEInfo,
|
||||
AppendUTF8toUTF16(aTempFileExtension, mTempFileExtension);
|
||||
|
||||
// replace platform specific path separator and illegal characters to avoid any confusion
|
||||
mSuggestedFileName.ReplaceChar(FILE_PATH_SEPARATOR FILE_ILLEGAL_CHARACTERS, '_');
|
||||
mTempFileExtension.ReplaceChar(FILE_PATH_SEPARATOR FILE_ILLEGAL_CHARACTERS, '_');
|
||||
mSuggestedFileName.ReplaceChar(KNOWN_PATH_SEPARATORS FILE_ILLEGAL_CHARACTERS, '_');
|
||||
mTempFileExtension.ReplaceChar(KNOWN_PATH_SEPARATORS FILE_ILLEGAL_CHARACTERS, '_');
|
||||
|
||||
// Remove unsafe bidi characters which might have spoofing implications (bug 511521).
|
||||
const char16_t unsafeBidiCharacters[] = {
|
||||
@ -1436,13 +1436,13 @@ nsresult nsExternalAppHandler::SetUpTempFile(nsIChannel * aChannel)
|
||||
|
||||
// Base64 characters are alphanumeric (a-zA-Z0-9) and '+' and '/', so we need
|
||||
// to replace illegal characters -- notably '/'
|
||||
tempLeafName.ReplaceChar(FILE_PATH_SEPARATOR FILE_ILLEGAL_CHARACTERS, '_');
|
||||
tempLeafName.ReplaceChar(KNOWN_PATH_SEPARATORS FILE_ILLEGAL_CHARACTERS, '_');
|
||||
|
||||
// now append our extension.
|
||||
nsAutoCString ext;
|
||||
mMimeInfo->GetPrimaryExtension(ext);
|
||||
if (!ext.IsEmpty()) {
|
||||
ext.ReplaceChar(FILE_PATH_SEPARATOR FILE_ILLEGAL_CHARACTERS, '_');
|
||||
ext.ReplaceChar(KNOWN_PATH_SEPARATORS FILE_ILLEGAL_CHARACTERS, '_');
|
||||
if (ext.First() != '.')
|
||||
tempLeafName.Append('.');
|
||||
tempLeafName.Append(ext);
|
||||
|
@ -110,17 +110,22 @@ NS_COM_GLUE void NS_MakeRandomString(char *buf, int32_t bufLen);
|
||||
#define LFSTR "\012"
|
||||
#define CRLF "\015\012" /* A CR LF equivalent string */
|
||||
|
||||
// We use the most restrictive filesystem as our default set of illegal filename
|
||||
// characters. This is currently Windows.
|
||||
#define OS_FILE_ILLEGAL_CHARACTERS "/:*?\"<>|"
|
||||
// We also provide a list of all known file path separators for all filesystems.
|
||||
// This can be used in replacement of FILE_PATH_SEPARATOR when you need to
|
||||
// identify or replace all known path separators.
|
||||
#define KNOWN_PATH_SEPARATORS "\\/"
|
||||
|
||||
#if defined(XP_MACOSX)
|
||||
#define FILE_PATH_SEPARATOR "/"
|
||||
#define OS_FILE_ILLEGAL_CHARACTERS ":"
|
||||
#elif defined(XP_WIN)
|
||||
#define FILE_PATH_SEPARATOR "\\"
|
||||
#define OS_FILE_ILLEGAL_CHARACTERS "/:*?\"<>|"
|
||||
#elif defined(XP_UNIX)
|
||||
#define FILE_PATH_SEPARATOR "/"
|
||||
#define OS_FILE_ILLEGAL_CHARACTERS ""
|
||||
#else
|
||||
#error need_to_define_your_file_path_separator_and_illegal_characters
|
||||
#error need_to_define_your_file_path_separator_and_maybe_illegal_characters
|
||||
#endif
|
||||
|
||||
// Not all these control characters are illegal in all OSs, but we don't really
|
||||
|
Loading…
Reference in New Issue
Block a user