browser_dbg_location-changes-01-simple.js 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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 works.
  6. */
  7. const TAB_URL = EXAMPLE_URL + "doc_recursion-stack.html";
  8. function test() {
  9. let options = {
  10. source: TAB_URL,
  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 gEditor = gDebugger.DebuggerView.editor;
  18. const gSources = gDebugger.DebuggerView.Sources;
  19. const gFrames = gDebugger.DebuggerView.StackFrames;
  20. const constants = gDebugger.require("./content/constants");
  21. Task.spawn(function* () {
  22. let onCaretUpdated = waitForCaretAndScopes(gPanel, 14);
  23. callInTab(gTab, "simpleCall");
  24. yield onCaretUpdated;
  25. is(gDebugger.gThreadClient.state, "paused",
  26. "Should only be getting stack frames while paused.");
  27. is(gFrames.itemCount, 1,
  28. "Should have only one frame.");
  29. is(gSources.itemCount, 1,
  30. "Found the expected number of entries in the sources widget.");
  31. isnot(gSources.selectedValue, null,
  32. "There should be a selected source value.");
  33. isnot(gEditor.getText().length, 0,
  34. "The source editor should have some text displayed.");
  35. isnot(gEditor.getText(), gDebugger.L10N.getStr("loadingText"),
  36. "The source editor text should not be 'Loading...'");
  37. is(gDebugger.document.querySelectorAll("#sources .side-menu-widget-empty-notice-container").length, 0,
  38. "The sources widget should not display any notice at this point (1).");
  39. is(gDebugger.document.querySelectorAll("#sources .side-menu-widget-empty-notice").length, 0,
  40. "The sources widget should not display any notice at this point (2).");
  41. is(gDebugger.document.querySelector("#sources .side-menu-widget-empty-notice > label"), null,
  42. "The sources widget should not display a notice at this point (3).");
  43. yield doResume(gPanel);
  44. navigateActiveTabTo(gPanel, "about:blank");
  45. yield waitForDispatch(gPanel, constants.UNLOAD);
  46. closeDebuggerAndFinish(gPanel);
  47. });
  48. });
  49. }