/** * Open a tab, load the url, find the tab with the devtools server, * and attach the console to it. * * @param {string} url : url to navigate to * @return {Promise} Promise resolving when commands are initialized * The Promise resolves with the commands.
*/
async function addTabAndCreateCommands(url) { const tab = await addTab(url); const commands = await CommandsFactory.forTab(tab);
await commands.targetCommand.startListening(); return commands;
}
/** * Naive implementaion of addTab working from a mochitest-chrome test.
*/
async function addTab(url) { const { gBrowser } = Services.wm.getMostRecentWindow("navigator:browser"); const { BrowserTestUtils } = ChromeUtils.importESModule( "resource://testing-common/BrowserTestUtils.sys.mjs"
); const tab = (gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser, url));
await BrowserTestUtils.browserLoaded(tab.linkedBrowser); return tab;
}
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.