Closed Bug 564675 Opened 13 years ago Closed 5 years ago
Allow bootstrapped add-ons to have default preferences
Requiring bootstrapped add-ons to have no default preferences is another issue for migration of existing add-ons. One solution would be nsIPrefServiceInternal interface to allow adding and removing default preferences files dynamically.
For now restartless add-ons can use the default branch to set these defaults, but note that these need to be re-set on each run, e.g.: http://github.com/mozilla/prospector/commit/398e5d86935149c5531bd5ac38d6d1049d4def17
Nice trick, somehow I didn't expect the default branch to be writable. So there is a relatively simple work-around here. For an extension that needs to stay compatible with Firefox 3.6 one would probably load the default preferences file into a sandbox, with the pref() function on that sandbox looking very similar to your setDefaultPrefs() function. The only problem is reverting these changes since in theory different extensions might touch the same prefs - not an issue for your own extension but probably something to consider when adding this functionality to the add-on manager.
Can you not use the reload-default-prefs observer notification to do this?
(In reply to comment #3) > Can you not use the reload-default-prefs observer notification to do this? Right now bootstrapped add-on pref directories don't appear in the directory service entries that the pref service loads from so that wouldn't work.
Commit pushed to https://github.com/mozilla/addon-sdk https://github.com/mozilla/addon-sdk/commit/85511f1c467a9fb5d2b8d2b6b4360e7598fce638 Loading default addon prefs on startup (workaround for bug 564675)
For those that want to use defaults/preferences/* in restartless addon not using sdk - here is my workaround: https://gist.github.com/oshybystyi/8cf882bc8b0c9a95a116
As bootstrapped add-ons will go away with Firefox 57, I assume this can be marked as WONTFIX, right? Sebastian
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.