Skip to content

Commit

Permalink
review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
yoavweiss committed Nov 2, 2018
1 parent 80f1ebd commit 82491b8
Show file tree
Hide file tree
Showing 9 changed files with 72 additions and 42 deletions.
21 changes: 13 additions & 8 deletions resource-timing/embed-refresh.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,27 @@
<script src="/resources/testharnessreport.js"></script>
<script>
let t = async_test("Test that an HTML embed refreshes are not observable by the parent");
function verify_iframe_refresh_not_observable() {
const pre_refresh_url = new URL("resources/document-that-refreshes.html", location).href;
const post_refresh_url = new URL("resources/document-refreshed.html", location).href;
function verify_embed_refresh_not_observable() {
let entries = performance.getEntriesByType("resource");
let found_first_iframe = false;
let found_first_embed = false;
for (entry of entries) {
if (entry.name == "{{location[scheme]}}://{{host]}}:{{ports[http][0]}}/resource-timing/resources/iframe-that-refreshes.html") {
found_first_iframe = true;
if (entry.name == pre_refresh_url) {
found_first_embed = true;
}
assert_not_equals(entry.name, "{{location[scheme]}}://{{host]}}:{{ports[http][0]}}/resource-timing/resources/refreshed_iframe.html", "Refreshed iframe should not be observable");
assert_not_equals(entry.name, post_refresh_url, "Refreshed embed should not be observable");
}
assert_true(found_first_iframe, "Initial iframe should be observable");
assert_true(found_first_embed, "Initial embed should be observable");
t.done();
}
window.addEventListener("message", t.step_func(e=>{
if (e.data == "refreshed") {
verify_iframe_refresh_not_observable();
verify_embed_refresh_not_observable();
}
}));
</script>
<embed type="text/html" src="{{location[scheme]}}://{{host]}}:{{ports[http][0]}}/resource-timing/resources/iframe-that-refreshes.html">
<embed type="text/html">
<script>
document.getElementsByTagName("embed")[0].src = pre_refresh_url;
</script>
4 changes: 2 additions & 2 deletions resource-timing/embed-reload-back.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
let t = async_test("Test that object reloads are not observable by the parent, even after history navigations");
window.open("resources/embed-reload-back.sub.html");
let t = async_test("Test that embed reloads are not observable by the parent, even after history navigations");
window.open("resources/embed-reload-back.html");
addEventListener("message", t.step_func(e => {
assert_equals(e.data, "PASS");
t.done();
Expand Down
21 changes: 13 additions & 8 deletions resource-timing/embed-reload.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,27 @@
<script src="/resources/testharnessreport.js"></script>
<script>
let t = async_test("Test that HTML embed reloads are not observable by the parent");
function verify_iframe_reload_not_observable() {
const pre_reload_url = new URL("resources/document-that-reloads.html", location).href;
const post_reload_url = new URL("resources/document-reloaded.html", location).href;
function verify_embed_reload_not_observable() {
let entries = performance.getEntriesByType("resource");
let found_first_iframe = false;
let found_first_embed = false;
for (entry of entries) {
if (entry.name == "{{location[scheme]}}://{{host]}}:{{ports[http][0]}}/resource-timing/resources/iframe-that-reloads.html") {
found_first_iframe = true;
if (entry.name == pre_reload_url) {
found_first_embed = true;
}
assert_not_equals(entry.name, "{{location[scheme]}}://{{host]}}:{{ports[http][0]}}/resource-timing/resources/reloaded_iframe.html", "Reloaded iframe should not be observable");
assert_not_equals(entry.name, post_reload_url, "Reloaded embed should not be observable");
}
assert_true(found_first_iframe, "Initial iframe should be observable");
assert_true(found_first_embed, "Initial embed should be observable");
t.done();
}
window.addEventListener("message", t.step_func(e=>{
if (e.data == "reloaded") {
verify_iframe_reload_not_observable();
verify_embed_reload_not_observable();
}
}));
</script>
<embed type="text/html" src="{{location[scheme]}}://{{host]}}:{{ports[http][0]}}/resource-timing/resources/iframe-that-reloads.html">
<embed type="text/html">
<script>
document.getElementsByTagName("embed")[0].src = pre_reload_url;
</script>
11 changes: 8 additions & 3 deletions resource-timing/iframe-refresh.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,16 @@
<script src="/resources/testharnessreport.js"></script>
<script>
let t = async_test("Test that iframe refreshes are not observable by the parent");
const pre_refresh_url = new URL("resources/document-that-refreshes.html", location).href;
const post_refresh_url = new URL("resources/document-refreshed.html", location).href;
function verify_iframe_refresh_not_observable() {
let entries = performance.getEntriesByType("resource");
let found_first_iframe = false;
for (entry of entries) {
if (entry.name == "{{location[scheme]}}://{{host]}}:{{ports[http][0]}}/resource-timing/resources/iframe-that-refreshes.html") {
if (entry.name == pre_refresh_url) {
found_first_iframe = true;
}
assert_not_equals(entry.name, "{{location[scheme]}}://{{host]}}:{{ports[http][0]}}/resource-timing/resources/refreshed_iframe.html", "Refreshed iframe should not be observable");
assert_not_equals(entry.name, post_refresh_url, "Refreshed iframe should not be observable");
}
assert_true(found_first_iframe, "Initial iframe should be observable");
t.done();
Expand All @@ -25,4 +27,7 @@
}
}));
</script>
<iframe src="{{location[scheme]}}://{{host]}}:{{ports[http][0]}}/resource-timing/resources/iframe-that-refreshes.html">
<iframe></iframe>
<script>
document.getElementsByTagName("iframe")[0].src = pre_refresh_url;
</script>
2 changes: 1 addition & 1 deletion resource-timing/iframe-reload-back.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<script src="/resources/testharnessreport.js"></script>
<script>
let t = async_test("Test that iframe reloads are not observable by the parent, even after history navigations");
window.open("resources/iframe-reload-back.sub.html");
window.open("resources/iframe-reload-back.html");
addEventListener("message", t.step_func(e => {
assert_equals(e.data, "PASS");
t.done();
Expand Down
11 changes: 8 additions & 3 deletions resource-timing/iframe-reload.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,16 @@
<script src="/resources/testharnessreport.js"></script>
<script>
let t = async_test("Test that iframe reloads are not observable by the parent");
const pre_reload_url = new URL("resources/document-that-reloads.html", location).href;
const post_reload_url = new URL("resources/document-reloaded.html", location).href;
function verify_iframe_reload_not_observable() {
let entries = performance.getEntriesByType("resource");
let found_first_iframe = false;
for (entry of entries) {
if (entry.name == "{{location[scheme]}}://{{host]}}:{{ports[http][0]}}/resource-timing/resources/iframe-that-reloads.html") {
if (entry.name == pre_reload_url) {
found_first_iframe = true;
}
assert_not_equals(entry.name, "{{location[scheme]}}://{{host]}}:{{ports[http][0]}}/resource-timing/resources/reloaded_iframe.html", "Reloaded iframe should not be observable.");
assert_not_equals(entry.name, post_reload_url, "Reloaded iframe should not be observable.");
}
assert_true(found_first_iframe, "Initial iframe should be observable");
t.done();
Expand All @@ -25,4 +27,7 @@
}
}));
</script>
<iframe src="{{location[scheme]}}://{{host]}}:{{ports[http][0]}}/resource-timing/resources/iframe-that-reloads.html">
<iframe></iframe>
<script>
document.getElementsByTagName("iframe")[0].src = pre_reload_url;
</script>
21 changes: 13 additions & 8 deletions resource-timing/object-refresh.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,27 @@
<script src="/resources/testharnessreport.js"></script>
<script>
let t = async_test("Test that object refreshes are not observable by the parent");
function verify_iframe_refresh_not_observable() {
const pre_refresh_url = new URL("resources/document-that-refreshes.html", location).href;
const post_refresh_url = new URL("resources/document-refreshed.html", location).href;
function verify_object_refresh_not_observable() {
let entries = performance.getEntriesByType("resource");
let found_first_iframe = false;
let found_first_object = false;
for (entry of entries) {
if (entry.name == "{{location[scheme]}}://{{host]}}:{{ports[http][0]}}/resource-timing/resources/iframe-that-refreshes.html") {
found_first_iframe = true;
if (entry.name == pre_refresh_url) {
found_first_object = true;
}
assert_not_equals(entry.name, "{{location[scheme]}}://{{host]}}:{{ports[http][0]}}/resource-timing/resources/refreshed_iframe.html", "Refreshed object should not be observable");
assert_not_equals(entry.name, post_refresh_url, "Refreshed object should not be observable");
}
assert_true(found_first_iframe, "Initial object should be observable");
assert_true(found_first_object, "Initial object should be observable");
t.done();
}
window.addEventListener("message", t.step_func(e=>{
if (e.data == "refreshed") {
verify_iframe_refresh_not_observable();
verify_object_refresh_not_observable();
}
}));
</script>
<object type="text/html" data="{{location[scheme]}}://{{host]}}:{{ports[http][0]}}/resource-timing/resources/iframe-that-refreshes.html">
<object></object>
<script>
document.getElementsByTagName("object")[0].data = pre_refresh_url;
</script>
2 changes: 1 addition & 1 deletion resource-timing/object-reload-back.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<script src="/resources/testharnessreport.js"></script>
<script>
let t = async_test("Test that object reloads are not observable by the parent, even after history navigations");
window.open("resources/object-reload-back.sub.html");
window.open("resources/object-reload-back.html");
addEventListener("message", t.step_func(e => {
assert_equals(e.data, "PASS");
t.done();
Expand Down
21 changes: 13 additions & 8 deletions resource-timing/object-reload.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,27 @@
<script src="/resources/testharnessreport.js"></script>
<script>
let t = async_test("Test that object reloads are not observable by the parent");
function verify_iframe_reload_not_observable() {
const pre_reload_url = new URL("resources/document-that-reloads.html", location).href;
const post_reload_url = new URL("resources/document-reloaded.html", location).href;
function verify_object_reload_not_observable() {
let entries = performance.getEntriesByType("resource");
let found_first_iframe = false;
let found_first_object = false;
for (entry of entries) {
if (entry.name == "{{location[scheme]}}://{{host]}}:{{ports[http][0]}}/resource-timing/resources/iframe-that-reloads.html") {
found_first_iframe = true;
if (entry.name == pre_reload_url) {
found_first_object = true;
}
assert_not_equals(entry.name, "{{location[scheme]}}://{{host]}}:{{ports[http][0]}}/resource-timing/resources/reloaded_iframe.html", "Reloaded object should not be observable");
assert_not_equals(entry.name, post_reload_url, "Reloaded object should not be observable");
}
assert_true(found_first_iframe, "Initial object should be observable");
assert_true(found_first_object, "Initial object should be observable");
t.done();
}
window.addEventListener("message", t.step_func(e=>{
if (e.data == "reloaded") {
verify_iframe_reload_not_observable();
verify_object_reload_not_observable();
}
}));
</script>
<object type="text/html" data="{{location[scheme]}}://{{host]}}:{{ports[http][0]}}/resource-timing/resources/iframe-that-reloads.html">
<object></object>
<script>
document.getElementsByTagName("object")[0].data = pre_reload_url;
</script>

0 comments on commit 82491b8

Please sign in to comment.