diff --git a/CHANGELOG.md b/CHANGELOG.md index 778b12f63..7b5b7057b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,9 +13,11 @@ The format is based on [Keep a Changelog], and this project adheres to [Semantic - support for matching line number in `abort-on-stack-trace` scriptlet when `inlineScript` or `injectedScript` option is used [#439] +- new values to `set-cookie` and `set-cookie-reload` scriptlets: `checked`, `unchecked` [#444] [Unreleased]: https://github.com/AdguardTeam/Scriptlets/compare/v1.11.16...HEAD [#439]: https://github.com/AdguardTeam/Scriptlets/issues/439 +[#444]: https://github.com/AdguardTeam/Scriptlets/issues/444 ## [v1.11.16] - 2024-08-01 diff --git a/src/helpers/cookie-utils.ts b/src/helpers/cookie-utils.ts index fab3e4881..8cff2caa5 100644 --- a/src/helpers/cookie-utils.ts +++ b/src/helpers/cookie-utils.ts @@ -108,6 +108,8 @@ export const getLimitedCookieValue = (value: string): string | number | null => 'hidden', 'essential', 'nonessential', + 'checked', + 'unchecked', ]); let validValue; diff --git a/src/scriptlets/set-cookie-reload.js b/src/scriptlets/set-cookie-reload.js index 5e669d886..c421d5b2f 100644 --- a/src/scriptlets/set-cookie-reload.js +++ b/src/scriptlets/set-cookie-reload.js @@ -44,6 +44,7 @@ import { * - `necessary` / `required` * - `hide` / `hidden` * - `essential` / `nonessential` + * - `checked` / `unchecked` * - `path` — optional, cookie path, defaults to `/`; possible values: * - `/` — root path * - `none` — to set no path at all diff --git a/src/scriptlets/set-cookie.js b/src/scriptlets/set-cookie.js index 5c82c16ec..392bb6de3 100644 --- a/src/scriptlets/set-cookie.js +++ b/src/scriptlets/set-cookie.js @@ -46,6 +46,7 @@ import { * - `necessary` / `required` * - `hide` / `hidden` * - `essential` / `nonessential` + * - `checked` / `unchecked` * - `path` — optional, cookie path, defaults to `/`; possible values: * - `/` — root path * - `none` — to set no path at all diff --git a/tests/scriptlets/set-cookie.test.js b/tests/scriptlets/set-cookie.test.js index b55768863..e1a6fb466 100644 --- a/tests/scriptlets/set-cookie.test.js +++ b/tests/scriptlets/set-cookie.test.js @@ -70,6 +70,8 @@ const cookies = [ ['__test-cookie_hidden', 'hidden'], ['__test-cookie_essential', 'essential'], ['__test-cookie_nonessential', 'nonessential'], + ['__test-cookie_checked', 'checked'], + ['__test-cookie_unchecked', 'unchecked'], ]; test.each('Set cookie with valid value', cookies, (assert, [cName, cValue]) => {