Commit dd9bc85d authored by Scott Haseley's avatar Scott Haseley Committed by Commit Bot

[postTask] Fix error handling for tasks that throw errors

If a postTask task throws an error, the associated promise is rejected
with the error. Previously, the error would also be propagated to the
global error handler leading to errors being reported even if the
promise rejection was handled. This CL suppresses that propagation,
resulting in errors being reported to the global error handler only if
the rejected promise is not handled.

Bug: 979017
Change-Id: Ibbafaf8bd370b05a10f48cb5a122c8411305aadc
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2350113Reviewed-by: default avatarNate Chapin <japhet@chromium.org>
Commit-Queue: Scott Haseley <shaseley@chromium.org>
Cr-Commit-Position: refs/heads/master@{#797048}
parent 6f17d881
...@@ -87,7 +87,6 @@ void DOMTask::InvokeInternal(ScriptState* script_state) { ...@@ -87,7 +87,6 @@ void DOMTask::InvokeInternal(ScriptState* script_state) {
v8::Isolate* isolate = script_state->GetIsolate(); v8::Isolate* isolate = script_state->GetIsolate();
ScriptState::Scope scope(script_state); ScriptState::Scope scope(script_state);
v8::TryCatch try_catch(isolate); v8::TryCatch try_catch(isolate);
try_catch.SetVerbose(true);
ExecutionContext* context = ExecutionContext::From(script_state); ExecutionContext* context = ExecutionContext::From(script_state);
DCHECK(context); DCHECK(context);
......
<!doctype html> <!doctype html>
<title>Scheduling API: Task.result When a Task Throws an Erorr</title> <title>Scheduling API: Task.result When a Task Throws an Error</title>
<link rel="author" title="Scott Haseley" href="mailto:shaseley@chromium.org"> <link rel="author" title="Scott Haseley" href="mailto:shaseley@chromium.org">
<link rel="help" href="https://github.com/WICG/main-thread-scheduling"> <link rel="help" href="https://github.com/WICG/main-thread-scheduling">
<script src="/resources/testharness.js"></script> <script src="/resources/testharness.js"></script>
...@@ -8,10 +8,6 @@ ...@@ -8,10 +8,6 @@
<script> <script>
'use strict'; 'use strict';
// Uncaught exceptions in asynchronous tasks are still reported to the global
// handler, which we expect to happen in this test.
setup({allow_uncaught_exception : true});
async_test(t => { async_test(t => {
(function() { (function() {
let task_promise = scheduler.postTask(() => { throw Error('Failed'); }); let task_promise = scheduler.postTask(() => { throw Error('Failed'); });
......
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