How to disable Firefox Safe Mode...any way possible - firefox

I run a lot of automation using Firefox driver, and it takes a while (20-30 minutes). Naturally, while its running, I continue to work on something else.
However, while I doing things, I occasionally press the Shift key while a new Firefox instance is starting up. However, Firefox has hardcoded that it will boot in safe mode if you are holding shift, which then freezes automation in its "Are you sure you want to boot in safe mode?"
Here's the different options I've considered:
When I first ran into this, I thought that it was an issue with Firefox crashing multiple times. I changed toolkit.startup.max_resumed_crashes to 99999999 and browser.safebrowsing.enabled to false, both manually, and in my FirefoxProfile
I've tried this and this, both of which apparently refer to an old version of firefox, because the files they describe no longer exist.
This doesn't sound like it will work because profiles don't have anything to do with Safe Mode and I can't execute any AutoIt code because Selenium is still maintaining control as its frozen with the popup.
Running Firefox 3.6 or lower is not an option. Running headless is currently in the works (using Phantom), but we'll never stop running it with firefox. The same is true for the Grid (and I like running it local so I can actually see it run).
I've run into this enough times that I'm pretty desperate for any solution...whether that means changing something in my code, firefox settings, some files in the firefox folder, or even some AutoHotKey script (which I've considered, but don't know how it would work).
Thank you!

This solution you mentioned seems to work well for me even with the newest Firefox 22.
The omni.ja file is the one you want to unpack. It is a regular zip file.
Inside it:
Simply unpack, change the file, repack, save. Worked for me.

Related

How to run Google Keep as an App in Windows

How does one run Google Keep or other websites like an app or kiosk on a Windows PC.
Since I figured this out and nobody seems to of had a response, I made my own question and answered it. Credit to OurCodeWorld for helping figure out some of the fine tuning. He had a --chrome-frame flag, but I believe that is depreciated, so I am looking into it. But it seems to work fine without it
TLDR: Create a shortcut to chrome and add --app= this to the end of it. like this --app=https://keep.google.com/u/0/.
Now if you want it to have a specific size window? Well, you will have to add --window-size=WIDTH,LENGTH. But... Chrome saves the size of the last window closed, which If you use Chrome as a browser, this will change frequently. To solve this, we create a separate user-data directory --user-data-dir="C:\ExampleDir". This folder is around 50mb of who knows what...
So the whole thing put together, like this.
"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --user-data-dir="%localappdata%\GoogleKeep\User Data" --window-size=950,1000 --app=https://keep.google.com/u/0/

Enable remote debugging on Chrome by default on mac?

I am working on getting the VS Code debugger to attach to Chrome as part of my regular workflow.
I keep Chrome running all the time, and the highly-regarded VS Code Live Server extension opens my project in a new tab, which I like. I would like to be able to attach the VS Code debugger to this instance, but it looks like I have to start Chrome from the command line with
sudo /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --remote-debugging-port=9222
Several questions:
Is there a way to modify Chrome's configuration file so that it always starts with that flag set?
Is that a stupid thing to do?
Do I really need the sudo in the line above? Some sources do not have it.
Alternatively, is there a way to create a desktop/toolbar shortcut to chrome that will start it will remote debugging enabled?
Thanks!
PS I see the related SO question for Windows.
There are various Mac answers that used to work that don't anymore. I found one that does and built a double-clickable icon. I posted it on GitHub.
Apparently it's also pretty easy to do using Automator.

Best way to install a firefox extension on the shell

