Bug 1417869. P1 - Backed out changeset bf0e4dd83b3b of
bug 1412505.
MozReview-Commit-ID: KdxxwIsHZJS
--- a/toolkit/components/thumbnails/BackgroundPageThumbs.jsm
+++ b/toolkit/components/thumbnails/BackgroundPageThumbs.jsm
@@ -63,17 +63,17 @@ const BackgroundPageThumbs = {
* the queue and started. Defaults to 30000 (30 seconds).
* @opt isImage If true, backgroundPageThumbsContent will attempt to render
* the url directly to canvas. Note that images will mostly get
* detected and rendered as such anyway, but this will ensure it.
* @opt targetWidth The target width when capturing an image.
* @opt backgroundColor The background colour when capturing an image.
*/
capture(url, options = {}) {
- if (!PageThumbs._prefEnabled() || this.isBlacklistedUrl(url)) {
+ if (!PageThumbs._prefEnabled()) {
if (options.onDone)
schedule(() => options.onDone(url));
return;
}
this._captureQueue = this._captureQueue || [];
this._capturesByURL = this._capturesByURL || new Map();
tel("QUEUE_SIZE_ON_CAPTURE", this._captureQueue.length);
@@ -89,47 +89,30 @@ const BackgroundPageThumbs = {
}
let cap = new Capture(url, this._onCaptureOrTimeout.bind(this), options);
this._captureQueue.push(cap);
this._capturesByURL.set(url, cap);
this._processCaptureQueue();
},
/**
- * Determine if a url should not allow background captures.
- *
- * @param {string} url The URL to check.
- *
- * @return {bool} True or false.
- */
- isBlacklistedUrl(url) {
- try {
- const domain = Services.eTLD.getBaseDomain(Services.io.newURI(url));
- // Don't allow *.twitch.tv as its javascript causes high CPU when media
- // (<video>s) fail to load. See bug 1412505.
- return domain === "twitch.tv";
- } catch (ex) {}
- return false;
- },
-
- /**
* Asynchronously captures a thumbnail of the given URL if one does not
* already exist. Otherwise does nothing.
*
* @param url The URL to capture.
* @param options An optional object that configures the capture. See
* capture() for description.
* unloadingPromise This option is resolved when the calling context is
* unloading, so things can be cleaned up to avoid leak.
* @return {Promise} A Promise that resolves when this task completes
*/
async captureIfMissing(url, options = {}) {
// Short circuit this function if pref is enabled, or else we leak observers.
// See Bug 1400562
- if (!PageThumbs._prefEnabled() || this.isBlacklistedUrl(url)) {
+ if (!PageThumbs._prefEnabled()) {
if (options.onDone)
options.onDone(url);
return url;
}
// The fileExistsForURL call is an optimization, potentially but unlikely
// incorrect, and no big deal when it is. After the capture is done, we
// atomically test whether the file exists before writing it.
let exists = await PageThumbsStorage.fileExistsForURL(url);
--- a/toolkit/components/thumbnails/test/browser.ini
+++ b/toolkit/components/thumbnails/test/browser.ini
@@ -13,17 +13,16 @@ support-files =
thumbnails_update.sjs
[browser_thumbnails_bg_bad_url.js]
[browser_thumbnails_bg_crash_during_capture.js]
skip-if = !crashreporter
[browser_thumbnails_bg_crash_while_idle.js]
skip-if = !crashreporter
[browser_thumbnails_bg_basic.js]
-[browser_thumbnails_bg_blacklist.js]
[browser_thumbnails_bg_queueing.js]
[browser_thumbnails_bg_timeout.js]
[browser_thumbnails_bg_redirect.js]
[browser_thumbnails_bg_destroy_browser.js]
[browser_thumbnails_bg_no_cookies_sent.js]
[browser_thumbnails_bg_no_cookies_stored.js]
[browser_thumbnails_bg_no_auth_prompt.js]
[browser_thumbnails_bg_no_alert.js]
deleted file mode 100644
--- a/toolkit/components/thumbnails/test/browser_thumbnails_bg_blacklist.js
+++ /dev/null
@@ -1,19 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-function checkBlacklist(url, expect, desc) {
- is(BackgroundPageThumbs.isBlacklistedUrl(url), expect, `${url} blacklisted? ${desc}`);
-}
-
-function runTests() {
- checkBlacklist("invalid", false, "invalid url");
- checkBlacklist("https://tv", false, "no host");
- checkBlacklist("http://example.com", false, "not blacklisted");
-
- checkBlacklist("https://www.twitch.tv", true, "yes blacklisted");
- checkBlacklist("https://twitch.tv", true, "without subdomain");
- checkBlacklist("https://go.twitch.tv", true, "with other subdomain");
- checkBlacklist("https://foo.bar.go.twitch.tv", true, "with more subdomains");
- checkBlacklist("http://go.twitch.tv", true, "with http protocol");
- checkBlacklist("https://go.twitch.tv/somepage", true, "with path");
-}