Bug 224315 - Throw within queueMicrotask callbacks are not reported
Summary: Throw within queueMicrotask callbacks are not reported
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: Safari Technology Preview
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2021-04-07 19:29 PDT by Xuan Huang
Modified: 2022-02-23 14:40 PST (History)
8 users (show)

See Also:


Attachments
Safari 13 does nothing (56.61 KB, image/jpeg)
2021-04-07 19:29 PDT, Xuan Huang
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Xuan Huang 2021-04-07 19:29:49 PDT
Created attachment 425470 [details]
Safari 13 does nothing

Webkit does nothing if a callback queued via `queueMicrotask` throw.

The spec (https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#microtask-queuing) specified:

> The queueMicrotask(callback) method must queue a microtask to invoke callback, and if callback throws an exception, report the exception.

The expected behavior is similar to `throw` within `setTimeout` callback.
Comment 1 Xuan Huang 2021-04-07 20:51:00 PDT
I first tested in in Safari 13 but now I tried with technology preview and it's the same.

I'm not sure how to fix this though. As far as I know, JavaScriptCore automatically drains its internal microtask queue when JSLock is released. I'm not sure how would exceptions thrown during the draining can propagate to WebCore.
Comment 2 Radar WebKit Bug Importer 2021-04-08 15:05:27 PDT
<rdar://problem/76423585>