browser_dbg_breakpoints-eval.js 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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. * Test setting breakpoints on an eval script
  6. */
  7. const TAB_URL = EXAMPLE_URL + "doc_script-eval.html";
  8. function test() {
  9. let options = {
  10. source: EXAMPLE_URL + "code_script-eval.js",
  11. line: 1
  12. };
  13. initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => {
  14. const gTab = aTab;
  15. const gPanel = aPanel;
  16. const gDebugger = gPanel.panelWin;
  17. const gSources = gDebugger.DebuggerView.Sources;
  18. const actions = bindActionCreators(gPanel);
  19. Task.spawn(function* () {
  20. let newSource = waitForDebuggerEvents(gPanel, gDebugger.EVENTS.NEW_SOURCE);
  21. callInTab(gTab, "evalSourceWithSourceURL");
  22. yield newSource;
  23. // Wait for it to be added to the UI
  24. yield waitForTick();
  25. const newSourceActor = getSourceActor(gSources, EXAMPLE_URL + "bar.js");
  26. yield actions.addBreakpoint({
  27. actor: newSourceActor,
  28. line: 2
  29. });
  30. yield ensureThreadClientState(gPanel, "resumed");
  31. const paused = waitForThreadEvents(gPanel, "paused");
  32. callInTab(gTab, "bar");
  33. let frame = (yield paused).frame;
  34. is(frame.where.source.actor, newSourceActor, "Should have broken on the eval'ed source");
  35. is(frame.where.line, 2, "Should break on line 2");
  36. yield resumeDebuggerThenCloseAndFinish(gPanel);
  37. });
  38. });
  39. }