Worker: Abort all inflight tasks in Worklet::ContextDestroyed()

Before this CL, all inflight tasks can be retained in
Worklet::pending_tasks_set_ even after context destruction, and that causes
dcheck failures in the destructor of Worklet. This CL fixes it by aborting them
in Worklet::ContextDestroyed().

In addition, this CL adds test coverage of addModule() calls on a detached
iframe. In the tests, LayoutWorklet is used for testing main thread worklets
instead of PaintWorklet because PaintWorklet will be switched to
off-the-main-thread worklets (see https://crbug.com/829967).

Bug: 962355
Change-Id: I7da71e7f4bdcbfa20125853832122a733c118a7a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1626062
Reviewed-by: Matt Falkenhagen <falken@chromium.org>
Commit-Queue: Hiroki Nakagawa <nhiroki@chromium.org>
Cr-Commit-Position: refs/heads/master@{#662923}
2 files changed