browser_toolbox_getpanelwhenready.js (1112B)
1 /* Any copyright is dedicated to the Public Domain. 2 * http://creativecommons.org/publicdomain/zero/1.0/ */ 3 4 // Tests that getPanelWhenReady returns the correct panel in promise 5 // resolutions regardless of whether it has opened first. 6 7 var toolbox = null; 8 9 const URL = "data:text/html;charset=utf8,test for getPanelWhenReady"; 10 11 add_task(async function () { 12 const tab = await addTab(URL); 13 toolbox = await gDevTools.showToolboxForTab(tab); 14 15 const debuggerPanelPromise = toolbox.getPanelWhenReady("jsdebugger"); 16 await toolbox.selectTool("jsdebugger"); 17 const debuggerPanel = await debuggerPanelPromise; 18 19 is( 20 debuggerPanel, 21 toolbox.getPanel("jsdebugger"), 22 "The debugger panel from getPanelWhenReady before loading is the actual panel" 23 ); 24 25 const debuggerPanel2 = await toolbox.getPanelWhenReady("jsdebugger"); 26 is( 27 debuggerPanel2, 28 toolbox.getPanel("jsdebugger"), 29 "The debugger panel from getPanelWhenReady after loading is the actual panel" 30 ); 31 32 await cleanup(); 33 }); 34 35 async function cleanup() { 36 await toolbox.destroy(); 37 gBrowser.removeCurrentTab(); 38 toolbox = null; 39 }