browser_dbg_breakpoints-actual-location.js 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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 737803: Setting a breakpoint in a line without code should move
  6. * the icon to the actual location.
  7. */
  8. const TAB_URL = EXAMPLE_URL + "doc_script-switching-01.html";
  9. function test() {
  10. let options = {
  11. source: EXAMPLE_URL + "code_script-switching-01.js",
  12. line: 1
  13. };
  14. initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => {
  15. const gTab = aTab;
  16. const gPanel = aPanel;
  17. const gDebugger = gPanel.panelWin;
  18. const gEditor = gDebugger.DebuggerView.editor;
  19. const gSources = gDebugger.DebuggerView.Sources;
  20. const gController = gDebugger.DebuggerController;
  21. const constants = gDebugger.require("./content/constants");
  22. const queries = gDebugger.require("./content/queries");
  23. const actions = bindActionCreators(gPanel);
  24. Task.spawn(function* () {
  25. yield waitForSourceAndCaretAndScopes(gPanel, "-02.js", 1);
  26. is(queries.getBreakpoints(gController.getState()).length, 0,
  27. "There are no breakpoints in the editor");
  28. const response = yield actions.addBreakpoint({
  29. actor: gSources.selectedValue, line: 4
  30. });
  31. ok(response.actualLocation, "has an actualLocation");
  32. is(response.actualLocation.line, 6, "moved to line 6");
  33. is(queries.getBreakpoints(gController.getState()).length, 1,
  34. "There is only one breakpoint in the editor");
  35. ok(!queries.getBreakpoint(gController.getState(), { actor: gSources.selectedValue, line: 4 }),
  36. "There isn't any breakpoint added on an invalid line.");
  37. ok(queries.getBreakpoint(gController.getState(), { actor: gSources.selectedValue, line: 6 }),
  38. "There isn't any breakpoint added on an invalid line.");
  39. resumeDebuggerThenCloseAndFinish(gPanel);
  40. });
  41. callInTab(gTab, "firstCall");
  42. });
  43. }