From eb96ba6d27122571e563251de5a99bab5793e3ed Mon Sep 17 00:00:00 2001 From: Sebastian Hengst Date: Fri, 25 Aug 2017 16:43:33 +0200 Subject: [PATCH] Backed out changeset a7b0c6ddd812 (bug 863246) --- .../static/browser_all_files_referenced.js | 6 +- .../test/static/browser_parsable_css.js | 60 ++++++++----------- caps/tests/mochitest/test_bug292789.html | 7 +-- .../platform/content/test/test_clipboard.html | 25 ++------ .../mixedcontentblocker/test_bug803225.html | 7 +-- 5 files changed, 36 insertions(+), 69 deletions(-) diff --git a/browser/base/content/test/static/browser_all_files_referenced.js b/browser/base/content/test/static/browser_all_files_referenced.js index 03afb19e96dfb..759ade89e0146 100644 --- a/browser/base/content/test/static/browser_all_files_referenced.js +++ b/browser/base/content/test/static/browser_all_files_referenced.js @@ -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 => @@ -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); } } @@ -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 = []; diff --git a/browser/base/content/test/static/browser_parsable_css.js b/browser/base/content/test/static/browser_parsable_css.js index 20b12a9820c9d..20d69bd9b1d16 100644 --- a/browser/base/content/test/static/browser_parsable_css.js +++ b/browser/base/content/test/static/browser_parsable_css.js @@ -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, @@ -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. diff --git a/caps/tests/mochitest/test_bug292789.html b/caps/tests/mochitest/test_bug292789.html index 000cf6c12b8f6..6b30e207771ca 100644 --- a/caps/tests/mochitest/test_bug292789.html +++ b/caps/tests/mochitest/test_bug292789.html @@ -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); diff --git a/devtools/shared/platform/content/test/test_clipboard.html b/devtools/shared/platform/content/test/test_clipboard.html index 832e9fc0c3c11..75d1c9eee4b76 100644 --- a/devtools/shared/platform/content/test/test_clipboard.html +++ b/devtools/shared/platform/content/test/test_clipboard.html @@ -15,8 +15,12 @@ "use strict"; var exports = {} + + + - +