Closed Bug 1263140 Opened 4 years ago Closed 4 years ago

Fix notified button name in SDK native-options module

Categories

(Add-on SDK Graveyard :: General, defect)

defect
Not set

Tracking

(firefox48 fixed)

RESOLVED FIXED
mozilla48
Tracking Status
firefox48 --- fixed

People

(Reporter: rpl, Assigned: rpl)

Details

Attachments

(1 file)

Unfortunately the jetpack test suite didn't catched that in the changes introduced by Bug 1167246 the name of the button is now used in a closure and the command handler of the add-on preferences button will notify the wrong preference name if the button is not the last element of the preferences array.
Comment on attachment 8739411 [details]
MozReview Request: Bug 1263140 - fix notified button name in SDK native-options module. r=mossop

https://reviewboard.mozilla.org/r/45263/#review41755

::: addon-sdk/source/lib/sdk/preferences/native-options.js:136
(Diff revision 1)
>  // dynamically injects inline options into about:addons page at runtime
>  // NOTE: on Firefox Desktop the about:addons page is a xul page document,
>  // on Firefox for Android the about:addons page is an xhtml page, to support both
>  // the XUL xml namespace have to be enforced.
>  function injectOptions({ preferences, preferencesBranch, document, parent, id }) {
>    for (let { name, type, hidden, title, description, label, options, on, off } of preferences) {

Can you instead make this

    preferences.forEach(({name, type, hidden, title, description, label, options, on, off}) => {
    ...
    });

That should solve the issue and make sure it doesn't catch us elsewhere.
Attachment #8739411 - Flags: review?(dtownsend) → review+
(In reply to Dave Townsend [:mossop] from comment #2)
> Comment on attachment 8739411 [details]
> MozReview Request: Bug 1263140 - fix notified button name in SDK
> native-options module. r?mossop
> 
> https://reviewboard.mozilla.org/r/45263/#review41755
> 
> ::: addon-sdk/source/lib/sdk/preferences/native-options.js:136
> (Diff revision 1)
> >  // dynamically injects inline options into about:addons page at runtime
> >  // NOTE: on Firefox Desktop the about:addons page is a xul page document,
> >  // on Firefox for Android the about:addons page is an xhtml page, to support both
> >  // the XUL xml namespace have to be enforced.
> >  function injectOptions({ preferences, preferencesBranch, document, parent, id }) {
> >    for (let { name, type, hidden, title, description, label, options, on, off } of preferences) {
> 
> Can you instead make this
> 
>     preferences.forEach(({name, type, hidden, title, description, label,
> options, on, off}) => {
>     ...
>     });
> 
> That should solve the issue and make sure it doesn't catch us elsewhere.

sure, and I like it more than my proposed one.
Comment on attachment 8739411 [details]
MozReview Request: Bug 1263140 - fix notified button name in SDK native-options module. r=mossop

Review request updated; see interdiff: https://reviewboard.mozilla.org/r/45263/diff/1-2/
Attachment #8739411 - Attachment description: MozReview Request: Bug 1263140 - fix notified button name in SDK native-options module. r?mossop → MozReview Request: Bug 1263140 - fix notified button name in SDK native-options module. r=mossop
https://reviewboard.mozilla.org/r/45263/#review41755

> Can you instead make this
> 
>     preferences.forEach(({name, type, hidden, title, description, label, options, on, off}) => {
>     ...
>     });
> 
> That should solve the issue and make sure it doesn't catch us elsewhere.

Patch updated as suggested in the review comment.
Assignee: nobody → lgreco
Status: NEW → ASSIGNED
https://hg.mozilla.org/mozilla-central/rev/6553edb04f02
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla48
You need to log in before you can comment on or make changes to this bug.