Bug 1442559 part 3 - Detect whitelist item which doesn't have any condition. r?Gijs
MozReview-Commit-ID: GavZUKl9y1r
--- 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;
}
}