aboutsummaryrefslogtreecommitdiff
path: root/test-suite/unit/grant-scope.test.mjs
diff options
context:
space:
mode:
authorIgor Soarez <igor@soarez.org>2026-11-20 16:38:11 +0200
committerIgor Soarez <igor@soarez.org>2026-11-20 16:38:11 +0200
commit31eee500cd9c570c960bbb9a50209c0c21c1b716 (patch)
tree68c3fd9a7a093493b821552a76f8b55e84a41591 /test-suite/unit/grant-scope.test.mjs
parent7658ed71898c7daca2661c7d15ffe03c8608c865 (diff)
extension: a stopped bridge drops its open connectionsHEADmaster
server.close() refuses new connections but leaves open the ones busy at that moment, such as the extension posting a result. When the owner pi reloaded, Chrome sent the extension's next /next on such a connection, and the stopped bridge answered it, and every poll after it, for good. Commands went to the new owner, which never heard from Chrome: "not polling (last seen never)" until the extension was reloaded. Seen 2026-11-20 with lsof: Chrome connected to a pi that no longer listened. stop() now closes every connection once the final answers are written, so the extension reconnects to whoever owns the port next. bridge-handover.test.mjs covers a connection busy at the stop and one opened before it; both reached the stopped bridge before this change.
Diffstat (limited to 'test-suite/unit/grant-scope.test.mjs')
-rw-r--r--test-suite/unit/grant-scope.test.mjs2
1 files changed, 1 insertions, 1 deletions
diff --git a/test-suite/unit/grant-scope.test.mjs b/test-suite/unit/grant-scope.test.mjs
index 7717131..fd67508 100644
--- a/test-suite/unit/grant-scope.test.mjs
+++ b/test-suite/unit/grant-scope.test.mjs
@@ -21,7 +21,7 @@ function piProcess(env) {
const fakeProcess = Object.create(process, { env: { value: { ...env, PI_CHROME_BRIDGE_PORT: "0" } } });
const context = vm.createContext({
process: fakeProcess, console, Buffer, URL, AbortController, fetch,
- setTimeout, clearTimeout, setInterval, clearInterval,
+ setTimeout, clearTimeout, setInterval, clearInterval, setImmediate,
});
let runtime;
// A grant an earlier runtime left on globalThis, e.g. a build that saved the env grant there.