Closed Bug 981820 Opened 11 years ago Closed 11 years ago

Preferences not saved upon force quit

Categories

(Firefox :: Untriaged, defect)

27 Branch
x86_64
Linux
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 981818

People

(Reporter: sibi.antony, Unassigned)

Details

User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:27.0) Gecko/20100101 Firefox/27.0 (Beta/Release)
Build ID: 20140212131424

Steps to reproduce:

Working on a simple extension, found this strange behavior with preferences saving. I often use a Ctrl+C to quit ff between tests. Whenever I do this, the preferences which I  set using nsIPrefBranch methods (setCharPref, setBoolPref) are not saved. I can easily see the problem in my working profile, but can be reproduced on a fresh profile with these steps. 

1. Set default preferences during initialization. Code snippet for default branch: 
    let branch = Services.prefs.getDefaultBranch("extensions.myextension.");
    branch.setCharPref("test.string", "Hello world");
2. Modify 'extensions.myextension.test.string' to say "Old String" in about:config
3. Do a reset (Right click-> Reset) immediately to reset the value.
4. Force quit ff (Ctrl+C for console or a SIGKILL should do).

Start ff again, and If the problem has occured, one can see "Old string" in the preference rather than the reset value. If the string has the expected value (reset value), I could easily hit the problem by repeating the above steps one more time.

At this stage, any more changes to this preference value will not get saved as long as a force quit is performed. This can be tested by these steps : 
1. Set the default preference as usual
2. Change the preference value from js on the preference branch.
    const prefs = Components.classes["@mozilla.org/preferences-service;1"]
                                             .getService(Components.interfaces.nsIPrefBranch);
    prefs.setCharPref("extensions.myextension.test.string", "New string");
3. Force quit. 

Remove the code for preference setting on preference branch, and restarting firefox shows "Old String"! The new preferences will be saved only if I shutdown ff normally. 
If this is really a problem (and not some mistake from my end), then I believe it's a major issue, as many users do not properly shutdown the browser (force quits happen with OS shutdown etc.)




Actual results:

Preferences are not saved when ff is force quit.


Expected results:

User preferences must be saved immediately and must be available after a browser restart.
Status: UNCONFIRMED → RESOLVED
Closed: 11 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.