From e538c3e53e203fabb8a9fed94b6810c345ee6f80 Mon Sep 17 00:00:00 2001 From: Igor Soarez Date: Sun, 8 Nov 2026 11:58:33 +0000 Subject: navigate: answer a page's Leave-site prompt instead of hanging A page with a beforeunload handler shows 'Leave site?' when the extension navigates away. Nothing answered it, so chrome_navigate waited out its timeout and the agent never learned why. The worker now hears Page.javascriptDialogOpening and dismisses the dialog (stay/cancel); page.navigate fails at once and says so. leaveIfAsked: true, for that call only, accepts a beforeunload prompt. Tool description and primer tell agents when to use it and to ask the user when unsure. --- test-suite/unit/background-policy.test.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test-suite/unit/background-policy.test.mjs') diff --git a/test-suite/unit/background-policy.test.mjs b/test-suite/unit/background-policy.test.mjs index 2388d78..efbca78 100644 --- a/test-suite/unit/background-policy.test.mjs +++ b/test-suite/unit/background-policy.test.mjs @@ -477,7 +477,7 @@ test("full-page tiles remain CDP-only, pin the resolved target, and restore both scrolls.push(clone(args)); }; let captures = 0; - h.cdpResult = () => { if (++captures === 2 && fail) throw new Error("tile failed"); return { data: "dGlsZQ==" }; }; + h.cdpResult = (method) => { if (method === "Page.captureScreenshot" && ++captures === 2 && fail) throw new Error("tile failed"); return { data: "dGlsZQ==" }; }; const shot = h.w.dispatch("page.screenshot", { urlIncludes: "target.test", fullPage: true, background: true, foreground: true }); if (fail) await assert.rejects(shot, /tile failed/); else { -- cgit v1.2.3