browser_dbg_stack-03.js 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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 scrollable.
  6. */
  7. const TAB_URL = EXAMPLE_URL + "doc_recursion-stack.html";
  8. let framesScrollingInterval;
  9. function test() {
  10. let options = {
  11. source: TAB_URL,
  12. line: 1
  13. };
  14. initDebugger(TAB_URL, options).then(([aTab, aDebuggee, aPanel]) => {
  15. const tab = aTab;
  16. const debuggee = aDebuggee;
  17. const panel = aPanel;
  18. const gDebugger = panel.panelWin;
  19. const frames = gDebugger.DebuggerView.StackFrames;
  20. const classicFrames = gDebugger.DebuggerView.StackFramesClassicList;
  21. Task.spawn(function* () {
  22. framesScrollingInterval = window.setInterval(() => {
  23. frames.widget._list.scrollByIndex(-1);
  24. }, 100);
  25. yield waitForDebuggerEvents(panel, gDebugger.EVENTS.AFTER_FRAMES_REFILLED);
  26. is(gDebugger.gThreadClient.state, "paused",
  27. "Should only be getting stack frames while paused.");
  28. is(frames.itemCount, gDebugger.gCallStackPageSize,
  29. "Should have only the max limit of frames.");
  30. is(classicFrames.itemCount, gDebugger.gCallStackPageSize,
  31. "Should have only the max limit of frames in the mirrored view as well.");
  32. yield waitForDebuggerEvents(panel, gDebugger.EVENTS.AFTER_FRAMES_REFILLED);
  33. is(frames.itemCount, gDebugger.gCallStackPageSize * 2,
  34. "Should now have twice the max limit of frames.");
  35. is(classicFrames.itemCount, gDebugger.gCallStackPageSize * 2,
  36. "Should now have twice the max limit of frames in the mirrored view as well.");
  37. yield waitForDebuggerEvents(panel, gDebugger.EVENTS.AFTER_FRAMES_REFILLED);
  38. is(frames.itemCount, debuggee.gRecurseLimit,
  39. "Should have reached the recurse limit.");
  40. is(classicFrames.itemCount, debuggee.gRecurseLimit,
  41. "Should have reached the recurse limit in the mirrored view as well.");
  42. // Call stack frame scrolling should stop before
  43. // we resume the gDebugger as it could be a source of race conditions.
  44. window.clearInterval(framesScrollingInterval);
  45. resumeDebuggerThenCloseAndFinish(panel);
  46. });
  47. debuggee.gRecurseLimit = (gDebugger.gCallStackPageSize * 2) + 1;
  48. debuggee.recurse();
  49. });
  50. }