Skip to content

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

fix(captcha): resolve Firefox bridge script from extension root

Codex release-state test1e1f2fcc0bd9
diff --git a/src/chrome/src/agent/captcha-bridge-registration.js b/src/chrome/src/agent/captcha-bridge-registration.js
index 0a82fda85..39e2e8319 100644
--- a/src/chrome/src/agent/captcha-bridge-registration.js
+++ b/src/chrome/src/agent/captcha-bridge-registration.js
@@ -11,7 +11,8 @@ export function createCaptchaBridgeRegistration(api) {
if (enabled && !firefoxRegistration) {
firefoxRegistration = await api.contentScripts.register({
matches: [...MATCHES],
- js: [{ file: SCRIPT_FILE }],
+ // Firefox resolves relative file URLs from the calling background page.
+ js: [{ file: `/${SCRIPT_FILE}` }],
runAt: 'document_start',
world: 'MAIN',
allFrames: true,
diff --git a/src/firefox/src/agent/captcha-bridge-registration.js b/src/firefox/src/agent/captcha-bridge-registration.js
index 0a82fda85..39e2e8319 100644
--- a/src/firefox/src/agent/captcha-bridge-registration.js
+++ b/src/firefox/src/agent/captcha-bridge-registration.js
@@ -11,7 +11,8 @@ export function createCaptchaBridgeRegistration(api) {
if (enabled && !firefoxRegistration) {
firefoxRegistration = await api.contentScripts.register({
matches: [...MATCHES],
- js: [{ file: SCRIPT_FILE }],
+ // Firefox resolves relative file URLs from the calling background page.
+ js: [{ file: `/${SCRIPT_FILE}` }],
runAt: 'document_start',
world: 'MAIN',
allFrames: true,
diff --git a/test/captcha-bridge-registration.mjs b/test/captcha-bridge-registration.mjs
index 88d9b83d7..987cbb1a0 100644
--- a/test/captcha-bridge-registration.mjs
+++ b/test/captcha-bridge-registration.mjs
@@ -53,7 +53,7 @@ for (const build of ['chrome', 'firefox']) {
await registration.sync(true);
assert.deepEqual(script, {
matches: ['<all_urls>'],
- js: [{ file: 'src/content/captcha-callback-bridge.js' }],
+ js: [{ file: '/src/content/captcha-callback-bridge.js' }],
runAt: 'document_start',
world: 'MAIN',
allFrames: true,