Closed Bug 612016 Opened 14 years ago Closed 14 years ago

Switch to construct/destroy model for context-menu

Categories

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

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: adw, Assigned: adw)

References

Details

Attachments

(1 file)

See bug 596053.
Attached patch patchSplinter Review
When an item is created, it's added to the top-level context menu.  If the item is later added to a Menu (by being a member of the items array of the options object passed to the Menu constructor), the item is removed from the top-level context menu and added to the new submenu.  (This results in some unnecessary shuffling of XUL elements, but I don't see a way around that.)

Calling destroy on a non-top-level item is a no-op.  In other words, if an item is contained in a Menu, calling destroy on it doesn't remove it from the Menu.  (I'm OK with this for now; certainly we can come back later if we decide we want sub-items to be destroyable.)

destroy is idempotent: all calls to destroy after the first are no-ops.

This patch also updates the test, doc, and Programs page in the dev-guide.
Attachment #490423 - Flags: review?(myk)
(In reply to comment #1)
> Calling destroy on a non-top-level item is a no-op.  In other words, if an item
> is contained in a Menu, calling destroy on it doesn't remove it from the Menu. 
> (I'm OK with this for now; certainly we can come back later if we decide we
> want sub-items to be destroyable.)

Oh, I meant to add that it's not currently possible to remove() a sub-item anyway.
Comment on attachment 490423 [details] [diff] [review]
patch

>-// ADD NO TESTS BELOW THIS LINE! ///////////////////////////////////////////////
>+// NO TESTS BELOW THIS LINE! ///////////////////////////////////////////////////

Ha! :-)
Attachment #490423 - Flags: review?(myk) → review+
Completely screwed up the merges here.

https://github.com/mozilla/addon-sdk/commit/0c5622438b02b2f7ad4ff7c2454462cd43912cea

https://github.com/mozilla/addon-sdk/commit/b6a233af15694fb010d1283d4495ef789d0c3c80
Status: ASSIGNED → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
Target Milestone: -- → 0.10
Target Milestone: 0.10 → 1.0b1
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: