summaryrefslogtreecommitdiffstats
path: root/devtools/client/webconsole/test/browser/browser_console_ignore_debugger_statement.js
blob: 7ed84f2b0802398ddd6ffabac9e9dbf7fb2b5fab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

// Test that debugger statements are ignored in the browser console.

"use strict";

const URI_WITH_DEBUGGER_STATEMENT = `data:text/html,<!DOCTYPE html>
  <meta charset=utf8>
  browser console ignore debugger statement
  <script>
    debugger;
    console.log("after debugger statement");
  </script>`;

add_task(async function () {
  // Show the content messages
  await pushPref("devtools.browsertoolbox.scope", "everything");

  info("Open the Browser Console");
  const hud = await BrowserConsoleManager.toggleBrowserConsole();

  info("Add tab with a script containing debugger statement");
  const onMessage = waitForMessageByType(
    hud,
    `after debugger statement`,
    ".console-api"
  );
  await addTab(URI_WITH_DEBUGGER_STATEMENT);
  await onMessage;

  ok(true, "The debugger statement was ignored");
});