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 | * Check that the editing state of a Variable is correctly tracked. Clicking on |
michael@0 | 6 | * the textbox while editing should not cancel editing. |
michael@0 | 7 | */ |
michael@0 | 8 | |
michael@0 | 9 | const TAB_URL = EXAMPLE_URL + "doc_watch-expressions.html"; |
michael@0 | 10 | |
michael@0 | 11 | function test() { |
michael@0 | 12 | Task.spawn(function*() { |
michael@0 | 13 | let [tab, debuggee, panel] = yield initDebugger(TAB_URL); |
michael@0 | 14 | let win = panel.panelWin; |
michael@0 | 15 | let vars = win.DebuggerView.Variables; |
michael@0 | 16 | |
michael@0 | 17 | win.DebuggerView.WatchExpressions.addExpression("this"); |
michael@0 | 18 | |
michael@0 | 19 | // Allow this generator function to yield first. |
michael@0 | 20 | executeSoon(() => debuggee.ermahgerd()); |
michael@0 | 21 | yield waitForDebuggerEvents(panel, win.EVENTS.FETCHED_WATCH_EXPRESSIONS); |
michael@0 | 22 | |
michael@0 | 23 | let exprScope = vars.getScopeAtIndex(0); |
michael@0 | 24 | let exprVar = exprScope.get("this"); |
michael@0 | 25 | let name = exprVar.target.querySelector(".title > .name"); |
michael@0 | 26 | |
michael@0 | 27 | is(exprVar.editing, false, |
michael@0 | 28 | "The expression should indicate it is not being edited."); |
michael@0 | 29 | |
michael@0 | 30 | EventUtils.sendMouseEvent({ type: "dblclick" }, name, win); |
michael@0 | 31 | let input = exprVar.target.querySelector(".title > .element-name-input"); |
michael@0 | 32 | is(exprVar.editing, true, |
michael@0 | 33 | "The expression should indicate it is being edited."); |
michael@0 | 34 | is(input.selectionStart !== input.selectionEnd, true, |
michael@0 | 35 | "The expression text should be selected."); |
michael@0 | 36 | |
michael@0 | 37 | EventUtils.synthesizeMouse(input, 2, 2, {}, win); |
michael@0 | 38 | is(exprVar.editing, true, |
michael@0 | 39 | "The expression should indicate it is still being edited after a click."); |
michael@0 | 40 | is(input.selectionStart === input.selectionEnd, true, |
michael@0 | 41 | "The expression text should not be selected."); |
michael@0 | 42 | |
michael@0 | 43 | EventUtils.sendKey("ESCAPE", win); |
michael@0 | 44 | is(exprVar.editing, false, |
michael@0 | 45 | "The expression should indicate it is not being edited after cancelling."); |
michael@0 | 46 | |
michael@0 | 47 | // Why is this needed? |
michael@0 | 48 | EventUtils.synthesizeMouse(vars.parentNode, 2, 2, {}, win); |
michael@0 | 49 | |
michael@0 | 50 | yield resumeDebuggerThenCloseAndFinish(panel); |
michael@0 | 51 | }); |
michael@0 | 52 | } |