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 that overridden variables in the VariablesView are styled properly.
6 */
8 const TAB_URL = EXAMPLE_URL + "doc_scope-variable-2.html";
10 function test() {
11 Task.spawn(function() {
12 let [tab, debuggee, panel] = yield initDebugger(TAB_URL);
13 let win = panel.panelWin;
14 let events = win.EVENTS;
15 let variables = win.DebuggerView.Variables;
17 // Wait for the hierarchy to be committed by the VariablesViewController.
18 let committedLocalScopeHierarchy = promise.defer();
19 variables.oncommit = committedLocalScopeHierarchy.resolve;
21 // Allow this generator function to yield first.
22 executeSoon(() => debuggee.test());
23 yield waitForSourceAndCaretAndScopes(panel, ".html", 23);
24 yield committedLocalScopeHierarchy.promise;
26 let firstScope = variables.getScopeAtIndex(0);
27 let secondScope = variables.getScopeAtIndex(1);
28 let thirdScope = variables.getScopeAtIndex(2);
30 let someVar1 = firstScope.get("a");
31 let argsVar1 = firstScope.get("arguments");
33 is(someVar1.target.hasAttribute("overridden"), false,
34 "The first 'a' variable should not be marked as being overridden.");
35 is(argsVar1.target.hasAttribute("overridden"), false,
36 "The first 'arguments' variable should not be marked as being overridden.");
38 // Wait for the hierarchy to be committed by the VariablesViewController.
39 let committedSecondScopeHierarchy = promise.defer();
40 variables.oncommit = committedSecondScopeHierarchy.resolve;
41 secondScope.expand();
42 yield committedSecondScopeHierarchy.promise;
44 let someVar2 = secondScope.get("a");
45 let argsVar2 = secondScope.get("arguments");
47 is(someVar2.target.hasAttribute("overridden"), true,
48 "The second 'a' variable should be marked as being overridden.");
49 is(argsVar2.target.hasAttribute("overridden"), true,
50 "The second 'arguments' variable should be marked as being overridden.");
52 // Wait for the hierarchy to be committed by the VariablesViewController.
53 let committedThirdScopeHierarchy = promise.defer();
54 variables.oncommit = committedThirdScopeHierarchy.resolve;
55 thirdScope.expand();
56 yield committedThirdScopeHierarchy.promise;
58 let someVar3 = thirdScope.get("a");
59 let argsVar3 = thirdScope.get("arguments");
61 is(someVar3.target.hasAttribute("overridden"), true,
62 "The third 'a' variable should be marked as being overridden.");
63 is(argsVar3.target.hasAttribute("overridden"), true,
64 "The third 'arguments' variable should be marked as being overridden.");
66 yield resumeDebuggerThenCloseAndFinish(panel);
67 });
68 }