browser_toolbox_getpanelwhenready.js 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  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. // Tests that getPanelWhenReady returns the correct panel in promise
  5. // resolutions regardless of whether it has opened first.
  6. var toolbox = null;
  7. const URL = "data:text/html;charset=utf8,test for getPanelWhenReady";
  8. add_task(function* () {
  9. let tab = yield addTab(URL);
  10. let target = TargetFactory.forTab(tab);
  11. toolbox = yield gDevTools.showToolbox(target);
  12. let debuggerPanelPromise = toolbox.getPanelWhenReady("jsdebugger");
  13. yield toolbox.selectTool("jsdebugger");
  14. let debuggerPanel = yield debuggerPanelPromise;
  15. is(debuggerPanel, toolbox.getPanel("jsdebugger"),
  16. "The debugger panel from getPanelWhenReady before loading is the actual panel");
  17. let debuggerPanel2 = yield toolbox.getPanelWhenReady("jsdebugger");
  18. is(debuggerPanel2, toolbox.getPanel("jsdebugger"),
  19. "The debugger panel from getPanelWhenReady after loading is the actual panel");
  20. yield cleanup();
  21. });
  22. function* cleanup() {
  23. yield toolbox.destroy();
  24. gBrowser.removeCurrentTab();
  25. toolbox = null;
  26. }