Skip to content

Commit

Permalink
AG-35299 Improve 'set-cookie' — add 'checked' and 'unchecked' to supp…
Browse files Browse the repository at this point in the history
…orted values. #444
  • Loading branch information
jellizaveta committed Aug 21, 2024
1 parent c8985b7 commit ac72ad4
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 2 additions & 0 deletions src/helpers/cookie-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@ export const getLimitedCookieValue = (value: string): string | number | null =>
'hidden',
'essential',
'nonessential',
'checked',
'unchecked',
]);

let validValue;
Expand Down
1 change: 1 addition & 0 deletions src/scriptlets/set-cookie-reload.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions src/scriptlets/set-cookie.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions tests/scriptlets/set-cookie.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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]) => {
Expand Down

0 comments on commit ac72ad4

Please sign in to comment.