From 25c9820494ae8d1e1d35dddfac7dfb2e8f4b2547 Mon Sep 17 00:00:00 2001 From: Stanislav A Date: Tue, 20 Dec 2022 13:29:55 +0300 Subject: [PATCH] update changelog and fix typos in test --- CHANGELOG.md | 53 +++++++++++-------- .../trusted-replace-xhr-response.test.js | 8 ++- 2 files changed, 33 insertions(+), 28 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f8487501..757985df 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,41 +1,48 @@ # Scriptlets and Redirect Resources Changelog +## 1.8.0 + +### Fixed + +- `prevent-xhr` and `trusted-replace-xhr-response` closure bug on multiple requests [#261](https://github.com/AdguardTeam/Scriptlets/issues/261) + + ## v1.7.10 ### Added -* new scriptlet `trusted-set-cookie-reload` +- new scriptlet `trusted-set-cookie-reload` ### Fixed -* `set-cookie-reload` infinite page reloading [#265](https://github.com/AdguardTeam/Scriptlets/issues/265) -* breakage of `prevent-element-src-loading` due to `window` getting into `apply` wrapper [#264](https://github.com/AdguardTeam/Scriptlets/issues/264) -* spread of args bug at `getXhrData` call for `trusted-replace-xhr-response` -* request properties array not being served to `getRequestData` and `parseMatchProps` helpers +- `set-cookie-reload` infinite page reloading [#265](https://github.com/AdguardTeam/Scriptlets/issues/265) +- breakage of `prevent-element-src-loading` due to `window` getting into `apply` wrapper [#264](https://github.com/AdguardTeam/Scriptlets/issues/264) +- spread of args bug at `getXhrData` call for `trusted-replace-xhr-response` +- request properties array not being served to `getRequestData` and `parseMatchProps` helpers ## v1.7.3 ### Added -* [Trusted scriptlets](./README.md#trusted-scriptlets) with extended capabilities: - * trusted-click-element [#23](https://github.com/AdguardTeam/Scriptlets/issues/23) - * trusted-replace-xhr-response [#202](https://github.com/AdguardTeam/Scriptlets/issues/202) - * trusted-replace-fetch-response - * trusted-set-local-storage-item - * trusted-set-cookie +- [Trusted scriptlets](./README.md#trusted-scriptlets) with extended capabilities: + - trusted-click-element [#23](https://github.com/AdguardTeam/Scriptlets/issues/23) + - trusted-replace-xhr-response [#202](https://github.com/AdguardTeam/Scriptlets/issues/202) + - trusted-replace-fetch-response + - trusted-set-local-storage-item + - trusted-set-cookie -* Scriptlets: - * xml-prune [#249](https://github.com/AdguardTeam/Scriptlets/issues/249) +- Scriptlets: + - xml-prune [#249](https://github.com/AdguardTeam/Scriptlets/issues/249) ### Improved -* Scriptlets: - * prevent-element-src-loading [#228](https://github.com/AdguardTeam/Scriptlets/issues/228) - * prevent-fetch [#216](https://github.com/AdguardTeam/Scriptlets/issues/216) - * abort-on-stack-trace [#201](https://github.com/AdguardTeam/Scriptlets/issues/201) - * abort-current-inline-script [#251](https://github.com/AdguardTeam/Scriptlets/issues/251) - * set-cookie & set-cookie-reload -* Redirects: - * google-ima3 [#255](https://github.com/AdguardTeam/Scriptlets/issues/255) - * metrika-yandex-tag [#254](https://github.com/AdguardTeam/Scriptlets/issues/254) - * googlesyndication-adsbygoogle [#252](https://github.com/AdguardTeam/Scriptlets/issues/252) +- Scriptlets: + - prevent-element-src-loading [#228](https://github.com/AdguardTeam/Scriptlets/issues/228) + - prevent-fetch [#216](https://github.com/AdguardTeam/Scriptlets/issues/216) + - abort-on-stack-trace [#201](https://github.com/AdguardTeam/Scriptlets/issues/201) + - abort-current-inline-script [#251](https://github.com/AdguardTeam/Scriptlets/issues/251) + - set-cookie & set-cookie-reload +- Redirects: + - google-ima3 [#255](https://github.com/AdguardTeam/Scriptlets/issues/255) + - metrika-yandex-tag [#254](https://github.com/AdguardTeam/Scriptlets/issues/254) + - googlesyndication-adsbygoogle [#252](https://github.com/AdguardTeam/Scriptlets/issues/252) diff --git a/tests/scriptlets/trusted-replace-xhr-response.test.js b/tests/scriptlets/trusted-replace-xhr-response.test.js index 2efbc4ea..92ff2171 100644 --- a/tests/scriptlets/trusted-replace-xhr-response.test.js +++ b/tests/scriptlets/trusted-replace-xhr-response.test.js @@ -203,7 +203,7 @@ if (isSupported) { const URL_TO_BLOCK = `${FETCH_OBJECTS_PATH}/test01.json`; const PATTERN = '*'; const REPLACEMENT = ''; - const MATCH_DATA = [PATTERN, REPLACEMENT, `${URL}`]; + const MATCH_DATA = [PATTERN, REPLACEMENT, 'test01']; runScriptlet(name, MATCH_DATA); @@ -217,19 +217,17 @@ if (isSupported) { xhr2.open(METHOD, URL_TO_BLOCK); xhr1.onload = () => { - console.log(xhr1.response); assert.strictEqual(xhr1.readyState, 4, 'Response done'); assert.ok(xhr1.response.includes(INTACT_RESPONSE_PART), 'Response is intact'); - assert.strictEqual(window.hit, undefined, 'hit should not fire'); done1(); }; xhr2.onload = () => { assert.strictEqual(xhr2.readyState, 4, 'Response done'); - assert.notOk(xhr2.response === '', 'Response has been removed'); + assert.ok(xhr2.response === '', 'Response has been removed'); - assert.strictEqual(window.hit, undefined, 'hit function fired'); + assert.strictEqual(window.hit, 'FIRED', 'hit function fired'); done2(); };