Bug 1476322 - Make browser_parsable_css.js parse more types of rules. r=jaws
MozReview-Commit-ID: HZmMUEJsROz
--- a/browser/base/content/test/static/browser_parsable_css.js
+++ b/browser/base/content/test/static/browser_parsable_css.js
@@ -115,26 +115,22 @@ let propNameWhitelist = [
isFromDevTools: false},
{propName: "--positionDurationBox-width-long",
isFromDevTools: false},
// Used on Linux
{propName: "--in-content-box-background-odd",
platforms: ["win", "macosx"],
isFromDevTools: false},
- // These properties *are* actually referenced. Need to find why
- // their reference isn't getting counted.
+ // These variables are used in a shorthand, but the CSS parser deletes the values
+ // when expanding the shorthands. See https://github.com/w3c/csswg-drafts/issues/2515
{propName: "--bezier-diagonal-color",
isFromDevTools: true},
{propName: "--bezier-grid-color",
isFromDevTools: true},
-
- // Bug 1476322 - Doesn't parse CSSKeyframeRules
- {propName: "--tracking-protection-shield-color",
- isFromDevTools: false},
];
// Add suffix to stylesheets' URI so that we always load them here and
// have them parsed. Add a random number so that even if we run this
// test multiple times, it would be unlikely to affect each other.
const kPathSuffix = "?always-parse-css-" + Math.random();
function dumpWhitelistItem(item) {
@@ -251,25 +247,25 @@ function messageIsCSSError(msg) {
return false;
}
let imageURIsToReferencesMap = new Map();
let customPropsToReferencesMap = new Map();
function processCSSRules(sheet) {
for (let rule of sheet.cssRules) {
- if (rule instanceof CSSMediaRule) {
+ if (rule instanceof CSSConditionRule || rule instanceof CSSKeyframesRule) {
processCSSRules(rule);
continue;
}
- if (!(rule instanceof CSSStyleRule))
+ if (!(rule instanceof CSSStyleRule) && !(rule instanceof CSSKeyframeRule))
continue;
// Extract urls from the css text.
- // Note: CSSStyleRule.cssText always has double quotes around URLs even
+ // Note: CSSRule.cssText always has double quotes around URLs even
// when the original CSS file didn't.
let urls = rule.cssText.match(/url\("[^"]*"\)/g);
// Extract props by searching all "--" preceeded by "var(" or a non-word
// character.
let props = rule.cssText.match(/(var\(|\W)(--[\w\-]+)/g);
if (!urls && !props)
continue;