Skip to content

feat(ext/web): web locks api#31166

Open
devsnek wants to merge 11 commits into
mainfrom
web-locks
Open

feat(ext/web): web locks api#31166
devsnek wants to merge 11 commits into
mainfrom
web-locks

Conversation

@devsnek

@devsnek devsnek commented Nov 2, 2025

Copy link
Copy Markdown
Contributor

Closes #15905

devsnek and others added 8 commits November 2, 2025 12:42
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
# Conflicts:
#	ext/web/lib.rs
#	runtime/js/98_global_scope_shared.js
#	runtime/js/98_global_scope_window.js
#	runtime/js/98_global_scope_worker.js
…resource cleanup

- Move locks.js to lazy_loaded_esm, use createLazyLoader for Lock/LockManager globals
- Replace dedicated thread + tokio runtime with simple Mutex<LockState>
- Fix client_id: use per-OpState atomic counter instead of thread name
- Fix steal: properly drain and reject pending requests for stolen lock name
- Add AbortSignal support: split into sync request + async await + cancel ops
- Add resource cleanup: HeldLockResource/PendingLockResource impl Drop to
  release/cancel on worker termination
- Fix ifAvailable: return explicit status instead of silently dropping sender
- Make query() and release() synchronous
@bartlomieju bartlomieju added this to the 2.9.0 milestone Jun 10, 2026
# Conflicts:
#	ext/web/lib.rs
#	runtime/js/98_global_scope_shared.js
#	runtime/js/98_global_scope_window.js
@deno-cla-assistant

Copy link
Copy Markdown

Deno Individual Contributor License Agreement

The following contributors need to sign the CLA before this PR can be merged:

Click here to review and sign the CLA | Re-run CLA check


This is an automated message from CLA Assistant

…s names

- Notify lock holders when their lock is stolen so request() rejects with
  AbortError, and keep the event loop alive while a lock is held (new
  op_lock_manager_await_steal). This fixes the WPT file failures in
  steal/signal where held-forever locks drained the event loop before the
  harness completed.
- Don't abort pending requests on steal; the stealing request jumps the
  queue but other waiters remain queued (per spec).
- Process a synchronously-signaled abort on an immediately-granted lock by
  yielding a microtask and re-checking the signal.
- Escape lone surrogates in lock names so distinct DOMStrings don't collide
  as keys (fixes resource-names deadlock).
- Update web-locks WPT expectations accordingly.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature request: Web Locks API

2 participants