Skip to content

Commit

Permalink
Merge tag '1.12.0' into safari
Browse files Browse the repository at this point in the history
# Conflicts:
#	.github/ISSUE_TEMPLATE.md
#	.travis.yml
#	src/_locales/sk/messages.json
#	src/_locales/uk/messages.json
  • Loading branch information
el1t committed Apr 10, 2017
2 parents db68d8a + f4f52c3 commit ade3ca5
Show file tree
Hide file tree
Showing 56 changed files with 2,050 additions and 341 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
### Steps for anyone to reproduce the issue

1. Be as detailed as possible,
1. Be as detailed as possible:
1. Because we are not looking over your shoulder and
1. Keep in mind: Nobody can read your mind.

Expand Down
2 changes: 2 additions & 0 deletions assets/assets.json
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@
"title": "EasyList",
"contentURL": [
"https://easylist.to/easylist/easylist.txt",
"https://secure.fanboy.co.nz/easylist.txt",
"https://easylist-downloads.adblockplus.org/easylist.txt",
"https://raw.githubusercontent.com/uBlockOrigin/uAssets/master/thirdparties/easylist-downloads.adblockplus.org/easylist.txt",
"assets/thirdparties/easylist-downloads.adblockplus.org/easylist.txt"
Expand Down Expand Up @@ -124,6 +125,7 @@
"title": "EasyPrivacy",
"contentURL": [
"https://easylist.to/easylist/easyprivacy.txt",
"https://secure.fanboy.co.nz/easyprivacy.txt",
"https://easylist-downloads.adblockplus.org/easyprivacy.txt",
"https://raw.githubusercontent.com/uBlockOrigin/uAssets/master/thirdparties/easylist-downloads.adblockplus.org/easyprivacy.txt",
"assets/thirdparties/easylist-downloads.adblockplus.org/easyprivacy.txt"
Expand Down
6 changes: 3 additions & 3 deletions dist/description/description-ja.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@

他ソフトとの比較: https://github.com/gorhill/uBlock/wiki/uBlock-vs.-ABP:-efficiency-compared

使用法: ポップアップに表示される大きな電源ボタンは、現在のサイトでuBlockの有効/無効を切り替えます。 現在のサイトのみに適用されます、グローバルボタンではありません
使用法: ポップアップに表示される大きな電源ボタンは、現在のサイトでuBlockの有効/無効を切り替えます。 変更は現在のサイトへのみ適用されます。他のサイトとの共通ボタンではありません

***

ただの「広告ブロッカー」より柔軟です:ホストファイルを読み込みフィルターを作成できます。

要するに、以下のフィルターが読み込まれ、適用されます
初回起動時の設定では、以下のフィルターが読み込まれ、適用されています

- EasyList
- Peter Lowe’s Ad server list
Expand All @@ -23,7 +23,7 @@
- hpHosts’s Ad and tracking servers
- MVPS HOSTS
- Spam404
- その他たくさん
- などなど

もちろん、多くのフィルターを適用すれば使用メモリーは増えます。 ただ、それでも、Fanboy's Special Blocking List、Fanboy's Enhanced Tracking List、hpHost's Ad and tracking serversの三つのリストを追加で適用しても、uBlockは他の人気のブロッカーより少ないメモリー消費を実現しています。

Expand Down
8 changes: 4 additions & 4 deletions dist/description/description-pt_PT.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ Um bloqueador eficiente: leve na memória e CPU e, no entanto, consegue carregar
Visão geral ilustradora da sua eficiência:
https://github.com/gorhill/uBlock/wiki/uBlock-vs.-ABP:-efficiency-compared

Utilização: O botão grande de energia na janela serve para desativar ou ativar, permanentemente, o uBlock para o web site atual. Aplica-se unicamente ao web site atual, não sendo um botão de energia global.
Utilização: O botão grande de energia na janela serve para desativar/ativar permanentemente o uBlock para o web site atual. Aplica-se unicamente ao web site atual, não sendo um botão de energia global.

***

Flexível, é mais do que um bloqueador de anúncios. Pode também ler e criar filtros a partir de ficheiros de servidores.
Flexível, é mais do que um "bloqueador de anúncios": pode também ler e criar filtros a partir de ficheiros de servidores.

Por predefinição, estas listas de filtros são carregadas e aplicadas:

Expand All @@ -27,15 +27,15 @@ Se quiser, estão disponíveis mais listas para seleção:

Obviamente que quanto maior o número de filtros ativos, maior será o consumo de memória. No entanto, mesmo após adicionar as duas listas extra do Fanboy, hpHosts Ad and tracking servers, o uBlock₀ continua a consumir menos memória do que outros bloqueadores populares disponíveis.

Esteja ciente de que se selecionar algumas destas listas extra pode resultar numa probabilidade acrescida de rutura em alguns web sites -- especialmente nas listas que são normalmente utilizadas como ficheiro de servidores.
Esteja ciente de que selecionar algumas destas listas extra pode resultar numa probabilidade acrescida de rutura em alguns web sites -- especialmente as listas que são normalmente utilizadas como ficheiro de servidores.

***

Sem as listas de filtros predefinidas, esta extensão não é nada. Se realmente quiser contribuir com algo, pense nas pessoas que trabalham duro para manter as listas de filtros que usa, que foram tornadas disponíveis para uso por todos sem custos.

***

Grátis.
Livre.
Código aberto com licença pública (GPLv3)
De utilizadores para utilizadores.

Expand Down
2 changes: 1 addition & 1 deletion dist/description/description-tr.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ Katkıda bulunanlar @ Crowdin: https://crowdin.net/project/ublock

***

Bu çok erken bir sürüm, gözden geçirirken, bunu göz önünde bulundurun.
Bu çok erken bir sürüm, gözden geçirirken bunu göz önünde bulundurun.

Proje değişiklik günlüğü:
https://github.com/gorhill/uBlock/releases
7 changes: 2 additions & 5 deletions platform/chromium/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"manifest_version": 2,

"name": "uBlock Origin",
"version": "1.11.3.1",
"version": "1.12.0",

"default_locale": "en",
"description": "__MSG_extShortDesc__",
Expand Down Expand Up @@ -54,10 +54,7 @@
"webNavigation",
"webRequest",
"webRequestBlocking",
"http://*/*",
"https://*/*",
"ws://*/*",
"wss://*/*"
"<all_urls>"
],
"short_name": "uBlock₀",
"storage": {
Expand Down
16 changes: 6 additions & 10 deletions platform/chromium/vapi-background.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,16 +169,12 @@ vAPI.browserSettings = (function() {
scope: 'regular'
}, this.noopCallback);
} else {
// Respect current stricter setting if any.
cpn.webRTCIPHandlingPolicy.get({}, function(details) {
var value = details.value === 'disable_non_proxied_udp' ?
'disable_non_proxied_udp' :
'default_public_interface_only';
cpn.webRTCIPHandlingPolicy.set({
value: value,
scope: 'regular'
}, this.noopCallback);
}.bind(this));
// https://github.com/uBlockOrigin/uAssets/issues/333#issuecomment-289426678
// - Leverage virtuous side-effect of strictest setting.
cpn.webRTCIPHandlingPolicy.set({
value: 'disable_non_proxied_udp',
scope: 'regular'
}, this.noopCallback);
}
} catch(ex) {
console.error(ex);
Expand Down
9 changes: 7 additions & 2 deletions platform/chromium/vapi-client.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*******************************************************************************
uBlock Origin - a browser extension to block requests.
Copyright (C) 2014-2016 The uBlock Origin authors
Copyright (C) 2014-2017 The uBlock Origin authors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -56,7 +56,12 @@ if ( /^image\/|^text\/plain/.test(contentType) ) {

/******************************************************************************/

var vAPI = self.vAPI = self.vAPI || {};
// https://bugs.chromium.org/p/project-zero/issues/detail?id=1225&desc=6#c10
if ( !self.vAPI || self.vAPI.uBO !== true ) {
self.vAPI = { uBO: true };
}

var vAPI = self.vAPI;
var chrome = self.chrome;

// https://github.com/chrisaljoudi/uBlock/issues/456
Expand Down
14 changes: 10 additions & 4 deletions platform/chromium/vapi-common.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*******************************************************************************
uBlock Origin - a browser extension to block requests.
Copyright (C) 2014-2016 The uBlock Origin authors
Copyright (C) 2014-2017 The uBlock Origin authors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand All @@ -26,9 +26,14 @@
/******************************************************************************/
/******************************************************************************/

(function() {
(function(self) {

var vAPI = self.vAPI = self.vAPI || {};
// https://bugs.chromium.org/p/project-zero/issues/detail?id=1225&desc=6#c10
if ( !self.vAPI || self.vAPI.uBO !== true ) {
self.vAPI = { uBO: true };
}

var vAPI = self.vAPI;
var chrome = self.chrome;

/******************************************************************************/
Expand Down Expand Up @@ -56,6 +61,7 @@ vAPI.download = function(details) {
var a = document.createElement('a');
a.href = details.url;
a.setAttribute('download', details.filename || '');
a.setAttribute('type', 'text/plain');
a.dispatchEvent(new MouseEvent('click'));
};

Expand Down Expand Up @@ -96,6 +102,6 @@ try {

/******************************************************************************/

})();
})(this);

/******************************************************************************/
98 changes: 77 additions & 21 deletions platform/firefox/bootstrap.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*******************************************************************************
µBlock - a browser extension to block requests.
Copyright (C) 2014 The µBlock authors
uBlock Origin - a browser extension to block requests.
Copyright (C) 2014-2017 The uBlock Origin authors
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand All @@ -26,11 +26,13 @@

/******************************************************************************/

const {classes: Cc, interfaces: Ci} = Components;
const {classes: Cc, interfaces: Ci, utils: Cu} = Components;

// Accessing the context of the background page:
// var win = Services.appShell.hiddenDOMWindow.document.querySelector('iframe[src*=ublock0]').contentWindow;

let windowlessBrowser = null;
let windowlessBrowserPL = null;
let bgProcess = null;
let version;
const hostName = 'ublock0';
Expand Down Expand Up @@ -58,6 +60,52 @@ function startup(data/*, reason*/) {
return;
}

waitForHiddenWindow();
}

function createBgProcess(parentDocument) {
bgProcess = parentDocument.documentElement.appendChild(
parentDocument.createElementNS('http://www.w3.org/1999/xhtml', 'iframe')
);
bgProcess.setAttribute(
'src',
'chrome://' + hostName + '/content/background.html#' + version
);

// https://developer.mozilla.org/en-US/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsIMessageListenerManager#addMessageListener%28%29
// "If the same listener registers twice for the same message, the
// "second registration is ignored."
restartListener.messageManager.addMessageListener(
hostName + '-restart',
restartListener
);
}

function getWindowlessBrowserFrame(appShell) {
windowlessBrowser = appShell.createWindowlessBrowser(true);
windowlessBrowser.QueryInterface(Ci.nsIInterfaceRequestor);
let webProgress = windowlessBrowser.getInterface(Ci.nsIWebProgress);
let XPCOMUtils = Cu.import('resource://gre/modules/XPCOMUtils.jsm', null).XPCOMUtils;
windowlessBrowserPL = {
QueryInterface: XPCOMUtils.generateQI([
Ci.nsIWebProgressListener,
Ci.nsIWebProgressListener2,
Ci.nsISupportsWeakReference
]),
onStateChange: function(wbp, request, stateFlags/*, status*/) {
if ( !request ) { return; }
if ( stateFlags & Ci.nsIWebProgressListener.STATE_STOP ) {
webProgress.removeProgressListener(windowlessBrowserPL);
windowlessBrowserPL = null;
createBgProcess(windowlessBrowser.document);
}
}
};
webProgress.addProgressListener(windowlessBrowserPL, Ci.nsIWebProgress.NOTIFY_STATE_DOCUMENT);
windowlessBrowser.document.location = "data:application/vnd.mozilla.xul+xml;charset=utf-8,<window%20id='" + hostName + "-win'/>";
}

function waitForHiddenWindow() {
let appShell = Cc['@mozilla.org/appshell/appShellService;1']
.getService(Ci.nsIAppShellService);

Expand All @@ -76,22 +124,20 @@ function startup(data/*, reason*/) {
return false;
}

bgProcess = hiddenDoc.documentElement.appendChild(
hiddenDoc.createElementNS('http://www.w3.org/1999/xhtml', 'iframe')
);
bgProcess.setAttribute(
'src',
'chrome://' + hostName + '/content/background.html#' + version
);

// https://developer.mozilla.org/en-US/docs/Mozilla/Tech/XPCOM/Reference/Interface/nsIMessageListenerManager#addMessageListener%28%29
// "If the same listener registers twice for the same message, the
// "second registration is ignored."
restartListener.messageManager.addMessageListener(
hostName + '-restart',
restartListener
);

// In theory, it should be possible to create a windowless browser
// immediately, without waiting for the hidden window to have loaded
// completely. However, in practice, on Windows this seems to lead
// to a broken Firefox appearance. To avoid this, we only create the
// windowless browser here. We'll use that rather than the hidden
// window for the actual background page (windowless browsers are
// also what the webextension implementation in Firefox uses for
// background pages).
let { Services } = Cu.import('resource://gre/modules/Services.jsm', null);
if ( Services.vc.compare(Services.appinfo.platformVersion, '27') >= 0 ) {
getWindowlessBrowserFrame(appShell);
} else {
createBgProcess(hiddenDoc);
}
return true;
};

Expand Down Expand Up @@ -150,6 +196,15 @@ function shutdown(data, reason) {
bgProcess = null;
}

if ( windowlessBrowser !== null ) {
// close() does not exist for older versions of Firefox.
if ( typeof windowlessBrowser.close === 'function' ) {
windowlessBrowser.close();
}
windowlessBrowser = null;
windowlessBrowserPL = null;
}

if ( data === undefined ) {
return;
}
Expand Down Expand Up @@ -187,8 +242,9 @@ function uninstall(aData, aReason) {
// To cleanup vAPI.localStorage in vapi-common.js
// As I get more familiar with FF API, will find out whetehr there was
// a better way to do this.
Components.utils.import('resource://gre/modules/Services.jsm', null)
.Services.prefs.getBranch('extensions.' + hostName + '.').deleteBranch('');
Cu.import('resource://gre/modules/Services.jsm', null)
.Services.prefs.getBranch('extensions.' + hostName + '.')
.deleteBranch('');
}

/******************************************************************************/
Loading

0 comments on commit ade3ca5

Please sign in to comment.