|
1 | 1 |
|
2 | 2 | /** |
3 | 3 | * AdGuard Scriptlets |
4 | | - * Version 1.9.96 |
| 4 | + * Version 1.9.101 |
5 | 5 | */ |
6 | 6 |
|
7 | 7 | (function () { |
|
1184 | 1184 | } |
1185 | 1185 | }); |
1186 | 1186 |
|
| 1187 | + // In the case if responseType is opaque |
| 1188 | + // mock response' body, status & statusText to avoid adb checks |
| 1189 | + // https://github.com/AdguardTeam/Scriptlets/issues/364 |
| 1190 | + if (responseType === 'opaque') { |
| 1191 | + Object.defineProperties(response, { |
| 1192 | + body: { |
| 1193 | + value: null |
| 1194 | + }, |
| 1195 | + status: { |
| 1196 | + value: 0 |
| 1197 | + }, |
| 1198 | + statusText: { |
| 1199 | + value: '' |
| 1200 | + } |
| 1201 | + }); |
| 1202 | + } |
| 1203 | + |
1187 | 1204 | // eslint-disable-next-line consistent-return |
1188 | 1205 | return Promise.resolve(response); |
1189 | 1206 | }; |
|
6402 | 6419 | * defaults to `emptyObj`. Possible values: |
6403 | 6420 | * - `emptyObj` — empty object |
6404 | 6421 | * - `emptyArr` — empty array |
| 6422 | + * - `emptyStr` — empty string |
6405 | 6423 | * - `responseType` — optional, string for defining response type, |
6406 | 6424 | * original response type is used if not specified. Possible values: |
6407 | 6425 | * - `default` |
|
6478 | 6496 | strResponseBody = '{}'; |
6479 | 6497 | } else if (responseBody === 'emptyArr') { |
6480 | 6498 | strResponseBody = '[]'; |
| 6499 | + } else if (responseBody === 'emptyStr') { |
| 6500 | + strResponseBody = ''; |
6481 | 6501 | } else { |
6482 | 6502 | logMessage(source, "Invalid responseBody parameter: '".concat(responseBody, "'")); |
6483 | 6503 | return; |
|
10158 | 10178 | ubo: 'noop.js', |
10159 | 10179 | abp: 'blank-js' |
10160 | 10180 | }, { |
10161 | | - adg: 'noopjson' |
| 10181 | + adg: 'noopjson', |
| 10182 | + ubo: 'noop.json' |
10162 | 10183 | }, { |
10163 | 10184 | adg: 'nooptext', |
10164 | 10185 | ubo: 'noop.txt', |
|
11999 | 12020 | setCookieOptions: noopThis, |
12000 | 12021 | setForceSafeFrame: noopThis, |
12001 | 12022 | setLocation: noopThis, |
| 12023 | + setPrivacySettings: noopThis, |
12002 | 12024 | setPublisherProvidedId: noopThis, |
12003 | 12025 | setRequestNonPersonalizedAds: noopThis, |
12004 | 12026 | setSafeFrameConfig: noopThis, |
|
16895 | 16917 | "noop.js": "noopjs.js", |
16896 | 16918 | "blank-js": "noopjs.js", |
16897 | 16919 | noopjson: "noopjson.json", |
| 16920 | + "noop.json": "noopjson.json", |
16898 | 16921 | nooptext: "nooptext.js", |
16899 | 16922 | "noop.txt": "nooptext.js", |
16900 | 16923 | "blank-text": "nooptext.js", |
|
17044 | 17067 | convertAdgRedirectToUbo |
17045 | 17068 | }; |
17046 | 17069 |
|
| 17070 | + var version = "1.9.101"; |
| 17071 | + |
17047 | 17072 | function abortCurrentInlineScript(source, args) { |
17048 | 17073 | function abortCurrentInlineScript(source, property, search) { |
17049 | 17074 | var searchRegexp = toRegExp(search); |
|
20841 | 20866 | value: responseType |
20842 | 20867 | } |
20843 | 20868 | }); |
| 20869 | + if (responseType === "opaque") { |
| 20870 | + Object.defineProperties(response, { |
| 20871 | + body: { |
| 20872 | + value: null |
| 20873 | + }, |
| 20874 | + status: { |
| 20875 | + value: 0 |
| 20876 | + }, |
| 20877 | + statusText: { |
| 20878 | + value: "" |
| 20879 | + } |
| 20880 | + }); |
| 20881 | + } |
20844 | 20882 | return Promise.resolve(response); |
20845 | 20883 | } |
20846 | 20884 | var updatedArgs = args ? [].concat(source).concat(args) : [source]; |
|
21757 | 21795 | strResponseBody = "{}"; |
21758 | 21796 | } else if (responseBody === "emptyArr") { |
21759 | 21797 | strResponseBody = "[]"; |
| 21798 | + } else if (responseBody === "emptyStr") { |
| 21799 | + strResponseBody = ""; |
21760 | 21800 | } else { |
21761 | 21801 | logMessage(source, "Invalid responseBody parameter: '".concat(responseBody, "'")); |
21762 | 21802 | return; |
|
21922 | 21962 | value: responseType |
21923 | 21963 | } |
21924 | 21964 | }); |
| 21965 | + if (responseType === "opaque") { |
| 21966 | + Object.defineProperties(response, { |
| 21967 | + body: { |
| 21968 | + value: null |
| 21969 | + }, |
| 21970 | + status: { |
| 21971 | + value: 0 |
| 21972 | + }, |
| 21973 | + statusText: { |
| 21974 | + value: "" |
| 21975 | + } |
| 21976 | + }); |
| 21977 | + } |
21925 | 21978 | return Promise.resolve(response); |
21926 | 21979 | } |
21927 | 21980 | function modifyResponse(origResponse) { |
|
24788 | 24841 | value: responseType |
24789 | 24842 | } |
24790 | 24843 | }); |
| 24844 | + if (responseType === "opaque") { |
| 24845 | + Object.defineProperties(response, { |
| 24846 | + body: { |
| 24847 | + value: null |
| 24848 | + }, |
| 24849 | + status: { |
| 24850 | + value: 0 |
| 24851 | + }, |
| 24852 | + statusText: { |
| 24853 | + value: "" |
| 24854 | + } |
| 24855 | + }); |
| 24856 | + } |
24791 | 24857 | return Promise.resolve(response); |
24792 | 24858 | } |
24793 | 24859 | function getPropertyInChain(base, chain) { |
|
28606 | 28672 | convertAbpToAdg: convertAbpSnippetToAdg, |
28607 | 28673 | convertScriptletToAdg, |
28608 | 28674 | convertAdgToUbo: convertAdgScriptletToUbo, |
28609 | | - redirects |
| 28675 | + redirects, |
| 28676 | + SCRIPTLETS_VERSION: version |
28610 | 28677 | }; |
28611 | 28678 | }(); |
28612 | 28679 |
|
|
0 commit comments