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 event listeners aren't fetched when the events tab isn't selected. |
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 | gDebugger.on(gDebugger.EVENTS.EVENT_LISTENERS_FETCHED, () => { |
michael@0 | 17 | ok(false, "Shouldn't have fetched any event listeners."); |
michael@0 | 18 | }); |
michael@0 | 19 | gDebugger.on(gDebugger.EVENTS.EVENT_BREAKPOINTS_UPDATED, () => { |
michael@0 | 20 | ok(false, "Shouldn't have updated any event breakpoints."); |
michael@0 | 21 | }); |
michael@0 | 22 | |
michael@0 | 23 | gView.toggleInstrumentsPane({ visible: true, animated: false }); |
michael@0 | 24 | |
michael@0 | 25 | is(gView.instrumentsPaneHidden, false, |
michael@0 | 26 | "The instruments pane should be visible now."); |
michael@0 | 27 | is(gView.instrumentsPaneTab, "variables-tab", |
michael@0 | 28 | "The variables tab should be selected by default."); |
michael@0 | 29 | |
michael@0 | 30 | Task.spawn(function() { |
michael@0 | 31 | yield waitForSourceShown(aPanel, ".html"); |
michael@0 | 32 | is(gEvents.itemCount, 0, "There should be no events before reloading."); |
michael@0 | 33 | |
michael@0 | 34 | let reloaded = waitForSourcesAfterReload(); |
michael@0 | 35 | gDebugger.DebuggerController._target.activeTab.reload(); |
michael@0 | 36 | |
michael@0 | 37 | is(gEvents.itemCount, 0, "There should be no events while reloading."); |
michael@0 | 38 | yield reloaded; |
michael@0 | 39 | is(gEvents.itemCount, 0, "There should be no events after reloading."); |
michael@0 | 40 | |
michael@0 | 41 | yield closeDebuggerAndFinish(aPanel); |
michael@0 | 42 | }); |
michael@0 | 43 | |
michael@0 | 44 | function waitForSourcesAfterReload() { |
michael@0 | 45 | return promise.all([ |
michael@0 | 46 | waitForDebuggerEvents(aPanel, gDebugger.EVENTS.NEW_SOURCE), |
michael@0 | 47 | waitForDebuggerEvents(aPanel, gDebugger.EVENTS.SOURCES_ADDED), |
michael@0 | 48 | waitForDebuggerEvents(aPanel, gDebugger.EVENTS.SOURCE_SHOWN) |
michael@0 | 49 | ]); |
michael@0 | 50 | } |
michael@0 | 51 | }); |
michael@0 | 52 | } |