dom/tests/browser/test-console-api.html

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     1 <!DOCTYPE HTML>
     2 <html dir="ltr" xml:lang="en-US" lang="en-US"><head>
     3     <title>Console API test page</title>
     4     <script type="text/javascript">
     5       window.foobar585956c = function(a) {
     6         console.trace();
     7         return a+"c";
     8       };
    10       function foobar585956b(a) {
    11         return foobar585956c(a+"b");
    12       }
    14       function foobar585956a(omg) {
    15         return foobar585956b(omg + "a");
    16       }
    18       function foobar646025(omg) {
    19         console.log(omg, "o", "d");
    20       }
    22       function startTimer(timer) {
    23         console.time(timer);
    24       }
    26       function stopTimer(timer) {
    27         console.timeEnd(timer);
    28       }
    30       function namelessTimer() {
    31         console.time();
    32         console.timeEnd();
    33       }
    35       function test() {
    36         var str = "Test Message."
    37         console.foobar(str); // if this throws, we don't execute following funcs
    38         console.log(str);
    39         console.info(str);
    40         console.warn(str);
    41         console.error(str);
    42         console.exception(str);
    43         console.assert(false, str);
    44         console.count(str);
    45       }
    47       function testGroups() {
    48         console.groupCollapsed("a", "group");
    49         console.group("b", "group");
    50         console.groupEnd("b", "group");
    51       }
    53       function nativeCallback() {
    54         new Promise(function(resolve, reject) { resolve(42); }).then(console.log.bind(console));
    55       }
    56     </script>
    57   </head>
    58   <body>
    59     <h1>Console API Test Page</h1>
    60     <button onclick="test();">Log stuff</button>
    61     <button id="test-trace" onclick="foobar585956a('omg');">Test trace</button>
    62     <button id="test-location" onclick="foobar646025('omg');">Test location</button>
    63     <button id="test-nativeCallback" onclick="nativeCallback();">Test nativeCallback</button>
    64     <button id="test-groups" onclick="testGroups();">Test groups</button>
    65     <button id="test-time" onclick="startTimer('foo');">Test time</button>
    66     <button id="test-timeEnd" onclick="stopTimer('foo');">Test timeEnd</button>
    67     <button id="test-namelessTimer" onclick="namelessTimer();">Test namelessTimer</button>
    68   </body>
    69 </html>

mercurial