Skip to content

Commit 2d20aa3

Browse files
Release build 4.42.0 [ci release]
1 parent e467598 commit 2d20aa3

File tree

13 files changed

+954
-835
lines changed

13 files changed

+954
-835
lines changed

Sources/ContentScopeScripts/dist/contentScope.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@
2525
};
2626
/*! © DuckDuckGo ContentScopeScripts protections https://github.com/duckduckgo/content-scope-scripts/ */
2727
(function() {
28-
var _bundledConfig, _trackerLookup, _documentOriginIsTracker, _bundledfeatureSettings, _messagingContext, _debugMessaging, _isDebugFlagSet, _args, _tagName, _el, _listeners, _connected, _sinks, _debug;
2928
"use strict";
29+
var _bundledConfig, _trackerLookup, _documentOriginIsTracker, _bundledfeatureSettings, _messagingContext, _debugMessaging, _isDebugFlagSet, _args, _tagName, _el, _listeners, _connected, _sinks, _debug;
3030
const Set$1 = globalThis.Set;
3131
const Reflect$1 = globalThis.Reflect;
3232
globalThis.customElements?.get.bind(globalThis.customElements);

Sources/ContentScopeScripts/dist/contentScopeIsolated.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3281,8 +3281,9 @@
32813281
*/
32823282
toPrivatePlayerUrl () {
32833283
// no try/catch because we already validated the ID
3284-
const duckUrl = new URL(this.id, 'https://player');
3285-
duckUrl.protocol = 'duck:';
3284+
// in Microsoft WebView2 v118+ changing from special protocol (https) to non-special one (duck) is forbidden
3285+
// so we need to construct duck player this way
3286+
const duckUrl = new URL(`duck://player/${this.id}`);
32863287

32873288
if (this.time) {
32883289
duckUrl.searchParams.set('t', this.time);

build/chrome-mv3/inject.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3529,7 +3529,7 @@
35293529
*/
35303530
function setCookiePolicy (argValue) {
35313531
let setCookieContext = null;
3532-
if (!argValue.toString || typeof argValue.toString() !== 'string') {
3532+
if (!argValue?.toString || typeof argValue.toString() !== 'string') {
35333533
// not a string, or string-like
35343534
return
35353535
}

build/chrome/inject.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/contentScope.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11271,7 +11271,7 @@
1127111271
*/
1127211272
function setCookiePolicy (argValue) {
1127311273
let setCookieContext = null;
11274-
if (!argValue.toString || typeof argValue.toString() !== 'string') {
11274+
if (!argValue?.toString || typeof argValue.toString() !== 'string') {
1127511275
// not a string, or string-like
1127611276
return
1127711277
}
@@ -12448,8 +12448,9 @@
1244812448
*/
1244912449
toPrivatePlayerUrl () {
1245012450
// no try/catch because we already validated the ID
12451-
const duckUrl = new URL(this.id, 'https://player');
12452-
duckUrl.protocol = 'duck:';
12451+
// in Microsoft WebView2 v118+ changing from special protocol (https) to non-special one (duck) is forbidden
12452+
// so we need to construct duck player this way
12453+
const duckUrl = new URL(`duck://player/${this.id}`);
1245312454

1245412455
if (this.time) {
1245512456
duckUrl.searchParams.set('t', this.time);

build/firefox/inject.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3581,7 +3581,7 @@
35813581
*/
35823582
function setCookiePolicy (argValue) {
35833583
let setCookieContext = null;
3584-
if (!argValue.toString || typeof argValue.toString() !== 'string') {
3584+
if (!argValue?.toString || typeof argValue.toString() !== 'string') {
35853585
// not a string, or string-like
35863586
return
35873587
}

build/integration/contentScope.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11271,7 +11271,7 @@
1127111271
*/
1127211272
function setCookiePolicy (argValue) {
1127311273
let setCookieContext = null;
11274-
if (!argValue.toString || typeof argValue.toString() !== 'string') {
11274+
if (!argValue?.toString || typeof argValue.toString() !== 'string') {
1127511275
// not a string, or string-like
1127611276
return
1127711277
}
@@ -12448,8 +12448,9 @@
1244812448
*/
1244912449
toPrivatePlayerUrl () {
1245012450
// no try/catch because we already validated the ID
12451-
const duckUrl = new URL(this.id, 'https://player');
12452-
duckUrl.protocol = 'duck:';
12451+
// in Microsoft WebView2 v118+ changing from special protocol (https) to non-special one (duck) is forbidden
12452+
// so we need to construct duck player this way
12453+
const duckUrl = new URL(`duck://player/${this.id}`);
1245312454

1245412455
if (this.time) {
1245512456
duckUrl.searchParams.set('t', this.time);

build/windows/contentScope.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3588,7 +3588,7 @@
35883588
*/
35893589
function setCookiePolicy (argValue) {
35903590
let setCookieContext = null;
3591-
if (!argValue.toString || typeof argValue.toString() !== 'string') {
3591+
if (!argValue?.toString || typeof argValue.toString() !== 'string') {
35923592
// not a string, or string-like
35933593
return
35943594
}
@@ -8504,8 +8504,9 @@
85048504
*/
85058505
toPrivatePlayerUrl () {
85068506
// no try/catch because we already validated the ID
8507-
const duckUrl = new URL(this.id, 'https://player');
8508-
duckUrl.protocol = 'duck:';
8507+
// in Microsoft WebView2 v118+ changing from special protocol (https) to non-special one (duck) is forbidden
8508+
// so we need to construct duck player this way
8509+
const duckUrl = new URL(`duck://player/${this.id}`);
85098510

85108511
if (this.time) {
85118512
duckUrl.searchParams.set('t', this.time);

integration-test/test-cookie.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,4 +52,26 @@ describe('Cookie protection tests', () => {
5252
expect(result.value).toEqual('b')
5353
expect(result.expires).toBeLessThan(Date.now() + 605_000_000)
5454
})
55+
56+
it('Erroneous values do not throw', async () => {
57+
const page = await browser.newPage()
58+
await page.goto('http://localhost:8080/index.html')
59+
60+
const result = await page.evaluate(async () => {
61+
// @ts-expect-error - Invalid argument to document.cookie on purpose for test
62+
document.cookie = null
63+
64+
// @ts-expect-error - Invalid argument to document.cookie on purpose for test
65+
document.cookie = undefined
66+
67+
// wait for a tick, as cookie modification happens in a promise
68+
await new Promise((resolve) => setTimeout(resolve, 1))
69+
// @ts-expect-error - cookieStore API types are missing here
70+
// eslint-disable-next-line no-undef
71+
return cookieStore.get('a')
72+
})
73+
expect(result.name).toEqual('a')
74+
expect(result.value).toEqual('b')
75+
expect(result.expires).toBeLessThan(Date.now() + 605_000_000)
76+
})
5577
})

0 commit comments

Comments
 (0)