tor-browser

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

browser_sourcemap.js (1142B)


      1 add_task(async function () {
      2  let uri = "http://example.com/browser/layout/style/test/sourcemap_css.html";
      3  info(`URI is ${uri}`);
      4 
      5  await BrowserTestUtils.withNewTab(
      6    {
      7      gBrowser,
      8      url: uri,
      9    },
     10    async function (browser) {
     11      await SpecialPowers.spawn(browser, [], function () {
     12        let seenSheets = 0;
     13 
     14        for (let i = 0; i < content.document.styleSheets.length; ++i) {
     15          let sheet = content.document.styleSheets[i];
     16 
     17          info(`Checking ${sheet.href}`);
     18          if (/mapped\.css/.test(sheet.href)) {
     19            is(
     20              sheet.sourceMapURL,
     21              "mapped.css.map",
     22              "X-SourceMap header took effect"
     23            );
     24            seenSheets |= 1;
     25          } else if (/mapped2\.css/.test(sheet.href)) {
     26            is(
     27              sheet.sourceMapURL,
     28              "mapped2.css.map",
     29              "SourceMap header took effect"
     30            );
     31            seenSheets |= 2;
     32          } else {
     33            ok(false, "sheet does not have source map URL");
     34          }
     35        }
     36 
     37        is(seenSheets, 3, "seen all source-mapped sheets");
     38      });
     39    }
     40  );
     41 });