forked from web-platform-tests/wpt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcookieStore_get_set_across_frames.tentative.https.html
46 lines (38 loc) · 1.63 KB
/
cookieStore_get_set_across_frames.tentative.https.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<!doctype html>
<meta charset='utf-8'>
<title>Async Cookies: cookieStore basic API across frames</title>
<link rel='help' href='https://github.com/WICG/cookie-store'>
<link rel='author' href='[email protected]' title='Jarryd Goodman'>
<script src='/resources/testharness.js'></script>
<script src='/resources/testharnessreport.js'></script>
<style>iframe { display: none; }</style>
<iframe id='iframe'></iframe>
<script>
'use strict';
promise_test(async t => {
const iframe = document.getElementById('iframe');
const frameCookieStore = iframe.contentWindow.cookieStore;
const oldCookie = await frameCookieStore.get('cookie-name');
assert_equals(oldCookie, null,
'Precondition not met: cookie store should be empty');
await cookieStore.set('cookie-name', 'cookie-value');
t.add_cleanup(async () => {
await cookieStore.delete('cookie-name');
});
const frameCookie = await frameCookieStore.get('cookie-name');
assert_equals(frameCookie.value, 'cookie-value');
}, 'cookieStore.get() sees cookieStore.set() in frame');
promise_test(async t => {
const iframe = document.getElementById('iframe');
const frameCookieStore = iframe.contentWindow.cookieStore;
const oldCookie = await frameCookieStore.get('cookie-name');
assert_equals(oldCookie, null,
'Precondition not met: cookie store should be empty');
await frameCookieStore.set('cookie-name', 'cookie-value');
t.add_cleanup(async () => {
await frameCookieStore.delete('cookie-name');
});
const cookie = await cookieStore.get('cookie-name');
assert_equals(cookie.value, 'cookie-value');
}, 'cookieStore.get() in frame sees cookieStore.set()')
</script>