Closed Bug 1121700 Opened 6 years ago Closed 6 years ago

Create an OptionsView helper for devtools panels

Categories

(DevTools :: General, defect)

37 Branch
x86
macOS
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
Firefox 38

People

(Reporter: jsantell, Assigned: jsantell)

References

Details

Attachments

(1 file, 1 obsolete file)

A helper to keep preference values in sync with a dropdown menu. For use with web audio editor (bug 1023462) and new perf tool (bug 1102350). Debugger options could be converted to use this as well (and would update the checkboxes when updated from elsewhere)
Assignee: nobody → jsantell
Status: NEW → ASSIGNED
Comment on attachment 8549188 [details] [diff] [review]
1121700-options-view.patch

Review of attachment 8549188 [details] [diff] [review]:
-----------------------------------------------------------------

This is beautiful.

::: browser/devtools/shared/options-view.js
@@ +9,5 @@
> + * OptionsView constructor. Takes several options, all required:
> + * - branchName: The name of the prefs branch, like "devtools.debugger."
> + * - window: The window the XUL elements live in.
> + * - menupopup: The XUL `menupopup` item that contains the pref buttons.
> + * 

Nit: whitespace.
Attachment #8549188 - Flags: review?(vporof) → review+
Comment on attachment 8549188 [details] [diff] [review]
1121700-options-view.patch

Review of attachment 8549188 [details] [diff] [review]:
-----------------------------------------------------------------

::: browser/devtools/shared/options-view.js
@@ +46,5 @@
> +    this.mutationObserver = new MutationObserver(this._onOptionChange);
> +    let observerConfig = { attributes: true, attributeFilter: ["checked"]};
> +
> +    // Sets observers and default options for all options
> +    Array.forEach(this.$$("menuitem", this.menupopup), $el => {

nit: a for-of loop would be shorter here :
for (let $el of this.$$("menuitem",this.menupopup)) {
Nits fixed
Attachment #8549188 - Attachment is obsolete: true
Attachment #8549864 - Flags: review+
https://hg.mozilla.org/integration/fx-team/rev/09b5d7e43b60
Flags: in-testsuite+
Keywords: checkin-needed
Whiteboard: [fixed-in-fx-team]
https://hg.mozilla.org/mozilla-central/rev/09b5d7e43b60
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Whiteboard: [fixed-in-fx-team]
Target Milestone: --- → Firefox 38
Product: Firefox → DevTools
You need to log in before you can comment on or make changes to this bug.