Closed
Bug 564675
Opened 15 years ago
Closed 8 years ago
Allow bootstrapped add-ons to have default preferences
Categories
(Toolkit :: Add-ons Manager, defect)
Toolkit
Add-ons Manager
Tracking
()
RESOLVED
WONTFIX
People
(Reporter: jwkbugzilla, Unassigned)
References
Details
(Whiteboard: [rewrite])
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.
Reporter | ||
Updated•15 years ago
|
Whiteboard: [rewrite]
Comment 1•14 years ago
|
||
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
Reporter | ||
Comment 2•14 years ago
|
||
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.
Comment 3•14 years ago
|
||
Can you not use the reload-default-prefs observer notification to do this?
Comment 4•14 years ago
|
||
(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.
Comment 5•13 years ago
|
||
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)
Comment 6•10 years ago
|
||
For those that want to use defaults/preferences/* in restartless addon not using sdk - here is my workaround:
https://gist.github.com/oshybystyi/8cf882bc8b0c9a95a116
Comment 7•10 years ago
|
||
The existing example at MDN [1] accomplishes the same feat without relying on regular expressions to parse JavaScript function calls. The pref loader module in Firebug takes it a step further, ensuring that default preferences are cleaned up in the event that the extension is uninstalled. [2]
[1] https://developer.mozilla.org/en-US/Add-ons/How_to_convert_an_overlay_extension_to_restartless#Step_4.3A_Manually_handle_default_preferences
[2] https://github.com/firebug/firebug/blob/master/extension/modules/prefLoader.js
Comment 8•10 years ago
|
||
(In reply to Minh Nguyen from comment #7)
> The existing example at MDN [1] accomplishes the same feat without relying
> on regular expressions to parse JavaScript function calls. The pref loader
> module in Firebug takes it a step further, ensuring that default preferences
> are cleaned up in the event that the extension is uninstalled. [2]
>
> [1]
> https://developer.mozilla.org/en-US/Add-ons/
> How_to_convert_an_overlay_extension_to_restartless#Step_4.
> 3A_Manually_handle_default_preferences
> [2]
> https://github.com/firebug/firebug/blob/master/extension/modules/prefLoader.
> js
Thanks for the review Minh. I introduced few changes into https://gist.github.com/oshybystyi/8cf882bc8b0c9a95a116#comment-1439795
In short: removed regex and added clearDefaultPrefs()
Comment 9•8 years ago
|
||
As bootstrapped add-ons will go away with Firefox 57, I assume this can be marked as WONTFIX, right?
Sebastian
Flags: needinfo?(amckay)
Comment 10•8 years ago
|
||
Yup.
Status: NEW → RESOLVED
Closed: 8 years ago
Flags: needinfo?(amckay)
Resolution: --- → WONTFIX
You need to log in
before you can comment on or make changes to this bug.
Description
•