Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:2.0b1) Gecko/20100630 Firefox/4.0b1 Reproduce: 1. uncheck "notify me when a new study comes" in TP panel 2. restart Firefox Actually result: "notify me when a new study comes" is checked. Expect result: "notify me when a new study comes" is unchecked.
Oh dear. I thought that I was doing this the right way (setting the pref in the default branch, so that it is overridden by any user-created settings) but it looks like I was wrong.
Andres says: > The problem is that the preferences are not being saved, since the browser.preferences.instantApply is set to false by default on Fx, so changes to the test pilot settings are not being applied immediately. According to https://developer.mozilla.org/en/XUL/prefwindow, in this case a OK value is needed when closing in order to save the preferences. But as we don't have buttons in this window, the only way to close the TP panel is with the window close button, which don't save the preferences. So if that's the case, then it's not just changes to the "notify me when a new study comes" pref that's not being saved -- it's all the prefs in the Test Pilot pref pane!! I would favor saving the prefs in the unload method of the window, or if that doesn't work, adding click handlers to the buttons in the pref pane to save the changes immediately. I'd prefer not to have to add any buttons or change the value of browser.preferences.instantApply.
Created attachment 462836 [details] [diff] [review] proposed patch Saving preferences in the unload window event.
The patch doesn't seem to be working for me on Windows -- even if I just close the all-studies window and then reopen it (without quitting Firefox), my prefs revert to what they were before. The code looks right, though, so let me play around with it a little more. Maybe I can figure out what's going on.
Hmm, ok, we could write a general test case that checks that "state" of TP prefs remains the same on restart. Not going to write a case for each specific pref though. Are restart test cases difficult in automated test suites? I think so. minusing that.
Comment on attachment 462836 [details] [diff] [review] proposed patch You're breaking the platform consistency by doing this, not sure if I agree with that but I guess that is your call to make. This code is not very maintainable, you would need to remember to update the JS every time you modify the set of preferences. Instead just do: document.getElementById("settings-pane").writePreferences(true);
Created attachment 470055 [details] [diff] [review] New patch using prefPane.writePreferences instead Made a new patch using your suggestion. Please reveiw this one instead.
Landed in mozilla-central: http://hg.mozilla.org/mozilla-central/rev/bd3fb04d8e6d