browser_dbg_breakpoints-reload.js 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  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 on code that gets run on load, will get
  6. * hit when we reload.
  7. */
  8. const TAB_URL = EXAMPLE_URL + "doc_breakpoints-reload.html";
  9. var test = Task.async(function* () {
  10. requestLongerTimeout(4);
  11. const options = {
  12. source: TAB_URL,
  13. line: 1
  14. };
  15. const [tab,, panel] = yield initDebugger(TAB_URL, options);
  16. const actions = bindActionCreators(panel);
  17. const sources = panel.panelWin.DebuggerView.Sources;
  18. yield actions.addBreakpoint({
  19. actor: sources.selectedValue,
  20. line: 10 // "break on me" string
  21. });
  22. const paused = waitForThreadEvents(panel, "paused");
  23. yield reloadActiveTab(panel, panel.panelWin.EVENTS.SOURCE_SHOWN);
  24. const packet = yield paused;
  25. is(packet.why.type, "breakpoint",
  26. "Should have hit the breakpoint after the reload");
  27. is(packet.frame.where.line, 10,
  28. "Should have stopped at line 10, where we set the breakpoint");
  29. yield resumeDebuggerThenCloseAndFinish(panel);
  30. });