Skip to content

Commit 2a3e445

Browse files
author
Atlassian Bamboo
committed
deploy: update dist v1.9.83
1 parent b9e4ddd commit 2a3e445

File tree

6 files changed

+229
-65
lines changed

6 files changed

+229
-65
lines changed

dist/build.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
version=1.9.72
1+
version=1.9.83

dist/redirects.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#
22
# AdGuard Scriptlets (Redirects Source)
3-
# Version 1.9.72
3+
# Version 1.9.83
44
#
55
- title: 1x1-transparent.gif
66
added: v1.0.4

dist/scriptlets.corelibs.json

Lines changed: 22 additions & 9 deletions
Large diffs are not rendered by default.

dist/scriptlets.js

Lines changed: 101 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
/**
33
* AdGuard Scriptlets
4-
* Version 1.9.72
4+
* Version 1.9.83
55
*/
66

77
(function () {
@@ -1872,17 +1872,22 @@
18721872
* @param args fetch args
18731873
* @returns data object
18741874
*/
1875-
var getFetchData = function getFetchData(args) {
1875+
var getFetchData = function getFetchData(args, nativeRequestClone) {
18761876
var fetchPropsObj = {};
1877+
var resource = args[0];
18771878
var fetchUrl;
18781879
var fetchInit;
1879-
if (args[0] instanceof Request) {
1880+
if (resource instanceof Request) {
1881+
// Get real properties in case if data URL was used
1882+
// and properties were set by Object.defineProperty
1883+
// https://github.com/AdguardTeam/Scriptlets/issues/367
1884+
var realData = nativeRequestClone.call(resource);
18801885
// if Request passed to fetch, it will be in array
1881-
var requestData = getRequestData(args[0]);
1886+
var requestData = getRequestData(realData);
18821887
fetchUrl = requestData.url;
18831888
fetchInit = requestData;
18841889
} else {
1885-
fetchUrl = args[0]; // eslint-disable-line prefer-destructuring
1890+
fetchUrl = resource; // eslint-disable-line prefer-destructuring
18861891
fetchInit = args[1]; // eslint-disable-line prefer-destructuring
18871892
}
18881893

@@ -3937,6 +3942,30 @@
39373942
if (prevSetter !== undefined) {
39383943
prevSetter(a);
39393944
}
3945+
// Set a proxy trap to observe changes
3946+
// This is a partial fix and only works with a single scriptlet,
3947+
// a full fix requires synchronisation between the scriptlets
3948+
// TODO: add proper fix when synchronisation between scriptlets is added
3949+
// https://github.com/AdguardTeam/Scriptlets/issues/330
3950+
if (a instanceof Object) {
3951+
// Get properties which should be checked and remove first one
3952+
// because it's current object
3953+
var propertiesToCheck = property.split('.').slice(1);
3954+
a = new Proxy(a, {
3955+
get: function get(target, propertyKey, val) {
3956+
// Check if object contains required property, if so
3957+
// check if current value is equal to constantValue, if not, set it to constantValue
3958+
propertiesToCheck.reduce(function (object, currentProp, index, array) {
3959+
var currentObj = object === null || object === void 0 ? void 0 : object[currentProp];
3960+
if (currentObj && index === array.length - 1 && currentObj !== constantValue) {
3961+
object[currentProp] = constantValue;
3962+
}
3963+
return currentObj || object;
3964+
}, target);
3965+
return Reflect.get(target, propertyKey, val);
3966+
}
3967+
});
3968+
}
39403969
handler.set(a);
39413970
}
39423971
});
@@ -4470,6 +4499,9 @@
44704499
* A simple scriptlet which only purpose is to print arguments to console.
44714500
* This scriptlet can be helpful for debugging and troubleshooting other scriptlets.
44724501
*
4502+
* Related ABP source:
4503+
* https://gitlab.com/eyeo/snippets/-/blob/main/source/introspection/log.js
4504+
*
44734505
* ### Examples
44744506
*
44754507
* ```adblock
@@ -4485,7 +4517,7 @@
44854517
console.log(args); // eslint-disable-line no-console
44864518
}
44874519

4488-
log$1.names = ['log'];
4520+
log$1.names = ['log', 'abp-log'];
44894521

44904522
/* eslint-disable no-eval, no-extra-bind */
44914523

@@ -5609,7 +5641,7 @@
56095641
}
56105642
adjustSetInterval$1.names = ['adjust-setInterval',
56115643
// aliases are needed for matching the related scriptlet converted into our syntax
5612-
'nano-setInterval-booster.js', 'ubo-nano-setInterval-booster.js', 'nano-sib.js', 'ubo-nano-sib.js', 'ubo-nano-setInterval-booster', 'ubo-nano-sib'];
5644+
'nano-setInterval-booster.js', 'ubo-nano-setInterval-booster.js', 'nano-sib.js', 'ubo-nano-sib.js', 'adjust-setInterval.js', 'ubo-adjust-setInterval.js', 'ubo-nano-setInterval-booster', 'ubo-nano-sib', 'ubo-adjust-setInterval'];
56135645
adjustSetInterval$1.injections = [hit, isValidCallback, toRegExp, getBoostMultiplier, isDelayMatched, logMessage,
56145646
// following helpers should be injected as helpers above use them
56155647
nativeIsNaN, nativeIsFinite, getMatchDelay, shouldMatchAnyDelay];
@@ -5705,7 +5737,7 @@
57055737
}
57065738
adjustSetTimeout$1.names = ['adjust-setTimeout',
57075739
// aliases are needed for matching the related scriptlet converted into our syntax
5708-
'nano-setTimeout-booster.js', 'ubo-nano-setTimeout-booster.js', 'nano-stb.js', 'ubo-nano-stb.js', 'ubo-nano-setTimeout-booster', 'ubo-nano-stb'];
5740+
'adjust-setTimeout.js', 'ubo-adjust-setTimeout.js', 'nano-setTimeout-booster.js', 'ubo-nano-setTimeout-booster.js', 'nano-stb.js', 'ubo-nano-stb.js', 'ubo-adjust-setTimeout', 'ubo-nano-setTimeout-booster', 'ubo-nano-stb'];
57095741
adjustSetTimeout$1.injections = [hit, isValidCallback, toRegExp, getBoostMultiplier, isDelayMatched, logMessage,
57105742
// following helpers should be injected as helpers above use them
57115743
nativeIsNaN, nativeIsFinite, getMatchDelay, shouldMatchAnyDelay];
@@ -6398,6 +6430,7 @@
63986430
if (typeof fetch === 'undefined' || typeof Proxy === 'undefined' || typeof Response === 'undefined') {
63996431
return;
64006432
}
6433+
var nativeRequestClone = Request.prototype.clone;
64016434
var strResponseBody;
64026435
if (responseBody === '' || responseBody === 'emptyObj') {
64036436
strResponseBody = '{}';
@@ -6420,7 +6453,7 @@
64206453
}
64216454
var handlerWrapper = async function handlerWrapper(target, thisArg, args) {
64226455
var shouldPrevent = false;
6423-
var fetchData = getFetchData(args);
6456+
var fetchData = getFetchData(args, nativeRequestClone);
64246457
if (typeof propsToMatch === 'undefined') {
64256458
logMessage(source, "fetch( ".concat(objectToString(fetchData), " )"), true);
64266459
hit(source);
@@ -7221,7 +7254,9 @@
72217254
}
72227255
}
72237256
}
7224-
forceWindowClose$1.names = ['close-window', 'window-close-if.js', 'ubo-window-close-if.js', 'ubo-window-close-if'];
7257+
forceWindowClose$1.names = ['close-window',
7258+
// aliases are needed for matching the related scriptlet converted into our syntax
7259+
'window-close-if.js', 'ubo-window-close-if.js', 'ubo-window-close-if', 'close-window.js', 'ubo-close-window.js', 'ubo-close-window'];
72257260
forceWindowClose$1.injections = [hit, toRegExp, logMessage];
72267261

72277262
/* eslint-disable max-len */
@@ -7338,9 +7373,9 @@
73387373
// Aliases are needed for matching the related scriptlet converted into our syntax
73397374
// These are used by UBO rules syntax
73407375
// https://github.com/gorhill/uBlock/wiki/Resources-Library#general-purpose-scriptlets
7341-
'refresh-defuser.js', 'refresh-defuser',
7376+
'prevent-refresh.js', 'refresh-defuser.js', 'refresh-defuser',
73427377
// Prefix 'ubo-' is required to run converted rules
7343-
'ubo-refresh-defuser.js', 'ubo-refresh-defuser'];
7378+
'ubo-prevent-refresh.js', 'ubo-prevent-refresh', 'ubo-refresh-defuser.js', 'ubo-refresh-defuser'];
73447379
preventRefresh$1.injections = [hit, getNumberFromString, logMessage, nativeIsNaN];
73457380

73467381
/* eslint-disable max-len, consistent-return */
@@ -7675,10 +7710,12 @@
76757710
}
76767711
if (matchRequestProps(source, propsToMatch, xhrData)) {
76777712
thisArg.shouldBePrevented = true;
7713+
thisArg.headersReceived = !!thisArg.headersReceived;
76787714
}
76797715

76807716
// Trap setRequestHeader of target xhr object to mimic request headers later
7681-
if (thisArg.shouldBePrevented) {
7717+
if (thisArg.shouldBePrevented && !thisArg.headersReceived) {
7718+
thisArg.headersReceived = true;
76827719
thisArg.collectedHeaders = [];
76837720
var setRequestHeaderWrapper = function setRequestHeaderWrapper(target, thisArg, args) {
76847721
// Collect headers
@@ -8432,7 +8469,7 @@
84328469
*/
84338470
// TODO: make it compatible with $hls modifier
84348471
var pruneM3U = function pruneM3U(text) {
8435-
var lines = text.split(/\n\r|\n|\r/);
8472+
var lines = text.split(/\r?\n/);
84368473
if (text.includes(COMCAST_AD_MARKER.VMAP_AD_BREAK)) {
84378474
lines = pruneVmapBlock(lines);
84388475
return lines.filter(function (l) {
@@ -8965,11 +9002,12 @@
89659002
return;
89669003
}
89679004
var shouldLog = pattern === '' && replacement === '';
9005+
var nativeRequestClone = Request.prototype.clone;
89689006
var nativeFetch = fetch;
89699007
var shouldReplace = false;
89709008
var fetchData;
89719009
var handlerWrapper = function handlerWrapper(target, thisArg, args) {
8972-
fetchData = getFetchData(args);
9010+
fetchData = getFetchData(args, nativeRequestClone);
89739011
if (shouldLog) {
89749012
// log if no propsToMatch given
89759013
logMessage(source, "fetch( ".concat(objectToString(fetchData), " )"), true);
@@ -20210,7 +20248,7 @@
2021020248
return isM3U(text) && regexp.test(text);
2021120249
};
2021220250
var pruneM3U = function pruneM3U(text) {
20213-
var lines = text.split(/\n\r|\n|\r/);
20251+
var lines = text.split(/\r?\n/);
2021420252
if (text.includes(COMCAST_AD_MARKER.VMAP_AD_BREAK)) {
2021520253
lines = pruneVmapBlock(lines);
2021620254
return lines.filter(function (l) {
@@ -21520,6 +21558,7 @@
2152021558
if (typeof fetch === "undefined" || typeof Proxy === "undefined" || typeof Response === "undefined") {
2152121559
return;
2152221560
}
21561+
var nativeRequestClone = Request.prototype.clone;
2152321562
var strResponseBody;
2152421563
if (responseBody === "" || responseBody === "emptyObj") {
2152521564
strResponseBody = "{}";
@@ -21540,7 +21579,7 @@
2154021579
}
2154121580
var handlerWrapper = async function handlerWrapper(target, thisArg, args) {
2154221581
var shouldPrevent = false;
21543-
var fetchData = getFetchData(args);
21582+
var fetchData = getFetchData(args, nativeRequestClone);
2154421583
if (typeof propsToMatch === "undefined") {
2154521584
logMessage(source, "fetch( ".concat(objectToString(fetchData), " )"), true);
2154621585
hit(source);
@@ -21599,16 +21638,18 @@
2159921638
window.__debug(source);
2160021639
}
2160121640
}
21602-
function getFetchData(args) {
21641+
function getFetchData(args, nativeRequestClone) {
2160321642
var fetchPropsObj = {};
21643+
var resource = args[0];
2160421644
var fetchUrl;
2160521645
var fetchInit;
21606-
if (args[0] instanceof Request) {
21607-
var requestData = getRequestData(args[0]);
21646+
if (resource instanceof Request) {
21647+
var realData = nativeRequestClone.call(resource);
21648+
var requestData = getRequestData(realData);
2160821649
fetchUrl = requestData.url;
2160921650
fetchInit = requestData;
2161021651
} else {
21611-
fetchUrl = args[0];
21652+
fetchUrl = resource;
2161221653
fetchInit = args[1];
2161321654
}
2161421655
fetchPropsObj.url = fetchUrl;
@@ -24373,6 +24414,21 @@
2437324414
if (prevSetter !== undefined) {
2437424415
prevSetter(a);
2437524416
}
24417+
if (a instanceof Object) {
24418+
var propertiesToCheck = property.split(".").slice(1);
24419+
a = new Proxy(a, {
24420+
get: function get(target, propertyKey, val) {
24421+
propertiesToCheck.reduce(function (object, currentProp, index, array) {
24422+
var currentObj = object === null || object === void 0 ? void 0 : object[currentProp];
24423+
if (currentObj && index === array.length - 1 && currentObj !== constantValue) {
24424+
object[currentProp] = constantValue;
24425+
}
24426+
return currentObj || object;
24427+
}, target);
24428+
return Reflect.get(target, propertyKey, val);
24429+
}
24430+
});
24431+
}
2437624432
handler.set(a);
2437724433
}
2437824434
});
@@ -25599,11 +25655,12 @@
2559925655
return;
2560025656
}
2560125657
var shouldLog = pattern === "" && replacement === "";
25658+
var nativeRequestClone = Request.prototype.clone;
2560225659
var nativeFetch = fetch;
2560325660
var shouldReplace = false;
2560425661
var fetchData;
2560525662
var handlerWrapper = function handlerWrapper(target, thisArg, args) {
25606-
fetchData = getFetchData(args);
25663+
fetchData = getFetchData(args, nativeRequestClone);
2560725664
if (shouldLog) {
2560825665
logMessage(source, "fetch( ".concat(objectToString(fetchData), " )"), true);
2560925666
hit(source);
@@ -25713,16 +25770,18 @@
2571325770
}
2571425771
nativeConsole("".concat(name, ": ").concat(message));
2571525772
}
25716-
function getFetchData(args) {
25773+
function getFetchData(args, nativeRequestClone) {
2571725774
var fetchPropsObj = {};
25775+
var resource = args[0];
2571825776
var fetchUrl;
2571925777
var fetchInit;
25720-
if (args[0] instanceof Request) {
25721-
var requestData = getRequestData(args[0]);
25778+
if (resource instanceof Request) {
25779+
var realData = nativeRequestClone.call(resource);
25780+
var requestData = getRequestData(realData);
2572225781
fetchUrl = requestData.url;
2572325782
fetchInit = requestData;
2572425783
} else {
25725-
fetchUrl = args[0];
25784+
fetchUrl = resource;
2572625785
fetchInit = args[1];
2572725786
}
2572825787
fetchPropsObj.url = fetchUrl;
@@ -26085,8 +26144,10 @@
2608526144
}
2608626145
if (matchRequestProps(source, propsToMatch, xhrData)) {
2608726146
thisArg.shouldBePrevented = true;
26147+
thisArg.headersReceived = !!thisArg.headersReceived;
2608826148
}
26089-
if (thisArg.shouldBePrevented) {
26149+
if (thisArg.shouldBePrevented && !thisArg.headersReceived) {
26150+
thisArg.headersReceived = true;
2609026151
thisArg.collectedHeaders = [];
2609126152
var setRequestHeaderWrapper = function setRequestHeaderWrapper(target, thisArg, args) {
2609226153
thisArg.collectedHeaders.push(args);
@@ -27579,13 +27640,19 @@
2757927640
"ubo-nano-setInterval-booster.js": adjustSetInterval,
2758027641
"nano-sib.js": adjustSetInterval,
2758127642
"ubo-nano-sib.js": adjustSetInterval,
27643+
"adjust-setInterval.js": adjustSetInterval,
27644+
"ubo-adjust-setInterval.js": adjustSetInterval,
2758227645
"ubo-nano-setInterval-booster": adjustSetInterval,
2758327646
"ubo-nano-sib": adjustSetInterval,
27647+
"ubo-adjust-setInterval": adjustSetInterval,
2758427648
"adjust-setTimeout": adjustSetTimeout,
27649+
"adjust-setTimeout.js": adjustSetTimeout,
27650+
"ubo-adjust-setTimeout.js": adjustSetTimeout,
2758527651
"nano-setTimeout-booster.js": adjustSetTimeout,
2758627652
"ubo-nano-setTimeout-booster.js": adjustSetTimeout,
2758727653
"nano-stb.js": adjustSetTimeout,
2758827654
"ubo-nano-stb.js": adjustSetTimeout,
27655+
"ubo-adjust-setTimeout": adjustSetTimeout,
2758927656
"ubo-nano-setTimeout-booster": adjustSetTimeout,
2759027657
"ubo-nano-stb": adjustSetTimeout,
2759127658
"debug-current-inline-script": debugCurrentInlineScript,
@@ -27604,6 +27671,9 @@
2760427671
"window-close-if.js": forceWindowClose,
2760527672
"ubo-window-close-if.js": forceWindowClose,
2760627673
"ubo-window-close-if": forceWindowClose,
27674+
"close-window.js": forceWindowClose,
27675+
"ubo-close-window.js": forceWindowClose,
27676+
"ubo-close-window": forceWindowClose,
2760727677
"hide-in-shadow-dom": hideInShadowDom,
2760827678
"inject-css-in-shadow-dom": injectCssInShadowDom,
2760927679
"json-prune": jsonPrune,
@@ -27612,6 +27682,7 @@
2761227682
"ubo-json-prune": jsonPrune,
2761327683
"abp-json-prune": jsonPrune,
2761427684
log: log,
27685+
"abp-log": log,
2761527686
"log-addEventListener": logAddEventListener,
2761627687
"addEventListener-logger.js": logAddEventListener,
2761727688
"ubo-addEventListener-logger.js": logAddEventListener,
@@ -27670,8 +27741,11 @@
2767027741
"ubo-popads.net.js": preventPopadsNet,
2767127742
"ubo-popads.net": preventPopadsNet,
2767227743
"prevent-refresh": preventRefresh,
27744+
"prevent-refresh.js": preventRefresh,
2767327745
"refresh-defuser.js": preventRefresh,
2767427746
"refresh-defuser": preventRefresh,
27747+
"ubo-prevent-refresh.js": preventRefresh,
27748+
"ubo-prevent-refresh": preventRefresh,
2767527749
"ubo-refresh-defuser.js": preventRefresh,
2767627750
"ubo-refresh-defuser": preventRefresh,
2767727751
"prevent-requestAnimationFrame": preventRequestAnimationFrame,

0 commit comments

Comments
 (0)