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.
1 /* Any copyright is dedicated to the Public Domain.
2 http://creativecommons.org/publicdomain/zero/1.0/ */
4 /**
5 * Tests that event listeners aren't fetched when the events tab isn't selected.
6 */
8 const TAB_URL = EXAMPLE_URL + "doc_event-listeners-02.html";
10 function test() {
11 initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => {
12 let gDebugger = aPanel.panelWin;
13 let gView = gDebugger.DebuggerView;
14 let gEvents = gView.EventListeners;
16 gDebugger.on(gDebugger.EVENTS.EVENT_LISTENERS_FETCHED, () => {
17 ok(false, "Shouldn't have fetched any event listeners.");
18 });
19 gDebugger.on(gDebugger.EVENTS.EVENT_BREAKPOINTS_UPDATED, () => {
20 ok(false, "Shouldn't have updated any event breakpoints.");
21 });
23 gView.toggleInstrumentsPane({ visible: true, animated: false });
25 is(gView.instrumentsPaneHidden, false,
26 "The instruments pane should be visible now.");
27 is(gView.instrumentsPaneTab, "variables-tab",
28 "The variables tab should be selected by default.");
30 Task.spawn(function() {
31 yield waitForSourceShown(aPanel, ".html");
32 is(gEvents.itemCount, 0, "There should be no events before reloading.");
34 let reloaded = waitForSourcesAfterReload();
35 gDebugger.DebuggerController._target.activeTab.reload();
37 is(gEvents.itemCount, 0, "There should be no events while reloading.");
38 yield reloaded;
39 is(gEvents.itemCount, 0, "There should be no events after reloading.");
41 yield closeDebuggerAndFinish(aPanel);
42 });
44 function waitForSourcesAfterReload() {
45 return promise.all([
46 waitForDebuggerEvents(aPanel, gDebugger.EVENTS.NEW_SOURCE),
47 waitForDebuggerEvents(aPanel, gDebugger.EVENTS.SOURCES_ADDED),
48 waitForDebuggerEvents(aPanel, gDebugger.EVENTS.SOURCE_SHOWN)
49 ]);
50 }
51 });
52 }