browser_dbg_breakpoints-other-tabs.js 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. /* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
  2. /* Any copyright is dedicated to the Public Domain.
  3. * http://creativecommons.org/publicdomain/zero/1.0/ */
  4. /**
  5. * Make sure that setting a breakpoint in one tab, doesn't cause another tab at
  6. * the same source to pause at that location.
  7. */
  8. const TAB_URL = EXAMPLE_URL + "doc_breakpoints-other-tabs.html";
  9. var test = Task.async(function* () {
  10. const options = {
  11. source: EXAMPLE_URL + "code_breakpoints-other-tabs.js",
  12. line: 1
  13. };
  14. const [tab1,, panel1] = yield initDebugger(TAB_URL, options);
  15. const [tab2,, panel2] = yield initDebugger(TAB_URL, options);
  16. const queries = panel1.panelWin.require("./content/queries");
  17. const actions = bindActionCreators(panel1);
  18. const getState = panel1.panelWin.DebuggerController.getState;
  19. const sources = panel1.panelWin.DebuggerView.Sources;
  20. yield actions.addBreakpoint({
  21. actor: queries.getSelectedSource(getState()).actor,
  22. line: 2
  23. });
  24. const paused = waitForThreadEvents(panel2, "paused");
  25. callInTab(tab2, "testCase");
  26. const packet = yield paused;
  27. is(packet.why.type, "debuggerStatement",
  28. "Should have stopped at the debugger statement, not the other tab's breakpoint");
  29. is(packet.frame.where.line, 3,
  30. "Should have stopped at line 3 (debugger statement), not line 2 (other tab's breakpoint)");
  31. yield resumeDebuggerThenCloseAndFinish(panel2);
  32. });