Skip to content

Support co-located VFS providers and request-scoped operations - #96

Open
DeBaschdi wants to merge 4 commits into
thunderbird:masterfrom
DeBaschdi:feature/vfs-toolkit-provider-lifecycle
Open

Support co-located VFS providers and request-scoped operations#96
DeBaschdi wants to merge 4 commits into
thunderbird:masterfrom
DeBaschdi:feature/vfs-toolkit-provider-lifecycle

Conversation

@DeBaschdi

Copy link
Copy Markdown
Contributor

Summary

  • Allow a WebExtension to register and consume a provider from the same add-on without relying on management discovery.
  • Acknowledge connection-cache updates before setup or removal returns.
  • Bind storage grants and setup completion to the verified runtime consumer and originating port.
  • Add request-scoped cancellation for read, list and picker operations while retaining the existing bulk abort API.

Why

The toolkit currently discovers only other extensions, so an add-on cannot expose a provider and consume it through the same VFS API.

Provider setup can also return before the picker cache contains the new connection. Caller-provided IDs must not establish identity, and provider-wide cancellation can interrupt unrelated operations.

Compatibility

The API version and existing operation payloads remain unchanged.

Existing external providers continue to work with the updated client. The provider still accepts the original API 1.3 cancel message without its own request ID, so older clients remain compatible. New clients add a request ID only for correlation and request ownership.

Co-located provider support is opt-in through registerLocalProvider().

Verification

  • Client and provider syntax checked for every commit
  • Example client and provider add-ons built successfully
  • Co-located registration, setup and connection removal tested
  • Old/new API 1.3 cancellation compatibility tested
  • Cross-consumer grant isolation and request-scoped cancellation tested

A WebExtension can implement a storage provider and consume it from the same add-on. Register the provider explicitly in the client session and use a local background port while picker pages continue through the runtime port handler.
Provider setup waits for the consumer response before returning a storage reference. Return the client session write promises so that response means the new or removed connection is already reflected in the picker state.
Command payloads are caller-controlled and cannot establish identity. Derive the consumer ID from the runtime port, require the exact consumer and storage pair for commands and change events, and bind one-time setup approval to the port that requested it.
The existing abort API cancels every pending request for a provider. Pass AbortSignal through read, list, and picker operations, keep request ownership on its runtime port, and close only the matching picker so independent work can continue.
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.

1 participant