Closed Bug 523729 Opened 15 years ago Closed 15 years ago

Notify when the add-ons list is built and when options are populated

Categories

(Firefox for Android Graveyard :: General, defect)

x86
macOS
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
fennec1.0

People

(Reporter: Mardak, Assigned: fabrice.desre)

References

Details

Attachments

(1 file)

It would be useful to know when the add-ons list has been generated -- potentially an add-on would want to modify its listing.

Also, it would be useful to know when the options button was clicked for the first time and caused the options to be populated with <setting>s.

This can be done right now by wrapping certain functions, but it could be much simpler with the notifications.

// Wait for the add-ons to be loaded to modify the prefs behavior
let origGet = ExtensionsView.getAddonsFromLocal;   
ExtensionsView.getAddonsFromLocal = function() {
  // Restore the original function and call it then do our work
  ExtensionsView.getAddonsFromLocal = origGet;
  ExtensionsView.getAddonsFromLocal();

  // Wait for options to get loaded
  let item = ExtensionsView.getElementForAddon("{...}");
  let origToggle = item.toggleOptions;                                
  item.toggleOptions = function() {
    item.toggleOptions = origToggle;                          
    item.toggleOptions();
    ...
Attached patch patchSplinter Review
This patch adds a "AddonOptionsLoad" event dispatched by the richlistitem.

Listener should be attached to the container richlistbox (id="addons-list")
Assignee: nobody → fabrice.desre
Attachment #414041 - Flags: review?(mark.finkle)
Attachment #414041 - Flags: review?(mark.finkle) → review+
pushed:
https://hg.mozilla.org/mobile-browser/rev/76c68975fc20
Status: NEW → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
Target Milestone: --- → Post-B5
So addons should attach an event listener for AddonOptionsLoad on the window and check if the target has an attribute set to the add-on's guid?
As said in comment #1, you can attach your event listener to the <richlistbox id="addons-list"> (it bubbles from the richlistitem). The originalTarget of the event is a node that carries the addonId has an attribute. We should update the wiki with this.
Blocks: 532722
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: