1
1
mirror of https://github.com/gorhill/uBlock.git synced 2025-10-05 21:32:39 +02:00

Compare commits

...

7 Commits

Author SHA1 Message Date
Raymond Hill
e57cf185b6 New revision for stable release 2023-09-21 12:38:18 -04:00
Daylin Cooper
321aec41a7 Fix XHR hook partial response handling. 2023-09-21 12:37:14 -04:00
Raymond Hill
1552f9dd84 Fix detection of leading combinators
Related feedback:
https://github.com/uBlockOrigin/uBlock-issues/issues/2778#issuecomment-1722488224
2023-09-21 12:36:56 -04:00
Raymond Hill
c701406fe3 Fix regression in :is() operator
Related issue:
https://github.com/uBlockOrigin/uBlock-issues/issues/2818
2023-09-21 12:36:31 -04:00
Raymond Hill
5d40669b64 Update scriptlets
Allow smaller multipliers in nano-sib/nano-stb
https://github.com/uBlockOrigin/uBlock-issues/issues/2808

Remove adfly-defuser, which is now unused.
2023-09-21 12:36:13 -04:00
Raymond Hill
f069323c8e Do not assume set viewport for popup panel when using portrait mode in descktop
Related issue:
https://github.com/uBlockOrigin/uBlock-issues/issues/2814
2023-09-21 12:35:38 -04:00
Raymond Hill
32d6e863c8 Fix removal of :scope prefix in :has() operator
Related feedback:
https://github.com/uBlockOrigin/uBlock-issues/issues/2778#issuecomment-1705101771
2023-09-21 12:35:15 -04:00
4 changed files with 45 additions and 110 deletions

View File

