browser/devtools/debugger/test/browser_dbg_break-on-dom-01.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/browser/devtools/debugger/test/browser_dbg_break-on-dom-01.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,52 @@
     1.4 +/* Any copyright is dedicated to the Public Domain.
     1.5 +   http://creativecommons.org/publicdomain/zero/1.0/ */
     1.6 +
     1.7 +/**
     1.8 + * Tests that event listeners aren't fetched when the events tab isn't selected.
     1.9 + */
    1.10 +
    1.11 +const TAB_URL = EXAMPLE_URL + "doc_event-listeners-02.html";
    1.12 +
    1.13 +function test() {
    1.14 +  initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => {
    1.15 +    let gDebugger = aPanel.panelWin;
    1.16 +    let gView = gDebugger.DebuggerView;
    1.17 +    let gEvents = gView.EventListeners;
    1.18 +
    1.19 +    gDebugger.on(gDebugger.EVENTS.EVENT_LISTENERS_FETCHED, () => {
    1.20 +      ok(false, "Shouldn't have fetched any event listeners.");
    1.21 +    });
    1.22 +    gDebugger.on(gDebugger.EVENTS.EVENT_BREAKPOINTS_UPDATED, () => {
    1.23 +      ok(false, "Shouldn't have updated any event breakpoints.");
    1.24 +    });
    1.25 +
    1.26 +    gView.toggleInstrumentsPane({ visible: true, animated: false });
    1.27 +
    1.28 +    is(gView.instrumentsPaneHidden, false,
    1.29 +      "The instruments pane should be visible now.");
    1.30 +    is(gView.instrumentsPaneTab, "variables-tab",
    1.31 +      "The variables tab should be selected by default.");
    1.32 +
    1.33 +    Task.spawn(function() {
    1.34 +      yield waitForSourceShown(aPanel, ".html");
    1.35 +      is(gEvents.itemCount, 0, "There should be no events before reloading.");
    1.36 +
    1.37 +      let reloaded = waitForSourcesAfterReload();
    1.38 +      gDebugger.DebuggerController._target.activeTab.reload();
    1.39 +
    1.40 +      is(gEvents.itemCount, 0, "There should be no events while reloading.");
    1.41 +      yield reloaded;
    1.42 +      is(gEvents.itemCount, 0, "There should be no events after reloading.");
    1.43 +
    1.44 +      yield closeDebuggerAndFinish(aPanel);
    1.45 +    });
    1.46 +
    1.47 +    function waitForSourcesAfterReload() {
    1.48 +      return promise.all([
    1.49 +        waitForDebuggerEvents(aPanel, gDebugger.EVENTS.NEW_SOURCE),
    1.50 +        waitForDebuggerEvents(aPanel, gDebugger.EVENTS.SOURCES_ADDED),
    1.51 +        waitForDebuggerEvents(aPanel, gDebugger.EVENTS.SOURCE_SHOWN)
    1.52 +      ]);
    1.53 +    }
    1.54 +  });
    1.55 +}

mercurial