|
1 /** |
|
2 * Any copyright is dedicated to the Public Domain. |
|
3 * http://creativecommons.org/publicdomain/zero/1.0/ |
|
4 */ |
|
5 |
|
6 onmessage = function(event) { |
|
7 // TEST: does console exist? |
|
8 postMessage({event: 'console exists', status: !!console, last : false}); |
|
9 |
|
10 postMessage({event: 'trace without function', status: true, last : false}); |
|
11 |
|
12 for (var i = 0; i < 10; ++i) { |
|
13 console.what('1', 123, 321); |
|
14 } |
|
15 |
|
16 for (var i = 0; i < 10; ++i) { |
|
17 console.log(i, i, i); |
|
18 } |
|
19 |
|
20 function trace1() { |
|
21 function trace2() { |
|
22 function trace3() { |
|
23 console.trace("trace " + i); |
|
24 } |
|
25 trace3(); |
|
26 } |
|
27 trace2(); |
|
28 } |
|
29 trace1(); |
|
30 |
|
31 foobar585956c = function(a) { |
|
32 console.trace(); |
|
33 return a+"c"; |
|
34 }; |
|
35 |
|
36 function foobar585956b(a) { |
|
37 return foobar585956c(a+"b"); |
|
38 } |
|
39 |
|
40 function foobar585956a(omg) { |
|
41 return foobar585956b(omg + "a"); |
|
42 } |
|
43 |
|
44 function foobar646025(omg) { |
|
45 console.log(omg, "o", "d"); |
|
46 } |
|
47 |
|
48 function startTimer(timer) { |
|
49 console.time(timer); |
|
50 } |
|
51 |
|
52 function stopTimer(timer) { |
|
53 console.timeEnd(timer); |
|
54 } |
|
55 |
|
56 function testGroups() { |
|
57 console.groupCollapsed("a", "group"); |
|
58 console.group("b", "group"); |
|
59 console.groupEnd("b", "group"); |
|
60 } |
|
61 |
|
62 foobar585956a('omg'); |
|
63 foobar646025('omg'); |
|
64 testGroups(); |
|
65 startTimer('foo'); |
|
66 setTimeout(function() { |
|
67 stopTimer('foo'); |
|
68 nextSteps(event); |
|
69 }, 10); |
|
70 } |
|
71 |
|
72 function nextSteps(event) { |
|
73 |
|
74 function namelessTimer() { |
|
75 console.time(); |
|
76 console.timeEnd(); |
|
77 } |
|
78 |
|
79 namelessTimer(); |
|
80 |
|
81 var str = "Test Message." |
|
82 console.foobar(str); // if this throws, we don't execute following funcs |
|
83 console.log(str); |
|
84 console.info(str); |
|
85 console.warn(str); |
|
86 console.error(str); |
|
87 console.exception(str); |
|
88 console.assert(true, str); |
|
89 console.assert(false, str); |
|
90 console.profile(str); |
|
91 console.profileEnd(str); |
|
92 postMessage({event: '4 messages', status: true, last : false}); |
|
93 |
|
94 // Recursive: |
|
95 if (event.data == true) { |
|
96 var worker = new Worker('console_worker.js'); |
|
97 worker.onmessage = function(event) { |
|
98 postMessage(event.data); |
|
99 } |
|
100 worker.postMessage(false); |
|
101 } else { |
|
102 postMessage({event: 'bye bye', status: true, last : true}); |
|
103 } |
|
104 } |