Skip to content

Commit

Permalink
Fix Safari
Browse files Browse the repository at this point in the history
  • Loading branch information
TimothyGu committed Jul 19, 2018
1 parent ed3d711 commit c796e4a
Showing 1 changed file with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@
// second actually calls document.open() to test if the method call removes
// that specific task from the queue.

setup({
allow_uncaught_exception: true
});

function taskTest(description, testBody) {
async_test(t => {
const frame = document.body.appendChild(document.createElement("iframe"));
Expand Down Expand Up @@ -90,11 +86,15 @@ taskTest("MessagePort", (t, frame, open) => {
});

taskTest("Promise rejection", (t, frame, open) => {
const promise = frame.contentWindow.eval("Promise.reject(42);");
open(frame.contentDocument);
frame.contentWindow.onunhandledrejection = t.step_func_done(ev => {
assert_equals(ev.promise, promise);
assert_equals(ev.reason, 42);
// The frame.contentWindow.setTimeout is necessary to make the test work on
// Safari. See: https://bugs.webkit.org/show_bug.cgi?id=187822
frame.contentWindow.setTimeout(() => {
const promise = frame.contentWindow.eval("Promise.reject(42);");
open(frame.contentDocument);
frame.contentWindow.onunhandledrejection = t.step_func_done(ev => {
assert_equals(ev.promise, promise);
assert_equals(ev.reason, 42);
});
});
});

Expand Down

0 comments on commit c796e4a

Please sign in to comment.