Skip to content

Open-source AI browser agent for Chrome and Firefox (monorepo) 🧠

Key the release test's failing capture on the capture itself

Claude22210133830c
diff --git a/src/chrome/src/agent/agent.js b/src/chrome/src/agent/agent.js
index e594f894a..046843c62 100644
--- a/src/chrome/src/agent/agent.js
+++ b/src/chrome/src/agent/agent.js
@@ -28466,14 +28466,14 @@ Rules: no prose intro, no conclusion, no "this screenshot shows...", no layout d
// fallback.
const selector = nativeKind === 'menu' ? '.dropdown-menu' : '.modal-root__modal.safety-action-modal';
const deadline = Date.now() + 3000;
- const capture = () => {
+ const pollNativePopup = () => {
if (binding.popup || binding.until < Date.now()) return;
const shown = popups().filter(nativeResourceRendered);
if (shown.length === 1 && !before.has(shown[0]) && shown[0].matches(selector)
&& (!sourcePopup || !nativeResourceRendered(sourcePopup))) { binding.popup = shown[0]; return; }
- if (Date.now() < deadline) binding.captureTimer = setTimeout(capture, 50);
+ if (Date.now() < deadline) binding.captureTimer = setTimeout(pollNativePopup, 50);
};
- binding.captureTimer = setTimeout(capture, 0);
+ binding.captureTimer = setTimeout(pollNativePopup, 0);
};
doc.addEventListener('click', listener, true);
binding.cleanup = () => { doc.removeEventListener('click', listener, true); clearTimeout(binding.listenerTimer);
diff --git a/src/firefox/src/agent/agent.js b/src/firefox/src/agent/agent.js
index fec9d4a1f..4e47f4a8c 100644
--- a/src/firefox/src/agent/agent.js
+++ b/src/firefox/src/agent/agent.js
@@ -25786,14 +25786,14 @@ Rules: no prose intro, no conclusion, no "this screenshot shows...", no layout d
// fallback.
const selector = nativeKind === 'menu' ? '.dropdown-menu' : '.modal-root__modal.safety-action-modal';
const deadline = Date.now() + 3000;
- const capture = () => {
+ const pollNativePopup = () => {
if (binding.popup || binding.until < Date.now()) return;
const shown = popups().filter(nativeResourceRendered);
if (shown.length === 1 && !before.has(shown[0]) && shown[0].matches(selector)
&& (!sourcePopup || !nativeResourceRendered(sourcePopup))) { binding.popup = shown[0]; return; }
- if (Date.now() < deadline) binding.captureTimer = setTimeout(capture, 50);
+ if (Date.now() < deadline) binding.captureTimer = setTimeout(pollNativePopup, 50);
};
- binding.captureTimer = setTimeout(capture, 0);
+ binding.captureTimer = setTimeout(pollNativePopup, 0);
};
doc.addEventListener('click', listener, true);
binding.cleanup = () => { doc.removeEventListener('click', listener, true); clearTimeout(binding.listenerTimer);
diff --git a/test/release-publication-completion.mjs b/test/release-publication-completion.mjs
index e1af6d545..70fb976c2 100644
--- a/test/release-publication-completion.mjs
+++ b/test/release-publication-completion.mjs
@@ -84,8 +84,11 @@ for (const build of ['chrome', 'firefox']) {
const api = { storage: { local: area, session: area }, runtime: { getURL: p => `extension://fixture/${p}` },
tabs: { get: async id => ({ id, url: page.url(), title: 'Owned release' }), executeScript: async (_id, { code, args = [] }) => {
h.transports.push('tabs.executeScript');
- if (!review && page.url() === formUrl && code.includes('const capture =')) throw new Error('Owned capture transport failure');
- if (page.url() === formUrl && code.includes('const capture =')) await h.beforeCapture?.();
+ // Only the release form capture fails or waits; the submit probe and
+ // every other script go through.
+ const isCapture = code.includes(Agent._githubReleaseFormSnapshot.toString());
+ if (!review && page.url() === formUrl && isCapture) throw new Error('Owned capture transport failure');
+ if (page.url() === formUrl && isCapture) await h.beforeCapture?.();
return [await evaluateContent(code, args)];
} },
...(build === 'chrome' ? { scripting: { executeScript: async ({ target, world = 'ISOLATED', func, args = [] }) => {
@@ -102,7 +105,7 @@ for (const build of ['chrome', 'firefox']) {
globalThis.chrome = globalThis.browser = api;
if (cdp) { cdp.attach = async () => {}; cdp.sendCommand = async () => ({}); cdp.evaluate = async (_id, code) => {
h.transports.push('cdpClient.evaluate');
- if (!review && page.url() === formUrl && code.includes('const capture =')) throw new Error('Owned capture transport failure');
+ if (!review && page.url() === formUrl && code.includes(Agent._githubReleaseFormSnapshot.toString())) throw new Error('Owned capture transport failure');
return { result: { value: await page.evaluate(code) } };
}; }
const provider = h.provider = { model: 'owned-offline', supportsVision: false, config: { category: 'local' }, chat() {} };