Skip to content

armgit / rea

Public Imported from GitHub
0

Reverse engineer anything with agents, from app behavior down to native binaries.

test(browser): select a bounded service-worker setup deadline (#6186)

gensokyo-dev18669641e98d
diff --git a/scripts/lib/browser-scenario-service-worker-setup-e2e.mjs b/scripts/lib/browser-scenario-service-worker-setup-e2e.mjs
index ace6fc567..3eeda1331 100644
--- a/scripts/lib/browser-scenario-service-worker-setup-e2e.mjs
+++ b/scripts/lib/browser-scenario-service-worker-setup-e2e.mjs
@@ -142,6 +142,9 @@ export const verifyScenarioPolicySetup = async (
page,
) => {
const result = {};
+ // Exercise a caller-selected handshake deadline within the existing teardown
+ // guard; the default command deadline may legitimately outlast that guard.
+ const setupCommandTimeoutMs = 2_000;
for (const mode of ["http-websocket", "http-discovery", "deadline"]) {
const proxy = await startProxy(endpoint, mode);
const provider = createBrowserScenarioProvider(process.env);
@@ -152,6 +155,9 @@ export const verifyScenarioPolicySetup = async (
target_id: targetId,
},
start_url: { url: origin },
+ ...(mode === "deadline"
+ ? { command_timeout_ms: setupCommandTimeoutMs }
+ : {}),
environment: { service_workers: "block" },
actions: [
{ step_id: "settle", action: "wait_for_timeout", duration_ms: 1 },
@@ -189,7 +195,9 @@ export const verifyScenarioPolicySetup = async (
if (!next.ok) throw next.error;
assert.equal(next.value.browser.cleanup, "disconnected-external");
result[mode] = {
- ...(mode === "deadline" ? { timed_out: true } : { cancelled: true }),
+ ...(mode === "deadline"
+ ? { timed_out: true, command_timeout_ms: setupCommandTimeoutMs }
+ : { cancelled: true }),
socket_closed: true,
target_reused: true,
};