mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1220907 - Add suffix to chrome css uri in browser_parsable_css test so that the file is always reparsed. r=Gijs
This commit is contained in:
parent
629a438afe
commit
a02bc10fa2
@ -11,27 +11,32 @@
|
||||
* failure. */
|
||||
const kWhitelist = [
|
||||
// CodeMirror is imported as-is, see bug 1004423.
|
||||
{sourceName: /codemirror\.css/i},
|
||||
{sourceName: /codemirror\.css$/i},
|
||||
// PDFjs is futureproofing its pseudoselectors, and those rules are dropped.
|
||||
{sourceName: /web\/viewer\.css/i,
|
||||
{sourceName: /web\/viewer\.css$/i,
|
||||
errorMessage: /Unknown pseudo-class.*(fullscreen|selection)/i},
|
||||
// Tracked in bug 1004428.
|
||||
{sourceName: /aboutaccounts\/(main|normalize)\.css/i},
|
||||
{sourceName: /aboutaccounts\/(main|normalize)\.css$/i},
|
||||
// TokBox SDK assets, see bug 1032469.
|
||||
{sourceName: /loop\/.*sdk-content\/.*\.css$/i},
|
||||
// Loop standalone client CSS uses placeholder cross browser pseudo-element
|
||||
{sourceName: /loop\/.*\.css/i,
|
||||
{sourceName: /loop\/.*\.css$/i,
|
||||
errorMessage: /Unknown pseudo-class.*placeholder/i},
|
||||
{sourceName: /loop\/.*shared\/css\/common.css/i,
|
||||
{sourceName: /loop\/.*shared\/css\/common.css$/i,
|
||||
errorMessage: /Unknown property 'user-select'/i},
|
||||
// Highlighter CSS uses chrome-only pseudo-class, see bug 985597.
|
||||
{sourceName: /highlighters\.css/i,
|
||||
// Highlighter CSS uses a UA-only pseudo-class, see bug 985597.
|
||||
{sourceName: /highlighters\.css$/i,
|
||||
errorMessage: /Unknown pseudo-class.*moz-native-anonymous/i},
|
||||
];
|
||||
|
||||
var moduleLocation = gTestPath.replace(/\/[^\/]*$/i, "/parsingTestHelpers.jsm");
|
||||
var {generateURIsFromDirTree} = Cu.import(moduleLocation, {});
|
||||
|
||||
// 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();
|
||||
|
||||
/**
|
||||
* Check if an error should be ignored due to matching one of the whitelist
|
||||
* objects defined in kWhitelist
|
||||
@ -135,17 +140,19 @@ function convertToChromeUri(fileUri) {
|
||||
}
|
||||
}
|
||||
|
||||
function messageIsCSSError(msg, innerWindowID, outerWindowID) {
|
||||
function messageIsCSSError(msg) {
|
||||
// Only care about CSS errors generated by our iframe:
|
||||
if ((msg instanceof Ci.nsIScriptError) &&
|
||||
msg.category.includes("CSS") &&
|
||||
msg.innerWindowID === innerWindowID && msg.outerWindowID === outerWindowID) {
|
||||
msg.sourceName.endsWith(kPathSuffix)) {
|
||||
let sourceName = msg.sourceName.slice(0, -kPathSuffix.length);
|
||||
let msgInfo = { sourceName, errorMessage: msg.errorMessage };
|
||||
// Check if this error is whitelisted in kWhitelist
|
||||
if (!ignoredError(msg)) {
|
||||
ok(false, "Got error message for " + msg.sourceName + ": " + msg.errorMessage);
|
||||
if (!ignoredError(msgInfo)) {
|
||||
ok(false, `Got error message for ${sourceName}: ${msg.errorMessage}`);
|
||||
return true;
|
||||
}
|
||||
info("Ignored error for " + msg.sourceName + " because of filter.");
|
||||
info(`Ignored error for ${sourceName} because of filter.`);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@ -167,10 +174,6 @@ add_task(function checkAllTheCSS() {
|
||||
iframe.contentWindow.location = testFile;
|
||||
yield iframeLoaded;
|
||||
let doc = iframe.contentWindow.document;
|
||||
let windowUtils = iframe.contentWindow.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIDOMWindowUtils);
|
||||
let innerWindowID = windowUtils.currentInnerWindowID;
|
||||
let outerWindowID = windowUtils.outerWindowID;
|
||||
|
||||
// Parse and remove all manifests from the list.
|
||||
// NOTE that this must be done before filtering out devtools paths
|
||||
@ -214,7 +217,7 @@ add_task(function checkAllTheCSS() {
|
||||
linkEl.addEventListener("error", onError);
|
||||
linkEl.setAttribute("type", "text/css");
|
||||
let chromeUri = convertToChromeUri(uri);
|
||||
linkEl.setAttribute("href", chromeUri.spec);
|
||||
linkEl.setAttribute("href", chromeUri.spec + kPathSuffix);
|
||||
allPromises.push(promiseForThisSpec.promise);
|
||||
doc.head.appendChild(linkEl);
|
||||
}
|
||||
@ -225,7 +228,7 @@ add_task(function checkAllTheCSS() {
|
||||
let messages = Services.console.getMessageArray();
|
||||
// Count errors (the test output will list actual issues for us, as well
|
||||
// as the ok(false) in messageIsCSSError.
|
||||
let errors = messages.filter(m => messageIsCSSError(m, innerWindowID, outerWindowID));
|
||||
let errors = messages.filter(messageIsCSSError);
|
||||
is(errors.length, 0, "All the styles (" + allPromises.length + ") loaded without errors.");
|
||||
|
||||
// Clean up to avoid leaks:
|
||||
|
Loading…
Reference in New Issue
Block a user