browser_console_ignore_debugger_statement.js (1028B)
1 /* This Source Code Form is subject to the terms of the Mozilla Public 2 * License, v. 2.0. If a copy of the MPL was not distributed with this 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 4 5 // Test that debugger statements are ignored in the browser console. 6 7 "use strict"; 8 9 const URI_WITH_DEBUGGER_STATEMENT = `data:text/html,<!DOCTYPE html> 10 <meta charset=utf8> 11 browser console ignore debugger statement 12 <script> 13 debugger; 14 console.log("after debugger statement"); 15 </script>`; 16 17 add_task(async function () { 18 // Show the content messages 19 await pushPref("devtools.browsertoolbox.scope", "everything"); 20 21 info("Open the Browser Console"); 22 const hud = await BrowserConsoleManager.toggleBrowserConsole(); 23 24 info("Add tab with a script containing debugger statement"); 25 const onMessage = waitForMessageByType( 26 hud, 27 `after debugger statement`, 28 ".console-api" 29 ); 30 await addTab(URI_WITH_DEBUGGER_STATEMENT); 31 await onMessage; 32 33 ok(true, "The debugger statement was ignored"); 34 });