diff options
Diffstat (limited to 'devtools/client/webconsole/test/browser/browser_webconsole_console_dir_uninspectable.js')
-rw-r--r-- | devtools/client/webconsole/test/browser/browser_webconsole_console_dir_uninspectable.js | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/devtools/client/webconsole/test/browser/browser_webconsole_console_dir_uninspectable.js b/devtools/client/webconsole/test/browser/browser_webconsole_console_dir_uninspectable.js new file mode 100644 index 0000000000..a55d0886f3 --- /dev/null +++ b/devtools/client/webconsole/test/browser/browser_webconsole_console_dir_uninspectable.js @@ -0,0 +1,53 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ + +// Make sure that the Web Console output does not break after we try to call +// console.dir() for objects that are not inspectable. + +"use strict"; + +const TEST_URI = + "data:text/html;charset=utf8,<!DOCTYPE html>test console.dir on uninspectable object"; +const FIRST_LOG_MESSAGE = "fooBug773466a"; +const SECOND_LOG_MESSAGE = "fooBug773466b"; + +add_task(async function () { + const hud = await openNewTabAndConsole(TEST_URI); + + info("Logging a first message to make sure everything is working"); + await executeAndWaitForMessageByType( + hud, + `console.log("${FIRST_LOG_MESSAGE}")`, + FIRST_LOG_MESSAGE, + ".console-api" + ); + + info("console.dir on an uninspectable object"); + await executeAndWaitForMessageByType( + hud, + "console.dir(Object.create(null))", + "Object { }", + ".console-api" + ); + + info("Logging a second message to make sure the console is not broken"); + const onLogMessage = waitForMessageByType( + hud, + SECOND_LOG_MESSAGE, + ".console-api" + ); + // Logging from content to make sure the console API is working. + SpecialPowers.spawn( + gBrowser.selectedBrowser, + [SECOND_LOG_MESSAGE], + string => { + content.console.log(string); + } + ); + await onLogMessage; + + ok( + true, + "The console.dir call on an uninspectable object did not break the console" + ); +}); |