browser_dbg_console-named-eval.js 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  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. * Breaking in the middle of a named eval script created by the
  6. * console should work
  7. */
  8. function test() {
  9. Task.spawn(runTests);
  10. }
  11. function* runTests() {
  12. let TAB_URL = EXAMPLE_URL + "doc_empty-tab-01.html";
  13. let [,, panel] = yield initDebugger(TAB_URL, { source: null });
  14. let dbgWin = panel.panelWin;
  15. let sources = dbgWin.DebuggerView.Sources;
  16. let frames = dbgWin.DebuggerView.StackFrames;
  17. let editor = dbgWin.DebuggerView.editor;
  18. let toolbox = gDevTools.getToolbox(panel.target);
  19. let paused = waitForSourceAndCaretAndScopes(panel, "foo.js", 1);
  20. toolbox.once("webconsole-ready", () => {
  21. ok(toolbox.splitConsole, "Split console is shown.");
  22. let jsterm = toolbox.getPanel("webconsole").hud.jsterm;
  23. jsterm.execute("eval('debugger; //# sourceURL=foo.js')");
  24. });
  25. EventUtils.synthesizeKey("VK_ESCAPE", {}, dbgWin);
  26. yield paused;
  27. is(sources.selectedItem.attachment.label, "foo.js",
  28. "New source is selected in sources");
  29. is(sources.selectedItem.attachment.group, "http://example.com",
  30. "New source is in the right group");
  31. ok(editor.getText() === "debugger; //# sourceURL=foo.js", "Editor has correct text");
  32. yield toolbox.closeSplitConsole();
  33. yield resumeDebuggerThenCloseAndFinish(panel);
  34. }