browser_dbg_bug-896139.js 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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. * Bug 896139 - Breakpoints not triggering when reloading script.
  6. */
  7. const TAB_URL = EXAMPLE_URL + "doc_bug-896139.html";
  8. const SCRIPT_URL = EXAMPLE_URL + "code_bug-896139.js";
  9. function test() {
  10. Task.spawn(function* () {
  11. function testBreakpoint() {
  12. let promise = waitForDebuggerEvents(panel, win.EVENTS.FETCHED_SCOPES);
  13. callInTab(tab, "f");
  14. return promise.then(() => doResume(panel));
  15. }
  16. let options = {
  17. source: SCRIPT_URL,
  18. line: 1
  19. };
  20. let [tab,, panel] = yield initDebugger(TAB_URL, options);
  21. let win = panel.panelWin;
  22. let Sources = win.DebuggerView.Sources;
  23. yield panel.addBreakpoint({
  24. actor: getSourceActor(win.DebuggerView.Sources, SCRIPT_URL),
  25. line: 6
  26. });
  27. // Race condition: the setBreakpoint request sometimes leaves the
  28. // debugger in paused state for a bit because we are called before
  29. // that request finishes (see bug 1156531 for plans to fix)
  30. if (panel.panelWin.gThreadClient.state !== "attached") {
  31. yield waitForThreadEvents(panel, "resumed");
  32. }
  33. yield testBreakpoint();
  34. yield reloadActiveTab(panel, win.EVENTS.SOURCE_SHOWN);
  35. yield testBreakpoint();
  36. yield closeDebuggerAndFinish(panel);
  37. });
  38. }