Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fork Sync: Update from parent repository #173

Closed
wants to merge 12 commits into from
21 changes: 4 additions & 17 deletions assets/assets.dev.json
Original file line number Diff line number Diff line change
Expand Up @@ -221,13 +221,13 @@
"group": "malware",
"title": "Online Malicious URL Blocklist",
"contentURL": [
"https://malware-filter.gitlab.io/urlhaus-filter/urlhaus-filter-online.txt",
"https://malware-filter.gitlab.io/urlhaus-filter/urlhaus-filter-ag-online.txt",
"assets/thirdparties/urlhaus-filter/urlhaus-filter-online.txt"
],
"cdnURLs": [
"https://curbengh.github.io/malware-filter/urlhaus-filter-online.txt",
"https://malware-filter.gitlab.io/urlhaus-filter/urlhaus-filter-online.txt",
"https://malware-filter.pages.dev/urlhaus-filter-online.txt"
"https://curbengh.github.io/malware-filter/urlhaus-filter-ag-online.txt",
"https://malware-filter.gitlab.io/urlhaus-filter/urlhaus-filter-ag-online.txt",
"https://malware-filter.pages.dev/urlhaus-filter-ag-online.txt"
],
"supportURL": "https://gitlab.com/malware-filter/urlhaus-filter#malicious-url-blocklist"
},
Expand All @@ -244,19 +244,6 @@
],
"supportURL": "https://gitlab.com/malware-filter/phishing-filter#phishing-url-blocklist"
},
"curben-pup": {
"content": "filters",
"group": "malware",
"off": true,
"title": "PUP Domains Blocklist",
"contentURL": "https://malware-filter.gitlab.io/pup-filter/pup-filter.txt",
"cdnURLs": [
"https://curbengh.github.io/pup-filter/pup-filter.txt",
"https://malware-filter.gitlab.io/pup-filter/pup-filter.txt",
"https://pup-filter.pages.dev/pup-filter.txt"
],
"supportURL": "https://gitlab.com/malware-filter/pup-filter#pup-domains-blocklist"
},
"adguard-social": {
"content": "filters",
"group": "annoyances",
Expand Down
21 changes: 4 additions & 17 deletions assets/assets.json
Original file line number Diff line number Diff line change
Expand Up @@ -221,13 +221,13 @@
"group": "malware",
"title": "Online Malicious URL Blocklist",
"contentURL": [
"https://malware-filter.gitlab.io/urlhaus-filter/urlhaus-filter-online.txt",
"https://malware-filter.gitlab.io/urlhaus-filter/urlhaus-filter-ag-online.txt",
"assets/thirdparties/urlhaus-filter/urlhaus-filter-online.txt"
],
"cdnURLs": [
"https://curbengh.github.io/malware-filter/urlhaus-filter-online.txt",
"https://malware-filter.gitlab.io/urlhaus-filter/urlhaus-filter-online.txt",
"https://malware-filter.pages.dev/urlhaus-filter-online.txt"
"https://curbengh.github.io/malware-filter/urlhaus-filter-ag-online.txt",
"https://malware-filter.gitlab.io/urlhaus-filter/urlhaus-filter-ag-online.txt",
"https://malware-filter.pages.dev/urlhaus-filter-ag-online.txt"
],
"supportURL": "https://gitlab.com/malware-filter/urlhaus-filter#malicious-url-blocklist"
},
Expand All @@ -244,19 +244,6 @@
],
"supportURL": "https://gitlab.com/malware-filter/phishing-filter#phishing-url-blocklist"
},
"curben-pup": {
"content": "filters",
"group": "malware",
"off": true,
"title": "PUP Domains Blocklist",
"contentURL": "https://malware-filter.gitlab.io/pup-filter/pup-filter.txt",
"cdnURLs": [
"https://curbengh.github.io/pup-filter/pup-filter.txt",
"https://malware-filter.gitlab.io/pup-filter/pup-filter.txt",
"https://pup-filter.pages.dev/pup-filter.txt"
],
"supportURL": "https://gitlab.com/malware-filter/pup-filter#pup-domains-blocklist"
},
"adguard-social": {
"content": "filters",
"group": "annoyances",
Expand Down
122 changes: 109 additions & 13 deletions assets/resources/scriptlets.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ function safeSelf() {
if ( pattern === '' ) {
return { matchAll: true };
}
const expect = (options.canNegate === true && pattern.startsWith('!') === false);
const expect = (options.canNegate !== true || pattern.startsWith('!') === false);
if ( expect === false ) {
pattern = pattern.slice(1);
}
Expand Down Expand Up @@ -1441,11 +1441,12 @@ function evaldataPrune(
/******************************************************************************/

builtinScriptlets.push({
name: 'nano-setInterval-booster.js',
name: 'adjust-setInterval.js',
aliases: [
'nano-setInterval-booster.js',
'nano-sib.js',
],
fn: nanoSetIntervalBooster,
fn: adjustSetInterval,
dependencies: [
'safe-self.fn',
],
Expand All @@ -1462,7 +1463,7 @@ builtinScriptlets.push({
// boostRatio - The delay multiplier when there is a match, 0.5 speeds up by
// 2 times and 2 slows down by 2 times, defaults to 0.05 or speed up
// 20 times. Speed up and down both cap at 50 times.
function nanoSetIntervalBooster(
function adjustSetInterval(
needleArg = '',
delayArg = '',
boostArg = ''
Expand Down Expand Up @@ -1493,11 +1494,12 @@ function nanoSetIntervalBooster(
/******************************************************************************/

builtinScriptlets.push({
name: 'nano-setTimeout-booster.js',
name: 'adjust-setTimeout.js',
aliases: [
'nano-setTimeout-booster.js',
'nano-stb.js',
],
fn: nanoSetTimeoutBooster,
fn: adjustSetTimeout,
dependencies: [
'safe-self.fn',
],
Expand All @@ -1515,7 +1517,7 @@ builtinScriptlets.push({
// boostRatio - The delay multiplier when there is a match, 0.5 speeds up by
// 2 times and 2 slows down by 2 times, defaults to 0.05 or speed up
// 20 times. Speed up and down both cap at 50 times.
function nanoSetTimeoutBooster(
function adjustSetTimeout(
needleArg = '',
delayArg = '',
boostArg = ''
Expand Down Expand Up @@ -1650,15 +1652,18 @@ function noFetchIf(
/******************************************************************************/

builtinScriptlets.push({
name: 'refresh-defuser.js',
fn: refreshDefuser,
name: 'prevent-refresh.js',
aliases: [
'refresh-defuser.js',
],
fn: preventRefresh,
world: 'ISOLATED',
dependencies: [
'run-at.fn',
],
});
// https://www.reddit.com/r/uBlockOrigin/comments/q0frv0/while_reading_a_sports_article_i_was_redirected/hf7wo9v/
function refreshDefuser(
function preventRefresh(
arg1 = ''
) {
if ( typeof arg1 !== 'string' ) { return; }
Expand Down Expand Up @@ -2294,16 +2299,20 @@ function noWindowOpenIf(
/******************************************************************************/

builtinScriptlets.push({
name: 'window-close-if.js',
fn: windowCloseIf,
name: 'close-window.js',
aliases: [
'window-close-if.js',
],
fn: closeWindow,
world: 'ISOLATED',
dependencies: [
'safe-self.fn',
],
});
// https://github.com/uBlockOrigin/uAssets/issues/10323#issuecomment-992312847
// https://github.com/AdguardTeam/Scriptlets/issues/158
// https://github.com/uBlockOrigin/uBlock-issues/discussions/2270
function windowCloseIf(
function closeWindow(
arg1 = ''
) {
if ( typeof arg1 !== 'string' ) { return; }
Expand Down Expand Up @@ -3379,6 +3388,93 @@ function setAttr(
runAt(( ) => { start(); }, 'idle');
}

/*******************************************************************************
*
* @scriptlet prevent-canvas
*
* @description
* Prevent usage of specific or all (default) canvas APIs.
*
* ### Syntax
*
* ```text
* example.com##+js(prevent-canvas [, contextType])
* ```
*
* - `contextType`: A specific type of canvas API to prevent (default to all
* APIs). Can be a string or regex which will be matched against the type
* used in getContext() call. Prepend with `!` to test for no-match.
*
* ### Examples
*
* 1. Prevent `example.com` from accessing all canvas APIs
*
* ```adblock
* example.com##+js(prevent-canvas)
* ```
*
* 2. Prevent access to any flavor of WebGL API, everywhere
*
* ```adblock
* *##+js(prevent-canvas, /webgl/)
* ```
*
* 3. Prevent `example.com` from accessing any flavor of canvas API except `2d`
*
* ```adblock
* example.com##+js(prevent-canvas, !2d)
* ```
*
* ### References
*
* https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext
*
* */

builtinScriptlets.push({
name: 'prevent-canvas.js',
fn: preventCanvas,
dependencies: [
'safe-self.fn',
],
});
function preventCanvas(
contextType = ''
) {
const safe = safeSelf();
const pattern = safe.initPattern(contextType, { canNegate: true });
const proto = globalThis.HTMLCanvasElement.prototype;
proto.getContext = new Proxy(proto.getContext, {
apply(target, thisArg, args) {
if ( safe.testPattern(pattern, args[0]) ) { return null; }
return Reflect.apply(target, thisArg, args);
}
});
}

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

builtinScriptlets.push({
name: 'multiup.js',
fn: multiup,
world: 'ISOLATED',
});
function multiup() {
const handler = ev => {
const target = ev.target;
if ( target.matches('button[link]') === false ) { return; }
const ancestor = target.closest('form');
if ( ancestor === null ) { return; }
if ( ancestor !== target.parentElement ) { return; }
const link = (target.getAttribute('link') || '').trim();
if ( link === '' ) { return; }
ev.preventDefault();
ev.stopPropagation();
document.location.href = link;
};
document.addEventListener('click', handler, { capture: true });
}


/*******************************************************************************
*
Expand Down
4 changes: 2 additions & 2 deletions dist/firefox/updates.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
"uBlock0@raymondhill.net": {
"updates": [
{
"version": "1.52.3.0",
"version": "1.52.3.3",
"browser_specific_settings": { "gecko": { "strict_min_version": "79.0" } },
"update_link": "https://github.com/gorhill/uBlock/releases/download/1.52.3b0/uBlock0_1.52.3b0.firefox.signed.xpi"
"update_link": "https://github.com/gorhill/uBlock/releases/download/1.52.3b3/uBlock0_1.52.3b3.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.52.3.0
1.52.3.3