w3c / web-locks

Cross-tab resource coordination API
https://w3c.github.io/web-locks/
Other
124 stars 16 forks source link

Checking grantability before enqueuing is invalid #70

Closed saschanaz closed 3 years ago

saschanaz commented 3 years ago

https://wicg.github.io/web-locks/#lock-request-grantable

No lock request in queue earlier than request exists.

This can't be done before enqueuing, but in https://wicg.github.io/web-locks/#algorithm-request-lock:

1. If ifAvailable is true and request is not grantable, then enqueue the following steps on callback’s relevant settings object's responsible event loop:
    1. Let r be the result of invoking callback with null as the only argument.
    2. Resolve promise with r and abort these steps.
2. Enqueue request in queue.

I think it should check whether it's in the queue or not (or define "earlier than" better?)

inexorabletash commented 3 years ago

I think that probably needs to be expanded to:

Or alternately:

Thoughts? cc: @pwnall