Commit 6ea643d3 authored by Dave Barker's avatar Dave Barker 🐈

Noissue - Merge branch 'next' into 'master'

parents 9bd72100 138bc568
Pipeline #80191052 failed with stages
in 10 minutes
......@@ -2,7 +2,7 @@ Hi,
You tried to submit a pull request for adblockpluschrome.
While we love GitHub, the project is hosted on GitLab, therefor we do
While we love GitHub, the project is hosted on GitLab, therefore we do
not monitor pull request submitted on GitHub.
Please visit: https://gitlab.com/eyeo/adblockplus/adblockpluschrome
......
......@@ -41,13 +41,15 @@ stages:
if [[ "$CI_RUNNER_DESCRIPTION" == *gitlab.com ]]; then
apt-get update;
apt-get install -y apt-transport-https python-pip libgtk-3-0 libxt6 \
xvfb libnss3 libxss1 libgconf-2-4 libasound2;
curl -sL https://deb.nodesource.com/setup_8.x | bash -;
apt-get update -y;
apt-get install -y nodejs;
xvfb libnss3 libxss1 libgconf-2-4 libasound2 nodejs npm;
fi
- mkdir -p .git/info
- pip install --user Jinja2 cryptography
- pip install --user Jinja2 cryptography fonttools brotli
# This pipeline runs on a custom runner as an unpriviliged user.
# Therefore the pyftsubset executable of the fonttools dependency above is
# installed to `~/.local/bin` and needs to be added to the $PATH variable
# in order to be available.
- export PATH=$PATH:~/.local/bin
- "npm_config_unsafe_perm=true python ensure_dependencies.py"
- "[ -d node_modules ] || npm install"
......
......@@ -22,6 +22,8 @@ Building
- [Python 2.7](https://www.python.org)
- [The Jinja2 module](http://jinja.pocoo.org/docs) (>= 2.8)
- For signed builds: [PyCrypto module](https://www.dlitz.net/software/pycrypto/)
- For font generation using pyftsubset: [fonttools](https://github.com/fonttools/fonttools)
- Enabling fonttools to generate WOFF 2.0 fonts: [brotli](https://github.com/google/brotli)
- [Node.js](https://nodejs.org/) (>= 8.9)
### Building on Windows
......
_root = hg:https://hg.adblockplus.org/ git:https://github.com/adblockplus/
_self = buildtools/ensure_dependencies.py
buildtools = buildtools hg:0ebf8cd23b36 git:04d50e0
adblockpluscore = adblockpluscore hg:05984b2920bc git:33bdc49
adblockplusui = adblockplusui hg:167a3e7b5189 git:e4eb28e
adblockpluscore = adblockpluscore hg:43c5f74ef7ca git:d3f6b1b
adblockplusui = adblockplusui hg:42f63b4d9186 git:cb2f5cd
\ No newline at end of file
......@@ -81,7 +81,7 @@ function injected(eventName, injectedIntoContentWindow)
);
// Apparently in HTMLObjectElement.prototype.contentWindow does not exist
// in older versions of Chrome such as 42.
// in older versions of Chrome such as 51.
if (!contentWindowDesc)
continue;
......@@ -303,7 +303,7 @@ function injected(eventName, injectedIntoContentWindow)
// Since the old webkitRTCPeerConnection constructor takes an optional
// second argument we need to take care to pass that through. Necessary
// for older versions of Chrome such as 49.
// for older versions of Chrome such as 51.
let constraints = undefined;
if (args.length > 1)
constraints = args[1];
......
/*
* This file is part of Adblock Plus <https://adblockplus.org/>,
* Copyright (C) 2006-present 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 <http://www.gnu.org/licenses/>.
*/
"use strict";
//
// XPCOM emulation
//
let ComponentsObject = {
interfaces:
{
nsITimer: {TYPE_REPEATING_SLACK: 0},
nsIInterfaceRequestor: null
},
classes:
{
"@mozilla.org/timer;1":
{
createInstance() { return new FakeTimer(); }
}
},
utils: {
import(resource)
{
let match = /^resource:\/\/gre\/modules\/(.+)\.jsm$/.exec(resource);
let resourceName = match && match[1];
if (resourceName && Cu.import.resources.has(resourceName))
return {[resourceName]: Cu.import.resources.get(resourceName)};
throw new Error(
"Attempt to import unknown JavaScript module " + resource
);
},
reportError(e)
{
console.error(e);
console.trace();
}
},
manager: null,
ID() { return null; }
};
const Cc = ComponentsObject.classes;
const Ci = ComponentsObject.interfaces;
const Cu = ComponentsObject.utils;
Cu.import.resources = new Map([
[
"XPCOMUtils",
{
generateQI() {}
}
],
[
"Services",
{
obs: {
addObserver() {},
removeObserver() {}
}
}
]
]);
function FakeTimer()
{
}
FakeTimer.prototype =
{
delay: 0,
callback: null,
initWithCallback(callback, delay)
{
this.callback = callback;
this.delay = delay;
this.scheduleTimeout();
},
scheduleTimeout()
{
setTimeout(() =>
{
try
{
this.callback();
}
catch (e)
{
Cu.reportError(e);
}
this.scheduleTimeout();
}, this.delay);
}
};
......@@ -20,9 +20,9 @@
"use strict";
const {RegExpFilter} = require("../adblockpluscore/lib/filterClasses");
const {ElemHide, createStyleSheet,
const {elemHide, createStyleSheet,
rulesFromStyleSheet} = require("../adblockpluscore/lib/elemHide");
const {ElemHideEmulation} = require("../adblockpluscore/lib/elemHideEmulation");
const {elemHideEmulation} = require("../adblockpluscore/lib/elemHideEmulation");
const {filterNotifier} = require("../adblockpluscore/lib/filterNotifier");
const {snippets, compileScript} = require("../adblockpluscore/lib/snippets");
const {checkWhitelisted} = require("./whitelisting");
......@@ -155,19 +155,12 @@ function executeScript(script, tabId, frameId)
{
try
{
let details = {
return browser.tabs.executeScript(tabId, {
code: getExecutableCode(script),
matchAboutBlank: true,
runAt: "document_start"
};
// Chrome <50 throws an exception if chrome.tabs.executeScript is called
// with a frameId of 0.
if (frameId != 0)
details.frameId = frameId;
return browser.tabs.executeScript(tabId, details)
.catch(error =>
runAt: "document_start",
frameId
}).catch(error =>
{
// Sometimes a frame is added and removed very quickly, in such cases we
// simply ignore the error.
......@@ -230,10 +223,10 @@ port.on("content.applyFilters", (message, sender) =>
{
let specificOnly = checkWhitelisted(sender.page, sender.frame, null,
RegExpFilter.typeMap.GENERICHIDE);
styleSheet = ElemHide.generateStyleSheetForDomain(docDomain, specificOnly,
styleSheet = elemHide.generateStyleSheetForDomain(docDomain, specificOnly,
trace, trace);
for (let filter of ElemHideEmulation.getRulesForDomain(docDomain))
for (let filter of elemHideEmulation.getRulesForDomain(docDomain))
emulatedPatterns.push({selector: filter.selector, text: filter.text});
}
}
......
......@@ -101,7 +101,7 @@ function getBackupData()
});
}
filterNotifier.on("load", scheduleBackup);
filterNotifier.on("ready", scheduleBackup);
filterNotifier.on("subscription.updated", scheduleBackup);
filterNotifier.on("subscription.added", scheduleBackup);
filterNotifier.on("subscription.removed", scheduleBackup);
......
This diff is collapsed.
This diff is collapsed.
......@@ -146,12 +146,6 @@ defaults.show_statsinpopup = true;
*/
defaults.shouldShowBlockElementMenu = true;
/**
* Whether notification opt-out UI should be shown.
* @type {boolean}
*/
defaults.notifications_showui = false;
/**
* Whether to show tracking warning in options page when both
* Acceptable Ads and subscription of type "Privacy" are enabled.
......@@ -183,8 +177,8 @@ defaults.notifications_ignoredcategories = [];
defaults.show_devtools_panel = true;
/**
* Whether to suppress the first run and updates page. This preference isn't
* set by the extension but can be pre-configured externally.
* Prevents unsolicited UI elements from showing up after installation. This
* preference isn't set by the extension but can be pre-configured externally.
*
* @see https://adblockplus.org/development-builds/suppressing-the-first-run-page-on-chrome
* @type {boolean}
......
......@@ -113,12 +113,6 @@ function logRequest(tabIds, request, filter)
browser.webRequest.onBeforeRequest.addListener(details =>
{
// This event doesn't fire in Chrome 49 for object requests when we filter by
// request type. So, we have to instead listen for all request types and
// manually ignore the ones we don't care about.
if (details.type == "main_frame")
return;
// Filter out requests from non web protocols. Ideally, we'd explicitly
// specify the protocols we are interested in (i.e. http://, https://,
// ws:// and wss://) with the url patterns, given below, when adding this
......@@ -206,6 +200,8 @@ browser.webRequest.onBeforeRequest.addListener(details =>
return result;
}, {
types: Object.values(browser.webRequest.ResourceType)
.filter(type => type != "main_frame"),
urls: ["<all_urls>"]
}, ["blocking"]);
......@@ -320,4 +316,4 @@ filterNotifier.on("subscription.disabled", arg => onFilterChange(arg, true));
filterNotifier.on("filter.added", onFilterChange);
filterNotifier.on("filter.removed", onFilterChange);
filterNotifier.on("filter.disabled", arg => onFilterChange(arg, true));
filterNotifier.on("load", onFilterChange);
filterNotifier.on("ready", onFilterChange);
......@@ -287,7 +287,7 @@ function addSubscriptionsAndNotifyUser(subscriptions)
}
Promise.all([
filterNotifier.once("load"),
filterNotifier.once("ready"),
Prefs.untilLoaded.catch(() => { dataCorrupted = true; })
]).then(detectFirstRun)
.then(getSubscriptions)
......@@ -295,7 +295,7 @@ Promise.all([
// We have to require the "uninstall" module on demand,
// as the "uninstall" module in turn requires this module.
.then(() => { require("./uninstall").setUninstallURL(); })
.then(initNotifications);
.then(() => initNotifications(firstRun));
/**
* Gets a value indicating whether the default filter subscriptions have been
......
......@@ -53,5 +53,11 @@ let Utils = exports.Utils = {
yield()
{
},
logError(e)
{
console.error(e);
console.trace();
}
};
......@@ -5,12 +5,10 @@ author = eyeo GmbH
backgroundScripts = polyfill.js
ext/common.js
ext/background.js
lib/compat.js
lib/adblockplus.js
testScripts = ../polyfill.js
../ext/common.js
../ext/background.js
../lib/compat.js
tests.js
options = options.html
browserAction =
......@@ -39,10 +37,13 @@ permissions =
storage
unlimitedStorage
notifications
optional_permissions =
contentSettings
management
[compat]
chrome = 49.0
opera = 36.0
chrome = 51.0
opera = 38.0
[contentScripts]
document_start =
......@@ -56,6 +57,8 @@ document_end = include.postload.js
common.js = adblockplusui/common.js
composer.html = adblockplusui/composer.html
composer.js = adblockplusui/composer.js
day1.html = adblockplusui/day1.html
day1.js = adblockplusui/day1.js
desktop-options.html = adblockplusui/desktop-options.html
desktop-options.js = adblockplusui/desktop-options.js
devtools-panel.html = adblockplusui/devtools-panel.html
......@@ -67,6 +70,9 @@ issue-reporter.html = adblockplusui/issue-reporter.html
issue-reporter.js = adblockplusui/issue-reporter.js
popup.html = adblockplusui/popup.html
popup.js = adblockplusui/popup.js
popup-dummy.html = adblockplusui/popup-dummy.html
popup-dummy.js = adblockplusui/popup-dummy.js
proxy.html = adblockplusui/proxy.html
snippets.js = adblockpluscore/lib/content/snippets.js
updates.html = adblockplusui/updates.html
updates.js = adblockplusui/updates.js
......@@ -74,37 +80,30 @@ data/languages.json = adblockplusui/data/languages.json
icons/detailed/abp-128.png = adblockplusui/skin/icons/abp-128.png
skin/common.css = adblockplusui/skin/common.css
skin/composer.css = adblockplusui/skin/composer.css
skin/day1.css = adblockplusui/skin/day1.css
skin/desktop-options.css = adblockplusui/skin/desktop-options.css
skin/devtools-panel.css = adblockplusui/skin/devtools-panel.css
skin/first-run.css = adblockplusui/skin/first-run.css
skin/fonts.css = adblockplusui/skin/fonts.css
skin/fonts.css = adblockplusui/skin/fonts/font.css
skin/issue-reporter.css = adblockplusui/skin/issue-reporter.css
skin/popup.css = adblockplusui/skin/popup.css
skin/popup-dummy.css = adblockplusui/skin/popup-dummy.css
skin/updates.css = adblockplusui/skin/updates.css
skin/web.css = adblockplusui/skin/web.css
skin/backgrounds/appstore.svg = adblockplusui/skin/backgrounds/appstore.svg
skin/backgrounds/googleplay.svg = adblockplusui/skin/backgrounds/googleplay.svg
skin/fonts/Source-Sans-Pro/300/cyrillic-ext.woff2 = adblockplusui/skin/fonts/Source-Sans-Pro/300/cyrillic-ext.woff2
skin/fonts/Source-Sans-Pro/300/cyrillic.woff2 = adblockplusui/skin/fonts/Source-Sans-Pro/300/cyrillic.woff2
skin/fonts/Source-Sans-Pro/300/greek-ext.woff2 = adblockplusui/skin/fonts/Source-Sans-Pro/300/greek-ext.woff2
skin/fonts/Source-Sans-Pro/300/greek.woff2 = adblockplusui/skin/fonts/Source-Sans-Pro/300/greek.woff2
skin/fonts/Source-Sans-Pro/300/latin-ext.woff2 = adblockplusui/skin/fonts/Source-Sans-Pro/300/latin-ext.woff2
skin/fonts/Source-Sans-Pro/300/latin.woff2 = adblockplusui/skin/fonts/Source-Sans-Pro/300/latin.woff2
skin/fonts/Source-Sans-Pro/300/vietnamese.woff2 = adblockplusui/skin/fonts/Source-Sans-Pro/300/vietnamese.woff2
skin/fonts/Source-Sans-Pro/400/cyrillic-ext.woff2 = adblockplusui/skin/fonts/Source-Sans-Pro/400/cyrillic-ext.woff2
skin/fonts/Source-Sans-Pro/400/cyrillic.woff2 = adblockplusui/skin/fonts/Source-Sans-Pro/400/cyrillic.woff2
skin/fonts/Source-Sans-Pro/400/greek-ext.woff2 = adblockplusui/skin/fonts/Source-Sans-Pro/400/greek-ext.woff2
skin/fonts/Source-Sans-Pro/400/greek.woff2 = adblockplusui/skin/fonts/Source-Sans-Pro/400/greek.woff2
skin/fonts/Source-Sans-Pro/400/latin-ext.woff2 = adblockplusui/skin/fonts/Source-Sans-Pro/400/latin-ext.woff2
skin/fonts/Source-Sans-Pro/400/latin.woff2 = adblockplusui/skin/fonts/Source-Sans-Pro/400/latin.woff2
skin/fonts/Source-Sans-Pro/400/vietnamese.woff2 = adblockplusui/skin/fonts/Source-Sans-Pro/400/vietnamese.woff2
skin/fonts/Source-Sans-Pro/700/cyrillic-ext.woff2 = adblockplusui/skin/fonts/Source-Sans-Pro/700/cyrillic-ext.woff2
skin/fonts/Source-Sans-Pro/700/cyrillic.woff2 = adblockplusui/skin/fonts/Source-Sans-Pro/700/cyrillic.woff2
skin/fonts/Source-Sans-Pro/700/greek-ext.woff2 = adblockplusui/skin/fonts/Source-Sans-Pro/700/greek-ext.woff2
skin/fonts/Source-Sans-Pro/700/greek.woff2 = adblockplusui/skin/fonts/Source-Sans-Pro/700/greek.woff2
skin/fonts/Source-Sans-Pro/700/latin-ext.woff2 = adblockplusui/skin/fonts/Source-Sans-Pro/700/latin-ext.woff2
skin/fonts/Source-Sans-Pro/700/latin.woff2 = adblockplusui/skin/fonts/Source-Sans-Pro/700/latin.woff2
skin/fonts/Source-Sans-Pro/700/vietnamese.woff2 = adblockplusui/skin/fonts/Source-Sans-Pro/700/vietnamese.woff2
skin/backgrounds/toolbar.svg = adblockplusui/skin/backgrounds/toolbar.svg
skin/fonts/300/Athiti.woff2 = adblockplusui/skin/fonts/300/Athiti.woff2
skin/fonts/300/Cairo.woff2 = adblockplusui/skin/fonts/300/Cairo.woff2
skin/fonts/300/SourceSansPro.woff2 = adblockplusui/skin/fonts/300/SourceSansPro.woff2
skin/fonts/400/Athiti.woff2 = adblockplusui/skin/fonts/400/Athiti.woff2
skin/fonts/400/Cairo.woff2 = adblockplusui/skin/fonts/400/Cairo.woff2
skin/fonts/400/SourceSansPro.woff2 = adblockplusui/skin/fonts/400/SourceSansPro.woff2
skin/fonts/700/Athiti.woff2 = adblockplusui/skin/fonts/700/Athiti.woff2
skin/fonts/700/Cairo.woff2 = adblockplusui/skin/fonts/700/Cairo.woff2
skin/fonts/700/SourceSansPro.woff2 = adblockplusui/skin/fonts/700/SourceSansPro.woff2
skin/fonts/font.css = adblockplusui/skin/fonts/font.css
skin/icons/abp-full-logo.svg = adblockplusui/skin/icons/abp-full-logo.svg
skin/icons/abp-logo.svg = adblockplusui/skin/icons/abp-logo.svg
skin/icons/alert.svg = adblockplusui/skin/icons/alert.svg
skin/icons/android.svg = adblockplusui/skin/icons/android.svg
......@@ -121,6 +120,7 @@ skin/icons/error.svg = adblockplusui/skin/icons/error.svg
skin/icons/facebook.svg = adblockplusui/skin/icons/facebook.svg
skin/icons/gear.svg = adblockplusui/skin/icons/gear.svg
skin/icons/globe.svg = adblockplusui/skin/icons/globe.svg
skin/icons/heart.svg = adblockplusui/skin/icons/heart.svg
skin/icons/hide.svg = adblockplusui/skin/icons/hide.svg
skin/icons/highlight.svg = adblockplusui/skin/icons/highlight.svg
skin/icons/iconOff.svg = adblockplusui/skin/icons/iconOff.svg
......@@ -129,11 +129,15 @@ skin/icons/info.svg = adblockplusui/skin/icons/info.svg
skin/icons/radio.svg = adblockplusui/skin/icons/radio.svg
skin/icons/reload.svg = adblockplusui/skin/icons/reload.svg
skin/icons/report-issue.svg = adblockplusui/skin/icons/report-issue.svg
skin/icons/star.svg = adblockplusui/skin/icons/star.svg
skin/icons/toggle.svg = adblockplusui/skin/icons/toggle.svg
skin/icons/tooltip.svg = adblockplusui/skin/icons/tooltip.svg
skin/icons/trash.svg = adblockplusui/skin/icons/trash.svg
skin/icons/twitter.svg = adblockplusui/skin/icons/twitter.svg
skin/icons/weibo.svg = adblockplusui/skin/icons/weibo.svg
skin/icons/day1/bug.svg = adblockplusui/skin/icons/day1/bug.svg
skin/icons/day1/tower.svg = adblockplusui/skin/icons/day1/tower.svg
skin/icons/day1/wave.svg = adblockplusui/skin/icons/day1/wave.svg
skin/icons/first-run/checkmark-header.svg = adblockplusui/skin/icons/first-run/checkmark-header.svg
skin/icons/first-run/checkmark.svg = adblockplusui/skin/icons/first-run/checkmark.svg
skin/icons/first-run/lock.svg = adblockplusui/skin/icons/first-run/lock.svg
......@@ -142,6 +146,7 @@ skin/icons/updates/base-graphic.svg = adblockplusui/skin/icons/updates/base-grap
skin/icons/updates/mobile.svg = adblockplusui/skin/icons/updates/mobile.svg
skin/icons/updates/rocket.svg = adblockplusui/skin/icons/updates/rocket.svg
skin/icons/updates/thumbs-up.svg = adblockplusui/skin/icons/updates/thumbs-up.svg
skin/icons/waving.svg = adblockplusui/skin/icons/waving.svg
skin/icons/web/navbar-logo.svg = adblockplusui/skin/icons/web/navbar-logo.svg
[bundles]
......@@ -157,7 +162,7 @@ lib/adblockplus.js =
lib/uninstall.js
lib/csp.js
lib/contentFiltering.js
adblockplusui/lib/messageResponder.js
lib/messageResponder.js
include.preload.js =
include.preload.js
inject.preload.js
......@@ -169,6 +174,7 @@ include.postload.js =
adblockplusui/locale/*/antiadblockInit.json = *
adblockplusui/locale/*/common.json = *
adblockplusui/locale/*/composer.json = *
adblockplusui/locale/*/day1.json = *
adblockplusui/locale/*/desktop-options.json = *
adblockplusui/locale/*/devtools-panel.json = *
adblockplusui/locale/*/filter-validation.json = *
......
......@@ -20,7 +20,7 @@
"geckodriver": "^1.14.1",
"handlebars": "^4.0.12",
"jimp": "^0.3.11",
"jsdoc": "^3.5.5",
"jsdoc": "^3.6.3",
"ncp": "^2.0.0",
"mocha": "^5.2.0",
"request": "^2.88.0",
......
......@@ -21,10 +21,16 @@
let asyncAPIs = [
"browserAction.setIcon",
"browserAction.getPopup",
"contentSettings.cookies.get",
"contentSettings.javascript.get",
"contextMenus.removeAll",
"devtools.panels.create",
"management.getAll",
"notifications.clear",
"notifications.create",
"permissions.contains",
"permissions.remove",
"permissions.request",
"runtime.getBrowserInfo",
"runtime.openOptionsPage",
"runtime.sendMessage",
......@@ -278,15 +284,6 @@
wrapRuntimeOnMessage();
}
// Workaround since HTMLCollection, NodeList, StyleSheetList, and CSSRuleList
// didn't have iterator support before Chrome 51.
// https://bugs.chromium.org/p/chromium/issues/detail?id=401699
for (let object of [HTMLCollection, NodeList, StyleSheetList, CSSRuleList])
{
if (!(Symbol.iterator in object.prototype))
object.prototype[Symbol.iterator] = Array.prototype[Symbol.iterator];
}
}
// Object.values is not supported in Chrome <54.
......@@ -323,32 +320,6 @@ if (browser.webRequest && !("ResourceType" in browser.webRequest))
}
}
// Chrome <50 does not support createImageBitmap, this is a simplistic
// polyfill which only fulfills the usecase of accepting a Blob containing
// an image and returning something which CanvasRenderingContext2D.drawImage()
// accepts.
if (typeof createImageBitmap == "undefined")
{
self.createImageBitmap = blob =>
{
return new Promise((resolve, reject) =>
{
let image = new Image();
image.src = URL.createObjectURL(blob);
image.addEventListener("load", () =>
{
URL.revokeObjectURL(image.src);
resolve(image);
});
image.addEventListener("error", () =>
{
URL.revokeObjectURL(image.src);
reject("createImageBitmap failed");
});
});
};
}
// Chrome <69 does not support OffscreenCanvas
if (typeof OffscreenCanvas == "undefined")
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment