electtest

command
v0.76.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 6, 2026 License: BSD-3-Clause Imports: 3 Imported by: 0

Documentation

Rendered for js/wasm

Overview

Command electtest is the real-browser proof that a host election decided by a Web Lock leaves exactly one host, where the window it replaces would leave two.

It is driven by election_browser_test.go, which opens TWO pages on it — the whole point, since a lock is only exclusive across tabs and a one-page harness cannot see that.

The window passed to OpenBroadcastSession is ZERO, and that is what makes this discriminating rather than decorative. With a zero window electRole concludes at once that it heard no host and hosts; both tabs would therefore host, which is the starvation failure electRole's own comment describes, reached deliberately instead of by loading the machine. If a lock is taken, exactly one tab hosts whatever the window says.

Each page leaves its role on globalThis.__role and, on failure, its reason on globalThis.__err. main does not return: a host holds its lock for as long as its promise is unsettled, which is for as long as this program's context lives.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL