dom/tests/browser/test-console-api.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.

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

mercurial