Skip to content

Commit

Permalink
Backed out changeset a7b0c6ddd812 (bug 863246)
Browse files Browse the repository at this point in the history
  • Loading branch information
Archaeopteryx committed Aug 25, 2017
1 parent 9ad417f commit eb96ba6
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 69 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ var whitelist = [
{file: "resource://gre/modules/accessibility/AccessFu.jsm"},
// Bug 1351637
{file: "resource://gre/modules/sdk/bootstrap.js"},

];

whitelist = new Set(whitelist.filter(item =>
Expand Down Expand Up @@ -474,8 +475,7 @@ function findChromeUrlsFromArray(array, prefix) {

// 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) ||
string.startsWith("resource://content-accessible/"))
/resource:\/\/gre.*\.[a-z]+/.test(string))
gReferencesFromCode.add(string);
}
}
Expand Down Expand Up @@ -537,8 +537,6 @@ add_task(async function checkAllTheFiles() {
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 = [];
Expand Down
60 changes: 26 additions & 34 deletions browser/base/content/test/static/browser_parsable_css.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ let whitelist = [
{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,
Expand Down Expand Up @@ -288,49 +288,41 @@ add_task(async function checkAllTheCSS() {
// 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)));

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");
for (let uri of uris) {
let linkEl = doc.createElement("link");
linkEl.setAttribute("rel", "stylesheet");
linkEl.setAttribute("type", "text/css");
linkEl.addEventListener("load", onLoad);
linkEl.addEventListener("error", onError);
linkEl.setAttribute("href", chromeUri + kPathSuffix);
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);
}));
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.
Expand Down
7 changes: 1 addition & 6 deletions caps/tests/mochitest/test_bug292789.html
Original file line number Diff line number Diff line change
Expand Up @@ -100,12 +100,7 @@
}

// Start off the script src test, and have it start the img tests when complete.
// Temporarily allow content to access all resource:// URIs.
SpecialPowers.pushPrefEnv({
set: [
["security.all_resource_uri_content_accessible", true]
]
}, () => testScriptSrc(runImgTest));
testScriptSrc(runImgTest);
</script>
</pre>
</body>
Expand Down
25 changes: 5 additions & 20 deletions devtools/shared/platform/content/test/test_clipboard.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,12 @@
"use strict";
var exports = {}
</script>

<script type="application/javascript"
src="resource://devtools/shared/platform/content/clipboard.js"></script>

</head>
<body onload="pre_do_tests()">
<body onload="do_tests()">
<script type="application/javascript">
"use strict";

Expand All @@ -27,25 +31,6 @@
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);
Expand Down
7 changes: 2 additions & 5 deletions dom/security/test/mixedcontentblocker/test_bug803225.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,8 @@

//Cycle through 4 different preference settings.
function changePrefs(callback) {
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]]
];
let newPrefs = [["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");
Expand Down

0 comments on commit eb96ba6

Please sign in to comment.