michael@0: /* Any copyright is dedicated to the Public Domain. michael@0: http://creativecommons.org/publicdomain/zero/1.0/ */ michael@0: michael@0: /** michael@0: * Tests that overridden variables in the VariablesView are styled properly. michael@0: */ michael@0: michael@0: const TAB_URL = EXAMPLE_URL + "doc_scope-variable-2.html"; michael@0: michael@0: function test() { michael@0: Task.spawn(function() { michael@0: let [tab, debuggee, panel] = yield initDebugger(TAB_URL); michael@0: let win = panel.panelWin; michael@0: let events = win.EVENTS; michael@0: let variables = win.DebuggerView.Variables; michael@0: michael@0: // Wait for the hierarchy to be committed by the VariablesViewController. michael@0: let committedLocalScopeHierarchy = promise.defer(); michael@0: variables.oncommit = committedLocalScopeHierarchy.resolve; michael@0: michael@0: // Allow this generator function to yield first. michael@0: executeSoon(() => debuggee.test()); michael@0: yield waitForSourceAndCaretAndScopes(panel, ".html", 23); michael@0: yield committedLocalScopeHierarchy.promise; michael@0: michael@0: let firstScope = variables.getScopeAtIndex(0); michael@0: let secondScope = variables.getScopeAtIndex(1); michael@0: let thirdScope = variables.getScopeAtIndex(2); michael@0: michael@0: let someVar1 = firstScope.get("a"); michael@0: let argsVar1 = firstScope.get("arguments"); michael@0: michael@0: is(someVar1.target.hasAttribute("overridden"), false, michael@0: "The first 'a' variable should not be marked as being overridden."); michael@0: is(argsVar1.target.hasAttribute("overridden"), false, michael@0: "The first 'arguments' variable should not be marked as being overridden."); michael@0: michael@0: // Wait for the hierarchy to be committed by the VariablesViewController. michael@0: let committedSecondScopeHierarchy = promise.defer(); michael@0: variables.oncommit = committedSecondScopeHierarchy.resolve; michael@0: secondScope.expand(); michael@0: yield committedSecondScopeHierarchy.promise; michael@0: michael@0: let someVar2 = secondScope.get("a"); michael@0: let argsVar2 = secondScope.get("arguments"); michael@0: michael@0: is(someVar2.target.hasAttribute("overridden"), true, michael@0: "The second 'a' variable should be marked as being overridden."); michael@0: is(argsVar2.target.hasAttribute("overridden"), true, michael@0: "The second 'arguments' variable should be marked as being overridden."); michael@0: michael@0: // Wait for the hierarchy to be committed by the VariablesViewController. michael@0: let committedThirdScopeHierarchy = promise.defer(); michael@0: variables.oncommit = committedThirdScopeHierarchy.resolve; michael@0: thirdScope.expand(); michael@0: yield committedThirdScopeHierarchy.promise; michael@0: michael@0: let someVar3 = thirdScope.get("a"); michael@0: let argsVar3 = thirdScope.get("arguments"); michael@0: michael@0: is(someVar3.target.hasAttribute("overridden"), true, michael@0: "The third 'a' variable should be marked as being overridden."); michael@0: is(argsVar3.target.hasAttribute("overridden"), true, michael@0: "The third 'arguments' variable should be marked as being overridden."); michael@0: michael@0: yield resumeDebuggerThenCloseAndFinish(panel); michael@0: }); michael@0: }