Open
Bug 1149171
Opened 10 years ago
Updated 2 years ago
Adding new toolbar buttons requires adding new prefs
Categories
(DevTools :: Framework, defect)
DevTools
Framework
Tracking
(Not tracked)
NEW
People
(Reporter: pbro, Unassigned)
Details
If you want to create a new toolbar button in the devtools, you have to go through the following steps:
- create a new gcli command,
- flag your command as buttonId and buttonClass,
- create an icon for the button
- whitelist your command in toolbox.js : ToolboxButtons
- update pref devtools.toolbox.toolbarSpec to also contain the command to be executed
- *AND* create a new pref in firefox.js. For instance:
pref("devtools.command-button-mycommand.enabled", false);
The pref is ultimately used to persist the state of the toolbar button (whether it's visible in the toolbar by default or not).
Storing this in a pref is fine, but it looks like an implementation detail, and asking to create a new pref for it is bad, especially when the button is hidden by default.
The pref is used here:
https://dxr.mozilla.org/mozilla-central/source/browser/devtools/framework/toolbox.js#806
Which later does `Services.prefs.getBoolPref(pref)`.
Right now, not defining the pref will make this call fail with NS_ERROR_UNEXPECTED.
The proposal is to try/catch the getBoolPref call to avoid having to define a new pref for new toolbar buttons.
The toolbox framework should just create it itself when/if it needs to store the state of the button.
Reporter | ||
Updated•10 years ago
|
Summary: Adding new toolbar buttons require adding new prefs → Adding new toolbar buttons requires adding new prefs
Comment 1•10 years ago
|
||
(In reply to Patrick Brosset [:pbrosset] [:patrick] from comment #0)
> The proposal is to try/catch the getBoolPref call to avoid having to define
> a new pref for new toolbar buttons.
> The toolbox framework should just create it itself when/if it needs to store
> the state of the button.
Seems reasonable to me. Also, I notice here that in this part visibilityswitch is defaulting to true if not defined: https://dxr.mozilla.org/mozilla-central/source/browser/devtools/framework/toolbox.js#820. I think it should be defaulting to false instead.
Updated•7 years ago
|
Product: Firefox → DevTools
Updated•2 years ago
|
Severity: normal → S3
You need to log in
before you can comment on or make changes to this bug.
Description
•