Skip to content

Commit

Permalink
Window onerror is not triggered bug fix
Browse files Browse the repository at this point in the history
As pointed out in the bug, unhandled errors on worker threads were not
properly being propagated for the parent thread to handle as the spec
requires (https://html.spec.whatwg.org/multipage/workers.html#runtime-script-errors-2).
This fix adds in the code to do that.

Bug: 685303
Change-Id: Ie3e7ec03153a43efdc6e70b874d6b1a1d8ac35ef
  • Loading branch information
kjd564 authored and chromium-wpt-export-bot committed Nov 6, 2018
1 parent bfc7ce5 commit c68bc9e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions workers/modules/dedicated-worker-import-failure.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<title>DedicatedWorker: import failure</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script> setup({allow_uncaught_exception: true}); </script>
<script>

promise_test(async () => {
Expand Down
5 changes: 4 additions & 1 deletion workers/modules/resources/new-worker-window.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@
window.onmessage = e => {
worker = new Worker(e.data, { type: 'module' });
worker.onmessage = msg => window.opener.postMessage(msg.data, '*');
worker.onerror = err => window.opener.postMessage(['ERROR'], '*');
worker.onerror = err => {
window.opener.postMessage(['ERROR'], '*');
err.preventDefault();
};
};
window.opener.postMessage('LOADED', '*');
</script>

0 comments on commit c68bc9e

Please sign in to comment.