tor-browser

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

browser_webconsole_sourcemap_css.js (1248B)


      1 /* Any copyright is dedicated to the Public Domain.
      2 * http://creativecommons.org/publicdomain/zero/1.0/ */
      3 
      4 "use strict";
      5 
      6 // Test that a missing original source is reported.
      7 
      8 const CSS_URL = URL_ROOT + "source-mapped.css";
      9 
     10 const PAGE_URL = `data:text/html,
     11 <!doctype html>
     12 
     13 <html>
     14  <head>
     15    <meta charset="utf-8"/>
     16    <title>Empty test page to test source map and css</title>
     17  </head>
     18 
     19  <link href="${CSS_URL}" rel="stylesheet" type="text/css">
     20  <body>
     21    <div>
     22    There should be a source-mapped CSS warning in the console.
     23    </div>
     24  </body>
     25 
     26 </html>`;
     27 
     28 add_task(async function () {
     29  await pushPref("devtools.source-map.client-service.enabled", true);
     30  await pushPref("devtools.webconsole.filter.css", true);
     31 
     32  const hud = await openNewTabAndConsole(PAGE_URL);
     33 
     34  info("Waiting for css warning");
     35  const node = await waitFor(() => findWarningMessage(hud, "octopus"));
     36  ok(!!node, "css warning seen");
     37 
     38  info("Waiting for source map to be applied");
     39  const found = await waitFor(() => {
     40    const messageLocationNode = node.querySelector(".message-location");
     41    const url = messageLocationNode.getAttribute("data-url");
     42    return url.includes("scss");
     43  });
     44 
     45  ok(found, "css warning is source mapped in web console");
     46 });