@@ -1365,6 +1365,10 @@ function jsonPruneXhrResponse(
if ( xhrDetails === undefined ) {
return innerResponse;
}
if ( xhrDetails.latestResponseLength != innerResponse.length ) {
xhrDetails.response = undefined;
xhrDetails.latestResponseLength = innerResponse.length;
}
if ( xhrDetails.response !== undefined ) {
return xhrDetails.response;
}
@@ -1467,7 +1471,7 @@ function nanoSetIntervalBooster(
if ( isNaN(delay) || isFinite(delay) === false ) { delay = 1000; }
let boost = parseFloat(boostArg);
boost = isNaN(boost) === false && isFinite(boost)
? Math.min(Math.max(boost, 0.02), 50)
? Math.min(Math.max(boost, 0.001), 50)
: 0.05;
self.setInterval = new Proxy(self.setInterval, {
apply: function(target, thisArg, args) {
@@ -1520,7 +1524,7 @@ function nanoSetTimeoutBooster(
if ( isNaN(delay) || isFinite(delay) === false ) { delay = 1000; }
let boost = parseFloat(boostArg);
boost = isNaN(boost) === false && isFinite(boost)
? Math.min(Math.max(boost, 0.02), 50)
? Math.min(Math.max(boost, 0.001), 50)
: 0.05;
self.setTimeout = new Proxy(self.setTimeout, {
apply: function(target, thisArg, args) {
@@ -2477,74 +2481,6 @@ function golemDe() {
/******************************************************************************/
builtinScriptlets.push({
name: 'adfly-defuser.js',
fn: adflyDefuser,
});
// https://github.com/reek/anti-adblock-killer/issues/3774#issuecomment-348536138
// https://github.com/uBlockOrigin/uAssets/issues/883
function adflyDefuser() {
// Based on AdsBypasser
// License:
// https://github.com/adsbypasser/adsbypasser/blob/master/LICENSE
var isDigit = /^\d$/;
var handler = function(encodedURL) {
var var1 = "", var2 = "", i;
for (i = 0; i < encodedURL.length; i++) {
if (i % 2 === 0) {
var1 = var1 + encodedURL.charAt(i);
} else {
var2 = encodedURL.charAt(i) + var2;
}
}
var data = (var1 + var2).split("");
for (i = 0; i < data.length; i++) {
if (isDigit.test(data[i])) {
for (var ii = i + 1; ii < data.length; ii++) {
if (isDigit.test(data[ii])) {
var temp = parseInt(data[i],10) ^ parseInt(data[ii],10);
if (temp < 10) {
data[i] = temp.toString();
}
i = ii;
break;
}
}
}
}
data = data.join("");
var decodedURL = window.atob(data).slice(16, -16);
window.stop();
window.onbeforeunload = null;
window.location.href = decodedURL;
};
try {
var val;
var flag = true;
window.Object.defineProperty(window, "ysmm", {
configurable: false,
set: function(value) {
if (flag) {
flag = false;
try {
if (typeof value === "string") {
handler(value);
}
} catch (err) { }
}
val = value;
},
get: function() {
return val;
}
});
} catch (err) {
window.console.error("Failed to set up Adfly bypasser!");
}
}
/******************************************************************************/
builtinScriptlets.push({
name: 'disable-newtab-links.js',
fn: disableNewtabLinks,
@@ -3779,7 +3715,11 @@ function trustedReplaceXhrResponse(
return textAfter;
}
get responseText() {
return this.response;
const response = this.response;
if ( typeof response !== 'string' ) {
return super.responseText;
}
return response;
}
};
}

2
dist/version vendored
View File

@@ -1 +1 @@
1.52.0
1.52.2

View File

@@ -720,7 +720,7 @@ body:not([data-more*="e"]) [data-more="e"] {
}
/* horizontally-constrained viewport */
:root.portrait body {
:root.portrait:not(.desktop) body {
overflow-y: auto;
width: 100%;
}

View File

@@ -3436,35 +3436,6 @@ class ExtSelectorCompiler {
return out.join('');
}
astAppendPart(part, out) {
const s = this.astSerializePart(part);
if ( s === undefined ) { return false; }
const { data } = part;
switch ( data.type ) {
case 'Combinator':
if ( out.length === 0 ) {
if ( s !== ' ' ) {
out.push(s, ' ');
}
} else {
out.push(' ');
if ( s !== ' ' ) {
out.push(s, ' ');
}
}
break;
// csstree parses `.promoted*` as valid
case 'TypeSelector':
if ( s === '*' && out.length !== 0 ) {
const before = out[out.length-1];
if ( before.endsWith(' ') === false ) { return false; }
}
out.push(s);
break;
}
return true;
}
astSerialize(parts, plainCSS = true) {
const out = [];
for ( const part of parts ) {
@@ -3482,10 +3453,23 @@ class ExtSelectorCompiler {
out.push(s);
break;
}
case 'Combinator':
case 'TypeSelector':
if ( this.astAppendPart(part, out) === false ) { return; }
case 'Combinator': {
const s = this.astSerializePart(part);
if ( s === undefined ) { return; }
if ( out.length !== 0 ) { out.push(' '); }
if ( s !== ' ' ) { out.push(s, ' '); }
break;
}
case 'TypeSelector': {
const s = this.astSerializePart(part);
if ( s === undefined ) { return; }
if ( s === '*' && out.length !== 0 ) {
const before = out[out.length-1];
if ( before.endsWith(' ') === false ) { return; }
}
out.push(s);
break;
}
case 'Raw':
if ( plainCSS ) { return; }
out.push(this.astSerializePart(part));
@@ -3509,6 +3493,7 @@ class ExtSelectorCompiler {
const out = { selector: '' };
const prelude = [];
const tasks = [];
let startOfSelector = true;
for ( const part of parts ) {
if ( out.action !== undefined ) { return; }
const { data } = part;
@@ -3534,13 +3519,20 @@ class ExtSelectorCompiler {
case 'PseudoClassSelector':
case 'PseudoElementSelector':
case 'TypeSelector': {
const component = this.astSerializePart(part);
if ( component === undefined ) { return; }
prelude.push(component);
const s = this.astSerializePart(part);
if ( s === undefined ) { return; }
prelude.push(s);
startOfSelector = false;
break;
}
case 'Combinator': {
if ( this.astAppendPart(part, prelude) === false ) { return; }
const s = this.astSerializePart(part);
if ( s === undefined ) { return; }
if ( startOfSelector === false || prelude.length !== 0 ) {
prelude.push(' ');
}
if ( s !== ' ' ) { prelude.push(s, ' '); }
startOfSelector = false;
break;
}
case 'ProceduralSelector': {
@@ -3557,14 +3549,17 @@ class ExtSelectorCompiler {
const args = this.compileArgumentAst(data.name, part.args);
if ( args === undefined ) { return; }
tasks.push([ data.name, args ]);
startOfSelector = false;
break;
}
case 'Selector':
if ( prelude.length !== 0 ) {
prelude.push(', ');
}
startOfSelector = true;
break;
case 'SelectorList':
startOfSelector = true;
break;
default:
return;
@@ -3687,7 +3682,7 @@ class ExtSelectorCompiler {
case 'has': {
let r = this.astCompile(parts, { noaction: true });
if ( typeof r === 'string' ) {
r = { selector: r.replace(/^\s*:scope\s*/, ' ') };
r = { selector: r.replace(/^\s*:scope\s*/, '') };
}
return r;
}