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.
michael@0 | 1 | /* |
michael@0 | 2 | * Any copyright is dedicated to the Public Domain. |
michael@0 | 3 | * http://creativecommons.org/publicdomain/zero/1.0/ |
michael@0 | 4 | */ |
michael@0 | 5 | |
michael@0 | 6 | // Test the webconsole output for various types of objects. |
michael@0 | 7 | |
michael@0 | 8 | const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-console-output-03.html"; |
michael@0 | 9 | |
michael@0 | 10 | let inputTests = [ |
michael@0 | 11 | // 0 |
michael@0 | 12 | { |
michael@0 | 13 | input: "document", |
michael@0 | 14 | output: "HTMLDocument \u2192 " + TEST_URI, |
michael@0 | 15 | printOutput: "[object HTMLDocument]", |
michael@0 | 16 | inspectable: true, |
michael@0 | 17 | noClick: true, |
michael@0 | 18 | }, |
michael@0 | 19 | |
michael@0 | 20 | // 1 |
michael@0 | 21 | { |
michael@0 | 22 | input: "window", |
michael@0 | 23 | output: "Window \u2192 " + TEST_URI, |
michael@0 | 24 | printOutput: "[object Window", |
michael@0 | 25 | inspectable: true, |
michael@0 | 26 | noClick: true, |
michael@0 | 27 | }, |
michael@0 | 28 | |
michael@0 | 29 | // 2 |
michael@0 | 30 | { |
michael@0 | 31 | input: "document.body", |
michael@0 | 32 | output: "<body>", |
michael@0 | 33 | printOutput: "[object HTMLBodyElement]", |
michael@0 | 34 | inspectable: true, |
michael@0 | 35 | noClick: true, |
michael@0 | 36 | }, |
michael@0 | 37 | |
michael@0 | 38 | // 3 |
michael@0 | 39 | { |
michael@0 | 40 | input: "document.body.dataset", |
michael@0 | 41 | output: "DOMStringMap { }", |
michael@0 | 42 | printOutput: "[object DOMStringMap]", |
michael@0 | 43 | inspectable: true, |
michael@0 | 44 | variablesViewLabel: "DOMStringMap[0]", |
michael@0 | 45 | }, |
michael@0 | 46 | |
michael@0 | 47 | // 4 |
michael@0 | 48 | { |
michael@0 | 49 | input: "document.body.classList", |
michael@0 | 50 | output: "DOMTokenList [ ]", |
michael@0 | 51 | printOutput: '""', |
michael@0 | 52 | inspectable: true, |
michael@0 | 53 | variablesViewLabel: "DOMTokenList[0]", |
michael@0 | 54 | }, |
michael@0 | 55 | |
michael@0 | 56 | // 5 |
michael@0 | 57 | { |
michael@0 | 58 | input: "window.location.href", |
michael@0 | 59 | output: '"' + TEST_URI + '"', |
michael@0 | 60 | }, |
michael@0 | 61 | |
michael@0 | 62 | // 6 |
michael@0 | 63 | { |
michael@0 | 64 | input: "window.location", |
michael@0 | 65 | output: "Location \u2192 " + TEST_URI, |
michael@0 | 66 | printOutput: TEST_URI, |
michael@0 | 67 | inspectable: true, |
michael@0 | 68 | variablesViewLabel: "Location \u2192 test-console-output-03.html", |
michael@0 | 69 | }, |
michael@0 | 70 | |
michael@0 | 71 | // 7 |
michael@0 | 72 | { |
michael@0 | 73 | input: "document.body.attributes", |
michael@0 | 74 | output: "MozNamedAttrMap [ ]", |
michael@0 | 75 | printOutput: "[object MozNamedAttrMap]", |
michael@0 | 76 | inspectable: true, |
michael@0 | 77 | variablesViewLabel: "MozNamedAttrMap[0]", |
michael@0 | 78 | }, |
michael@0 | 79 | |
michael@0 | 80 | // 8 |
michael@0 | 81 | { |
michael@0 | 82 | input: "document.styleSheets", |
michael@0 | 83 | output: "StyleSheetList [ ]", |
michael@0 | 84 | printOutput: "[object StyleSheetList", |
michael@0 | 85 | inspectable: true, |
michael@0 | 86 | variablesViewLabel: "StyleSheetList[0]", |
michael@0 | 87 | }, |
michael@0 | 88 | |
michael@0 | 89 | // 9 |
michael@0 | 90 | { |
michael@0 | 91 | input: "testBodyClassName()", |
michael@0 | 92 | output: '<body class="test1 tezt2">', |
michael@0 | 93 | printOutput: "[object HTMLBodyElement]", |
michael@0 | 94 | inspectable: true, |
michael@0 | 95 | noClick: true, |
michael@0 | 96 | }, |
michael@0 | 97 | |
michael@0 | 98 | // 10 |
michael@0 | 99 | { |
michael@0 | 100 | input: "testBodyID()", |
michael@0 | 101 | output: '<body class="test1 tezt2" id="foobarid">', |
michael@0 | 102 | printOutput: "[object HTMLBodyElement]", |
michael@0 | 103 | inspectable: true, |
michael@0 | 104 | noClick: true, |
michael@0 | 105 | }, |
michael@0 | 106 | |
michael@0 | 107 | // 11 |
michael@0 | 108 | { |
michael@0 | 109 | input: "document.body.classList", |
michael@0 | 110 | output: 'DOMTokenList [ "test1", "tezt2" ]', |
michael@0 | 111 | printOutput: '"test1 tezt2"', |
michael@0 | 112 | inspectable: true, |
michael@0 | 113 | variablesViewLabel: "DOMTokenList[2]", |
michael@0 | 114 | }, |
michael@0 | 115 | |
michael@0 | 116 | // 12 |
michael@0 | 117 | { |
michael@0 | 118 | input: "testBodyDataset()", |
michael@0 | 119 | output: '<body class="test1 tezt2" id="foobarid"' + |
michael@0 | 120 | ' data-preview="zuzu"<a>foo">', |
michael@0 | 121 | printOutput: "[object HTMLBodyElement]", |
michael@0 | 122 | inspectable: true, |
michael@0 | 123 | noClick: true, |
michael@0 | 124 | }, |
michael@0 | 125 | |
michael@0 | 126 | // 13 |
michael@0 | 127 | { |
michael@0 | 128 | input: "document.body.dataset", |
michael@0 | 129 | output: 'DOMStringMap { preview: "zuzu"<a>foo" }', |
michael@0 | 130 | printOutput: "[object DOMStringMap]", |
michael@0 | 131 | inspectable: true, |
michael@0 | 132 | variablesViewLabel: "DOMStringMap[1]", |
michael@0 | 133 | }, |
michael@0 | 134 | |
michael@0 | 135 | // 14 |
michael@0 | 136 | { |
michael@0 | 137 | input: "document.body.attributes", |
michael@0 | 138 | output: 'MozNamedAttrMap [ class="test1 tezt2", id="foobarid", ' + |
michael@0 | 139 | 'data-preview="zuzu"<a>foo" ]', |
michael@0 | 140 | printOutput: "[object MozNamedAttrMap]", |
michael@0 | 141 | inspectable: true, |
michael@0 | 142 | variablesViewLabel: "MozNamedAttrMap[3]", |
michael@0 | 143 | }, |
michael@0 | 144 | |
michael@0 | 145 | // 15 |
michael@0 | 146 | { |
michael@0 | 147 | input: "document.body.attributes[0]", |
michael@0 | 148 | output: 'class="test1 tezt2"', |
michael@0 | 149 | printOutput: "[object Attr]", |
michael@0 | 150 | inspectable: true, |
michael@0 | 151 | variablesViewLabel: 'class="test1 tezt2"', |
michael@0 | 152 | }, |
michael@0 | 153 | ]; |
michael@0 | 154 | |
michael@0 | 155 | function test() { |
michael@0 | 156 | requestLongerTimeout(2); |
michael@0 | 157 | Task.spawn(function*() { |
michael@0 | 158 | const {tab} = yield loadTab(TEST_URI); |
michael@0 | 159 | const hud = yield openConsole(tab); |
michael@0 | 160 | yield checkOutputForInputs(hud, inputTests); |
michael@0 | 161 | inputTests = null; |
michael@0 | 162 | }).then(finishTest); |
michael@0 | 163 | } |