Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Install temporary addon #125

Open
fregante opened this issue Aug 28, 2021 · 7 comments
Open

Install temporary addon #125

fregante opened this issue Aug 28, 2021 · 7 comments

Comments

@fregante
Copy link
Contributor

fregante commented Aug 28, 2021

Firefox only allows signed addons to be installed permanently so I wonder if there's any way for this module to install addons. The source mentions possible installs from a directory (not just an xpi) but I think it only works for Firefox Developer

if (addon.slice(-4) === '.xpi') {

// or to the unzipped extension directory

web-ext seems to be installing the extension after opening the browser:

https://github.com/mozilla/web-ext/blob/8bd0d13f425bbaed6cfc2f8127883c5c43010f1d/src/firefox/remote.js#L139-L143

Is there any other way for unsigned/local/unpacked addons?

@saadtazi
Copy link
Owner

Hi @fregante ,
It's being a long time I haven't use my package, and I am away from keyboard for a couple of days.
What i found by looking at the documentation of firefox-profile-service (https://www.npmjs.com/package/@wdio/firefox-profile-service) which depends on this package: i think you can skip the signature verification:

'xpinstall.signatures.required': false,
legacy: true // only use for firefox <= 55

I hope it helps (... but not tested myself)
Please keep me posted!

@fregante
Copy link
Contributor Author

Unfortunately that hasn't worked for a couple of years since Firefox requires Addons to be signed. The only way I'm aware of is to open Firefox first and then request the installation via WebDriver, which is not ideal.

@fregante
Copy link
Contributor Author

web-ext manages to install the extension by packing it first:

https://github.com/mozilla/web-ext/blob/416b12895109331170a5b4f3af64e83918f2488b/src/firefox/index.js#L474-L541

whereas extensions added via firefox-profile (under the /extensions/ folder) are just deleted when Firefox loads the profile:

firefox-profile -o ffprofile -e path/to/extension
/Applications/Firefox.app/Contents/MacOS/firefox-bin -profile ffprofile

@fregante
Copy link
Contributor Author

I'm leaving it open for reference, but this is just not possible anymore. Firefox requires an RDP call to install unsigned extensions, it can't be done via profile.

@christian-bromann
Copy link

@fregante I am not facing the same issue and am unable to load any extension. Have you been able to find a workaround?

@fregante
Copy link
Contributor Author

fregante commented Apr 5, 2023

See my previous comment: it's not possible, use web-ext

@christian-bromann
Copy link

christian-bromann commented Apr 5, 2023

For reference, I ended up using WebdriverIO to inject a temporary extension at runtime via:

const extension = await fs.readFile(path.resolve(__dirname, '..', `runme-firefox-v${pkg.version}.xpi`))
await browser.installAddOn(extension.toString('base64'), true)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants