Skip to content

Commit

Permalink
add a postMessage test
Browse files Browse the repository at this point in the history
  • Loading branch information
annevk committed May 3, 2018
1 parent 4646a3b commit 8cc338c
Showing 1 changed file with 19 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,22 @@ async_test(t => {
}, 200);
// Ensure the load event fires and testharness doesn't timeout
frame.contentDocument.close();
}, "document.open() and tasks");
}, "document.open() and tasks (timeout)");

async_test(t => {
const frame = document.body.appendChild(document.createElement("iframe"));
let counter = 0;
frame.contentWindow.onmessage = t.step_func(e => {
assert_equals(e.data, undefined);
counter++;
alert(counter);
if (counter == 2) {
t.done();
}
});
frame.contentWindow.postMessage(undefined, "*");
frame.contentDocument.open();
frame.contentWindow.postMessage(undefined, "*");
// Ensure the load event fires and testharness doesn't timeout
frame.contentDocument.close();
}, "document.open() and tasks (message)");

0 comments on commit 8cc338c

Please sign in to comment.