browser/devtools/webconsole/test/browser_webconsole_output_03.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

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

mercurial