Bug 1442559 part 3 - Detect whitelist item which doesn't have any condition. r?Gijs draft
authorXidorn Quan <me@upsuper.org>
Sat, 03 Mar 2018 11:56:55 +1100
changeset 763010 137f49764f3334d90da129624de78893a8543193
parent 763009 81c72f023c1ee47857da6df69a4b6791c3aca4f6
push id101304
push userxquan@mozilla.com
push dateSun, 04 Mar 2018 23:54:42 +0000
reviewersGijs
bugs1442559
milestone60.0a1
Bug 1442559 part 3 - Detect whitelist item which doesn't have any condition. r?Gijs MozReview-Commit-ID: GavZUKl9y1r
browser/base/content/test/static/browser_parsable_css.js
--- a/browser/base/content/test/static/browser_parsable_css.js
+++ b/browser/base/content/test/static/browser_parsable_css.js
@@ -168,23 +168,31 @@ function dumpWhitelistItem(item) {
  * objects defined in whitelist
  *
  * @param aErrorObject the error to check
  * @return true if the error should be ignored, false otherwise.
  */
 function ignoredError(aErrorObject) {
   for (let whitelistItem of whitelist) {
     let matches = true;
+    let catchAll = true;
     for (let prop of ["sourceName", "errorMessage"]) {
-      if (whitelistItem.hasOwnProperty(prop) &&
-          !whitelistItem[prop].test(aErrorObject[prop] || "")) {
-        matches = false;
-        break;
+      if (whitelistItem.hasOwnProperty(prop)) {
+        catchAll = false;
+        if (!whitelistItem[prop].test(aErrorObject[prop] || "")) {
+          matches = false;
+          break;
+        }
       }
     }
+    if (catchAll) {
+      ok(false, "A whitelist item is catching all errors. " +
+         dumpWhitelistItem(whitelistItem));
+      continue;
+    }
     if (matches) {
       whitelistItem.used = true;
       let {sourceName, errorMessage} = aErrorObject;
       info(`Ignored error "${errorMessage}" on ${sourceName} ` +
            "because of whitelist item " + dumpWhitelistItem(whitelistItem));
       return true;
     }
   }