// We are opening/close toolboxes many times, // which introduces long GC pauses between each sub task // and requires some more time to run in DEBUG builds.
requestLongerTimeout(2);
const URL = "data:text/html;charset=utf8,test for opening toolbox in different hosts";
const tab = win.gBrowser.selectedTab;
toolbox = await gDevTools.showToolboxForTab(tab, {
toolId: "webconsole",
hostType: Toolbox.HostType.WINDOW,
}); const onToolboxClosed = toolbox.once("destroyed");
ok(
gDevToolsBrowser.hasToolboxOpened(win), "hasToolboxOpened is true before closing the toolbox"
);
await BrowserTestUtils.closeWindow(win);
ok(
!gDevToolsBrowser.hasToolboxOpened(win), "hasToolboxOpened is false after closing the window"
);
info("Wait for toolbox to be destroyed after browser window is closed");
await onToolboxClosed;
toolbox = null;
});
add_task(async function runTest() {
info("Create a test tab and open the toolbox"); const tab = await addTab(URL);
toolbox = await gDevTools.showToolboxForTab(tab, { toolId: "webconsole" });
// We run the same host switching tests in a private window. // See Bug 1581093 for an example of issue specific to private windows.
add_task(async function runPrivateWindowTest() {
info("Create a private window + tab and open the toolbox");
await runHostTestsFromSeparateWindow({ private: true,
});
});
// We run the same host switching tests in a non-fission window. // See Bug 1650963 for an example of issue specific to private windows.
add_task(async function runNonFissionWindowTest() {
info("Create a non-fission window + tab and open the toolbox");
await runHostTestsFromSeparateWindow({
fission: false,
});
});
function testRememberHost() { // last host was the window - make sure it's the same when re-opening
is(toolbox.hostType, WINDOW, "host remembered");
const win = Services.wm.getMostRecentWindow("devtools:toolbox");
ok(win, "toolbox separate window exists");
}
async function testPreviousHost() { // last host was the window - make sure it's the same when re-opening
is(toolbox.hostType, WINDOW, "host remembered");
info("Switching to left");
await toolbox.switchHost(LEFT);
checkHostType(toolbox, LEFT, WINDOW);
info("Switching to right");
await toolbox.switchHost(RIGHT);
checkHostType(toolbox, RIGHT, LEFT);
info("Switching to bottom");
await toolbox.switchHost(BOTTOM);
checkHostType(toolbox, BOTTOM, RIGHT);
info("Switching from bottom to right");
await toolbox.switchToPreviousHost();
checkHostType(toolbox, RIGHT, BOTTOM);
info("Switching from right to bottom");
await toolbox.switchToPreviousHost();
checkHostType(toolbox, BOTTOM, RIGHT);
info("Switching to window");
await toolbox.switchHost(WINDOW);
checkHostType(toolbox, WINDOW, BOTTOM);
info("Switching from window to bottom");
await toolbox.switchToPreviousHost();
checkHostType(toolbox, BOTTOM, WINDOW);
info("Forcing the previous host to match the current (bottom)");
Services.prefs.setCharPref("devtools.toolbox.previousHost", BOTTOM);
info("Switching from bottom to right (since previous=current=bottom");
await toolbox.switchToPreviousHost();
checkHostType(toolbox, RIGHT, BOTTOM);
info("Forcing the previous host to match the current (right)");
Services.prefs.setCharPref("devtools.toolbox.previousHost", RIGHT);
info("Switching from right to bottom (since previous=current=side");
await toolbox.switchToPreviousHost();
checkHostType(toolbox, BOTTOM, RIGHT);
}
function checkToolboxLoaded(iframe) { const tabs = iframe.contentDocument.querySelector(".toolbox-tabs");
ok(tabs, "toolbox UI has been loaded into iframe");
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.