browser_dbg_stack-01.js 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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 that stackframes are added when debugger is paused.
  6. */
  7. const TAB_URL = EXAMPLE_URL + "doc_recursion-stack.html";
  8. var gTab, gPanel, gDebugger;
  9. var gFrames, gClassicFrames;
  10. function test() {
  11. let options = {
  12. source: TAB_URL,
  13. line: 1
  14. };
  15. initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => {
  16. gTab = aTab;
  17. gPanel = aPanel;
  18. gDebugger = gPanel.panelWin;
  19. gFrames = gDebugger.DebuggerView.StackFrames;
  20. gClassicFrames = gDebugger.DebuggerView.StackFramesClassicList;
  21. waitForCaretAndScopes(gPanel, 14).then(performTest);
  22. callInTab(gTab, "simpleCall");
  23. });
  24. }
  25. function performTest() {
  26. is(gDebugger.gThreadClient.state, "paused",
  27. "Should only be getting stack frames while paused.");
  28. is(gFrames.itemCount, 1,
  29. "Should have only one frame.");
  30. is(gClassicFrames.itemCount, 1,
  31. "Should also have only one frame in the mirrored view.");
  32. resumeDebuggerThenCloseAndFinish(gPanel);
  33. }
  34. registerCleanupFunction(function () {
  35. gTab = null;
  36. gPanel = null;
  37. gDebugger = null;
  38. gFrames = null;
  39. gClassicFrames = null;
  40. });