dom/tests/mochitest/general/test_consoleAPI.html

Tue, 06 Jan 2015 21:39:09 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 06 Jan 2015 21:39:09 +0100
branch
TOR_BUG_9701
changeset 8
97036ab72558
permissions
-rw-r--r--

Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.

     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