diff options
Diffstat (limited to 'devtools/client/webconsole/test/browser/browser_console_clear_closed_tab.js')
-rw-r--r-- | devtools/client/webconsole/test/browser/browser_console_clear_closed_tab.js | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/devtools/client/webconsole/test/browser/browser_console_clear_closed_tab.js b/devtools/client/webconsole/test/browser/browser_console_clear_closed_tab.js new file mode 100644 index 0000000000..1473153ba6 --- /dev/null +++ b/devtools/client/webconsole/test/browser/browser_console_clear_closed_tab.js @@ -0,0 +1,39 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ + +// Check that clearing the browser console output still works if the tab that emitted some +// was closed. See Bug 1628626. + +"use strict"; + +const TEST_URI = + "http://example.com/browser/devtools/client/webconsole/test/browser/test-console.html"; + +add_task(async function () { + // Show the content messages + await pushPref("devtools.browsertoolbox.scope", "everything"); + + // Disable the preloaded process as it creates processes intermittently + // which forces the emission of RDP requests we aren't correctly waiting for. + await pushPref("dom.ipc.processPrelaunch.enabled", false); + + const tab = await addTab(TEST_URI); + const hud = await BrowserConsoleManager.toggleBrowserConsole(); + + info("Log a new message from the content page"); + SpecialPowers.spawn(gBrowser.selectedBrowser, [], function () { + content.console.log({ hello: "world" }); + }); + + await waitFor(() => findConsoleAPIMessage(hud, "hello")); + + await removeTab(tab); + // Wait for a bit, so the actors and fronts are released. + await wait(500); + + info("Clear the console output"); + hud.ui.outputNode.querySelector(".devtools-clear-icon").click(); + + await waitFor(() => !findConsoleAPIMessage(hud, "hello")); + ok(true, "Browser Console was cleared"); +}); |