Closed Bug 1803415 Opened 3 years ago Closed 3 years ago

[wpt-sync] Sync PR 37259 - Web Locks: Throwing a thenable in callback shouldn't invoke it

Categories

(Core :: DOM: Core & HTML, task, P4)

task

Tracking

()

RESOLVED FIXED
109 Branch
Tracking Status
firefox109 --- fixed

People

(Reporter: wpt-sync, Unassigned)

References

()

Details

(Whiteboard: [wptsync downstream])

Sync web-platform-tests PR 37259 into mozilla-central (this bug is closed when the sync is complete).

PR: https://github.com/web-platform-tests/wpt/pull/37259
Details from upstream follow.

Joshua Bell <jsbell@chromium.org> wrote:

Web Locks: Throwing a thenable in callback shouldn't invoke it

An edge case first reported on github[1] - the result from the lock
acquisition callback should be the resolution of the call's promise.
If the result is itself a promise (or a thenable - i.e. has a then()
method), then it should be "unpacked" per normal promise handling.
This works! Also, if the result is an "abrupt completion" (i.e the
callback throws), that means the resolution should be an exception. So
far, so good! But if that exception is a thenable, it should not be
"unpacked" per normal promise handling. But this is what was happening
in Chrome!

The spec is fine here, it was just an implementation bug. Fix the
implementation and add a WPT to cover this case.

[1] https://github.com/w3c/web-locks/issues/77

Bug: 1250253
Change-Id: Ib38cd1ff48d5f25e1939f50e614ce623c2d10a35
Reviewed-on: https://chromium-review.googlesource.com/4064307
WPT-Export-Revision: e313f53d669c7aefc47afb13ed7c5ddb06553ba7

Component: web-platform-tests → DOM: Core & HTML
Product: Testing → Core

CI Results

Ran 10 Firefox configurations based on mozilla-central, and Firefox, Chrome, and Safari on GitHub CI

Total 4 tests and 11 subtests

Status Summary

Firefox

OK : 4
PASS: 44

Chrome

OK : 4
PASS: 40
FAIL: 4

Safari

OK : 4
PASS: 44

Links

Gecko CI (Treeherder)
GitHub PR Head
GitHub PR Base

Pushed by wptsync@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/b380ce3b6d4b [wpt PR 37259] - Web Locks: Throwing a thenable in callback shouldn't invoke it, a=testonly
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 109 Branch
You need to log in before you can comment on or make changes to this bug.