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-04.html"; |
michael@0 | 9 | |
michael@0 | 10 | let inputTests = [ |
michael@0 | 11 | // 0 |
michael@0 | 12 | { |
michael@0 | 13 | input: "testTextNode()", |
michael@0 | 14 | output: '#text "hello world!"', |
michael@0 | 15 | printOutput: "[object Text]", |
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: "testCommentNode()", |
michael@0 | 23 | output: /<!--\s+- Any copyright /, |
michael@0 | 24 | printOutput: "[object Comment]", |
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: "testDocumentFragment()", |
michael@0 | 32 | output: 'DocumentFragment [ <div#foo1.bar>, <div#foo3> ]', |
michael@0 | 33 | printOutput: "[object DocumentFragment]", |
michael@0 | 34 | inspectable: true, |
michael@0 | 35 | variablesViewLabel: "DocumentFragment[2]", |
michael@0 | 36 | }, |
michael@0 | 37 | |
michael@0 | 38 | // 3 |
michael@0 | 39 | { |
michael@0 | 40 | input: "testError()", |
michael@0 | 41 | output: "TypeError: window.foobar is not a function\n" + |
michael@0 | 42 | "Stack trace:\n" + |
michael@0 | 43 | "testError@" + TEST_URI + ":44", |
michael@0 | 44 | printOutput: '"TypeError: window.foobar is not a function"', |
michael@0 | 45 | inspectable: true, |
michael@0 | 46 | variablesViewLabel: "TypeError", |
michael@0 | 47 | }, |
michael@0 | 48 | |
michael@0 | 49 | // 4 |
michael@0 | 50 | { |
michael@0 | 51 | input: "testDOMException()", |
michael@0 | 52 | output: 'DOMException [SyntaxError: "An invalid or illegal string was specified"', |
michael@0 | 53 | printOutput: '[Exception... "An invalid or illegal string was specified"', |
michael@0 | 54 | inspectable: true, |
michael@0 | 55 | variablesViewLabel: "SyntaxError", |
michael@0 | 56 | }, |
michael@0 | 57 | |
michael@0 | 58 | // 5 |
michael@0 | 59 | { |
michael@0 | 60 | input: "testCSSStyleDeclaration()", |
michael@0 | 61 | output: 'CSS2Properties { color: "green", font-size: "2em" }', |
michael@0 | 62 | printOutput: "[object CSS2Properties]", |
michael@0 | 63 | inspectable: true, |
michael@0 | 64 | noClick: true, |
michael@0 | 65 | }, |
michael@0 | 66 | |
michael@0 | 67 | // 6 |
michael@0 | 68 | { |
michael@0 | 69 | input: "testStyleSheetList()", |
michael@0 | 70 | output: "StyleSheetList [ CSSStyleSheet ]", |
michael@0 | 71 | printOutput: "[object StyleSheetList", |
michael@0 | 72 | inspectable: true, |
michael@0 | 73 | variablesViewLabel: "StyleSheetList[1]", |
michael@0 | 74 | }, |
michael@0 | 75 | |
michael@0 | 76 | // 7 |
michael@0 | 77 | { |
michael@0 | 78 | input: "document.styleSheets[0]", |
michael@0 | 79 | output: "CSSStyleSheet", |
michael@0 | 80 | printOutput: "[object CSSStyleSheet]", |
michael@0 | 81 | inspectable: true, |
michael@0 | 82 | }, |
michael@0 | 83 | |
michael@0 | 84 | // 8 |
michael@0 | 85 | { |
michael@0 | 86 | input: "document.styleSheets[0].cssRules", |
michael@0 | 87 | output: "CSSRuleList [ CSSStyleRule, CSSMediaRule ]", |
michael@0 | 88 | printOutput: "[object CSSRuleList", |
michael@0 | 89 | inspectable: true, |
michael@0 | 90 | variablesViewLabel: "CSSRuleList[2]", |
michael@0 | 91 | }, |
michael@0 | 92 | |
michael@0 | 93 | // 9 |
michael@0 | 94 | { |
michael@0 | 95 | input: "document.styleSheets[0].cssRules[0]", |
michael@0 | 96 | output: 'CSSStyleRule "p, div"', |
michael@0 | 97 | printOutput: "[object CSSStyleRule", |
michael@0 | 98 | inspectable: true, |
michael@0 | 99 | variablesViewLabel: "CSSStyleRule", |
michael@0 | 100 | }, |
michael@0 | 101 | |
michael@0 | 102 | // 10 |
michael@0 | 103 | { |
michael@0 | 104 | input: "document.styleSheets[0].cssRules[1]", |
michael@0 | 105 | output: 'CSSMediaRule "print"', |
michael@0 | 106 | printOutput: "[object CSSMediaRule", |
michael@0 | 107 | inspectable: true, |
michael@0 | 108 | variablesViewLabel: "CSSMediaRule", |
michael@0 | 109 | }, |
michael@0 | 110 | ]; |
michael@0 | 111 | |
michael@0 | 112 | function test() { |
michael@0 | 113 | addTab(TEST_URI); |
michael@0 | 114 | browser.addEventListener("load", function onLoad() { |
michael@0 | 115 | browser.removeEventListener("load", onLoad, true); |
michael@0 | 116 | openConsole().then((hud) => { |
michael@0 | 117 | return checkOutputForInputs(hud, inputTests); |
michael@0 | 118 | }).then(finishTest); |
michael@0 | 119 | }, true); |
michael@0 | 120 | } |