Bug 1442559 part 3 - Detect whitelist item which doesn't have any condition. r=Gijs
authorXidorn Quan <me@upsuper.org>
Sat, 03 Mar 2018 11:56:55 +1100
changeset 406522 39e3ac3b11944e2383286cba9ca0ef999db8a822
parent 406521 756d5b77b54002d1b058e4d6e297b8fef689f97a
child 406523 dc7e032121070c9833c9e804208405b370f6a32c
push id60576
push userxquan@mozilla.com
push dateSun, 04 Mar 2018 23:57:18 +0000
treeherderautoland@39e3ac3b1194 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersGijs
bugs1442559
milestone60.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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;
     }
   }