Skip to content

Commit

Permalink
Add a performance-timeline test making sure performance entries are n…
Browse files Browse the repository at this point in the history
…ot clonable
  • Loading branch information
yoavweiss committed Jul 24, 2019
1 parent 99422b9 commit fedd74d
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
10 changes: 10 additions & 0 deletions performance-timeline/not-clonable.html
@@ -0,0 +1,10 @@
<!doctype html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
const t = async_test("Test that a postMessage of a performance entry fails");
addEventListener("message", t.step_func_done(e => {
assert_equals(e.data, "PASS");
}));
</script>
<iframe src="resources/postmessage-entry.html"></iframe>
16 changes: 16 additions & 0 deletions performance-timeline/resources/postmessage-entry.html
@@ -0,0 +1,16 @@
<!doctype html>
<script>
addEventListener("load", () => {
const entry = performance.getEntriesByType("navigation")[0];
try {
window.top.postMessage(entry, "*");
} catch(error) {
if (error.name == "DataCloneError") {
window.top.postMessage("PASS", "*");
} else {
window.top.postMessage("FAIL - Wrong exception name: " + error.name, "*");
}
}
});

</script>

0 comments on commit fedd74d

Please sign in to comment.