tor-browser

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

test_consoleAPI.html (1492B)


      1 <!DOCTYPE HTML>
      2 <html>
      3 <head>
      4  <title>window.console test</title>
      5  <script src="/tests/SimpleTest/SimpleTest.js"></script>
      6  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
      7 </head>
      8 
      9 <body id="body">
     10 
     11 <script type="application/javascript">
     12 
     13 function doTest() {
     14  ok(window.console, "console exists");
     15 
     16  try {
     17    ok(!console.foo, "random property doesn't throw");
     18  } catch (ex) {
     19    ok(false, "random property threw: " + ex);
     20  }
     21 
     22  var expectedProps = {
     23    "log": "function",
     24    "info": "function",
     25    "warn": "function",
     26    "error": "function",
     27    "exception": "function",
     28    "debug": "function",
     29    "trace": "function",
     30    "dir": "function",
     31    "group": "function",
     32    "groupCollapsed": "function",
     33    "groupEnd": "function",
     34    "time": "function",
     35    "timeLog": "function",
     36    "timeEnd": "function",
     37    "profile": "function",
     38    "profileEnd": "function",
     39    "assert": "function",
     40    "count": "function",
     41    "countReset": "function",
     42    "table": "function",
     43    "clear": "function",
     44    "dirxml": "function",
     45    "timeStamp": "function",
     46  };
     47 
     48  var foundProps = 0;
     49  for (var prop in console) {
     50    foundProps++;
     51    is(typeof(console[prop]), expectedProps[prop], "expect console prop " + prop + " exists");
     52  }
     53  is(foundProps, Object.keys(expectedProps).length, "found correct number of properties");
     54 
     55  SimpleTest.finish();
     56 }
     57 
     58 SimpleTest.waitForExplicitFinish();
     59 addLoadEvent(doTest);
     60 
     61 </script>
     62 
     63 <p id="display"></p>
     64 
     65 </body>
     66 </html>