Skip to content

Move the rest of the shared worker code into its plugin - #4264

Merged
jcbrand merged 2 commits into
masterfrom
shared-worker-remnants
Nov 25, 2026
Merged

jcbrand merged 2 commits into
masterfrom
shared-worker-remnants

Conversation

@jcbrand

@jcbrand jcbrand commented Nov 25, 2026

Copy link
Copy Markdown
Member

Step 4 of the login credential sources work, following #4261 (review finding 3 there).

Core no longer knows about the shared worker. The converse-shared-worker plugin now owns:

  • Attaching. The plugin calls attach() with its own callback, which resolves the attach result and passes each status on to onConnectStatusChanged. Connection.restoreWorkerSession() and worker_attach_promise are gone. The method was undocumented and only api.user.login() called it.
  • Where the session is stored. initSession asks a new shouldShareSession hook, which the plugin answers from connection_options.worker.

hasResumed() no longer checks for the worker: an attached connection counts as resumed for any transport, otherwise Strophe answers (for the worker, its StreamManagementMirror).

The "a different tab must have attached" check in onConnectStatusChanged is dropped rather than moved. Strophe 6's worker sends ATTACHED to a tab only when that tab joins, once per attach or connect, so the check could not fire.

Leaving the plugin out still makes login fail when connection_options.worker is set (from #4261). The configuration docs now say that the plugin also decides where the session data is kept.

Testing

  • New specs, written before the move and passing before and after: attach, failed attach falling back to connect(), hasResumed() in both cases, and the session's storage with and without the worker.
  • Headless, main and daemon suites pass.
  • Checked in a real browser against Prosody with two tabs: the first connects, the second attaches to the same resource, a reloaded tab attaches to the running session, and IQs work from both.

@jcbrand
jcbrand marked this pull request as ready for review November 25, 2026 19:23
@jcbrand
jcbrand merged commit 815f631 into master Nov 25, 2026
6 checks passed
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