-
Notifications
You must be signed in to change notification settings - Fork 3.1k
/
entries-across-origins.html
33 lines (30 loc) · 1.29 KB
/
entries-across-origins.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
<!doctype html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/get-host-info.sub.js"></script>
<script src="resources/is_uuid.js"></script>
<iframe id="i" src="/common/blank.html"></iframe>
<script>
async_test(t => {
window.onload = t.step_func(() => {
let start_key = i.contentWindow.navigation.currentEntry.key;
let start_id = i.contentWindow.navigation.currentEntry.id;
let cross_origin_url = new URL("resources/post-entries-length-to-top.html", location.href);
cross_origin_url.hostname = get_host_info().REMOTE_HOST;
i.contentWindow.location.assign(cross_origin_url.href);
window.onmessage = t.step_func(e => {
assert_equals(e.data, 1);
i.src = "/common/blank.html?2";
i.onload = t.step_func_done(() => {
let entries = i.contentWindow.navigation.entries();
assert_equals(entries.length, 1);
assert_equals(new URL(entries[0].url).search, "?2");
assert_not_equals(entries[0].key, start_key);
assert_not_equals(entries[0].id, start_id);
assert_true(isUUID(entries[0].key));
assert_true(isUUID(entries[0].id));
});
});
});
}, "navigation.entries() should only contain entries that are both same-origin and contiguous");
</script>