Skip to content

Commit 2b9aefb

Browse files
bakulfmoz-wptsync-bot
authored andcommitted
Fix WPT cookie-store/cookieListItem_attributes.https.any.serviceworker.html
Differential Revision: https://phabricator.services.mozilla.com/D248736 bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1965167 gecko-commit: 34d43db4541911e3b736ed59ebd4fd36690746ef gecko-reviewers: valentin
1 parent c9780b1 commit 2b9aefb

File tree

1 file changed

+15
-12
lines changed

1 file changed

+15
-12
lines changed

cookie-store/cookieListItem_attributes.https.any.js

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -208,19 +208,22 @@ promise_test(async testCase => {
208208
assert_equals(cookie.secure, true);
209209
}, 'CookieListItem - secure defaults to true');
210210

211-
promise_test(async testCase => {
212-
await cookieStore.delete('cookie-name');
213-
testCase.add_cleanup(async () => {
211+
212+
if (self.GLOBAL.isWindow()) {
213+
promise_test(async testCase => {
214214
await cookieStore.delete('cookie-name');
215-
});
215+
testCase.add_cleanup(async () => {
216+
await cookieStore.delete('cookie-name');
217+
});
216218

217-
let encodedCookie = encodeURIComponent(JSON.stringify("cookie-name=1; max-age=99999999999999999999999999999; path=/"));
218-
await fetch(`/cookies/resources/cookie.py?set=${encodedCookie}`);
219+
let encodedCookie = encodeURIComponent(JSON.stringify("cookie-name=1; max-age=99999999999999999999999999999; path=/"));
220+
await fetch(`/cookies/resources/cookie.py?set=${encodedCookie}`);
219221

220-
assert_equals(document.cookie, "cookie-name=1", 'The cookie was set as expected.');
222+
assert_equals(document.cookie, "cookie-name=1", 'The cookie was set as expected.');
221223

222-
const cookie = await cookieStore.get('cookie-name');
223-
assert_equals(cookie.name, 'cookie-name');
224-
assert_equals(cookie.value, '1');
225-
assert_approx_equals(cookie.expires, kFourHundredDaysFromNow, kOneDay);
226-
}, "Test max-age attribute over the 400 days");
224+
const cookie = await cookieStore.get('cookie-name');
225+
assert_equals(cookie.name, 'cookie-name');
226+
assert_equals(cookie.value, '1');
227+
assert_approx_equals(cookie.expires, kFourHundredDaysFromNow, kOneDay);
228+
}, "Test max-age attribute over the 400 days");
229+
}

0 commit comments

Comments
 (0)