Skip to content

Commit

Permalink
Merge pull request gorhill#6 from gorhill/master
Browse files Browse the repository at this point in the history
Re-sync with uBo master
  • Loading branch information
pes10k committed Apr 27, 2020
2 parents fb554f7 + bdf9030 commit fd28693
Show file tree
Hide file tree
Showing 149 changed files with 6,277 additions and 2,447 deletions.
10 changes: 2 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,15 +100,9 @@ There is no guarantee the package will be available on your specific platform --

#### Microsoft Edge

Developer: [@nikrolls](https://github.com/nikrolls).
Publisher: [Nik Rolls](https://github.com/nikrolls/uBlock-Edge).

Chromium-based Edge: Stable version available in [Microsoft Edge Insider Addons](https://microsoftedge.microsoft.com/insider-addons/detail/odfafepnkmbhccpbejgmiehpchacaeak).

Legacy Edge: Stable version available in [Microsoft Store](https://www.microsoft.com/store/p/app/9nblggh444l4).

Development version available at <https://github.com/nikrolls/uBlock-Edge#edge>.

Note that issues specific to the Edge fork are the responsibility of the current maintainer, I have no control over the code base of the fork.
Chromium-based Edge: Stable version available in [Microsoft Edge Add-ons](https://microsoftedge.microsoft.com/addons/detail/odfafepnkmbhccpbejgmiehpchacaeak).

#### Safari (macOS)

Expand Down
44 changes: 16 additions & 28 deletions assets/assets.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@
"https://raw.githubusercontent.com/uBlockOrigin/uAssets/master/filters/filters.txt",
"assets/ublock/filters.txt"
],
"cdnURLs": [
"https://gitcdn.xyz/repo/uBlockOrigin/uAssets/master/filters/filters.txt",
"https://cdn.jsdelivr.net/gh/uBlockOrigin/uAssets@master/filters/filters.txt",
"https://cdn.statically.io/gh/uBlockOrigin/uAssets/master/filters/filters.txt"
],
"supportURL": "https://github.com/uBlockOrigin/uAssets/issues"
},
"ublock-badware": {
Expand Down Expand Up @@ -67,16 +72,13 @@
"contentURL": [
"https://raw.githubusercontent.com/uBlockOrigin/uAssets/master/filters/unbreak.txt",
"assets/ublock/unbreak.txt"
],
"cdnURLs": [
"https://gitcdn.xyz/repo/uBlockOrigin/uAssets/master/filters/unbreak.txt",
"https://cdn.jsdelivr.net/gh/uBlockOrigin/uAssets@master/filters/unbreak.txt",
"https://cdn.statically.io/gh/uBlockOrigin/uAssets/master/filters/unbreak.txt"
]
},
"awrl-0": {
"content": "filters",
"group": "ads",
"off": true,
"title": "Adblock Warning Removal",
"contentURL": "https://easylist-downloads.adblockplus.org/antiadblockfilters.txt",
"supportURL": "https://forums.lanik.us/"
},
"adguard-generic": {
"content": "filters",
"group": "ads",
Expand Down Expand Up @@ -137,13 +139,6 @@
"contentURL": "https://www.fanboy.co.nz/enhancedstats.txt",
"supportURL": "https://github.com/ryanbr/fanboy-adblock/issues"
},
"disconnect-malvertising": {
"content": "filters",
"group": "malware",
"off": true,
"title": "Malvertising filter list by Disconnect",
"contentURL": "https://s3.amazonaws.com/lists.disconnect.me/simple_malvertising.txt"
},
"malware-0": {
"content": "filters",
"group": "malware",
Expand Down Expand Up @@ -238,7 +233,12 @@
"group": "social",
"title": "uBlock filters – Annoyances",
"off": true,
"contentURL": "https://raw.githubusercontent.com/uBlockOrigin/uAssets/master/filters/annoyances.txt"
"contentURL": "https://raw.githubusercontent.com/uBlockOrigin/uAssets/master/filters/annoyances.txt",
"cdnURLs": [
"https://gitcdn.xyz/repo/uBlockOrigin/uAssets/master/filters/annoyances.txt",
"https://cdn.jsdelivr.net/gh/uBlockOrigin/uAssets@master/filters/annoyances.txt",
"https://cdn.statically.io/gh/uBlockOrigin/uAssets/master/filters/annoyances.txt"
]
},
"dpollock-0": {
"content": "filters",
Expand All @@ -249,18 +249,6 @@
"contentURL": "https://someonewhocares.org/hosts/hosts",
"supportURL": "https://someonewhocares.org/hosts/"
},
"hphosts": {
"content": "filters",
"group": "multipurpose",
"updateAfter": 11,
"off": true,
"title": "hpHosts’ Ad and tracking servers",
"contentURL": [
"https://hosts-file.net/.%5Cad_servers.txt",
"http://hosts-file.net/.%5Cad_servers.txt"
],
"supportURL": "https://hosts-file.net/"
},
"mvps-0": {
"content": "filters",
"group": "multipurpose",
Expand Down
78 changes: 74 additions & 4 deletions assets/resources/scriptlets.js
Original file line number Diff line number Diff line change
Expand Up @@ -458,8 +458,40 @@
})();


/// remove-class.js
/// alias rc.js
(function() {
const token = '{{1}}';
if ( token === '' || token === '{{1}}' ) { return; }
const tokens = token.split(/\s*\|\s*/);
let selector = '{{2}}';
if ( selector === '' || selector === '{{2}}' ) {
selector = '.' + tokens.map(a => CSS.escape(a)).join(',.');
}
const rmclass = function() {
try {
const nodes = document.querySelectorAll(selector);
for ( const node of nodes ) {
node.classList.remove(...tokens);
}
} catch(ex) {
}
};
if ( document.readyState === 'loading' ) {
window.addEventListener(
'DOMContentLoaded',
rmclass,
{ capture: true, once: true }
);
} else {
rmclass();
}
})();


/// requestAnimationFrame-if.js
/// alias raf-if.js
// Deprecated, use "no-requestAnimationFrame-if.js"
(function() {
let needle = '{{1}}';
const not = needle.charAt(0) === '!';
Expand Down Expand Up @@ -487,6 +519,38 @@
})();


/// no-requestAnimationFrame-if.js
/// alias norafif.js
(function() {
let needle = '{{1}}';
if ( needle === '{{1}}' ) { needle = ''; }
const needleNot = needle.charAt(0) === '!';
if ( needleNot ) { needle = needle.slice(1); }
if ( needle.startsWith('/') && needle.endsWith('/') ) {
needle = needle.slice(1, -1);
} else if ( needle !== '' ) {
needle = needle.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
}
const log = needleNot === false && needle === '' ? console.log : undefined;
const reNeedle = new RegExp(needle);
window.requestAnimationFrame = new Proxy(window.requestAnimationFrame, {
apply: function(target, thisArg, args) {
const a = String(args[0]);
let defuse = false;
if ( log !== undefined ) {
log('uBO: requestAnimationFrame("%s")', a);
} else {
defuse = reNeedle.test(a) !== needleNot;
}
if ( defuse ) {
args[0] = function(){};
}
return target.apply(thisArg, args);
}
});
})();


/// set-constant.js
/// alias set.js
(function() {
Expand Down Expand Up @@ -1092,11 +1156,17 @@
// https://github.com/uBlockOrigin/uAssets/issues/2912
/// fingerprint2.js
(function() {
let fp2 = function(){};
let browserId = '';
for ( let i = 0; i < 8; i++ ) {
browserId += (Math.random() * 0x10000 + 0x1000 | 0).toString(16).slice(-4);
}
const fp2 = function(){};
fp2.get = function(opts, cb) {
if ( !cb ) { cb = opts; }
setTimeout(( ) => { cb(browserId, []); }, 1);
};
fp2.prototype = {
get: function(cb) {
setTimeout(function() { cb('', []); }, 1);
}
get: fp2.get
};
window.Fingerprint2 = fp2;
})();
Expand Down
6 changes: 3 additions & 3 deletions dist/description/description-bn.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

এটির কার্যকারিতার সচিত্র সংক্ষিপ্ত বিবরণ: https://github.com/gorhill/uBlock/wiki/uBlock-vs.-ABP:-efficiency-compared

ব্যবহারের ধরন: পপআপে বড় পাওয়ার বোতাম স্থায়ীভাবে বর্তমান ওয়েব সাইটের জন্য uBlock সক্রিয়/নিষ্ক্রিয় করবে। এটা শুধুমাত্র বর্তমান ওয়েব সাইটে প্রযোজ্য, এটি একটি সার্বজনীন পাওয়ার বোতাম নয়।
ব্যবহার: পপআপে বড় বোতামটি বর্তমান ওয়েব সাইটকে স্থায়ীভাবে জন্য ইউব্লক দ্বারা সক্রিয়/নিষ্ক্রিয় করবে। এটা শুধুমাত্র বর্তমান ওয়েব সাইটে প্রযোজ্য, এটি একটি সার্বজনীন পাওয়ার বোতাম নয়।

***

Expand All @@ -18,7 +18,7 @@
আপনি যদি চান আপনি নির্বাচন করার জন্য আরো তালিকা পাবেন:

- ফ্যানবয়ের বর্ধিত অনুসরণকরণ তালিকা
- ডেন পোলোকস-এর হোস্ট ফাইল
- ডেন পোলোক-এর হোস্ট ফাইল
- এইচপিহোস্টসের বিজ্ঞাপন এবং অনুসরণকরণ সার্ভার
- MVPS হোস্টসমূহ
- স্প্যাম৪০৪
Expand All @@ -34,7 +34,7 @@

***

বিনামূল্যে।
মুক্তভাবে
পাবলিক লাইসেন্সসহ মুক্ত উৎসের (GPLv3)
ব্যবহারকারীদের দ্বারা ব্যবহারকারীদের জন্য।

Expand Down
49 changes: 49 additions & 0 deletions dist/description/description-oc.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
An efficient blocker: easy on memory and CPU footprint, and yet can load and enforce thousands more filters than other popular blockers out there.

Illustrated overview of its efficiency: https://github.com/gorhill/uBlock/wiki/uBlock-vs.-ABP:-efficiency-compared

Usage: The big power button in the popup is to permanently disable/enable uBlock for the current web site. It applies to the current web site only, it is not a global power button.

***

Flexible, it's more than an "ad blocker": it can also read and create filters from hosts files.

Out of the box, these lists of filters are loaded and enforced:

- EasyList
- Peter Lowe’s Ad server list
- EasyPrivacy
- Malware domains

More lists are available for you to select if you wish:

- Fanboy’s Enhanced Tracking List
- Dan Pollock’s hosts file
- hpHosts’s Ad and tracking servers
- MVPS HOSTS
- Spam404
- And many others

Of course, the more filters enabled, the higher the memory footprint. Yet, even after adding Fanboy's two extra lists, hpHosts’s Ad and tracking servers, uBlock still has a lower memory footprint than other very popular blockers out there.

Also, be aware that selecting some of these extra lists may lead to higher likelihood of web site breakage -- especially those lists which are normally used as hosts file.

***

Without the preset lists of filters, this extension is nothing. So if ever you really do want to contribute something, think about the people working hard to maintain the filter lists you are using, which were made available to use by all for free.

***

Free.
Open source with public license (GPLv3)
For users by users.

Contributors @ Github: https://github.com/gorhill/uBlock/graphs/contributors
Contributors @ Crowdin: https://crowdin.net/project/ublock

***

It's quite an early version, keep this in mind when you review.

Project change log:
https://github.com/gorhill/uBlock/releases
6 changes: 3 additions & 3 deletions dist/firefox/updates.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
"uBlock0@raymondhill.net": {
"updates": [
{
"version": "1.25.3.4",
"version": "1.26.3.11",
"browser_specific_settings": { "gecko": { "strict_min_version": "55" } },
"update_info_url": "https://github.com/gorhill/uBlock/releases/tag/1.25.3b4",
"update_link": "https://github.com/gorhill/uBlock/releases/download/1.25.3b4/uBlock0_1.25.3b4.firefox.signed.xpi"
"update_info_url": "https://github.com/gorhill/uBlock/releases/tag/1.26.3b11",
"update_link": "https://github.com/gorhill/uBlock/releases/download/1.26.3b11/uBlock0_1.26.3b11.firefox.signed.xpi"
}
]
}
Expand Down
2 changes: 1 addition & 1 deletion dist/version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.25.3.4
1.26.3.11
81 changes: 81 additions & 0 deletions platform/chromium/vapi-background.js
Original file line number Diff line number Diff line change
Expand Up @@ -943,6 +943,7 @@ vAPI.messaging = {
onFrameworkMessage: function(request, port, callback) {
const sender = port && port.sender;
if ( !sender ) { return; }
const fromDetails = this.ports.get(port.name) || {};
const tabId = sender.tab && sender.tab.id || undefined;
const msg = request.msg;
switch ( msg.what ) {
Expand Down Expand Up @@ -987,6 +988,14 @@ vAPI.messaging = {
callback();
});
break;
case 'localStorage': {
if ( fromDetails.privileged !== true ) { break; }
const args = msg.args || [];
vAPI.localStorage[msg.fn](...args).then(result => {
callback(result);
});
break;
}
case 'userCSS':
if ( tabId === undefined ) { break; }
const details = {
Expand Down Expand Up @@ -1401,6 +1410,78 @@ vAPI.adminStorage = (( ) => {
/******************************************************************************/
/******************************************************************************/

// A localStorage-like object which should be accessible from the
// background page or auxiliary pages.
//
// https://github.com/uBlockOrigin/uBlock-issues/issues/899
// Convert into asynchronous access API.
//
// Note: vAPI.localStorage should already be defined with the client-side
// implementation at this point, but we override with the
// background-side implementation.
vAPI.localStorage = {
start: async function() {
if ( this.cache instanceof Promise ) { return this.cache; }
if ( this.cache instanceof Object ) { return this.cache; }
this.cache = webext.storage.local.get('localStorage').then(bin => {
this.cache = undefined;
try {
if (
bin instanceof Object === false ||
bin.localStorage instanceof Object === false
) {
this.cache = {};
const ls = self.localStorage;
for ( let i = 0; i < ls.length; i++ ) {
const key = ls.key(i);
this.cache[key] = ls.getItem(key);
}
webext.storage.local.set({ localStorage: this.cache });
} else {
this.cache = bin.localStorage;
}
} catch(ex) {
}
if ( this.cache instanceof Object === false ) {
this.cache = {};
}
});
return this.cache;
},
clear: function() {
this.cache = {};
return webext.storage.local.set({ localStorage: this.cache });
},
getItem: function(key) {
if ( this.cache instanceof Object === false ) {
console.info(`localStorage.getItem('${key}') not ready`);
return null;
}
const value = this.cache[key];
return value !== undefined ? value : null;
},
getItemAsync: async function(key) {
await this.start();
const value = this.cache[key];
return value !== undefined ? value : null;
},
removeItem: async function(key) {
this.setItem(key);
},
setItem: async function(key, value = undefined) {
await this.start();
if ( value === this.cache[key] ) { return; }
this.cache[key] = value;
return webext.storage.local.set({ localStorage: this.cache });
},
cache: undefined,
};

vAPI.localStorage.start();

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

// https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/storage/sync

vAPI.cloud = (( ) => {
Expand Down

0 comments on commit fd28693

Please sign in to comment.