diff --git a/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/tasks.window.js b/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/tasks.window.js
index 17f7330849bb38..5c1b567f50b786 100644
--- a/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/tasks.window.js
+++ b/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/tasks.window.js
@@ -10,6 +10,10 @@
// 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"));
@@ -86,16 +90,20 @@ taskTest("MessagePort", (t, frame, open) => {
});
taskTest("Promise rejection", (t, frame, open) => {
- // 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);
- });
+ // There is currently some ambiguity on which Window object the
+ // unhandledrejection event should be fired on. Here, let's account for that
+ // ambiguity and allow event fired on _any_ global to pass this test.
+ // See:
+ // - https://github.com/whatwg/html/issues/958,
+ // - https://bugs.webkit.org/show_bug.cgi?id=187822
+ const promise = frame.contentWindow.eval("Promise.reject(42);");
+ open(frame.contentDocument);
+ const listener = t.step_func_done(ev => {
+ assert_equals(ev.promise, promise);
+ assert_equals(ev.reason, 42);
});
+ frame.contentWindow.onunhandledrejection = listener;
+ window.onunhandledrejection = listener;
});
taskTest("marquee start", (t, frame, open) => {