I want to create a new profile with an addon preinstalled.
What works:
run firefox a first time.
add the addon.xpi to profile/extensions/addon.xpi.
edit profile profile/extensions.ini and add Extension0=/full/path/to/extension.xpi.
start firefox again.
What i need:
add the addon to profile/extensions/addon.xpi.
edit extensions.ini or something similiar.
use only relative paths, if possible (seems not to be implemented for extensions.ini)
Finally i want to create a zip file with some firefox preferences/addons, which can be unziped into a profilefolder to create a fresh profile with some preinstalled stuff. For this, it would be important, that everything works with relative paths. If it is definitely not possible, i can add some script to it. But i would prefer some "just unzip" solution.
I think it may be a bit harder, because mozilla wanted to prevent other software from adding toolbars and similiar to firefox by making external addon installation harder. What i already found is the key extensions.autoDisableScopes=0.
What you can do is open firefox with command line options. And pass the file path to your xpi file, so you don't have to mess with all this internals you are over there.
So do this:
"C:\Program Files (x86)\Mozilla Firefox\firefox.exe" "C:\my.xpi"
and on launch it will open a tab and prompt to install your addon.
In the prefs.js:
pref("extensions.autoDisableScopes", 14); // 0x1 not set
See https://developer.mozilla.org/en-US/Add-ons/Installing_extensions#Disabling_install_locations
Then put the addons into extensions/myaddonid.xpi, making sure the filename is the id given in the install.rdf file inside the addon.xpi (zip-)file as <em:id>addon_id</em:id> tag.
On the next start the addons will be silently installed. Some addons needed one restart to work, at least the toolbar buttons were not added on the first start.
Not sure, if this will still work, when firefox decides to allow only addons signed by addons.mozilla.org. On the other hand, they will allow self-hosting addons, as soon as they are signed by AMO, so preinstalling addons downloaded from there will have a good chance.

Firefox profile changing using command

I want to switch between two firefox profiles online using bat file without closing my firefox. Is it possible? thanx in advance.
Profiles says:
"Firefox saves your personal information such as bookmarks, passwords, and user preferences in a set of files called your profile, which is stored in a separate location from the Firefox program files."
I don't think that is possible. Firefox reads files from the profile directory at start-up and writes them back when quit. If you would do it by hand you still need to tell Firefox to read the initialization files again. This could mess up all the profiles at the end I guess.
Why would that make sense? What do you want to do w/ it?
You can't switch profiles without restarting Firefox.
However, you can run several copies of FF with different profiles simultaneously. I don't know what is your goal, but maybe this can help?
Command line:
firefox -P <profile-name> -no-remote
Be careful not to run more than one instance of Firefox with same profile. The -no-remote switch prevents a Firefox instance from knowing about other instances. If multiple instances access the same profile simultaneously, the profile can be corrupted.

Correct way to restore Firefox preferences when Add-On uninstalled by external application

I have written an application suite on Windows which amongst other things installs a Firefox add-on which once run modifies the Firefox network preferences by interfacing with nsIPrefService.
The extension itself resides in a folder under Program Files along with other parts of the application which work together with each other.
Since the application consists of a number of components, the correct way to uninstall it is via the Control Panel or via an uninstall shortcut I provide for the users.
I have no control over whether Firefox will be running or not when the user chooses to uninstall (possibly I could try to detect if it's running in the uninstaller and request the user close it to continue).
Since the purposes of the uninstaller is to remove all traces of the program from the end-users system i.e:
all the files under the Program Files folder, including the extension components
remove the add-on from Firefox (by removing the registry key under HKEY_CURRENT_USER\Software\Mozilla\Firefox\Extensions, causing the add-on to unregister on next Firefox restart)
remove application specific registry keys
Then after uninstall there isn't any of my code left on the users system capable of restoring the network preferences to what they were before the component was installed. This results in end-users not being able to browse the web and being very frustrated!
The only way I can figure out how to do this at the moment is to have my component write to the window's registry the location of the users profile folder - which I can do with my add-on:
Components.classes["#mozilla.org/file/directory_service;1"]
.getService(Components.interfaces.nsIProperties).get("ProfD",
Components.interfaces.nsIFile).path
And then have my uninstaller modify the prefs.js file in that location directly. But this will only work if I can guarantee Firefox isn't running during uninstall (since prefs.js is re-written on FF close)
To me this is not an elegant solution:
It seems not to be future proof since it is dependent on the format and symbols used prefs.js which may change in future FF releases.
Firefox has a nasty habbit of not always closing properlly (sometimes other installed add-ons prevent it from completely unloading from memory. This would break my uninstaller).
This wouldn't work (without elaborate modification) if the user has multiple FF profiles setup all using my add-on.
Is there a better or "standard" way to achieve this simple task?
Did you try to package defaults files (defaults/preferences/myprefs.js) in your extension? I didn't check if it works for overriding Firefox-wide defaults, but it should.
Can't the uninstaller "insist" that Firefox be closed? eg,
check if FireFox is open
if open, inform user "FF must be closed, or cancel uninstall" ok/cancel
loop
I've had several installers do this to me. Not unistallers, though, that I can remember.
Also, this doesn't future-proof the solution, nor deal with profiles.

Resources