Open Firefox with a temporary add-on on startup - firefox

Is there a way in which I can open Firefox and force it to load a temporary add-on (webextension) on startup? Normally I have to manually go to about:debugging and select the extension on my hard drive. I'm looking for a flag I can pass when I load Firefox so that this is done automatically.
If this is not possible, is there a recommended extension I can install to simulate that a user opens this URL and adds this extension?

Yes, you can use the command web-ext run from the directory in which the extension exists. This will start Firefox with the WebExtension installed using a temporary profile. web-ext run is intended for testing your WebExtension add-on during development, not for normal use of Firefox. By default, the web-ext run command will watch your WebExtension's files and automatically reload the extension when any of the files are changed. You can disable this feature by using the --no-reload option.
If you are using a Firefox version below 49, you will need to specify the --pre-install option which uses a different method of installing the extension in the profile. However, if you use the --pre-install, your WebExtension will not be operational if you are trying to use a release or beta version of Firefox and the extension is not signed. This basically means that using --pre-install is not useful for Firefox versions below 49 unless you are using a Developer Edition build. Using --pre-install can be useful for Developer Edition versions of Firefox above 49 if you are wanting to test how your extension behaves during Firefox startup. If you do not use the --pre-install option, your extension is installed as a temporary extension and does not need to be signed to be tested in release versions of Firefox.
If you want to use a specific profile, then you need to specify the profile using the --firefox-profile option. MDN says:
When using a custom profile, web-ext first copies the profile. The custom profile will not be altered.
Installing web-ext
You will need to install web-ext. You can do so by following the instructions in Getting started with web-ext. The instructions are to, after you install node/npm, run the following command:
npm install --global web-ext
References
Getting started with web-ext
web-ext command reference

Related

How to add extension to Firefox using Command Line

I'm trying to install an extension to Firefox by using command line, using the "-install-global-extension" argument but this is deleted at an older version. So are there anyway to install add-on extension on to Firefox?
Thanks.

Firefox addon stops working when packed in to xpi

