Skip to content

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

Firefox: upload a download's saved bytes, not a second fetch

Emre Sokullu56bf09bfd2a8
diff --git a/firefox-companion/README.md b/firefox-companion/README.md
index e69ec7c1e..3e26ca6f1 100644
--- a/firefox-companion/README.md
+++ b/firefox-companion/README.md
@@ -28,6 +28,7 @@ The connection test checks the real BiDi session. It does not submit forms or se
- Typing dispatches one character at a time, checking run ownership, deadline and focus before each step. Stop prevents the next step; a single already-dispatched character can still arrive. Newlines use a literal editing command, never Enter; single-line fields reject multiline payloads before clearing.
- Exact value readback after typing. `set_field` submits with Enter only after verification. An uncertain dispatch is not safe to repeat automatically.
- Active-run dialogs: acknowledge alerts; dismiss confirmations and prompts; stay on beforeunload unless an explicit navigate action is in progress. A Leave allowance is single use. This prevents prompts from hanging input without blanket approval of destructive confirmations. Idle tabs are not auto-handled. Pending dialog events are retained and handled when a task takes ownership; manually closed dialogs are discarded. Browser permission dialogs and arbitrary operating-system dialogs are outside this scope.
+- Saved downloads (capability `saved_download`): `readSavedDownload` reads a completed download's bytes from the path the browser recorded for it, for an open run only. It must be a regular file (not a link) of at most 25 MB that still has the recorded size and does not change while it is read. `upload_file({downloadId})` attaches those exact bytes. With an older companion, or without trusted automation, the extension fetches the file again from its address and refuses bytes whose size differs from the saved file.
- Vision mode's point input (capability `point_input`, which `connect` reports): `click_at` (one left click) and `hover_at` at a whole-pixel CSS point of the run's top document, rechecked against the element the extension marked there. A drag, a wheel, a right, middle or repeated click and a point over an embedded frame or inside an open shadow root stay synthetic; a BiDi wheel scrolls only the window's selected tab. With an older companion, which reports no capability, all vision input stays synthetic.
- Uploads keep the existing WebBrain attachment/download/picker authorization. Bytes are written to a private temporary file, passed to `input.setFiles`, and the file input's name and size are checked. The input must be unique, enabled, and in the current document's light DOM. Attachment is not proof the site has uploaded or submitted the file. Arbitrary model-supplied filesystem paths are not accepted.
diff --git a/firefox-companion/host.mjs b/firefox-companion/host.mjs
index 41e683958..0230572be 100644
--- a/firefox-companion/host.mjs
+++ b/firefox-companion/host.mjs
@@ -41,6 +41,7 @@ async function dispatch(message) {
case 'closeRun': result = await session.closeRun(args.runId); break;
case 'perform': result = await session.perform(args.runId, args.action, args.payload || {}, validatePageDispatch); break;
case 'captureFullPage': result = await session.captureFullPage(args.token, args.url); break;
+ case 'readSavedDownload': result = await session.readSavedDownload(args.runId, args.download || {}); break;
default: throw new Error('Unknown companion command');
}
reply({ id, result });
diff --git a/firefox-companion/session.mjs b/firefox-companion/session.mjs
index cbeb0da31..5cf3e29af 100644
--- a/firefox-companion/session.mjs
+++ b/firefox-companion/session.mjs
@@ -1,6 +1,6 @@
-import { mkdtemp, writeFile, rm } from 'node:fs/promises';
+import { mkdtemp, writeFile, rm, open, lstat } from 'node:fs/promises';
import { tmpdir } from 'node:os';
-import { join, basename } from 'node:path';
+import { join, basename, isAbsolute } from 'node:path';
// A rendered prefix cannot certify an unsupported rich-text document, and paragraph spacing
// in innerText is not the document's authored line breaks.
@@ -184,7 +184,8 @@ function unpackRemoteObjectValue(value) {
// What this companion can do beyond the first protocol, reported by
// `connect`. point_input: vision mode's click_at and hover_at, trusted input
// at a viewport point of the run's top document.
-export const COMPANION_CAPABILITIES = Object.freeze(['point_input']);
+export const COMPANION_CAPABILITIES = Object.freeze(['point_input', 'saved_download']);
+const SAVED_DOWNLOAD_MAX_BYTES = 25 * 1024 * 1024;
// Vision mode's point actions (point_input).
const POINT_ACTIONS = new Set(['click_at', 'hover_at']);
@@ -274,6 +275,45 @@ export class BidiSession {
if (matches.length !== 1) throw new Error('Tab or element binding is stale or ambiguous; re-read the page');
return matches[0];
}
+ /**
+ * The bytes of a completed browser download, read from the path the
+ * browser recorded for it: the extension cannot read files, and fetching
+ * the download's address again can return other bytes or spend a one-time
+ * link. Only for an open run, a regular file (not a link) that still has
+ * the recorded size, at most 25 MB, unchanged while it was read.
+ */
+ async readSavedDownload(runId, download = {}) {
+ if (!this.runs.get(runId)) throw new Error('Firefox run stopped');
+ if (!Number.isSafeInteger(download?.id) || download.id < 0 || download.state !== 'complete' || download.exists === false
+ || typeof download.filename !== 'string' || !isAbsolute(download.filename)) {
+ throw new Error('A completed browser download with its saved path is required');
+ }
+ const link = await lstat(download.filename);
+ if (!link.isFile()) throw new Error('The saved download is not a regular file');
+ const file = await open(download.filename, 'r');
+ try {
+ const before = await file.stat();
+ if (Number.isSafeInteger(download.fileSize) && download.fileSize >= 0 && download.fileSize !== before.size) {
+ throw new Error('The saved download no longer matches its browser record');
+ }
+ if (before.size > SAVED_DOWNLOAD_MAX_BYTES) throw new Error('File size exceeds 25MB limit.');
+ const bytes = Buffer.alloc(before.size);
+ let offset = 0;
+ while (offset < bytes.length) {
+ const part = await file.read(bytes, offset, bytes.length - offset, offset);
+ if (!part.bytesRead) throw new Error('The saved download changed while it was read');
+ offset += part.bytesRead;
+ }
+ const after = await file.stat();
+ if (!this.runs.get(runId) || after.size !== before.size || after.mtimeMs !== before.mtimeMs || after.ino !== before.ino) {
+ throw new Error('The saved download or the run changed while it was read');
+ }
+ return { base64: bytes.toString('base64'), size: bytes.length, filename: basename(download.filename), mimeType: String(download.mime || '') };
+ } finally {
+ await file.close();
+ }
+ }
+
async openRun(id, token, url) {
if (!/^[a-f0-9-]{36}$/.test(id) || this.runs.has(id) || this.closedRuns.has(id)) throw new Error('Invalid run');
const match = await this.locate(token, url);
diff --git a/src/firefox/src/agent/agent.js b/src/firefox/src/agent/agent.js
index 04b717903..04b90d39c 100644
--- a/src/firefox/src/agent/agent.js
+++ b/src/firefox/src/agent/agent.js
@@ -17243,6 +17243,28 @@ Rules: no prose intro, no conclusion, no "this screenshot shows...", no layout d
return Array.isArray(results) ? results[0] || null : null;
}
+ /**
+ * upload_file({downloadId}): the saved file's bytes through the companion
+ * (firefoxBidi.readSavedDownload), null when this run has no companion
+ * that can read them, or { error } when the file is gone or no longer
+ * matches the browser's record.
+ */
+ async _firefoxSavedDownloadBytes(tabId, item) {
+ if (item?.exists === false) return { error: 'The downloaded file is no longer on disk. Download it again before uploading it.' };
+ let saved = null;
+ try { saved = await firefoxBidi.readSavedDownload(tabId, item); }
+ catch (error) {
+ if (error?.name === 'AbortError') throw error;
+ return { error: `Could not read the saved download (${String(error?.message || error).slice(0, 160)}).` };
+ }
+ if (!saved || typeof saved.base64 !== 'string') return null;
+ return {
+ base64: saved.base64,
+ filename: saved.filename || (item?.filename ? item.filename.split(/[\\/]/).pop() : 'downloaded_file'),
+ mimeType: saved.mimeType || item?.mime || 'application/octet-stream',
+ };
+ }
+
async _visionContentInput(tabId, params, kind = 'click') {
// Stop pressed while the checks before this input ran: nothing is sent.
this._throwIfAborted(this._runAbortSignal(tabId));
@@ -44501,102 +44523,115 @@ Rules: no prose intro, no conclusion, no "this screenshot shows...", no layout d
error: `Download is in state: ${dl[0].state}, not complete. Wait for it to finish (wait_for_stable / list_downloads) then retry.`,
};
}
- const targetUrl = dl[0].url;
- let currentUrl = targetUrl;
- let initialRegDomain = null;
- let tabRegDomain = null;
- try {
- initialRegDomain = registrableDomain(new URL(targetUrl).hostname);
- const currentTab = await browser.tabs.get(tabId);
- if (currentTab && currentTab.url) {
- tabRegDomain = registrableDomain(new URL(currentTab.url).hostname);
- }
- } catch {}
-
- let attachCookies = !!(tabRegDomain && initialRegDomain && tabRegDomain === initialRegDomain);
- let res = null;
- for (let hop = 0; hop < 5; hop++) {
- const v = validateFetchUrl(currentUrl, { allowLocalNetwork: getAllowLocalNetwork() });
- if (!v.ok) {
- return { success: false, error: `Invalid download URL: ${v.error}` };
- }
- res = await fetch(currentUrl, {
- method: 'GET',
- credentials: attachCookies ? 'include' : 'omit',
- redirect: 'manual',
- });
- if (res.status >= 300 && res.status < 400) {
- const location = res.headers.get('location');
- if (!location) {
- return { success: false, error: `Redirect from ${currentUrl} missing Location header` };
+ // The bytes the browser saved, read by the companion when this run
+ // has one; otherwise the file is fetched again from its address.
+ const saved = await this._firefoxSavedDownloadBytes(tabId, dl[0]);
+ if (saved?.error) return { success: false, error: saved.error };
+ if (saved) {
+ ({ base64, filename, mimeType } = saved);
+ } else {
+ const targetUrl = dl[0].url;
+ let currentUrl = targetUrl;
+ let initialRegDomain = null;
+ let tabRegDomain = null;
+ try {
+ initialRegDomain = registrableDomain(new URL(targetUrl).hostname);
+ const currentTab = await browser.tabs.get(tabId);
+ if (currentTab && currentTab.url) {
+ tabRegDomain = registrableDomain(new URL(currentTab.url).hostname);
}
- const nextUrl = new URL(location, currentUrl).href;
- const nextV = validateFetchUrl(nextUrl, { allowLocalNetwork: getAllowLocalNetwork() });
- if (!nextV.ok) {
- return { success: false, error: `Invalid redirect URL: ${nextV.error}` };
+ } catch {}
+
+ let attachCookies = !!(tabRegDomain && initialRegDomain && tabRegDomain === initialRegDomain);
+ let res = null;
+ for (let hop = 0; hop < 5; hop++) {
+ const v = validateFetchUrl(currentUrl, { allowLocalNetwork: getAllowLocalNetwork() });
+ if (!v.ok) {
+ return { success: false, error: `Invalid download URL: ${v.error}` };
}
- try {
- const nextRegDomain = registrableDomain(new URL(nextUrl).hostname);
- if (nextRegDomain !== initialRegDomain || (tabRegDomain && nextRegDomain !== tabRegDomain)) {
+ res = await fetch(currentUrl, {
+ method: 'GET',
+ credentials: attachCookies ? 'include' : 'omit',
+ redirect: 'manual',
+ });
+ if (res.status >= 300 && res.status < 400) {
+ const location = res.headers.get('location');
+ if (!location) {
+ return { success: false, error: `Redirect from ${currentUrl} missing Location header` };
+ }
+ const nextUrl = new URL(location, currentUrl).href;
+ const nextV = validateFetchUrl(nextUrl, { allowLocalNetwork: getAllowLocalNetwork() });
+ if (!nextV.ok) {
+ return { success: false, error: `Invalid redirect URL: ${nextV.error}` };
+ }
+ try {
+ const nextRegDomain = registrableDomain(new URL(nextUrl).hostname);
+ if (nextRegDomain !== initialRegDomain || (tabRegDomain && nextRegDomain !== tabRegDomain)) {
+ attachCookies = false;
+ }
+ } catch {
attachCookies = false;
}
- } catch {
- attachCookies = false;
+ currentUrl = nextUrl;
+ continue;
}
- currentUrl = nextUrl;
- continue;
+ break;
}
- break;
- }
- if (!res || !res.ok) {
- return { success: false, error: `Failed to re-fetch downloaded file from ${targetUrl} (HTTP ${res ? res.status : 'unknown'})` };
- }
- const clHeader = res.headers.get('content-length');
- if (clHeader != null) {
- const expectedLen = parseInt(clHeader, 10);
- if (Number.isFinite(expectedLen) && expectedLen > UPLOAD_MAX_BYTES) {
- return { success: false, error: 'File size exceeds 25MB limit.' };
+ if (!res || !res.ok) {
+ return { success: false, error: `Failed to re-fetch downloaded file from ${targetUrl} (HTTP ${res ? res.status : 'unknown'})` };
}
- }
- // Stream the body with a hard cap so a missing/lying Content-Length
- // cannot buffer an arbitrary payload into extension memory.
- let bytes;
- if (res.body && typeof res.body.getReader === 'function') {
- const reader = res.body.getReader();
- const chunks = [];
- let total = 0;
- for (;;) {
- const { done, value } = await reader.read();
- if (done) break;
- const part = value instanceof Uint8Array ? value : new Uint8Array(value);
- if (total + part.byteLength > UPLOAD_MAX_BYTES) {
- try { await reader.cancel(); } catch {}
+ const clHeader = res.headers.get('content-length');
+ if (clHeader != null) {
+ const expectedLen = parseInt(clHeader, 10);
+ if (Number.isFinite(expectedLen) && expectedLen > UPLOAD_MAX_BYTES) {
+ return { success: false, error: 'File size exceeds 25MB limit.' };
+ }
+ }
+ // Stream the body with a hard cap so a missing/lying Content-Length
+ // cannot buffer an arbitrary payload into extension memory.
+ let bytes;
+ if (res.body && typeof res.body.getReader === 'function') {
+ const reader = res.body.getReader();
+ const chunks = [];
+ let total = 0;
+ for (;;) {
+ const { done, value } = await reader.read();
+ if (done) break;
+ const part = value instanceof Uint8Array ? value : new Uint8Array(value);
+ if (total + part.byteLength > UPLOAD_MAX_BYTES) {
+ try { await reader.cancel(); } catch {}
+ return { success: false, error: 'File size exceeds 25MB limit.' };
+ }
+ chunks.push(part);
+ total += part.byteLength;
+ }
+ bytes = new Uint8Array(total);
+ let offset = 0;
+ for (const part of chunks) {
+ bytes.set(part, offset);
+ offset += part.byteLength;
+ }
+ } else {
+ const buf = await res.arrayBuffer();
+ if (buf.byteLength > UPLOAD_MAX_BYTES) {
return { success: false, error: 'File size exceeds 25MB limit.' };
}
- chunks.push(part);
- total += part.byteLength;
+ bytes = new Uint8Array(buf);
}
- bytes = new Uint8Array(total);
- let offset = 0;
- for (const part of chunks) {
- bytes.set(part, offset);
- offset += part.byteLength;
+ // Fetched again from its address: only the bytes the browser saved
+ // may be attached.
+ if (Number.isSafeInteger(dl[0].fileSize) && dl[0].fileSize >= 0 && bytes.length !== dl[0].fileSize) {
+ return { success: false, error: `The file at the download's address is not the one that was saved (${bytes.length} bytes now, ${dl[0].fileSize} saved). Download it again before uploading it.` };
}
- } else {
- const buf = await res.arrayBuffer();
- if (buf.byteLength > UPLOAD_MAX_BYTES) {
- return { success: false, error: 'File size exceeds 25MB limit.' };
+ let binary = '';
+ const chunk = 0x8000;
+ for (let i = 0; i < bytes.length; i += chunk) {
+ binary += String.fromCharCode.apply(null, bytes.subarray(i, i + chunk));
}
- bytes = new Uint8Array(buf);
- }
- let binary = '';
- const chunk = 0x8000;
- for (let i = 0; i < bytes.length; i += chunk) {
- binary += String.fromCharCode.apply(null, bytes.subarray(i, i + chunk));
+ base64 = btoa(binary);
+ filename = dl[0].filename ? dl[0].filename.split(/[\\/]/).pop() : 'downloaded_file';
+ mimeType = dl[0].mime || res.headers.get('content-type') || 'application/octet-stream';
}
- base64 = btoa(binary);
- filename = dl[0].filename ? dl[0].filename.split(/[\\/]/).pop() : 'downloaded_file';
- mimeType = dl[0].mime || res.headers.get('content-type') || 'application/octet-stream';
} else {
const pickerId = `upk_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 8)}`;
const tabPending = this._pendingUploadPickers.get(tabId) || new Map();
diff --git a/src/firefox/src/bidi/client.js b/src/firefox/src/bidi/client.js
index a8ffa3639..8b6a98c35 100644
--- a/src/firefox/src/bidi/client.js
+++ b/src/firefox/src/bidi/client.js
@@ -223,6 +223,21 @@ export class FirefoxBidiClient {
}
return this.request('perform', { runId: owner.runId, action, payload: { ...payload, pageFeedbackGuard } });
}
+ // A completed download's saved bytes, read by the companion from the path
+ // the browser recorded (upload_file({downloadId})). null: this tab has no
+ // trusted-automation run, or its companion cannot read saved downloads;
+ // the caller then falls back to its own route.
+ async readSavedDownload(tabId, download) {
+ const owner = this.runs.get(tabId);
+ if (!owner || owner.disconnected || owner.signal?.aborted) return null;
+ const connection = await this.connect();
+ if (!Array.isArray(connection?.capabilities) || !connection.capabilities.includes('saved_download')) return null;
+ await this.bindRun(tabId, owner);
+ if (!owner.bound) return null;
+ const { id, state, exists, filename, fileSize, mime } = download || {};
+ return this.request('readSavedDownload', { runId: owner.runId, download: { id, state, exists, filename, fileSize, mime } });
+ }
+
// Vision mode's point input as trusted input. The content script runs every
// check of its synthetic sequence (content.js visionInput) and marks the
// element the top document shows at the point; the companion then moves
diff --git a/test/firefox-bidi.mjs b/test/firefox-bidi.mjs
index 8c0e327e1..9de51ace2 100644
--- a/test/firefox-bidi.mjs
+++ b/test/firefox-bidi.mjs
@@ -53,6 +53,49 @@ test('an unfocused upload marks the file input instead of the active control', a
assert.equal((await session.perform(runId, 'upload', { token, base64: 'eA==', filename: 'test.txt', pageFeedbackGuard: guard }, async () => true)).success, true);
} finally { await session.close(); }
});
+test('the companion reads a saved download only as the browser recorded it', async () => {
+ const { mkdtemp, writeFile, symlink, rm } = await import('node:fs/promises');
+ const { join } = await import('node:path');
+ const { tmpdir } = await import('node:os');
+ const dir = await mkdtemp(join(tmpdir(), 'webbrain-saved-download-'));
+ const session = new BidiSession(), runId = id();
+ try {
+ const file = join(dir, 'report.pdf');
+ await writeFile(file, Buffer.from('%PDF-saved'));
+ const record = { id: 7, state: 'complete', exists: true, filename: file, fileSize: 10, mime: 'application/pdf' };
+ await assert.rejects(session.readSavedDownload(runId, record), /run stopped/);
+ session.runs.set(runId, { context: 'tab' });
+ const read = await session.readSavedDownload(runId, record);
+ assert.deepEqual({ ...read, base64: Buffer.from(read.base64, 'base64').toString() }, { base64: '%PDF-saved', size: 10, filename: 'report.pdf', mimeType: 'application/pdf' });
+ await assert.rejects(session.readSavedDownload(runId, { ...record, fileSize: 99 }), /no longer matches/);
+ await assert.rejects(session.readSavedDownload(runId, { ...record, state: 'in_progress' }), /completed browser download/);
+ await assert.rejects(session.readSavedDownload(runId, { ...record, filename: 'report.pdf' }), /completed browser download/);
+ const link = join(dir, 'link.pdf');
+ await symlink(file, link);
+ await assert.rejects(session.readSavedDownload(runId, { ...record, filename: link }), /not a regular file/);
+ } finally {
+ await session.close();
+ await rm(dir, { recursive: true, force: true });
+ }
+});
+
+test('the client asks the companion for saved bytes only when it can read them', async () => {
+ const client = new FirefoxBidiClient({ tabs: { sendMessage: async () => ({}) } });
+ const tab = 956;
+ const requests = [];
+ client.request = async (command, args) => { requests.push({ command, args }); return { base64: 'eA==' }; };
+ client.bindRun = async (_tab, owner) => { owner.bound = true; };
+ const record = { id: 3, state: 'complete', exists: true, filename: '/tmp/x.bin', fileSize: 1, mime: 'application/octet-stream', url: 'https://example.test/x' };
+ assert.equal(await client.readSavedDownload(tab, record), null, 'no run on this tab');
+ client.runs.set(tab, { runId: 'run-1', bound: true });
+ client.connect = async () => ({ connected: true, capabilities: ['point_input'] });
+ assert.equal(await client.readSavedDownload(tab, record), null, 'an older companion');
+ client.connect = async () => ({ connected: true, capabilities: ['point_input', 'saved_download'] });
+ assert.deepEqual(await client.readSavedDownload(tab, record), { base64: 'eA==' });
+ assert.deepEqual(requests, [{ command: 'readSavedDownload', args: { runId: 'run-1',
+ download: { id: 3, state: 'complete', exists: true, filename: '/tmp/x.bin', fileSize: 1, mime: 'application/octet-stream' } } }]);
+});
+
test('connection loss cannot fall through to synthetic input', async () => {
let messages = 0;
const client = new FirefoxBidiClient({ tabs: { sendMessage() { messages++; } } });
@@ -713,10 +756,10 @@ test('release workflows run the full suite on the companion runtime', async () =
test('the companion reports point input when it connects', async () => {
const { COMPANION_CAPABILITIES } = await import('../firefox-companion/session.mjs');
- assert.deepEqual([...COMPANION_CAPABILITIES], ['point_input']);
+ assert.deepEqual([...COMPANION_CAPABILITIES], ['point_input', 'saved_download']);
const session = new BidiSession();
session.socket = { readyState: 1 };
- assert.deepEqual(await session.connectSession(9222), { connected: true, capabilities: ['point_input'] });
+ assert.deepEqual(await session.connectSession(9222), { connected: true, capabilities: ['point_input', 'saved_download'] });
});
function pointSession({ context = 'tab', disabled = false, validate = async () => true } = {}) {
diff --git a/test/vision-mode-guards.mjs b/test/vision-mode-guards.mjs
index fa582229b..8124a6cf2 100644
--- a/test/vision-mode-guards.mjs
+++ b/test/vision-mode-guards.mjs
@@ -626,6 +626,28 @@ for (const build of ['chrome', 'firefox']) {
assert.match(agent._buildSystemPrompt('act', 1), /call get_captcha_capabilities/);
});
+ if (build === 'firefox') test('firefox: upload_file({downloadId}) uses the saved bytes when the companion can read them', async () => {
+ const { firefoxBidi } = await import('../src/firefox/src/bidi/client.js');
+ const agent = agentFor();
+ const item = { id: 5, state: 'complete', exists: true, filename: '/downloads/clip.mp4', fileSize: 3, mime: 'video/mp4' };
+ const saved = firefoxBidi.readSavedDownload;
+ try {
+ firefoxBidi.readSavedDownload = async () => ({ base64: 'AAAA', size: 3, filename: 'clip.mp4', mimeType: 'video/mp4' });
+ assert.deepEqual(await agent._firefoxSavedDownloadBytes(9, item), { base64: 'AAAA', filename: 'clip.mp4', mimeType: 'video/mp4' });
+ firefoxBidi.readSavedDownload = async () => null;
+ assert.equal(await agent._firefoxSavedDownloadBytes(9, item), null, 'no companion: the caller fetches again');
+ firefoxBidi.readSavedDownload = async () => { throw new Error('The saved download no longer matches its browser record'); };
+ assert.match((await agent._firefoxSavedDownloadBytes(9, item)).error, /no longer matches/);
+ assert.match((await agent._firefoxSavedDownloadBytes(9, { ...item, exists: false })).error, /no longer on disk/);
+ } finally {
+ firefoxBidi.readSavedDownload = saved;
+ }
+ // The fallback refuses bytes that are not the saved file's.
+ const source = (await import('node:fs')).readFileSync(new URL('../src/firefox/src/agent/agent.js', import.meta.url), 'utf8');
+ assert.match(source, /const saved = await this\._firefoxSavedDownloadBytes\(tabId, dl\[0\]\);[\s\S]{0,400}const targetUrl = dl\[0\]\.url;/);
+ assert.match(source, /bytes\.length !== dl\[0\]\.fileSize\) \{\s*return \{ success: false, error: `The file at the download's address is not the one that was saved/);
+ });
+
test(`${build}: Gmail's result counter, which takes no target, stays in the vision tool list`, () => {
// Offered on a Gmail result list (getGmailResultCountPolicy).
const names = getToolsForMode('act', { tier: 'full', gmailResultCounting: true, vision: { coordinates: 'pixel' } }).map(tool => tool.function.name);