User:MichaelKohler/SafeModeOption

From MozillaWiki
Jump to: navigation, search

What is this article about?

This articles talks about some thoughts I made about bug 347680: Add Safe Mode option to Session Restore dialogue. I have a quite finished implementation of it, but since this is not exactly what Alex Faaborg's mockup says, I decided to write this article to get some feedback.

Short summary of the bug

The bug is about the implementation of a Safe Mode option. If Firefox crashes multiple times, Firefox should start in Safe Mode to avoid problems (i.e. due to extension incompatibilities or failures).

My thoughts

When does a user see these options?

In my opinion Firefox shouldn't start in Safe Mode without an interaction of the user. Simon Bünzli suggested to offer three options to the user:

a) Disable all addons

b) Reset the preferences

c) Start in Safe Mode

Aboutsessionrestore.jpg

I think that a normal user would be very confused about this, since he/she might not even know Safe Mode. So I decided to only display these options (advanced version of about:sessionrestore) when Firefox crashed twice more than number of crashed that will be resumed automatically (browser.sessionstore.max_resumed_crashes in about:config). That means that with default preferences:

Firefox crashes -> Automatically resumed -> Firefox crashes -> about:sessionrestore without options -> Firefox crashes -> about:sessionrestore with options

What are the options the user can make exactly and what happens after that?

a) Disable all addons When the user chooses to disable all addons, Firefox creates a backup of the enabled addons (just the id of them of course..), then it disables all addons.

b) Reset all preferences When the user chooses to reset all preferences, Firefox creates a backup of the prefs.js file, then it resets all preferences.

c) Start in Safe Mode When the user chooses to start in Safe Mode, Firefox will restart in Safe Mode after the user has clicked "Restart Firefox". I talked to bsmedberg on IRC and he is okay with using a .txt file to indicate wether Firefox needs to start in Safe Mode. This file will be read at startup.

Disabling addons and resetting the preferences will only be applied when the user clicks on the restart button which will be displayed below the three checkboxes. When the user clicks on this button Firefox will restart and after coming up again, it will try to restore the old session. Now there are two possibilites:

1) The session is restored without crash: The user will get a notification that tells the user that the session was restored correctly [and if the user chose to reset the prefs:] and that there is a backup of the preferences in the profile folder.

2) The session crashes again while trying to restore: The about:sessionrestore page with the options will show up again and tells the user that there is a backup of the changed stuff. This is combined with an undo-button which will revert all the changes the user made. If he chooses to revert, Firefox will restart and display the options again. (the user can still choose to start in Safe Mode). Here we may even want to only display the "Start in Safe Mode" option to not confuse the user. I don't think we should start in Safe Mode automatically since the user may want to start a new session. This means, if the work was that important, he will choose to start in Safe Mode manually by selecting the checkbox and click on the restart button.

If the user doesn't undo the changes during the next 24 hours, the backup files will be deleted.

Feedback

I'd like to hear some feedback. Feel free to post your feedback below this paragraph! I don't mind rewriting the patch, although I implemented a lot of these things already. Please tell me if I should have missed something or if there are questions.