tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

browser_webconsole_warning_group_csp.js (1183B)


      1 /* Any copyright is dedicated to the Public Domain.
      2 * http://creativecommons.org/publicdomain/zero/1.0/ */
      3 
      4 // Load a page that generates multiple CSP parser warnings.
      5 
      6 "use strict";
      7 
      8 const TEST_FILE =
      9  "browser/devtools/client/webconsole/test/browser/test-warning-group-csp.html";
     10 
     11 add_task(async function testCSPGroup() {
     12  const GROUP_LABEL = "Content-Security-Policy warnings";
     13 
     14  const hud = await openNewTabAndConsole("https://example.org/" + TEST_FILE);
     15 
     16  info("Checking for warning group");
     17  await checkConsoleOutputForWarningGroup(hud, [`▶︎⚠ ${GROUP_LABEL} 4`]);
     18 
     19  info("Expand the warning group");
     20  const node = findWarningMessage(hud, GROUP_LABEL);
     21  node.querySelector(".arrow").click();
     22  await checkConsoleOutputForWarningGroup(hud, [
     23    `▼︎⚠ ${GROUP_LABEL} 4`,
     24    `| Ignoring “http:” within script-src: ‘strict-dynamic’ specified`,
     25    `| Ignoring “https:” within script-src: ‘strict-dynamic’ specified`,
     26    `| Ignoring “'unsafe-inline'” within script-src: ‘strict-dynamic’ specified`,
     27    `| Keyword ‘strict-dynamic’ within “script-src” with no valid nonce or hash might block all scripts from loading`,
     28  ]);
     29 });