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
Reviewed-on: https://chromium-review.googlesource.com/c/1287208
Commit-Queue: Katie Dillon <[email protected]>
Reviewed-by: Hiroshige Hayashizaki <[email protected]>
Reviewed-by: Hiroki Nakagawa <[email protected]>
Cr-Commit-Position: refs/heads/master@{#605857}
  • Loading branch information
kjd564 authored and chromium-wpt-export-bot committed Nov 6, 2018
1 parent 71fe0a6 commit bf67a6c
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 bf67a6c

Please sign in to comment.