netwerk/wifi/tests/wifi_access_point_test.html
author Mihai Sucan <msucan@mozilla.com>
Sat, 20 Nov 2010 15:53:14 -0400
changeset 57953 0fa9ae503e4b532b4f8f32e3bcf065440ddc65f8
parent 38835 52187d722adcb53ba77dee6af06bed0df8fc510c
permissions -rw-r--r--
Bug 597756 - Fx 4 Web Console fails to show javascript errors if a tab is closed and the same document is then re-opened in a new tab; f=rcampbell r=gavin.sharp a=blocking2.0

<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>