feat(firefox): port upload_file tool with downloadId and user picker β¦#350
Conversation
|
@Elijah-hash7 is attempting to deploy a commit to the esokullu's projects Team on Vercel. A member of the Team first needs to authorize it. |
There was a problem hiding this comment.
Pull request overview
Ports upload_file to Firefox using download re-fetching or a user file picker.
Changes:
- Adds Firefox upload execution, permissions, and tool exposure.
- Adds sidepanel picker and background response routing.
- Updates tests and changelog.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
src/firefox/src/agent/agent.js |
Implements both upload flows. |
src/firefox/src/agent/tools.js |
Defines and exposes the tool. |
src/firefox/src/agent/permission-gate.js |
Adds upload permissions. |
src/firefox/src/background.js |
Routes picker responses. |
src/firefox/src/ui/sidepanel.js |
Implements picker UI. |
src/firefox/src/ui/sidepanel.html |
Adds hidden file input. |
test/run.js |
Updates exposure and permission assertions. |
CHANGELOG.md |
Documents Firefox support. |
π‘ Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@Elijah-hash7 thank you. Pls confirm these are all addressed |
|
Fixed all 8 Copilot review comments redirect now uses manual hop validation with eTLD+1 boundary checks, file size checked before reading, FileReader.onerror handled, XSS fixed with textContent, all strings localized across 15 locales, |
|
ok i'm taking over from hre, thanks! |
e93882e to
bc88f91
Compare
Enforce the size limit while reading the response body so a missing or lying Content-Length cannot buffer an unbounded download. Update Firefox architecture notes and add a regression test for the streaming path.
Copilot review + merge statusVerified against the latest commits (
Merge conflicts with |
Reject non-complete downloads, wrap re-fetch/inject in try/catch, validate picker base64 and size, require input[type=file], and make the sidepanel picker one-shot with a per-card file input. Update site adapters and scratchpad guidance for Firefox upload_file, translate picker strings, and extend regression tests.
Implements upload_file for Firefox, closing #293.
Firefox can't replicate Chrome's CDP-based DOM.setFileInputFiles for arbitrary local paths, but two practical flows are now supported:
Flow 1 β downloadId re-fetch: Looks up an already-downloaded file via browser.downloads.search, re-fetches the bytes (same eTLD+1 cookie policy as readDownloadedFile), converts to base64, reconstructs a File object via DataTransfer in the page context, and dispatches bubbling input + change events.
Flow 2 β User file picker: When no downloadId is provided, emits an upload_picker request to the sidepanel, which opens a hidden , reads the selected file as base64 via FileReader, and routes it back through background.js to the agent.
Not supported (documented): filePath uploads β Firefox extensions have no general filesystem read access and no CDP equivalent.
Other changes:
Added Capability.UPLOAD permission gate
25MB file size cap enforced on both flows
749 tests passing
Closes #293