I've made an extension using the addon sdk, and it works as expected when running with cfx run. But when I pack it in to an xpi using cfx xpi and install it - it stops working - no scripts are injected and I'm not even getting any errors :(
Any ideas on how to fix this, or how can I debug this kind of issue?
Found a solution. I'm simply using the .xpi that Firefox packs automatically for testing. In order to use it, run the cfx run with the -p parameter pointing to a profile you've created, like this:
cfx run -p <your path to firefox>\profiles\someprofile
After running, go the that profile's folder, and find in there the extensions folder, it should be something like this:
<your path to firefox>\profiles\someprofile\extensions
In there you'll have your addon with a weird file name and an .xpi file extension. Rename it to anything you want, leaving the .xpi file extension intact.
EDIT:
Apparently the cfx xpi command strips by default what it thinks to be unused modules and .js files. To avoid this you need to run it with a special flag, like this: cfx xpi --no-strip-xpi
try to uninstall and then reinstall the addon you developed
try installing the addon on another firefox build(aurora, nightly, beta)
What I do in such a case:
Disable extension from Addon Manager.
Restart Firefox.
Open Console Window (Ctrl+Shift+J)
Enable extension and watch for errors in Console.
Sometimes startup errors do not appear in Console window unless it is already opened.
Resetting firefox worked for me.
Type about:troubleshooting in your address bar
Click the reset firefox button in the upper-right hand corner of the Troubleshooting page
(source: mozilla.net)
Confirm your action

Testing Firefox Browsers

With Firefox updating more quickly, how do I test my sites on version 3 through the current version? Can I have multiple versions installed? How do I set that up?
You can either run the installer for each (putting them in separate directories) or extract the content of the zip file for your platform.
Running firefox -ProfileManager will allow you to create new profiles (one per firefox version).
You can then run firefox -P <profile> (or create a shortcut in windows (don't forget to edit the properties to add the command line option) or shell script for it).
NOTE: run firefox -? for help.
Yes, you can have multiple versions but you should create a new .profile for each one so data doesn't overlap.

Does the -app command line option work properly in Firefox 4?

I have written some software that makes use of the -app command line option in Firefox to launch XUL applications in Firefox's embedded copy of XULRunner. This all worked fine in Firefox 3.x, however when I try with Firefox 4, Firefox either crashes or does nothing (depending on if it is on Mac or Windows).
I have tried a number of other command line options and many of them seem to be variously broken. (such as -v to print the version information, which crashes on OSX)
Does anyone know if there are already registered bugs about this? Was the removal of -app intentional or was it an oversight? Is there any way to work around this problem?
The -app is maintained in firefox 4 and should work.
I do not know if there is a bug for windows and mac os, but I'm using it on linux for several apps, and it works well (my firefox version is Mozilla Firefox 4.0.1)
Just wanted to bump this - as on Firefox 7, -app does not seem to be there:
$ uname -s -r
Linux 2.6.38-11-generic
$ firefox --version
Mozilla Firefox 7.0.1
$ firefox --help
Usage: firefox [ options ... ] [URL]
where options include:
X11 options
--display=DISPLAY X display to use
--sync Make X calls synchronous
--g-fatal-warnings Make all warnings fatal
Firefox options
-h or -help Print this message.
-v or -version Print Firefox version.
-P <profile> Start with <profile>.
-migration Start with migration wizard.
-ProfileManager Start with ProfileManager.
-no-remote Open new instance, not a new window in running instance.
-UILocale <locale> Start with <locale> resources as UI Locale.
-safe-mode Disables extensions and themes for this session.
-jsconsole Open the Error console.
-browser Open a browser window.
-new-window <url> Open <url> in a new window.
-new-tab <url> Open <url> in a new tab.
-preferences Open Preferences dialog.
-search <term> Search <term> with your default search engine.
-private Enable private browsing mode.
-private-toggle Toggle private browsing mode.
-setDefaultBrowser Set this app as the default browser.
-g or --debug Start within debugger
-d or --debugger Specify debugger to start with (eg, gdb or valgrind)
-a or --debugger-args Specify arguments for debugger
I too would love to know when and why it was removed, but I simply cannot find any info online (see also Single-file app with xulrunner - possible?) ...
PS: Just filed a bug here: Bug #880596 in firefox (Ubuntu): “Option '-app' missing from Firefox above version 3” - I thought it would be automatically copied to mozilla's bugzilla (seeing bugs like Bug #207454), but unfortunately, it wasn't so... - bugzilla bug needs to be copied and added manually, it's there now...
I also experienced problems using the -app switch. I'm using Firefox 10, but I have an idea this problem goes right back to FF 4.
The firefox binary, when run with the -help option, does not show list the -app option, which caused me much confusion, but I believe its still there.
The problem for me, instead, was to do with this change in Firefox 4, requiring a chrome manifest file in the application root. Since FF 4, only a single (root) chrome manifest is read, so you must create one with the following line, (or lines, if you want to have multiple manifests).
manifest chrome/chrome.manifest
Then launch the application the usual way
firefox -app path/to/application.ini -jsconsole
(For debugging use the -jsconsole option).
Another note, (you didn't mention having tried this, but I did and it was wrong) -- don't use the -no-remote option. I tried this with the intent of starting a new process for my XUL application separate from already running firefox instances. However, the -app option will create a new process for your application even if firefox instances are already running, so there is no need.
See also this question for more info about the chrome manifest issue.

Install Firefox extension using windows registry

I have followed the instructions here [MDC - Adding Extensions using the Windows Registry],
but haven't been able to get Firefox to automatically install my extension when I restart it.
I have written an application that is half windows service and half FF extension. I have built an installer and want it to be able to install the Firefox extension along with the service.
So far I have tried the following things:
Removing my dev version of the
extension from FF first
Removing the
pointer file to my dev version of the
extension from my profile dir
Removing my "dev" profile completelly
so that FF only has a "default"
profile
Running FF without the
-no-remote and -P switches I setup for the dev environment
Trying the
key in both HKEY_CURRENT_USER and
HKEY_LOCAL_MACHINE
Carefully checking
the ID and Paths I have used
Trying
Paths that don't include spaces
Trying the Paths in Quotes
Trying a
trailing \ at the end of the path
Trying the .xpi filename at the end of the path instead of just the dir name
Building the XPI using the Extension
Builder plugin instead of manually
(although my manual build would
install just fine if I dragged it to
FF)
I'm using FF3.5.2 on Windows 2003 Server
(could it be a W2K3 install security issue?)
UPDATE: Now tested also on WinXP FF3.0.11. Same problem.
OK. I figured it out myself! I miss-read one line of the instructions!!!
"the location of the unpacked XPI"
I must be losing my mind. For some reason I reread this as the "packed XPI" over and over!!!
(I feel very silly now)
The answer was to use the unpacked files in the install dir not the .xpi file.
I noticed that it's really important to have back-slash in the file path, ex: [TARGETDIR]Extension\Firefox\

Resources