|
1 /* Any copyright is dedicated to the Public Domain. |
|
2 http://creativecommons.org/publicdomain/zero/1.0/ */ |
|
3 |
|
4 /** |
|
5 * Tests that event listeners aren't fetched when the events tab isn't selected. |
|
6 */ |
|
7 |
|
8 const TAB_URL = EXAMPLE_URL + "doc_event-listeners-02.html"; |
|
9 |
|
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; |
|
15 |
|
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 }); |
|
22 |
|
23 gView.toggleInstrumentsPane({ visible: true, animated: false }); |
|
24 |
|
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."); |
|
29 |
|
30 Task.spawn(function() { |
|
31 yield waitForSourceShown(aPanel, ".html"); |
|
32 is(gEvents.itemCount, 0, "There should be no events before reloading."); |
|
33 |
|
34 let reloaded = waitForSourcesAfterReload(); |
|
35 gDebugger.DebuggerController._target.activeTab.reload(); |
|
36 |
|
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."); |
|
40 |
|
41 yield closeDebuggerAndFinish(aPanel); |
|
42 }); |
|
43 |
|
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 } |