From 61e8f86a3a3f746e4ed07d629d613da106a53681 Mon Sep 17 00:00:00 2001 From: Maxim Tsoy Date: Thu, 29 Aug 2024 23:39:06 +0200 Subject: [PATCH 1/3] Fix the cookie getter passthrough call --- src/features/cookie.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/features/cookie.js b/src/features/cookie.js index ba488d23a..38ae44e96 100644 --- a/src/features/cookie.js +++ b/src/features/cookie.js @@ -155,7 +155,7 @@ export default class CookieFeature extends ContentFeature { debugHelper('ignore', '3p frame', getCookieContext) } // @ts-expect-error - error TS18048: 'cookieSetter' is possibly 'undefined'. - return cookieGetter.call(document) + return cookieGetter.call(this) } /** From b7a46fbfd30d31f277a98232c10acacceebb0d2c Mon Sep 17 00:00:00 2001 From: Maxim Tsoy Date: Thu, 29 Aug 2024 23:50:26 +0200 Subject: [PATCH 2/3] Fix coookie setter passthrough call --- src/features/cookie.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/features/cookie.js b/src/features/cookie.js index 38ae44e96..6df5e1dc0 100644 --- a/src/features/cookie.js +++ b/src/features/cookie.js @@ -186,7 +186,7 @@ export default class CookieFeature extends ContentFeature { // if the value is valid. We will override this set later if the policy dictates that // the expiry should be changed. // @ts-expect-error - error TS18048: 'cookieSetter' is possibly 'undefined'. - cookieSetter.call(document, argValue) + cookieSetter.call(this, argValue) try { // wait for config before doing same-site tests From d19c03f127e1ab4d8c7a98bc6336503da08ce661 Mon Sep 17 00:00:00 2001 From: Maxim Tsoy Date: Thu, 29 Aug 2024 23:52:25 +0200 Subject: [PATCH 3/3] Cleanup --- src/features/cookie.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/features/cookie.js b/src/features/cookie.js index 6df5e1dc0..efcfe52ac 100644 --- a/src/features/cookie.js +++ b/src/features/cookie.js @@ -154,7 +154,7 @@ export default class CookieFeature extends ContentFeature { } else if (isTrackingCookie() || isNonTrackingCookie()) { debugHelper('ignore', '3p frame', getCookieContext) } - // @ts-expect-error - error TS18048: 'cookieSetter' is possibly 'undefined'. + // @ts-expect-error - error TS18048: 'cookieGetter' is possibly 'undefined'. return cookieGetter.call(this) } @@ -225,9 +225,7 @@ export default class CookieFeature extends ContentFeature { } } - this.defineProperty(globalThis.Document.prototype, 'cookie', { - enumerable: true, - configurable: true, + this.wrapProperty(globalThis.Document.prototype, 'cookie', { set: setCookiePolicy, get: getCookiePolicy })