Last Comment Bug 653410 - Provide a way to disable safe mode
: Provide a way to disable safe mode
Status: ASSIGNED
:
Product: Firefox
Classification: Client Software
Component: General (show other bugs)
: Trunk
: All All
: -- normal with 4 votes (vote)
: ---
Assigned To: Mike Kaply [:mkaply]
:
Mentors:
Depends on:
Blocks: safe-mode
  Show dependency treegraph
 
Reported: 2011-04-28 05:48 PDT by Mike Kaply [:mkaply]
Modified: 2015-11-03 10:48 PST (History)
15 users (show)
mozilla: needinfo? (kev)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
Allow disabling safe mode in override.ini (1.22 KB, patch)
2015-09-23 07:55 PDT, Mike Kaply [:mkaply]
benjamin: review-
Details | Diff | Review

Description Mike Kaply [:mkaply] 2011-04-28 05:48:57 PDT
While safe mode is great for debugging problems, in a corporate environment where browsers are locked down and certain extensions installed, providing the user an easy way to bypass all the locking that was put in place is a problem.

There should be a way for an administrator to disable Firefox's ability to be placed into safe mode.
Comment 1 Richard van den Berg 2011-07-28 03:55:16 PDT
Since FF 4 all users have to do is hold down the Shift key. Way too easy. In a Windows environment, one way of fixing this would be to check a registry key. If it exists: deny running in Safe Mode. This way, desktop support personnel can remove this key, and run Safe Mode to do troubleshooting. Afterward the registry key should be set again (Group Policy can take care of this).
Comment 2 Mike Kaply [:mkaply] 2012-10-07 10:34:03 PDT
This has become a much bigger problem with the landing of bug 732303.

It is now not possible to disable the safe mode dialog via an overlay (see http://mike.kaply.com/2012/04/10/customizing-firefox-disabling-safe-mode/ )

There should really be a way for an admin to disable safe mode.

Even something as simple as a kiosk doesn't work well because of this.
Comment 3 Jesse Ruderman 2012-10-15 10:26:24 PDT
Maybe it would be better to force certain extensions to remain enabled in safe mode, rather than disabling safe mode entirely.  Do any other aspects of safe mode create problems for your environment?

That said, I'd really like a way to disable the "feature" that holding Alt makes Firefox start in safe mode.  It's a royal pain for semi-automated testing.
Comment 4 Richard van den Berg 2012-10-15 10:55:05 PDT
Jesse, did you read Mike's blog regarding putting extensions into the distribution/bundles directory? One of the benefits is they are also loaded during safe mode.
Comment 5 Mike Kaply [:mkaply] 2012-10-15 11:08:22 PDT
> That said, I'd really like a way to disable the "feature" that holding Alt makes Firefox start in safe mode.  It's a royal pain for semi-automated testing.

Yeah, that's really the biggest deal here.

It impacts kiosks and any other place where someone is trying to lock down Firefox...
Comment 6 Jukka Jylänki 2015-01-20 03:12:28 PST
Any updates on this? This blocks my attempts to automate a unit test suite that runs tests in Firefox - if a rogue test fails, the test harness has no option but to kill the browser process, but in that case, all the subsequent tests fail as well since the Safe Mode dialog will pop up and nothing will actually load.

Is there an about:config pref that could be used to disable the Safe Mode from popping up? If not, can one be added?
Comment 7 Sebastian H. [:aryx][:archaeopteryx] 2015-01-20 03:40:10 PST
Set toolkit.startup.max_resumed_crashes to -1 to disable the automatic safe mode, see http://mxr.mozilla.org/mozilla-release/source/testing/mozbase/mozprofile/mozprofile/profile.py#409
Comment 8 andrew.pennebaker 2015-01-24 14:39:14 PST
+1 I really want to disable the Alt = Safe Mode hotkey.

@Archaeopteryx That doesn't help. My use case is I like setting global hotkeys for launching my favorite apps:

* Control+Alt+G Google Chrome
* Control+Alt+T Terminal
* Control+Alt+W Wunderlist

Using AutoHotkey, Quicksilver, or Ubuntu settings.

I'd love to add Firefox to this list, with Control+Alt+F, but Firefox *freaks out* when Alt is pressed.
Comment 9 Jesse Ruderman 2015-03-10 12:09:46 PDT
There are now environment variables to disable two safe mode triggers. Do they suffice for calling this bug FIXED?

From bug 1140183, MOZ_DISABLE_SAFE_MODE_KEY disables the "hold alt" thing.
From bug 745154, MOZ_DISABLE_AUTO_SAFE_MODE makes crashes not trigger safe mode.
Comment 10 Mike Kaply [:mkaply] 2015-03-12 10:46:01 PDT
Probably good enough. I still wish that there was a simple pref that could be flipped.

https://mike.kaply.com/2013/07/01/make-your-feature-enterprise-ready/
Comment 11 Jesse Ruderman 2015-03-19 12:34:56 PDT
I'm not sure how feasible that is. Some of these checks happen very early in startup.
Comment 12 Mike Kaply [:mkaply] 2015-03-19 12:50:15 PDT
Then maybe something in override.ini
Comment 13 Mike Kaply [:mkaply] 2015-09-23 07:55:36 PDT
Created attachment 8664863 [details] [diff] [review]
Allow disabling safe mode in override.ini

Here's my idea.

If we end up in safe mode, then check if it has been disabled in override.ini.

This has no effect on startup unless safe mode is triggered.
Comment 14 Mike Kaply [:mkaply] 2015-09-23 07:57:04 PDT
Note that profile migrator uses:

EnableProfileMigrator=0/1

Not sure if we should be consistent and be:

EnableSafeMode=0/1 (since enabled is the default).

Any idea on who would review this?
Comment 15 Mike Kaply [:mkaply] 2015-09-29 06:05:11 PDT
Comment on attachment 8664863 [details] [diff] [review]
Allow disabling safe mode in override.ini

This code only takes effect when safe mode has enabled.

It does duplicate code from the wizard code but I wasn't sure it was worth creating a function for code that happens twice in non standard cases.
Comment 16 Benjamin Smedberg [:bsmedberg] 2015-10-09 11:47:22 PDT
Comment on attachment 8664863 [details] [diff] [review]
Allow disabling safe mode in override.ini

As for the product question of whether we want to allow people to disable safe mode or change how it behaves, I want Kev to help answer that question before I review the code.

In terms of the actual code, though, our override.ini behavior is fragmented and we should not add additional uses without fixing it. override.ini, if we decide to support it at all, should be read consistenly in one place and nsXREAppData should encode all the information. We cannot take the startup hit of reading override.ini synchronously in multiple phases of startup.
Comment 17 Mike Kaply [:mkaply] 2015-10-09 13:08:44 PDT
> We cannot take the startup hit of reading override.ini synchronously in multiple phases of startup.

We would only take the startup hit if safe mode was actually invoked, so this would be a very rare case.

If you're proposing that we read override.ini at every startup, that seems like it would be the wrong path from a performance perspective. Right now we only read it if it is the very first profile.

Although honestly I wish we read override.ini at every startup. It would solve other problems (bug 723493).

I assume you meant kev needham for your commment. I've added a needinfo.

Note You need to log in before you can comment on or make changes to this bug.