diff --git a/resource-timing/nested-context-navigations-embed.html b/resource-timing/nested-context-navigations-embed.html index bbba46c50edf21..5c8a62a9ae281d 100644 --- a/resource-timing/nested-context-navigations-embed.html +++ b/resource-timing/nested-context-navigations-embed.html @@ -9,11 +9,19 @@ diff --git a/resource-timing/nested-context-navigations-iframe.html b/resource-timing/nested-context-navigations-iframe.html index 86a83285288a79..6e5cdd85c30d3e 100644 --- a/resource-timing/nested-context-navigations-iframe.html +++ b/resource-timing/nested-context-navigations-iframe.html @@ -9,11 +9,20 @@ diff --git a/resource-timing/nested-context-navigations-object.html b/resource-timing/nested-context-navigations-object.html index 20cceea38d6ff2..8d63c5e3d44e5d 100644 --- a/resource-timing/nested-context-navigations-object.html +++ b/resource-timing/nested-context-navigations-object.html @@ -9,11 +9,20 @@ diff --git a/resource-timing/resources/document-navigated.html b/resource-timing/resources/document-navigated.html index fa87355c3ed18f..bedae770824a3c 100644 --- a/resource-timing/resources/document-navigated.html +++ b/resource-timing/resources/document-navigated.html @@ -4,9 +4,9 @@ - navigated document! + Navigated document! diff --git a/resource-timing/resources/document-refreshed.html b/resource-timing/resources/document-refreshed.html index 7e4ca09891ed35..568f7f27c7d950 100644 --- a/resource-timing/resources/document-refreshed.html +++ b/resource-timing/resources/document-refreshed.html @@ -4,9 +4,9 @@ - Refreshed document! + Refreshed document! diff --git a/resource-timing/resources/document-that-navigates.html b/resource-timing/resources/document-that-navigates.html index cb567bf3d2ad12..a59e9f3ab2b783 100644 --- a/resource-timing/resources/document-that-navigates.html +++ b/resource-timing/resources/document-that-navigates.html @@ -5,7 +5,7 @@ diff --git a/resource-timing/resources/document-that-refreshes.html b/resource-timing/resources/document-that-refreshes.html index 75522782a62dbe..659513a642f382 100644 --- a/resource-timing/resources/document-that-refreshes.html +++ b/resource-timing/resources/document-that-refreshes.html @@ -4,5 +4,6 @@ - + + diff --git a/resource-timing/resources/embed-navigate-back.html b/resource-timing/resources/embed-navigate-back.html index ed14328190cddc..c9c7340f5307da 100644 --- a/resource-timing/resources/embed-navigate-back.html +++ b/resource-timing/resources/embed-navigate-back.html @@ -3,13 +3,16 @@ Resource Timing embed navigate - back button navigation - + + - + + + diff --git a/resource-timing/resources/embed-navigate.html b/resource-timing/resources/embed-navigate.html index 20a73c662b4f7b..24c9d3c462730f 100644 --- a/resource-timing/resources/embed-navigate.html +++ b/resource-timing/resources/embed-navigate.html @@ -3,13 +3,16 @@ Resource Timing embed navigate + + -
- + + + diff --git a/resource-timing/resources/embed-refresh.html b/resource-timing/resources/embed-refresh.html index 4a49fd0b4c1b54..bd4b5a14de9779 100644 --- a/resource-timing/resources/embed-refresh.html +++ b/resource-timing/resources/embed-refresh.html @@ -3,13 +3,16 @@ Resource Timing embed refresh + + -
- + + + diff --git a/resource-timing/resources/iframe-navigate-back.html b/resource-timing/resources/iframe-navigate-back.html index ed2424cba3ab10..f944b633e2f207 100644 --- a/resource-timing/resources/iframe-navigate-back.html +++ b/resource-timing/resources/iframe-navigate-back.html @@ -3,13 +3,16 @@ Resource Timing iframe navigate - back button navigation - + + - + + + diff --git a/resource-timing/resources/iframe-navigate.html b/resource-timing/resources/iframe-navigate.html index 2a1a7e063619fe..02868840218953 100644 --- a/resource-timing/resources/iframe-navigate.html +++ b/resource-timing/resources/iframe-navigate.html @@ -3,13 +3,16 @@ Resource Timing iframe navigate + + -
- + + + diff --git a/resource-timing/resources/iframe-refresh.html b/resource-timing/resources/iframe-refresh.html index 4ce3ea0424297a..862b96da9dae68 100644 --- a/resource-timing/resources/iframe-refresh.html +++ b/resource-timing/resources/iframe-refresh.html @@ -3,13 +3,16 @@ Resource Timing iframe refresh + + -
- + + + diff --git a/resource-timing/resources/nested-contexts.js b/resource-timing/resources/nested-contexts.js index 07ef33851b0125..31bc97bb119399 100644 --- a/resource-timing/resources/nested-contexts.js +++ b/resource-timing/resources/nested-contexts.js @@ -1,97 +1,107 @@ let destination = location; if (location.search == "?crossorigin") { - const host_info = get_host_info() - destination = location.protocol + "//" + host_info["REMOTE_HOST"] + ":" + location.port; + const {REMOTE_HOST} = get_host_info(); + destination = `${location.protocol}//${REMOTE_HOST}:${location.port}`; } -const pre_navigate_url = new URL("/resource-timing/resources/document-that-navigates.html", destination).href; -const post_navigate_url = new URL("/resource-timing/resources/document-navigated.html", destination).href; -const pre_refresh_url = new URL("/resource-timing/resources/document-that-refreshes.html", destination).href; -const post_refresh_url = new URL("/resource-timing/resources/document-refreshed.html", destination).href; +const pre_navigate_url = + new URL("/resource-timing/resources/document-that-navigates.html", + destination).href; +const post_navigate_url = + new URL("/resource-timing/resources/document-navigated.html", + destination).href; +const pre_refresh_url = + new URL("/resource-timing/resources/document-that-refreshes.html", + destination).href; +const post_refresh_url = + new URL("/resource-timing/resources/document-refreshed.html", + destination).href; -function setup_navigate_or_refresh(type, pre, post) { - function verify_document_navigate_not_observable() { - let entries = performance.getEntriesByType("resource"); - let found_first_document = false; - for (entry of entries) { - if (entry.name == pre) { - found_first_document = true; - } - if (entry.name == post) { - opener.postMessage("FAIL - " + type + " document should not be observable", "*"); - return; - } - } - if (!found_first_document) { - opener.postMessage("FAIL - initial document should be observable", "*"); - return; - } - opener.postMessage("PASS", "*"); +const setup_navigate_or_refresh = (type, pre, post) => { + const verify_document_navigate_not_observable = () => { + const entries = performance.getEntriesByType("resource"); + let found_first_document = false; + for (entry of entries) { + if (entry.name == pre) { + found_first_document = true; + } + if (entry.name == post) { + opener.postMessage(`FAIL - ${type} document should not be observable`, + `*`); + return; + } } - window.addEventListener("message", e=>{ - if (e.data == type) { - verify_document_navigate_not_observable(); - } - }); + if (!found_first_document) { + opener.postMessage("FAIL - initial document should be observable", "*"); + return; + } + opener.postMessage("PASS", "*"); + } + window.addEventListener("message", e => { + if (e.data == type) { + verify_document_navigate_not_observable(); + } + }); } -function setup_navigate_test() { - setup_navigate_or_refresh("navigated", pre_navigate_url, post_navigate_url); +const setup_navigate_test = () => { + setup_navigate_or_refresh("navigated", pre_navigate_url, post_navigate_url); } -function setup_refresh_test() { - setup_navigate_or_refresh("refreshed", pre_refresh_url, post_refresh_url); +const setup_refresh_test = () => { + setup_navigate_or_refresh("refreshed", pre_refresh_url, post_refresh_url); } -function setup_back_navigation(pushed_url) { - function verify_document_navigate_not_observable(navigated_back) { - let entries = performance.getEntriesByType("resource"); - let found_first_document = false; - for (entry of entries) { - if (entry.name == pre_navigate_url) { - found_first_document = true; - } - if (entry.name == post_navigate_url) { - opener.postMessage("FAIL - navigated document exposed", "*"); - return; - } - } - if (!found_first_document) { - opener.postMessage("FAIL - first document not exposed. navigated_back is " + navigated_back, "*"); - return; - } - if (navigated_back) { - opener.postMessage("PASS", "*"); - } +const setup_back_navigation = pushed_url => { + const verify_document_navigate_not_observable = navigated_back => { + const entries = performance.getEntriesByType("resource"); + let found_first_document = false; + for (entry of entries) { + if (entry.name == pre_navigate_url) { + found_first_document = true; + } + if (entry.name == post_navigate_url) { + opener.postMessage("FAIL - navigated document exposed", "*"); + return; + } } - window.addEventListener("message", e=>{ - if (e.data == "navigated") { - verify_document_navigate_not_observable(sessionStorage.navigated); - if (sessionStorage.navigated) { - delete sessionStorage.navigated; - } else { - sessionStorage.navigated = true; - setTimeout(() => { - history.pushState({}, "", pushed_url); - location.href="navigate_back.html"; - }, 0); - } - } - }); + if (!found_first_document) { + opener.postMessage(`FAIL - first document not exposed. navigated_back ` + + `is ${navigated_back}`, "*"); + return; + } + if (navigated_back) { + opener.postMessage("PASS", "*"); + } + } + window.addEventListener("message", e => { + if (e.data == "navigated") { + verify_document_navigate_not_observable(sessionStorage.navigated); + if (sessionStorage.navigated) { + delete sessionStorage.navigated; + } else { + sessionStorage.navigated = true; + setTimeout(() => { + history.pushState({}, "", pushed_url); + location.href="navigate_back.html"; + }, 0); + } + } + }); } -function open_test_window(url, message) { - promise_test(() => { - return new Promise((resolve, reject) => { - let openee = window.open(url); - addEventListener("message", e => { - openee.close(); - if (e.data == "PASS") { - resolve(); - } else { - reject(e.data); - } - }); - }); - }, message); +const open_test_window = (url, message) => { + promise_test(() => { + return new Promise((resolve, reject) => { + const openee = window.open(url); + addEventListener("message", e => { + openee.close(); + if (e.data == "PASS") { + resolve(); + } else { + reject(e.data); + } + }); + }); + }, message); } diff --git a/resource-timing/resources/object-navigate-back.html b/resource-timing/resources/object-navigate-back.html index 1023f984d5b9db..a746947818ffb4 100644 --- a/resource-timing/resources/object-navigate-back.html +++ b/resource-timing/resources/object-navigate-back.html @@ -3,13 +3,16 @@ Resource Timing object navigate - back button navigation - + + - + + + diff --git a/resource-timing/resources/object-navigate.html b/resource-timing/resources/object-navigate.html index 3ae39c8bc44fa7..6b4bb3128ee6f1 100644 --- a/resource-timing/resources/object-navigate.html +++ b/resource-timing/resources/object-navigate.html @@ -3,13 +3,16 @@ Resource Timing object navigate + + -
- + + + diff --git a/resource-timing/resources/object-refresh.html b/resource-timing/resources/object-refresh.html index 9e43e19de19fc7..5c5f60fb06851a 100644 --- a/resource-timing/resources/object-refresh.html +++ b/resource-timing/resources/object-refresh.html @@ -3,13 +3,16 @@ Resource Timing object refresh + + -
- + + +