browser_dbg_location-changes-03-new.js 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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. * Make sure that changing the tab location URL to a page with other sources works.
  6. */
  7. const TAB_URL_1 = EXAMPLE_URL + "doc_recursion-stack.html";
  8. const TAB_URL_2 = EXAMPLE_URL + "doc_iframes.html";
  9. function test() {
  10. let options = {
  11. source: TAB_URL_1,
  12. line: 1
  13. };
  14. initDebugger(TAB_URL_1, options).then(([aTab, aDebuggee, aPanel]) => {
  15. const gTab = aTab;
  16. const gDebuggee = aDebuggee;
  17. const gPanel = aPanel;
  18. const gDebugger = gPanel.panelWin;
  19. const gEditor = gDebugger.DebuggerView.editor;
  20. const gSources = gDebugger.DebuggerView.Sources;
  21. const gFrames = gDebugger.DebuggerView.StackFrames;
  22. const constants = gDebugger.require("./content/constants");
  23. Task.spawn(function* () {
  24. let onCaretUpdated = waitForCaretUpdated(gPanel, 14);
  25. callInTab(gTab, "simpleCall");
  26. yield onCaretUpdated;
  27. const startedLoading = waitForNextDispatch(gDebugger.DebuggerController,
  28. constants.LOAD_SOURCE_TEXT);
  29. navigateActiveTabTo(gPanel, TAB_URL_2, gDebugger.EVENTS.SOURCE_SHOWN);
  30. yield startedLoading;
  31. isnot(gDebugger.gThreadClient.state, "paused",
  32. "Should not be paused after a tab navigation.");
  33. is(gFrames.itemCount, 0,
  34. "Should have no frames.");
  35. is(gSources.itemCount, 1,
  36. "Found the expected number of entries in the sources widget.");
  37. is(getSelectedSourceURL(gSources), EXAMPLE_URL + "doc_inline-debugger-statement.html",
  38. "There should be a selected source value.");
  39. isnot(gEditor.getText().length, 0,
  40. "The source editor should have some text displayed.");
  41. is(gEditor.getText(), gDebugger.L10N.getStr("loadingText"),
  42. "The source editor text should be 'Loading...'");
  43. is(gDebugger.document.querySelectorAll("#sources .side-menu-widget-empty-text").length, 0,
  44. "The sources widget should not display any notice at this point.");
  45. yield waitForDispatch(gPanel, constants.LOAD_SOURCE_TEXT);
  46. closeDebuggerAndFinish(gPanel);
  47. });
  48. });
  49. }