Index: lib/polyfills/fetch.js
diff --git a/lib/polyfills/fetch.js b/lib/polyfills/fetch.js
deleted file mode 100644
index 0a835aff926bb272e02868ea4fbe162cf8217b80..0000000000000000000000000000000000000000
--- a/lib/polyfills/fetch.js
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * This file is part of Adblock Plus ,
- * Copyright (C) 2006-2016 Eyeo GmbH
- *
- * Adblock Plus is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 3 as
- * published by the Free Software Foundation.
- *
- * Adblock Plus is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Adblock Plus. If not, see .
- */
-
-(function(global)
-{
- "use strict";
-
- function Response(xhr)
- {
- this._xhr = xhr;
- }
- Response.prototype = {
- get ok()
- {
- return this._xhr.status >= 200 && this._xhr.status <= 299;
- },
- text: function()
- {
- return Promise.resolve(this._xhr.responseText);
- }
- };
-
- function fetch(url)
- {
- return new Promise(function(resolve, reject)
- {
- var xhr = new XMLHttpRequest();
-
- xhr.onload = function()
- {
- resolve(new Response(xhr));
- };
-
- xhr.onerror = xhr.onabort = function()
- {
- reject(new TypeError("Failed to fetch"));
- };
-
- xhr.overrideMimeType("text/plain");
- xhr.open("GET", url);
- xhr.send();
- });
- }
-
- // While the Fetch API is natively supported since Chrome 42, before
- // Chrome 47 it failed to fetch files from within the extension bundle.
- // https://code.google.com/p/chromium/issues/detail?id=466876
- var builtinFetch = global.fetch;
- if (builtinFetch)
- global.fetch = function(url, init)
- {
- return builtinFetch(url, init).catch(function(reason)
- {
- if (new URL(url, document.URL).protocol == "chrome-extension:")
- return fetch(url);
- throw reason;
- });
- };
- else
- global.fetch = fetch;
-})(this);
Index: chrome/ext/background.js
diff --git a/chrome/ext/background.js b/chrome/ext/background.js
index 49c0366bfcfe9de61f4b472c0131ea9f3ba614e8..4681ec08bb0fbf200b337c74cd8d33e09d754c26 100644
--- a/chrome/ext/background.js
+++ b/chrome/ext/background.js
@@ -202,38 +202,11 @@
this._changes = null;
};
BrowserAction.prototype = {
- _legacySetIcon: function(details)
- {
- var legacyDetails = {};
- for (var key in details)
- {
- var value = details[key];
- if (typeof value == "object")
- value = {19: value[19], 38: value[38]};
- legacyDetails[key] = value;
- }
- chrome.browserAction.setIcon(legacyDetails);
- },
- _safeSetIcon: function(details)
- {
- try
- {
- chrome.browserAction.setIcon(details);
- }
- catch (e)
- {
- // Older versions of Chrome do not allow any sizes other than 19 and 38
- // to be present, but newer versions of Chrome (and Edge) prefer
- // different sizes.
- this._safeSetIcon = this._legacySetIcon;
- this._legacySetIcon(details);
- }
- },
_applyChanges: function()
{
if ("iconPath" in this._changes)
{
- this._safeSetIcon({
+ chrome.browserAction.setIcon({
tabId: this._tabId,
path: {
16: this._changes.iconPath.replace("$size", "16"),
@@ -438,33 +411,6 @@
var onBeforeNavigate = chrome.webNavigation.onBeforeNavigate;
if (!onBeforeNavigate.hasListener(propagateHandlerBehaviorChange))
onBeforeNavigate.addListener(propagateHandlerBehaviorChange);
- },
- getIndistinguishableTypes: function()
- {
- // Chrome 38-48 mistakenly reports requests of type `object`
- // (e.g. requests initiated by Flash) with the type `other`.
- // https://code.google.com/p/chromium/issues/detail?id=410382
- var match = navigator.userAgent.match(/\bChrome\/(\d+)/);
- if (match)
- {
- var version = parseInt(match[1], 10);
- if (version >= 38 && version <= 48)
- return [["OTHER", "OBJECT", "OBJECT_SUBREQUEST"]];
- }
-
- // Chrome <44 doesn't have ResourceType.
- var ResourceType = chrome.webRequest.ResourceType || {};
-
- // Before Chrome 49, requests of the type `font` and `ping`
- // have been reported with the type `other`.
- // https://code.google.com/p/chromium/issues/detail?id=410382
- var otherTypes = ["OTHER", "MEDIA"];
- if (!("FONT" in ResourceType))
- otherTypes.push("FONT");
- if (!("PING" in ResourceType))
- otherTypes.push("PING");
-
- return [["OBJECT", "OBJECT_SUBREQUEST"], otherTypes];
}
};
@@ -554,22 +500,9 @@
if (!frames)
return null;
- if ("frameId" in rawSender)
- {
- // Chrome 41+
- var frame = frames[rawSender.frameId];
- if (frame)
- return frame.parent;
- }
- else
- {
- // Chrome 28-40
- for (var frameId in frames)
- {
- if (frames[frameId].url.href == this.url.href)
- return frames[frameId].parent;
- }
- }
+ var frame = frames[rawSender.frameId];
+ if (frame)
+ return frame.parent;
return frames[0];
}
Index: include.preload.js
diff --git a/include.preload.js b/include.preload.js
index 93acaeacd78ee37fc74a9686c25bf6dcd66103e9..2828275a319ac7dbfac4ffcf71f43c1a75e58952 100644
--- a/include.preload.js
+++ b/include.preload.js
@@ -15,8 +15,6 @@
* along with Adblock Plus. If not, see .
*/
-var MutationObserver = window.MutationObserver || window.WebKitMutationObserver;
-
var typeMap = {
"img": "IMAGE",
"input": "IMAGE",
@@ -164,13 +162,12 @@ function checkCollapse(element)
{
collapseElement();
- if (MutationObserver)
- new MutationObserver(collapseElement).observe(
- element, {
- attributes: true,
- attributeFilter: ["style"]
- }
- );
+ new MutationObserver(collapseElement).observe(
+ element, {
+ attributes: true,
+ attributeFilter: ["style"]
+ }
+ );
}
}
);
Index: lib/csp.js
diff --git a/lib/csp.js b/lib/csp.js
index 937792e99861062ac326b7f38b5adeb71c6fc5ec..5309863ab1bb65b9f8a5318d44ef723d0a6d49e9 100644
--- a/lib/csp.js
+++ b/lib/csp.js
@@ -34,15 +34,13 @@ chrome.webRequest.onHeadersReceived.addListener(function(details)
// since the Chrome extension API does not allow us to intercept them.
// https://bugs.chromium.org/p/chromium/issues/detail?id=129353
//
- // We also need the frame-src and child-src restrictions since CSPs are
+ // We also need the child-src and object-src restrictions since CSPs are
// not inherited from the parent for documents with data: and blob: URLs.
// https://bugs.chromium.org/p/chromium/issues/detail?id=513860
//
- // As of Chrome 49 "http:" also includes "https:" implictly. We specify
- // both here for compatibility with earlier versions of Chrome.
+ // "http:" also includes "https:" implictly.
// https://www.chromestatus.com/feature/6653486812889088
- value: "connect-src http: https:; frame-src http: https:; " +
- "child-src http: https:; object-src http: https:"
+ value: "connect-src http:; child-src http:; object-src http:"
});
return {responseHeaders: details.responseHeaders};
}
Index: lib/icon.js
diff --git a/lib/icon.js b/lib/icon.js
index 621f374eeb9f9c247c8e8d45699ad4632e7319db..a2e56a174a24d4c36fec0a658c108990bc92e8bb 100644
--- a/lib/icon.js
+++ b/lib/icon.js
@@ -64,7 +64,7 @@ function setIcon(page, notificationType, opacity, frames)
}
else
{
- page.browserAction._safeSetIcon({
+ chrome.browserAction.setIcon({
tabId: page.id,
imageData: frames["" + opacity + whitelisted]
});
Index: lib/requestBlocker.js
diff --git a/lib/requestBlocker.js b/lib/requestBlocker.js
index 0b3291a332dd1e949285dc8a532df0d09ea96302..91df223d5a1b82d6684d5d20f8a8c44ee7c4ed87 100644
--- a/lib/requestBlocker.js
+++ b/lib/requestBlocker.js
@@ -29,11 +29,8 @@ let {stringifyURL, extractHostFromFrame, isThirdParty} = require("url");
let {port} = require("messaging");
let devtools = require("devtools");
-ext.webRequest.getIndistinguishableTypes().forEach(types =>
-{
- for (let i = 1; i < types.length; i++)
- RegExpFilter.typeMap[types[i]] = RegExpFilter.typeMap[types[0]];
-});
+// Chrome can't distinguish between OBJECT_SUBREQUEST and OBJECT requests.
+RegExpFilter.typeMap.OBJECT_SUBREQUEST = RegExpFilter.typeMap.OBJECT;
function onBeforeRequestAsync(page, url, type, docDomain,
thirdParty, sitekey,
Index: metadata.chrome
diff --git a/metadata.chrome b/metadata.chrome
index e81217f8c16b64dfb05e832b92b154649cb26c82..9c56ad8e337600634fc9f06a2af217e8e905736f 100644
--- a/metadata.chrome
+++ b/metadata.chrome
@@ -21,7 +21,7 @@ icons = icons/abp-16.png icons/abp-32.png icons/detailed/abp-48.png
managedStorageSchema = managed-storage-schema.json
[compat]
-chrome = 41.0
+chrome = 49.0
[mapping]
icons/abp-16.png = chrome/icons/abp-16.png
Index: metadata.common
diff --git a/metadata.common b/metadata.common
index b9955577e85bcedcb718d877a28801a4fd443000..e47ea89afb985ea530207012c087df203c0f0598 100644
--- a/metadata.common
+++ b/metadata.common
@@ -1,7 +1,6 @@
[general]
version = 1.12.4
-backgroundScripts = lib/polyfills/fetch.js
- ext/common.js
+backgroundScripts = ext/common.js
ext/background.js
lib/compat.js
lib/info.js
Index: options.html
diff --git a/options.html b/options.html
index 59d287a468836da129fca202f0f688532da43689..06606509542d6bb3c4b2fb1b959be0f952665f5c 100644
--- a/options.html
+++ b/options.html
@@ -23,7 +23,6 @@
-
Index: options.js
diff --git a/options.js b/options.js
index c0ed6f788ac502175c8a0cbcc37a688686cc8304..94357cbc88c8ed9ce4572b368a8aa6ad43a3d32e 100644
--- a/options.js
+++ b/options.js
@@ -56,12 +56,7 @@ function wrapper(baseMessage /* , [paramKeys] */)
message[paramKeys[i]] = arguments[i];
}
- // Chrome 30 throws an exception when sendMessage is called with a callback
- // parameter of undefined, so we work around that here. (See issue 4052)
- if (callback)
- ext.backgroundPage.sendMessage(message, callback);
- else
- ext.backgroundPage.sendMessage(message);
+ ext.backgroundPage.sendMessage(message, callback);
};
}
Index: subscriptionLink.postload.js
diff --git a/subscriptionLink.postload.js b/subscriptionLink.postload.js
index bb37f6005996d09d87c7e1cb868a9ca871ab2fdf..09316efca0fc116de00a51c10456e8149316747e 100644
--- a/subscriptionLink.postload.js
+++ b/subscriptionLink.postload.js
@@ -17,11 +17,7 @@
"use strict";
-// In Chrome 37-40, the document_end content script (this one) runs properly,
-// while the document_start content scripts (that defines ext) might not. Check
-// whether variable ext exists before continuing to avoid
-// "Uncaught ReferenceError: ext is not defined". See https://crbug.com/416907
-if ("ext" in window && document instanceof HTMLDocument)
+if (document instanceof HTMLDocument)
{
document.addEventListener("click", function(event)
{
@@ -43,23 +39,12 @@ if ("ext" in window && document instanceof HTMLDocument)
return;
}
- let queryString = null;
if (link.protocol == "http:" || link.protocol == "https:")
{
- if (link.host == "subscribe.adblockplus.org" && link.pathname == "/")
- queryString = link.search.substr(1);
- }
- else
- {
- // Old versions of Chrome (30) don't populate the "search" property for
- // links with non-standard URL schemes so we need to extract the query
- // string manually.
- let match = /^abp:\/*subscribe\/*\?(.*)/i.exec(link.href);
- if (match)
- queryString = match[1];
+ if (link.host != "subscribe.adblockplus.org" || link.pathname != "/")
+ return;
}
-
- if (!queryString)
+ else if (!/^abp:\/*subscribe\/*\?/i.test(link.href))
return;
// This is our link - make sure the browser doesn't handle it
@@ -67,7 +52,7 @@ if ("ext" in window && document instanceof HTMLDocument)
event.stopPropagation();
// Decode URL parameters
- var params = queryString.split("&");
+ var params = link.search.substr(1).split("&");
var title = null;
var url = null;
for (var i = 0; i < params.length; i++)