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
47
48
49
50
51
52
53
54
55
|
<!DOCTYPE html>
<title>Test `Referer` header</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/utils.js"></script>
<script src="/common/utils.js"></script>
<body>
<script>
promise_test(async () => {
const referrer_key = token();
const referrer_ack_key = token();
const check_url = generateURL('resources/check-header-referrer.py',
[referrer_key])
attachFencedFrame(check_url);
const expected_referrer = "";
const actual_referrer = await nextValueFromServer(referrer_key);
assert_equals(actual_referrer, expected_referrer,
"The top-level fenced frame has the right value for " +
"`Referer` header");
const inner_url = generateURL('resources/header-referrer-inner.html',
[referrer_key, referrer_ack_key])
attachFencedFrame(inner_url);
const iframe_expected_referrer = inner_url.toString().replace("%2C", ",");
const iframe_actual_referrer = await nextValueFromServer(referrer_key);
assert_equals(iframe_actual_referrer, iframe_expected_referrer,
"The iframe inside the fenced frame has the right value for " +
"`Referer` header");
writeValueToServer(referrer_ack_key, "ACK");
const nested_fenced_frame_expected_referrer = "";
const nested_fenced_frame_actual_referrer = await nextValueFromServer(referrer_key);
assert_equals(nested_fenced_frame_actual_referrer, nested_fenced_frame_expected_referrer,
"The nested fenced frame has the right value for " +
"`Referer` header");
writeValueToServer(referrer_ack_key, "ACK");
const navigate_self_expected_referrer =
inner_url.toString().replace("%2C", ",");
const navigate_self_actual_referrer = await nextValueFromServer(referrer_key);
assert_equals(navigate_self_actual_referrer, navigate_self_expected_referrer,
"The fenced frame after it navigates itself has the right value for " +
"`Referer` header");
}, "header.referrer");
</script>
</body>
|