tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

test_console_binding.html (876B)


      1 <!DOCTYPE HTML>
      2 <html>
      3 <head>
      4  <meta charset="utf-8">
      5  <title>Test Console binding</title>
      6  <script src="/tests/SimpleTest/SimpleTest.js"></script>
      7  <script src="head.js"></script>
      8  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
      9 </head>
     10 <body>
     11  <script type="application/javascript">
     12 
     13 function consoleListener() {
     14  addConsoleStorageListener(this);
     15 }
     16 
     17 var order = 0;
     18 consoleListener.prototype  = {
     19  observe(obj) {
     20    ok(!obj.chromeContext, "Thils is not a chrome context");
     21    if (order + 1 == parseInt(obj.arguments[0])) {
     22      ok(true, "Message received: " + obj.arguments[0]);
     23      order++;
     24    }
     25 
     26    if (order == 3) {
     27      removeConsoleStorageListener(this);
     28      SimpleTest.finish();
     29    }
     30  },
     31 };
     32 
     33 var cl = new consoleListener();
     34 SimpleTest.waitForExplicitFinish();
     35 
     36 [1, 2, 3].forEach(console.log);
     37 
     38  </script>
     39 </body>
     40 </html>