tor-browser

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

browser_rules_invalid-source-map.js (1346B)


      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 when a source map is missing/invalid, the rule view still loads
      7 // correctly.
      8 
      9 const TESTCASE_URI = URL_ROOT + "doc_invalid_sourcemap.html";
     10 const PREF = "devtools.source-map.client-service.enabled";
     11 const CSS_LOC = "doc_invalid_sourcemap.css:1";
     12 
     13 add_task(async function () {
     14  Services.prefs.setBoolPref(PREF, true);
     15 
     16  await addTab(TESTCASE_URI);
     17  const { inspector, view } = await openRuleView();
     18 
     19  await selectNode("div", inspector);
     20 
     21  const ruleEl = getRuleViewRule(view, "div");
     22  ok(ruleEl, "The 'div' rule exists in the rule-view");
     23 
     24  const prop = getRuleViewProperty(view, "div", "color");
     25  ok(prop, "The 'color' property exists in this rule");
     26 
     27  const value = getRuleViewPropertyValue(view, "div", "color");
     28  is(value, "gold", "The 'color' property has the right value");
     29 
     30  await verifyLinkText(view, CSS_LOC);
     31 
     32  Services.prefs.clearUserPref(PREF);
     33 });
     34 
     35 function verifyLinkText(view, text) {
     36  info("Verifying that the rule-view stylesheet link is " + text);
     37  const label = getRuleViewLinkByIndex(view, 1).querySelector(
     38    ".ruleview-rule-source-label"
     39  );
     40  return waitForSuccess(
     41    () => label.textContent == text,
     42    "Link text changed to display correct location: " + text
     43  );
     44 }