summaryrefslogtreecommitdiffstats
path: root/devtools/client/webconsole/test/browser/browser_console_filters.js
blob: 5f79aa1acf0f626a76265cfe91ad4ccfd6ef9978 (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
35
36
37
38
39
40
41
42
43
44
45
46
/* Any copyright is dedicated to the Public Domain.
 * http://creativecommons.org/publicdomain/zero/1.0/ */

// Check that the Browser Console does not use the same filter prefs as the Web
// Console.

"use strict";

const TEST_URI =
  "data:text/html;charset=utf8,<!DOCTYPE html><p>browser console filters";

add_task(async function () {
  let hud = await openNewTabAndConsole(TEST_URI);
  ok(hud, "web console opened");

  let filterState = await getFilterState(hud);
  ok(filterState.error, "The web console error filter is enabled");

  info(`toggle "error" filter`);
  await setFilterState(hud, {
    error: false,
  });

  filterState = await getFilterState(hud);
  ok(!filterState.error, "The web console error filter is disabled");

  await resetFilters(hud);
  await closeConsole();
  info("web console closed");

  hud = await BrowserConsoleManager.toggleBrowserConsole();
  ok(hud, "browser console opened");

  filterState = await getFilterState(hud);
  ok(filterState.error, "The browser console error filter is enabled");

  info(`toggle "error" filter in browser console`);
  await setFilterState(hud, {
    error: false,
  });

  filterState = await getFilterState(hud);
  ok(!filterState.error, "The browser console error filter is disabled");

  await resetFilters(hud);
});