blob: 974a6be157ceca6fe3e95999829414ed39e109b3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
<html>
<head>
<title>hi</title>
<script>
var count = 0;
function test() {
}
test.prototype =
{
onChange: function (accessPoints)
{
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
var d = document.getElementById("d");
d.innerHTML = "";
for (var i=0; i<accessPoints.length; i++) {
var a = accessPoints[i];
d.innerHTML = d.innerHTML + "<p>" + a.mac + " " + a.ssid + " " + a.signal + "</p>";
}
var c = document.getElementById("c");
c.innerHTML = "<p>" + count++ + "</p>";
},
onError: function (value) {
alert("error: " +value);
},
QueryInterface: function(iid) {
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
if (iid.equals(Components.interfaces.nsIWifiListener) ||
iid.equals(Components.interfaces.nsISupports))
return this;
throw Components.results.NS_ERROR_NO_INTERFACE;
},
}
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
var listener = new test();
var wifi_service = Components.classes["@mozilla.org/wifi/monitor;1"].getService(Components.interfaces.nsIWifiMonitor);
wifi_service.startWatching(listener);
</script>
</head>
<body>
<div id="d"><p></p></div>
<div id="c"><p></p></div>
</body>
</html>
|