browser_dbg_split-console-paused-reload.js 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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. * Hitting ESC to open the split console when paused on reload should not stop
  6. * the pending navigation.
  7. */
  8. function test() {
  9. Task.spawn(runTests);
  10. }
  11. function* runTests() {
  12. let TAB_URL = EXAMPLE_URL + "doc_split-console-paused-reload.html";
  13. let options = {
  14. source: TAB_URL,
  15. line: 1
  16. };
  17. let [,, panel] = yield initDebugger(TAB_URL, options);
  18. let dbgWin = panel.panelWin;
  19. let sources = dbgWin.DebuggerView.Sources;
  20. let frames = dbgWin.DebuggerView.StackFrames;
  21. let toolbox = gDevTools.getToolbox(panel.target);
  22. yield panel.addBreakpoint({ actor: getSourceActor(sources, TAB_URL), line: 16 });
  23. info("Breakpoint was set.");
  24. dbgWin.DebuggerController._target.activeTab.reload();
  25. info("Page reloaded.");
  26. yield waitForSourceAndCaretAndScopes(panel, ".html", 16);
  27. yield ensureThreadClientState(panel, "paused");
  28. info("Breakpoint was hit.");
  29. EventUtils.sendMouseEvent({ type: "mousedown" },
  30. frames.selectedItem.target,
  31. dbgWin);
  32. info("The breadcrumb received focus.");
  33. // This is the meat of the test.
  34. let jsterm = yield getSplitConsole(toolbox);
  35. is(dbgWin.gThreadClient.state, "paused", "Execution is still paused.");
  36. let dbgFrameConsoleEvalResult = yield jsterm.execute("privateVar");
  37. is(
  38. dbgFrameConsoleEvalResult.querySelector(".console-string").textContent,
  39. '"privateVarValue"',
  40. "Got the expected split console result on paused debugger"
  41. );
  42. yield dbgWin.gThreadClient.resume();
  43. is(dbgWin.gThreadClient.state, "attached", "Execution is resumed.");
  44. // Get the last evaluation result adopted by the new debugger.
  45. let mainTargetConsoleEvalResult = yield jsterm.execute("$_");
  46. is(
  47. mainTargetConsoleEvalResult.querySelector(".console-string").textContent,
  48. '"privateVarValue"',
  49. "Got the expected split console log on $_ executed on resumed debugger"
  50. );
  51. Services.prefs.clearUserPref("devtools.toolbox.splitconsoleEnabled");
  52. yield closeDebuggerAndFinish(panel);
  53. }