Commit 36e64bc7 authored by Katie Dillon's avatar Katie Dillon Committed by Commit Bot

Updating tests for Window onerror is not triggered bug fix.

Chromium starts propagating errors from worker's onerror to window's onerror
after https://chromium-review.googlesource.com/c/chromium/src/+/1287208,
resulting in test failures for mixed-content/module-data-worker-import
tests that do not account for the thrown exception being sent to the window.

This CL adds preventDefault() to the worker.onerror() to handle the case of
uncaught exceptions.

Strictly speaking, this is not necessary according to the current spec, as
"worker's error event" fired at Step 12.1 of #run-a-worker
https://html.spec.whatwg.org/multipage/workers.html#run-a-worker
does not cause "report the error" and thus window's onerror.
But whether window.onerror is fired or not is not what the mixed-content tests
aim to test.


Change-Id: I571aaa85d90b5f933b6212691dcc783579b294be
Reviewed-on: https://chromium-review.googlesource.com/c/1294535
Commit-Queue: Katie Dillon <kdillon@chromium.org>
Reviewed-by: default avatarHiroshige Hayashizaki <hiroshige@chromium.org>
Cr-Commit-Position: refs/heads/master@{#602207}
parent ae8c3059
...@@ -86,6 +86,9 @@ function bindEvents(element, resolveEventName, rejectEventName) { ...@@ -86,6 +86,9 @@ function bindEvents(element, resolveEventName, rejectEventName) {
resolve(e); resolve(e);
}); });
element.addEventListener(rejectEventName || "error", function(e) { element.addEventListener(rejectEventName || "error", function(e) {
// Chromium starts propagating errors from worker.onerror to
// window.onerror. This handles the uncaught exceptions in tests.
e.preventDefault();
reject(e); reject(e);
}); });
}); });
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment