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