Backed out 2 changesets (bug 1845064, bug 1801416) for causing mochitests failures in browser_parsable_css.js. CLOSED TREE

Backed out changeset 0072ca947732 (bug 1845064)
Backed out changeset 97d46689ef0a (bug 1801416)
This commit is contained in:
Stanca Serban 2023-07-24 23:23:24 +03:00
Родитель d9cfb537bd
Коммит 74033863ce
4 изменённых файлов: 82 добавлений и 78 удалений

Просмотреть файл

@ -13,7 +13,7 @@ var isDevtools = SimpleTest.harnessParameters.subsuite == "devtools";
// This list should contain only path prefixes. It is meant to stop the test
// from reporting things that *are* referenced, but for which the test can't
// find any reference because the URIs are constructed programatically.
// If you need to allowlist specific files, please use the 'allowlist' object.
// If you need to whitelist specific files, please use the 'whitelist' object.
var gExceptionPaths = [
"resource://app/defaults/settings/blocklists/",
"resource://app/defaults/settings/security-state/",
@ -50,6 +50,7 @@ var gExceptionPaths = [
// Exclude all services-automation because they are used through webdriver
"resource://gre/modules/services-automation/",
"resource://services-automation/ServicesAutomation.jsm",
// Paths from this folder are constructed in NetErrorParent.sys.mjs based on
// the type of cert or net error the user is encountering.
@ -68,7 +69,7 @@ var gExceptionPaths = [
// Activity stream schemas are referenced programmatically.
"resource://activity-stream/schemas",
// Localization file added programatically in FeatureCallout.sys.mjs
// Localization file added programatically in featureCallout.jsm
"resource://app/localization/en-US/browser/featureCallout.ftl",
];
@ -83,7 +84,7 @@ if (AppConstants.MOZ_BACKGROUNDTASKS) {
// These preferences are active only when we're in background task mode.
gExceptionPaths.push("resource://gre/defaults/backgroundtasks/");
gExceptionPaths.push("resource://app/defaults/backgroundtasks/");
// `BackgroundTask_*.sys.mjs` are loaded at runtime by `app --backgroundtask id ...`.
// `BackgroundTask_id.jsm` is loaded at runtime by `app --backgroundtask id ...`.
gExceptionPaths.push("resource://gre/modules/backgroundtasks/");
gExceptionPaths.push("resource://app/modules/backgroundtasks/");
}
@ -101,11 +102,11 @@ if (AppConstants.NIGHTLY_BUILD) {
);
}
// Each allowlist entry should have a comment indicating which file is
// referencing the listed file in a way that the test can't detect, or a
// Each whitelist entry should have a comment indicating which file is
// referencing the whitelisted file in a way that the test can't detect, or a
// bug number to remove or use the file if it is indeed currently unreferenced.
var allowlist = [
// toolkit/components/pdfjs/content/PdfStreamConverter.sys.mjs
var whitelist = [
// toolkit/components/pdfjs/content/PdfStreamConverter.jsm
{ file: "chrome://pdf.js/locale/chrome.properties" },
{ file: "chrome://pdf.js/locale/viewer.properties" },
@ -207,7 +208,7 @@ var allowlist = [
{ file: "resource://pdf.js/web/debugger.js" },
{ file: "resource://pdf.js/web/debugger.css" },
// Starting from here, files in the allowlist are bugs that need fixing.
// Starting from here, files in the whitelist are bugs that need fixing.
// Bug 1339424 (wontfix?)
{
file: "chrome://browser/locale/taskbar.properties",
@ -254,7 +255,7 @@ var allowlist = [
// dom/xml/nsXMLPrettyPrinter.cpp
{ file: "resource://gre/localization/en-US/dom/XMLPrettyPrint.ftl" },
// tookit/mozapps/update/BackgroundUpdate.sys.mjs
// tookit/mozapps/update/BackgroundUpdate.jsm
{
file: "resource://gre/localization/en-US/toolkit/updates/backgroundupdate.ftl",
},
@ -288,29 +289,29 @@ var allowlist = [
if (AppConstants.NIGHTLY_BUILD && AppConstants.platform != "win") {
// This path is refereneced in nsFxrCommandLineHandler.cpp, which is only
// compiled in Windows. This path is allowed so that non-Windows builds
// compiled in Windows. Whitelisted this path so that non-Windows builds
// can access the FxR UI via --chrome rather than --fxr (which includes VR-
// specific functionality)
allowlist.push({ file: "chrome://fxr/content/fxrui.html" });
whitelist.push({ file: "chrome://fxr/content/fxrui.html" });
}
if (AppConstants.platform == "android") {
// The l10n build system can't package string files only for some platforms.
// Referenced by aboutGlean.html
allowlist.push({
whitelist.push({
file: "resource://gre/localization/en-US/toolkit/about/aboutGlean.ftl",
});
}
if (AppConstants.MOZ_UPDATE_AGENT && !AppConstants.MOZ_BACKGROUNDTASKS) {
// Task scheduling is only used for background updates right now.
allowlist.push({
file: "resource://gre/modules/TaskScheduler.sys.mjs",
whitelist.push({
file: "resource://gre/modules/TaskScheduler.jsm",
});
}
allowlist = new Set(
allowlist
whitelist = new Set(
whitelist
.filter(
item =>
"isFromDevTools" in item == isDevtools &&
@ -320,7 +321,7 @@ allowlist = new Set(
.map(item => item.file)
);
const ignorableAllowlist = new Set([
const ignorableWhitelist = new Set([
// The following files are outside of the omni.ja file, so we only catch them
// when testing on a non-packaged build.
@ -333,8 +334,8 @@ const ignorableAllowlist = new Set([
// Bug 1351669 - obsolete test file
"resource://gre/res/test.properties",
]);
for (let entry of ignorableAllowlist) {
allowlist.add(entry);
for (let entry of ignorableWhitelist) {
whitelist.add(entry);
}
if (!isDevtools) {
@ -349,17 +350,17 @@ if (!isDevtools) {
"tabs.sys.mjs",
"extension-storage.sys.mjs",
]) {
allowlist.add("resource://services-sync/engines/" + module);
whitelist.add("resource://services-sync/engines/" + module);
}
// resource://devtools/shared/worker/loader.js,
// resource://devtools/shared/loader/builtin-modules.js
if (!AppConstants.ENABLE_WEBDRIVER) {
allowlist.add("resource://gre/modules/jsdebugger.sys.mjs");
whitelist.add("resource://gre/modules/jsdebugger.sys.mjs");
}
}
if (AppConstants.MOZ_CODE_COVERAGE) {
allowlist.add(
whitelist.add(
"chrome://remote/content/marionette/PerTestCoverageUtils.sys.mjs"
);
}
@ -385,9 +386,9 @@ var gComponentsSet = new Set();
// In this map when the value is a Set of URLs, the file is referenced if any
// of the files in the Set is referenced.
// When the value is null, the file is referenced unconditionally.
// When the value is a string, "allowlist-direct" means that we have not found
// any reference in the code, but have a matching allowlist entry for this file.
// "allowlist" means that the file is indirectly allowlisted, ie. a allowlisted
// When the value is a string, "whitelist-direct" means that we have not found
// any reference in the code, but have a matching whitelist entry for this file.
// "whitelist" means that the file is indirectly whitelisted, ie. a whitelisted
// file causes this file to be referenced.
var gReferencesFromCode = new Map();
@ -953,8 +954,8 @@ add_task(async function checkAllTheFiles() {
let refType = gReferencesFromCode.get(ref);
if (
refType === null || // unconditionally referenced
refType == "allowlist" ||
refType == "allowlist-direct"
refType == "whitelist" ||
refType == "whitelist-direct"
) {
return false;
}
@ -966,7 +967,7 @@ add_task(async function checkAllTheFiles() {
let unreferencedFiles = chromeFiles;
let removeReferenced = useAllowlist => {
let removeReferenced = useWhitelist => {
let foundReference = false;
unreferencedFiles = unreferencedFiles.filter(f => {
let rv = isUnreferenced(f);
@ -978,15 +979,15 @@ add_task(async function checkAllTheFiles() {
}
if (!rv) {
foundReference = true;
if (useAllowlist) {
if (useWhitelist) {
info(
"indirectly allowlisted file: " +
"indirectly whitelisted file: " +
f +
" used from " +
listCodeReferences(gReferencesFromCode.get(f))
);
}
gReferencesFromCode.set(f, useAllowlist ? "allowlist" : null);
gReferencesFromCode.set(f, useWhitelist ? "whitelist" : null);
}
return rv;
});
@ -997,17 +998,17 @@ add_task(async function checkAllTheFiles() {
// As long as removeReferenced returns true, some files have been marked
// as referenced, so we need to run it again.
}
// Marked as referenced the files that have been explicitly allowed.
// Marked as referenced the files that have been explicitly whitelisted.
unreferencedFiles = unreferencedFiles.filter(file => {
if (allowlist.has(file)) {
allowlist.delete(file);
gReferencesFromCode.set(file, "allowlist-direct");
if (whitelist.has(file)) {
whitelist.delete(file);
gReferencesFromCode.set(file, "whitelist-direct");
return false;
}
return true;
});
// Run the process again, this time when more files are marked as referenced,
// it's a consequence of the allowlist.
// it's a consequence of the whitelist.
while (removeReferenced(true)) {
// As long as removeReferenced returns true, we need to run it again.
}
@ -1040,11 +1041,11 @@ add_task(async function checkAllTheFiles() {
}
}
for (let file of allowlist) {
if (ignorableAllowlist.has(file)) {
info("ignored unused allowlist entry: " + file);
for (let file of whitelist) {
if (ignorableWhitelist.has(file)) {
info("ignored unused whitelist entry: " + file);
} else {
ok(false, "unused allowlist entry: " + file);
ok(false, "unused whitelist entry: " + file);
}
}
@ -1067,7 +1068,7 @@ add_task(async function checkAllTheFiles() {
continue;
}
// TODO: bug 1349010 - add a allowlist and make this reliable enough
// TODO: bug 1349010 - add a whitelist and make this reliable enough
// that we could make the test fail when this catches something new.
let refList = listCodeReferences(refs);
let msg = "missing file: " + file;

Просмотреть файл

@ -9,7 +9,7 @@
* matching the offending error. If an object has multiple regex criteria, they
* ALL need to match an error in order for that error not to cause a test
* failure. */
let ignoreList = [
let whitelist = [
// CodeMirror is imported as-is, see bug 1004423.
{ sourceName: /codemirror\.css$/i, isFromDevTools: true },
{
@ -66,7 +66,7 @@ let ignoreList = [
if (!Services.prefs.getBoolPref("layout.css.color-mix.enabled")) {
// Reserved to UA sheets unless layout.css.color-mix.enabled flipped to true.
ignoreList.push({
whitelist.push({
sourceName: /\b(autocomplete-item)\.css$/,
errorMessage: /Expected color but found \u2018color-mix\u2019./i,
isFromDevTools: false,
@ -76,7 +76,7 @@ if (!Services.prefs.getBoolPref("layout.css.color-mix.enabled")) {
if (!Services.prefs.getBoolPref("layout.css.math-depth.enabled")) {
// mathml.css UA sheet rule for math-depth.
ignoreList.push({
whitelist.push({
sourceName: /\b(scrollbars|mathml)\.css$/i,
errorMessage: /Unknown property .*\bmath-depth\b/i,
isFromDevTools: false,
@ -85,7 +85,7 @@ if (!Services.prefs.getBoolPref("layout.css.math-depth.enabled")) {
if (!Services.prefs.getBoolPref("layout.css.math-style.enabled")) {
// mathml.css UA sheet rule for math-style.
ignoreList.push({
whitelist.push({
sourceName: /(?:res|gre-resources)\/mathml\.css$/i,
errorMessage: /Unknown property .*\bmath-style\b/i,
isFromDevTools: false,
@ -93,7 +93,7 @@ if (!Services.prefs.getBoolPref("layout.css.math-style.enabled")) {
}
if (!Services.prefs.getBoolPref("layout.css.scroll-anchoring.enabled")) {
ignoreList.push({
whitelist.push({
sourceName: /webconsole\.css$/i,
errorMessage: /Unknown property .*\boverflow-anchor\b/i,
isFromDevTools: true,
@ -101,7 +101,7 @@ if (!Services.prefs.getBoolPref("layout.css.scroll-anchoring.enabled")) {
}
if (!Services.prefs.getBoolPref("layout.css.forced-colors.enabled")) {
ignoreList.push({
whitelist.push({
sourceName: /pdf\.js\/web\/viewer\.css$/,
errorMessage: /Expected media feature name but found forced-colors*/i,
isFromDevTools: false,
@ -110,7 +110,7 @@ if (!Services.prefs.getBoolPref("layout.css.forced-colors.enabled")) {
if (!Services.prefs.getBoolPref("layout.css.forced-color-adjust.enabled")) {
// PDF.js uses a property that is currently not enabled.
ignoreList.push({
whitelist.push({
sourceName: /web\/viewer\.css$/i,
errorMessage:
/Unknown property forced-color-adjust\. {2}Declaration dropped\./i,
@ -118,7 +118,7 @@ if (!Services.prefs.getBoolPref("layout.css.forced-color-adjust.enabled")) {
});
}
let propNameAllowlist = [
let propNameWhitelist = [
// These custom properties are retrieved directly from CSSOM
// in videocontrols.xml to get pre-defined style instead of computed
// dimensions, which is why they are not referenced by CSS.
@ -154,27 +154,27 @@ let propNameAllowlist = [
// test multiple times, it would be unlikely to affect each other.
const kPathSuffix = "?always-parse-css-" + Math.random();
function dumpAllowlistItem(item) {
function dumpWhitelistItem(item) {
return JSON.stringify(item, (key, value) => {
return value instanceof RegExp ? value.toString() : value;
});
}
/**
* Check if an error should be ignored due to matching one of the allowlist
* objects.
* Check if an error should be ignored due to matching one of the whitelist
* 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 allowlistItem of ignoreList) {
for (let whitelistItem of whitelist) {
let matches = true;
let catchAll = true;
for (let prop of ["sourceName", "errorMessage"]) {
if (allowlistItem.hasOwnProperty(prop)) {
if (whitelistItem.hasOwnProperty(prop)) {
catchAll = false;
if (!allowlistItem[prop].test(aErrorObject[prop] || "")) {
if (!whitelistItem[prop].test(aErrorObject[prop] || "")) {
matches = false;
break;
}
@ -183,18 +183,18 @@ function ignoredError(aErrorObject) {
if (catchAll) {
ok(
false,
"An allowlist item is catching all errors. " +
dumpAllowlistItem(allowlistItem)
"A whitelist item is catching all errors. " +
dumpWhitelistItem(whitelistItem)
);
continue;
}
if (matches) {
allowlistItem.used = true;
whitelistItem.used = true;
let { sourceName, errorMessage } = aErrorObject;
info(
`Ignored error "${errorMessage}" on ${sourceName} ` +
"because of allowlist item " +
dumpAllowlistItem(allowlistItem)
"because of whitelist item " +
dumpWhitelistItem(whitelistItem)
);
return true;
}
@ -271,7 +271,7 @@ function messageIsCSSError(msg) {
) {
let sourceName = msg.sourceName.slice(0, -kPathSuffix.length);
let msgInfo = { sourceName, errorMessage: msg.errorMessage };
// Check if this error is allowlisted in allowlist
// Check if this error is whitelisted in whitelist
if (!ignoredError(msgInfo)) {
ok(false, `Got error message for ${sourceName}: ${msg.errorMessage}`);
return true;
@ -517,7 +517,7 @@ add_task(async function checkAllTheCSS() {
for (let [prop, refCount] of customPropsToReferencesMap) {
if (!refCount) {
let ignored = false;
for (let item of propNameAllowlist) {
for (let item of propNameWhitelist) {
if (item.propName == prop && isDevtools == item.isFromDevTools) {
item.used = true;
if (
@ -545,8 +545,8 @@ add_task(async function checkAllTheCSS() {
"All the styles (" + allPromises.length + ") loaded without errors."
);
// Confirm that all allowlist rules have been used.
function checkAllowlist(list) {
// Confirm that all whitelist rules have been used.
function checkWhitelist(list) {
for (let item of list) {
if (
!item.used &&
@ -554,12 +554,12 @@ add_task(async function checkAllTheCSS() {
(!item.platforms || item.platforms.includes(AppConstants.platform)) &&
!item.intermittent
) {
ok(false, "Unused allowlist item: " + dumpAllowlistItem(item));
ok(false, "Unused whitelist item: " + dumpWhitelistItem(item));
}
}
}
checkAllowlist(ignoreList);
checkAllowlist(propNameAllowlist);
checkWhitelist(whitelist);
checkWhitelist(propNameWhitelist);
// Clean up to avoid leaks:
doc.head.innerHTML = "";

Просмотреть файл

@ -8,7 +8,7 @@
requestLongerTimeout(2);
const kAllowlist = new Set([
const kWhitelist = new Set([
/browser\/content\/browser\/places\/controller.js$/,
]);
@ -34,15 +34,15 @@ const init = Cc["@mozilla.org/jsreflect;1"].createInstance();
init();
/**
* Check if an error should be ignored due to matching one of the allowlist
* objects.
* Check if an error should be ignored due to matching one of the whitelist
* objects defined in kWhitelist
*
* @param uri the uri to check against the allowlist
* @param uri the uri to check against the whitelist
* @return true if the uri should be skipped, false otherwise.
*/
function uriIsAllowed(uri) {
for (let allowlistItem of kAllowlist) {
if (allowlistItem.test(uri.spec)) {
function uriIsWhiteListed(uri) {
for (let whitelistItem of kWhitelist) {
if (whitelistItem.test(uri.spec)) {
return true;
}
}
@ -60,8 +60,8 @@ function uriIsESModule(uri) {
return true;
}
for (let allowlistItem of kESModuleList) {
if (allowlistItem.test(uri.spec)) {
for (let whitelistItem of kESModuleList) {
if (whitelistItem.test(uri.spec)) {
return true;
}
}
@ -153,8 +153,8 @@ add_task(async function checkAllTheJS() {
// We create an array of promises so we can parallelize all our parsing
// and file loading activity:
await PerfTestHelpers.throttledMapPromises(uris, uri => {
if (uriIsAllowed(uri)) {
info("Not checking allowlisted " + uri.spec);
if (uriIsWhiteListed(uri)) {
info("Not checking whitelisted " + uri.spec);
return undefined;
}
let target = "script";

Просмотреть файл

@ -46,6 +46,9 @@ avoid-blacklist-and-whitelist:
- browser/base/content/test/protectionsUI/browser_protectionsUI_state.js
- browser/base/content/test/protectionsUI/browser_protectionsUI_subview_shim.js
- browser/base/content/test/siteIdentity/browser_no_mcb_for_loopback.js
- browser/base/content/test/static/browser_all_files_referenced.js
- browser/base/content/test/static/browser_parsable_css.js
- browser/base/content/test/static/browser_parsable_script.js
- browser/base/content/test/tabMediaIndicator/browser_mute_webAudio.js
- browser/base/content/test/tabs/browser_new_file_whitelisted_http_tab.js
- browser/components/migration/ChromeMigrationUtils.sys.mjs