aboutsummaryrefslogtreecommitdiff
path: root/test-suite/unit/background-policy.test.mjs
diff options
context:
space:
mode:
authorIgor Soarez <igor@soarez.org>2026-11-08 11:58:33 +0000
committerIgor Soarez <igor@soarez.org>2026-11-08 11:58:33 +0000
commite538c3e53e203fabb8a9fed94b6810c345ee6f80 (patch)
tree394fd12fa9bb6829034e606c2bf0781c088af33d /test-suite/unit/background-policy.test.mjs
parentff99a4432a3feedfac10d9514ce661a9cb95004c (diff)
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.
Diffstat (limited to 'test-suite/unit/background-policy.test.mjs')
-rw-r--r--test-suite/unit/background-policy.test.mjs2
1 files changed, 1 insertions, 1 deletions
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 {