Bug 863246 - Fix test failures r=Gijs
MozReview-Commit-ID: 8tUr27zvs8z
--- a/browser/base/content/test/static/browser_all_files_referenced.js
+++ b/browser/base/content/test/static/browser_all_files_referenced.js
@@ -171,17 +171,16 @@ var whitelist = [
// Bug 1351079
{file: "resource://gre/modules/ISO8601DateUtils.jsm"},
// Bug 1337345
{file: "resource://gre/modules/Manifest.jsm"},
// Bug 1351097
{file: "resource://gre/modules/accessibility/AccessFu.jsm"},
// Bug 1351637
{file: "resource://gre/modules/sdk/bootstrap.js"},
-
];
whitelist = new Set(whitelist.filter(item =>
("isFromDevTools" in item) == isDevtools &&
(!item.skipNightly || !AppConstants.NIGHTLY_BUILD) &&
(!item.platforms || item.platforms.includes(AppConstants.platform))
).map(item => item.file));
@@ -473,17 +472,18 @@ function findChromeUrlsFromArray(array,
array.indexOf("#".charCodeAt(0), index));
let string = "";
for ( ; index < end; ++index) {
string += String.fromCharCode(array[index]);
}
// Only keep strings that look like real chrome or resource urls.
if (/chrome:\/\/[a-zA-Z09 -]+\/(content|skin|locale)\//.test(string) ||
- /resource:\/\/gre.*\.[a-z]+/.test(string))
+ /resource:\/\/gre.*\.[a-z]+/.test(string) ||
+ string.startsWith("resource://content-accessible/"))
gReferencesFromCode.add(string);
}
}
add_task(async function checkAllTheFiles() {
let libxulPath = OS.Constants.Path.libxul;
if (AppConstants.platform != "macosx")
libxulPath = OS.Constants.Path.libDir + "/" + libxulPath;
@@ -535,16 +535,18 @@ add_task(async function checkAllTheFiles
// Wait for all the files to have actually loaded:
await Promise.all(allPromises);
// Keep only chrome:// files, and filter out either the devtools paths or
// the non-devtools paths:
let devtoolsPrefixes = ["chrome://webide/",
"chrome://devtools",
"resource://devtools/",
+ "resource://devtools-client-jsonview/",
+ "resource://devtools-client-shared/",
"resource://app/modules/devtools",
"resource://gre/modules/devtools"];
let chromeFiles = [];
for (let uri of uris) {
uri = convertToCodeURI(uri.spec);
if ((uri.startsWith("chrome://") || uri.startsWith("resource://")) &&
isDevtools == devtoolsPrefixes.some(prefix => uri.startsWith(prefix)))
chromeFiles.push(uri);
--- a/browser/base/content/test/static/browser_parsable_css.js
+++ b/browser/base/content/test/static/browser_parsable_css.js
@@ -12,17 +12,17 @@
let whitelist = [
// CodeMirror is imported as-is, see bug 1004423.
{sourceName: /codemirror\.css$/i,
isFromDevTools: true},
// The debugger uses cross-browser CSS.
{sourceName: /devtools\/client\/debugger\/new\/debugger.css/i,
isFromDevTools: true},
// Reps uses cross-browser CSS.
- {sourceName: /devtools\/client\/shared\/components\/reps\/reps.css/i,
+ {sourceName: /devtools-client-shared\/components\/reps\/reps.css/i,
isFromDevTools: true},
// PDFjs is futureproofing its pseudoselectors, and those rules are dropped.
{sourceName: /web\/viewer\.css$/i,
errorMessage: /Unknown pseudo-class.*(fullscreen|selection)/i,
isFromDevTools: false},
// PDFjs rules needed for compat with other UAs.
{sourceName: /web\/viewer\.css$/i,
errorMessage: /Unknown property.*appearance/i,
@@ -283,51 +283,59 @@ add_task(async function checkAllTheCSS()
manifestPromises.push(parseManifest(uri));
return false;
}
return true;
});
// Wait for all manifest to be parsed
await Promise.all(manifestPromises);
- // We build a list of promises that get resolved when their respective
- // files have loaded and produced no errors.
- let allPromises = [];
-
// filter out either the devtools paths or the non-devtools paths:
let isDevtools = SimpleTest.harnessParameters.subsuite == "devtools";
let devtoolsPathBits = ["webide", "devtools"];
uris = uris.filter(uri => isDevtools == devtoolsPathBits.some(path => uri.spec.includes(path)));
- for (let uri of uris) {
- let linkEl = doc.createElement("link");
+ let loadCSS = chromeUri => new Promise(resolve => {
+ let linkEl, onLoad, onError;
+ onLoad = e => {
+ processCSSRules(linkEl.sheet);
+ resolve();
+ linkEl.removeEventListener("load", onLoad);
+ linkEl.removeEventListener("error", onError);
+ };
+ onError = e => {
+ ok(false, "Loading " + linkEl.getAttribute("href") + " threw an error!");
+ resolve();
+ linkEl.removeEventListener("load", onLoad);
+ linkEl.removeEventListener("error", onError);
+ };
+ linkEl = doc.createElement("link");
linkEl.setAttribute("rel", "stylesheet");
- allPromises.push(new Promise(resolve => {
- let onLoad = (e) => {
- processCSSRules(linkEl.sheet);
- resolve();
- linkEl.removeEventListener("load", onLoad);
- linkEl.removeEventListener("error", onError);
- };
- let onError = (e) => {
- ok(false, "Loading " + linkEl.getAttribute("href") + " threw an error!");
- resolve();
- linkEl.removeEventListener("load", onLoad);
- linkEl.removeEventListener("error", onError);
- };
- linkEl.addEventListener("load", onLoad);
- linkEl.addEventListener("error", onError);
- linkEl.setAttribute("type", "text/css");
- let chromeUri = convertToCodeURI(uri.spec);
- linkEl.setAttribute("href", chromeUri + kPathSuffix);
- }));
+ linkEl.setAttribute("type", "text/css");
+ linkEl.addEventListener("load", onLoad);
+ linkEl.addEventListener("error", onError);
+ linkEl.setAttribute("href", chromeUri + kPathSuffix);
doc.head.appendChild(linkEl);
+ });
+
+ // We build a list of promises that get resolved when their respective
+ // files have loaded and produced no errors.
+ const kInContentCommonCSS = "chrome://global/skin/in-content/common.css";
+ let allPromises = uris.map((uri) => convertToCodeURI(uri.spec))
+ .filter((uri) => uri !== kInContentCommonCSS);
+
+ // Make sure chrome://global/skin/in-content/common.css is loaded before other
+ // stylesheets in order to guarantee the --in-content variables can be
+ // correctly referenced.
+ if (allPromises.length !== uris.length) {
+ await loadCSS(kInContentCommonCSS);
}
// Wait for all the files to have actually loaded:
+ allPromises = allPromises.map(loadCSS);
await Promise.all(allPromises);
// Check if all the files referenced from CSS actually exist.
for (let [image, references] of imageURIsToReferencesMap) {
if (!chromeFileExists(image)) {
for (let ref of references) {
let ignored = false;
for (let item of allowedImageReferences) {
--- a/caps/tests/mochitest/test_bug292789.html
+++ b/caps/tests/mochitest/test_bug292789.html
@@ -95,13 +95,18 @@ function loadImage(uri, expect, callback
img.onload = success;
img.expected = expect;
img.callback = callback;
img.src = uri;
// document.getElementById("content").appendChild(img);
}
// Start off the script src test, and have it start the img tests when complete.
-testScriptSrc(runImgTest);
+// Temporarily allow content to access all resource:// URIs.
+SpecialPowers.pushPrefEnv({
+ set: [
+ ["security.all_resource_uri_content_accessible", true]
+ ]
+}, () => testScriptSrc(runImgTest));
</script>
</pre>
</body>
</html>
--- a/devtools/shared/platform/content/test/test_clipboard.html
+++ b/devtools/shared/platform/content/test/test_clipboard.html
@@ -10,32 +10,47 @@ https://bugzilla.mozilla.org/show_bug.cg
<link rel="stylesheet" type="text/css"
href="chrome://mochikit/content/tests/SimpleTest/test.css">
<script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
<script type="application/javascript">
"use strict";
var exports = {}
</script>
-
- <script type="application/javascript"
- src="resource://devtools/shared/platform/content/clipboard.js"></script>
-
</head>
-<body onload="do_tests()">
+<body onload="pre_do_tests()">
<script type="application/javascript">
"use strict";
const RESULT = "lark bunting";
function doCopy(e) {
console.log(e.isTrusted);
copyString(RESULT);
}
+async function pre_do_tests() {
+ // Temporarily allow content to access all resource:// URIs.
+ await SpecialPowers.pushPrefEnv({
+ set: [
+ ["security.all_resource_uri_content_accessible", true]
+ ]
+ });
+
+ // Load script.
+ await (() => new Promise((resolve) => {
+ var script = document.createElement("script");
+ script.onload = resolve;
+ script.src = "resource://devtools/shared/platform/content/clipboard.js";
+ document.head.appendChild(script);
+ }))();
+
+ do_tests();
+}
+
function do_tests() {
let elt = document.querySelector("#key");
elt.addEventListener("keydown", doCopy);
// Set the clipboard to something other than what we expect.
SpecialPowers.clipboardCopyString("snowy owl");
elt.focus();
--- a/dom/security/test/mixedcontentblocker/test_bug803225.html
+++ b/dom/security/test/mixedcontentblocker/test_bug803225.html
@@ -14,18 +14,21 @@ https://bugzilla.mozilla.org/show_bug.cg
var counter = 0;
var settings = [ [true, true], [true, false], [false, true], [false, false] ];
var blockActive;
var blockDisplay;
//Cycle through 4 different preference settings.
function changePrefs(callback) {
- let newPrefs = [["security.mixed_content.block_display_content", settings[counter][0]],
- ["security.mixed_content.block_active_content", settings[counter][1]]];
+ let newPrefs = [
+ ["security.all_resource_uri_content_accessible", true], // Temporarily allow content to access all resource:// URIs.
+ ["security.mixed_content.block_display_content", settings[counter][0]],
+ ["security.mixed_content.block_active_content", settings[counter][1]]
+ ];
SpecialPowers.pushPrefEnv({"set": newPrefs}, function () {
blockDisplay = SpecialPowers.getBoolPref("security.mixed_content.block_display_content");
blockActive = SpecialPowers.getBoolPref("security.mixed_content.block_active_content");
counter++;
callback();
});
}
--- a/parser/htmlparser/tests/reftest/bug482921-1-ref.html
+++ b/parser/htmlparser/tests/reftest/bug482921-1-ref.html
@@ -1,9 +1,9 @@
-<!DOCTYPE html><html><head><title></title><link rel="stylesheet" type="text/css" href="resource://gre-resources/viewsource.css"></head><body id="viewsource" class="wrap highlight"><pre id><span class="doctype"><!DOCTYPE html></span>
+<!DOCTYPE html><html><head><title></title><link rel="stylesheet" type="text/css" href="resource://content-accessible/viewsource.css"></head><body id="viewsource" class="wrap highlight"><pre id><span class="doctype"><!DOCTYPE html></span>
<span id></span><span><<span class="start-tag">html</span>></span>
<span id></span><span><<span class="start-tag">head</span>></span>
<span id></span><span><<span class="start-tag">title</span>></span><span>Title</span><span></<span class="end-tag">title</span>></span>
<span id></span><span><<span class="start-tag">script</span>></span>
<span id></span>var lt = "<";
<span id></span><!--
<span id></span>var s = "<script>foo</script>";
<span id></span>-->
--- a/parser/htmlparser/tests/reftest/bug482921-2-ref.html
+++ b/parser/htmlparser/tests/reftest/bug482921-2-ref.html
@@ -1,9 +1,9 @@
-<!DOCTYPE html><html><head><title></title><link rel="stylesheet" type="text/css" href="resource://gre-resources/viewsource.css"></head><body id="viewsource" class="wrap highlight"><pre id><span class="pi"><?xml version="1.0" encoding="utf-8"?></span>
+<!DOCTYPE html><html><head><title></title><link rel="stylesheet" type="text/css" href="resource://content-accessible/viewsource.css"></head><body id="viewsource" class="wrap highlight"><pre id><span class="pi"><?xml version="1.0" encoding="utf-8"?></span>
<span id></span><span class="pi"><?foo bar?></span>
<span id></span><span><<span class="start-tag">html</span>></span>
<span id></span><span><<span class="start-tag">head</span>></span>
<span id></span><span><<span class="start-tag">title</span>></span><span>Title</span><span></<span class="end-tag">title</span>></span>
<span id></span><span><<span class="start-tag">script</span>></span>
<span id></span>var s = "<span><<span class="start-tag">script</span>></span><span>foo</span><span></<span class="end-tag">script</span>></span>";
<span id></span><span class="comment"><!--
<span id></span>var s = "<script>foo</script>";
--- a/parser/htmlparser/tests/reftest/bug535530-2-ref.html
+++ b/parser/htmlparser/tests/reftest/bug535530-2-ref.html
@@ -1,9 +1,9 @@
-<!DOCTYPE html><html><head><title></title><link rel="stylesheet" type="text/css" href="resource://gre-resources/viewsource.css"></head><body id="viewsource" class="wrap highlight"><pre id><span class="doctype"><!DOCTYPE html></span>
+<!DOCTYPE html><html><head><title></title><link rel="stylesheet" type="text/css" href="resource://content-accessible/viewsource.css"></head><body id="viewsource" class="wrap highlight"><pre id><span class="doctype"><!DOCTYPE html></span>
<span id></span>XX<span class="error">&</span>XX
<span id></span>XX<span class="error">&</span>nXX
<span id></span>XX<span class="error">&</span>noXX
<span id></span>XX<span class="error entity">&not</span>XX
<span id></span>XX<span class="error entity">&noti</span>XX
<span id></span>XX<span class="error entity">&notin</span>XX
<span id></span>XX<span class="error">&</span>;XX
<span id></span>XX<span class="error">&</span>n;XX
--- a/parser/htmlparser/tests/reftest/bug704667-1-ref.html
+++ b/parser/htmlparser/tests/reftest/bug704667-1-ref.html
@@ -1,4 +1,4 @@
-<!DOCTYPE html><html><head><title></title><link rel="stylesheet" type="text/css" href="resource://gre-resources/viewsource.css"></head><body id="viewsource" class="wrap highlight"><pre id><span class="error comment"><!--></span> <span class="error comment"><!X></span>
+<!DOCTYPE html><html><head><title></title><link rel="stylesheet" type="text/css" href="resource://content-accessible/viewsource.css"></head><body id="viewsource" class="wrap highlight"><pre id><span class="error comment"><!--></span> <span class="error comment"><!X></span>
<span id></span>
</pre>
<!-- View source CSS matches the <pre id> and <span id> elements and produces line numbers. -->
--- a/parser/htmlparser/tests/reftest/bug731234-1-ref.html
+++ b/parser/htmlparser/tests/reftest/bug731234-1-ref.html
@@ -1,9 +1,9 @@
-<!DOCTYPE html><html><head><title></title><link rel="stylesheet" type="text/css" href="resource://gre-resources/viewsource.css"></head><body id="viewsource" class="wrap highlight"><pre id><span class="doctype"><!DOCTYPE html></span><span>
+<!DOCTYPE html><html><head><title></title><link rel="stylesheet" type="text/css" href="resource://content-accessible/viewsource.css"></head><body id="viewsource" class="wrap highlight"><pre id><span class="doctype"><!DOCTYPE html></span><span>
<span id></span></span><span><<span class="start-tag">body</span>></span><span>
<span id></span></span><span><<span class="start-tag">script</span>></span><span></span><span></<span class="end-tag">script</span>></span><span>X
<span id></span></span><span><<span class="start-tag">script</span>></span><span></span><span></<span class="end-tag">script</span> ></span><span>X
<span id></span></span><span><<span class="start-tag">script</span>></span><span></span><span></<span class="end-tag">script</span>
<span id></span>></span><span>X
<span id></span></span><span><<span class="start-tag">script</span>></span><span></span><span title="End tag had attributes." class="error"></<span class="end-tag">script</span> <span class="attribute-name">foo</span>></span><span>X
<span id></span></span><span><<span class="start-tag">script</span>></span><span></span><span title="End tag had attributes." class="error"></<span class="end-tag">script</span> <span class="attribute-name">foo</span>=<a class="attribute-value">bar</a>></span><span>X
<span id></span></span><span><<span class="start-tag">script</span>></span><span></span><span title="End tag had attributes." class="error"></<span class="end-tag">script</span> <span class="attribute-name">foo</span>="<a class="attribute-value">bar</a>"></span><span>X
--- a/parser/htmlparser/tests/reftest/bug910588-1-ref.html
+++ b/parser/htmlparser/tests/reftest/bug910588-1-ref.html
@@ -1,2 +1,2 @@
-<!DOCTYPE html><html><head><title></title><link rel="stylesheet" type="text/css" href="resource://gre-resources/viewsource.css"></head><body id="viewsource" class="highlight" style="-moz-tab-size: 4"><pre id="line1"><span></span><span class="doctype"><!DOCTYPE html></span><span></span><span><<span class="start-tag">table</span>></span><span></span><span title="Start tag “input” seen in “table”." class="error"><<span class="start-tag">input</span> <span class="attribute-name">type</span>=<a class="attribute-value">hidden</a>></span><span></span><span></<span class="end-tag">table</span>></span><span>
+<!DOCTYPE html><html><head><title></title><link rel="stylesheet" type="text/css" href="resource://content-accessible/viewsource.css"></head><body id="viewsource" class="highlight" style="-moz-tab-size: 4"><pre id="line1"><span></span><span class="doctype"><!DOCTYPE html></span><span></span><span><<span class="start-tag">table</span>></span><span></span><span title="Start tag “input” seen in “table”." class="error"><<span class="start-tag">input</span> <span class="attribute-name">type</span>=<a class="attribute-value">hidden</a>></span><span></span><span></<span class="end-tag">table</span>></span><span>
<span id="line2"></span></span></pre></body></html>