Skip to content

Commit 6c0a4f6

Browse files
committed
AG-42158, AG-45017, AG-51868 Improve set-cookie scriptlets — add 'all', 'mandatory' and 'declined' to predefined constants. #501, #518, #552
Squashed commit of the following: commit 5168fc0 Author: Adam Wróblewski <adam@adguard.com> Date: Fri Mar 13 16:07:43 2026 +0100 Add `all`, `mandatory` and `declined` as new values for `set-cookie` and `set-cookie-reload`
1 parent fa5555b commit 6c0a4f6

5 files changed

Lines changed: 18 additions & 0 deletions

File tree

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ The format is based on [Keep a Changelog], and this project adheres to [Semantic
1414

1515
### Added
1616

17+
- New value to `set-cookie` and `set-cookie-reload` scriptlets: `all` [#501].
18+
- New value to `set-cookie` and `set-cookie-reload` scriptlets: `mandatory` [#518].
19+
- New value to `set-cookie` and `set-cookie-reload` scriptlets: `declined` [#552].
1720
- `trusted-json-set`, `trusted-json-set-fetch-response`
1821
and `trusted-json-set-xhr-response` scriptlets [#308].
1922
- `freewheel-admanager` redirect resource and scriptlet [#401].
@@ -38,10 +41,13 @@ The format is based on [Keep a Changelog], and this project adheres to [Semantic
3841
[Unreleased]: https://github.com/AdguardTeam/Scriptlets/compare/v2.2.16...HEAD
3942
[#308]: https://github.com/AdguardTeam/Scriptlets/issues/308
4043
[#401]: https://github.com/AdguardTeam/Scriptlets/issues/401
44+
[#501]: https://github.com/AdguardTeam/Scriptlets/issues/501
4145
[#513]: https://github.com/AdguardTeam/Scriptlets/issues/513
4246
[#515]: https://github.com/AdguardTeam/Scriptlets/issues/515
47+
[#518]: https://github.com/AdguardTeam/Scriptlets/issues/518
4348
[#545]: https://github.com/AdguardTeam/Scriptlets/issues/545
4449
[#549]: https://github.com/AdguardTeam/Scriptlets/issues/549
50+
[#552]: https://github.com/AdguardTeam/Scriptlets/issues/552
4551

4652
## [v2.2.16] - 2026-02-19
4753

src/helpers/cookie-utils.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,9 @@ export const getLimitedCookieValue = (value: string): string | number | null =>
134134
'unchecked',
135135
'forbidden',
136136
'forever',
137+
'declined',
138+
'mandatory',
139+
'all',
137140
]);
138141

139142
let validValue;

src/scriptlets/set-cookie-reload.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,15 @@ import {
3333
* - `no` / `n`
3434
* - `ok`
3535
* - `on` / `off`
36+
* - `all`
3637
* - `accept`/ `accepted` / `notaccepted`
3738
* - `reject` / `rejected`
3839
* - `allow` / `allowed`
40+
* - `declined`
3941
* - `disallow` / `deny` / `denied`
4042
* - `enable` / `enabled`
4143
* - `disable` / `disabled`
44+
* - `mandatory`
4245
* - `necessary` / `required`
4346
* - `hide` / `hidden`
4447
* - `essential` / `nonessential`

src/scriptlets/set-cookie.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,15 @@ import {
3535
* - `no` / `n`
3636
* - `ok`
3737
* - `on` / `off`
38+
* - `all`
3839
* - `accept`/ `accepted` / `notaccepted`
3940
* - `reject` / `rejected`
4041
* - `allow` / `allowed`
42+
* - `declined`
4143
* - `disallow` / `deny` / `denied`
4244
* - `enable` / `enabled`
4345
* - `disable` / `disabled`
46+
* - `mandatory`
4447
* - `necessary` / `required`
4548
* - `hide` / `hidden`
4649
* - `essential` / `nonessential`

tests/scriptlets/set-cookie.test.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,9 @@ const cookies = [
7373
['__test-cookie_forever', 'forever'],
7474
['__test-cookie_emptyArray', 'emptyArr'],
7575
['__test-cookie_emptyObject', 'emptyObj'],
76+
['__test-cookie_all', 'all'],
77+
['__test-cookie_mandatory', 'mandatory'],
78+
['__test-cookie_declined', 'declined'],
7679
];
7780

7881
test.each('Set cookie with valid value', cookies, (assert, [cName, cValue]) => {

0 commit comments

Comments
 (0)