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 /* Any copyright is dedicated to the Public Domain.
2 http://creativecommons.org/publicdomain/zero/1.0/ */
4 /**
5 * Tests opening the variable inspection popup on a variable which has a
6 * complext object as the value.
7 */
9 const TAB_URL = EXAMPLE_URL + "doc_frame-parameters.html";
11 function test() {
12 requestLongerTimeout(2);
13 Task.spawn(function() {
14 let [tab, debuggee, panel] = yield initDebugger(TAB_URL);
15 let win = panel.panelWin;
16 let bubble = win.DebuggerView.VariableBubble;
17 let tooltip = bubble._tooltip.panel;
19 function verifyContents() {
20 is(tooltip.querySelectorAll(".variables-view-container").length, 1,
21 "There should be one variables view container added to the tooltip.");
23 is(tooltip.querySelectorAll(".variables-view-scope[untitled]").length, 1,
24 "There should be one scope with no header displayed.");
25 is(tooltip.querySelectorAll(".variables-view-variable[untitled]").length, 1,
26 "There should be one variable with no header displayed.");
28 is(tooltip.querySelectorAll(".variables-view-property").length, 7,
29 "There should be 7 properties displayed.");
31 is(tooltip.querySelectorAll(".variables-view-property .name")[0].getAttribute("value"), "a",
32 "The first property's name is correct.");
33 is(tooltip.querySelectorAll(".variables-view-property .value")[0].getAttribute("value"), "1",
34 "The first property's value is correct.");
36 is(tooltip.querySelectorAll(".variables-view-property .name")[1].getAttribute("value"), "b",
37 "The second property's name is correct.");
38 is(tooltip.querySelectorAll(".variables-view-property .value")[1].getAttribute("value"), "\"beta\"",
39 "The second property's value is correct.");
41 is(tooltip.querySelectorAll(".variables-view-property .name")[2].getAttribute("value"), "c",
42 "The third property's name is correct.");
43 is(tooltip.querySelectorAll(".variables-view-property .value")[2].getAttribute("value"), "3",
44 "The third property's value is correct.");
46 is(tooltip.querySelectorAll(".variables-view-property .name")[3].getAttribute("value"), "d",
47 "The fourth property's name is correct.");
48 is(tooltip.querySelectorAll(".variables-view-property .value")[3].getAttribute("value"), "false",
49 "The fourth property's value is correct.");
51 is(tooltip.querySelectorAll(".variables-view-property .name")[4].getAttribute("value"), "e",
52 "The fifth property's name is correct.");
53 is(tooltip.querySelectorAll(".variables-view-property .value")[4].getAttribute("value"), "null",
54 "The fifth property's value is correct.");
56 is(tooltip.querySelectorAll(".variables-view-property .name")[5].getAttribute("value"), "f",
57 "The sixth property's name is correct.");
58 is(tooltip.querySelectorAll(".variables-view-property .value")[5].getAttribute("value"), "undefined",
59 "The sixth property's value is correct.");
61 is(tooltip.querySelectorAll(".variables-view-property .name")[6].getAttribute("value"), "__proto__",
62 "The seventh property's name is correct.");
63 is(tooltip.querySelectorAll(".variables-view-property .value")[6].getAttribute("value"), "Object",
64 "The seventh property's value is correct.");
65 }
67 // Allow this generator function to yield first.
68 executeSoon(() => debuggee.start());
69 yield waitForSourceAndCaretAndScopes(panel, ".html", 24);
71 // Inspect variable.
72 yield openVarPopup(panel, { line: 17, ch: 12 }, true);
73 verifyContents();
75 yield resumeDebuggerThenCloseAndFinish(panel);
76 });
77 }