Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
1 /*
2 * Any copyright is dedicated to the Public Domain.
3 * http://creativecommons.org/publicdomain/zero/1.0/
4 */
6 // Test the webconsole output for various types of objects.
8 const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-console-output-04.html";
10 let inputTests = [
11 // 0
12 {
13 input: "testTextNode()",
14 output: '#text "hello world!"',
15 printOutput: "[object Text]",
16 inspectable: true,
17 noClick: true,
18 },
20 // 1
21 {
22 input: "testCommentNode()",
23 output: /<!--\s+- Any copyright /,
24 printOutput: "[object Comment]",
25 inspectable: true,
26 noClick: true,
27 },
29 // 2
30 {
31 input: "testDocumentFragment()",
32 output: 'DocumentFragment [ <div#foo1.bar>, <div#foo3> ]',
33 printOutput: "[object DocumentFragment]",
34 inspectable: true,
35 variablesViewLabel: "DocumentFragment[2]",
36 },
38 // 3
39 {
40 input: "testError()",
41 output: "TypeError: window.foobar is not a function\n" +
42 "Stack trace:\n" +
43 "testError@" + TEST_URI + ":44",
44 printOutput: '"TypeError: window.foobar is not a function"',
45 inspectable: true,
46 variablesViewLabel: "TypeError",
47 },
49 // 4
50 {
51 input: "testDOMException()",
52 output: 'DOMException [SyntaxError: "An invalid or illegal string was specified"',
53 printOutput: '[Exception... "An invalid or illegal string was specified"',
54 inspectable: true,
55 variablesViewLabel: "SyntaxError",
56 },
58 // 5
59 {
60 input: "testCSSStyleDeclaration()",
61 output: 'CSS2Properties { color: "green", font-size: "2em" }',
62 printOutput: "[object CSS2Properties]",
63 inspectable: true,
64 noClick: true,
65 },
67 // 6
68 {
69 input: "testStyleSheetList()",
70 output: "StyleSheetList [ CSSStyleSheet ]",
71 printOutput: "[object StyleSheetList",
72 inspectable: true,
73 variablesViewLabel: "StyleSheetList[1]",
74 },
76 // 7
77 {
78 input: "document.styleSheets[0]",
79 output: "CSSStyleSheet",
80 printOutput: "[object CSSStyleSheet]",
81 inspectable: true,
82 },
84 // 8
85 {
86 input: "document.styleSheets[0].cssRules",
87 output: "CSSRuleList [ CSSStyleRule, CSSMediaRule ]",
88 printOutput: "[object CSSRuleList",
89 inspectable: true,
90 variablesViewLabel: "CSSRuleList[2]",
91 },
93 // 9
94 {
95 input: "document.styleSheets[0].cssRules[0]",
96 output: 'CSSStyleRule "p, div"',
97 printOutput: "[object CSSStyleRule",
98 inspectable: true,
99 variablesViewLabel: "CSSStyleRule",
100 },
102 // 10
103 {
104 input: "document.styleSheets[0].cssRules[1]",
105 output: 'CSSMediaRule "print"',
106 printOutput: "[object CSSMediaRule",
107 inspectable: true,
108 variablesViewLabel: "CSSMediaRule",
109 },
110 ];
112 function test() {
113 addTab(TEST_URI);
114 browser.addEventListener("load", function onLoad() {
115 browser.removeEventListener("load", onLoad, true);
116 openConsole().then((hud) => {
117 return checkOutputForInputs(hud, inputTests);
118 }).then(finishTest);
119 }, true);
120 }