dom/tests/mochitest/general/test_consoleAPI.html

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 <!DOCTYPE HTML>
     2 <html>
     3 <head>
     4   <title>window.console test</title>
     5   <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
     6   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
     7 </head>
     9 <body id="body">
    11 <script type="application/javascript;version=1.8">
    13 function doTest() {
    14   ok(window.console, "console exists");
    16   try {
    17     ok(!console.foo, "random property doesn't throw");
    18   } catch (ex) {
    19     ok(false, "random property threw: " + ex);
    20   }
    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     "timeEnd": "function",
    36     "profile": "function",
    37     "profileEnd": "function",
    38     "assert": "function",
    39     "count": "function",
    40     "__noSuchMethod__": "function"
    41   };
    43   var foundProps = 0;
    44   for (var prop in console) {
    45     foundProps++;
    46     is(typeof(console[prop]), expectedProps[prop], "expect console prop " + prop + " exists");
    47   }
    48   is(foundProps, Object.keys(expectedProps).length, "found correct number of properties");
    50   SimpleTest.finish();
    51 }
    53 SimpleTest.waitForExplicitFinish();
    54 addLoadEvent(doTest);
    56 </script>
    58 <p id="display"></p>
    60 </body>
    61 </html>

mercurial