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 breaking on an event selects the variables view tab. |
michael@0 | 6 | */ |
michael@0 | 7 | |
michael@0 | 8 | const TAB_URL = EXAMPLE_URL + "doc_event-listeners-02.html"; |
michael@0 | 9 | |
michael@0 | 10 | function test() { |
michael@0 | 11 | initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => { |
michael@0 | 12 | let gDebugger = aPanel.panelWin; |
michael@0 | 13 | let gView = gDebugger.DebuggerView; |
michael@0 | 14 | let gEvents = gView.EventListeners; |
michael@0 | 15 | |
michael@0 | 16 | Task.spawn(function() { |
michael@0 | 17 | yield waitForSourceShown(aPanel, ".html"); |
michael@0 | 18 | aDebuggee.addBodyClickEventListener(); |
michael@0 | 19 | |
michael@0 | 20 | let fetched = waitForDebuggerEvents(aPanel, gDebugger.EVENTS.EVENT_LISTENERS_FETCHED); |
michael@0 | 21 | gView.toggleInstrumentsPane({ visible: true, animated: false }, 1); |
michael@0 | 22 | yield fetched; |
michael@0 | 23 | yield ensureThreadClientState(aPanel, "resumed"); |
michael@0 | 24 | |
michael@0 | 25 | is(gView.instrumentsPaneHidden, false, |
michael@0 | 26 | "The instruments pane should be visible."); |
michael@0 | 27 | is(gView.instrumentsPaneTab, "events-tab", |
michael@0 | 28 | "The events tab should be selected."); |
michael@0 | 29 | |
michael@0 | 30 | let updated = waitForDebuggerEvents(aPanel, gDebugger.EVENTS.EVENT_BREAKPOINTS_UPDATED); |
michael@0 | 31 | EventUtils.sendMouseEvent({ type: "click" }, getItemCheckboxNode(1), gDebugger); |
michael@0 | 32 | yield updated; |
michael@0 | 33 | yield ensureThreadClientState(aPanel, "resumed"); |
michael@0 | 34 | |
michael@0 | 35 | let paused = waitForCaretAndScopes(aPanel, 48); |
michael@0 | 36 | // Spin the event loop before causing the debuggee to pause, to allow |
michael@0 | 37 | // this function to yield first. |
michael@0 | 38 | executeSoon(() => { |
michael@0 | 39 | EventUtils.sendMouseEvent({ type: "click" }, aDebuggee.document.body, aDebuggee); |
michael@0 | 40 | }); |
michael@0 | 41 | yield paused; |
michael@0 | 42 | yield ensureThreadClientState(aPanel, "paused"); |
michael@0 | 43 | |
michael@0 | 44 | is(gView.instrumentsPaneHidden, false, |
michael@0 | 45 | "The instruments pane should be visible."); |
michael@0 | 46 | is(gView.instrumentsPaneTab, "variables-tab", |
michael@0 | 47 | "The variables tab should be selected."); |
michael@0 | 48 | |
michael@0 | 49 | yield resumeDebuggerThenCloseAndFinish(aPanel); |
michael@0 | 50 | }); |
michael@0 | 51 | |
michael@0 | 52 | function getItemCheckboxNode(index) { |
michael@0 | 53 | return gEvents.items[index].target.parentNode |
michael@0 | 54 | .querySelector(".side-menu-widget-item-checkbox"); |
michael@0 | 55 | } |
michael@0 | 56 | }); |
michael@0 | 57 | } |