enabling bootstrapped addon with inline options from the more information page doesn't fire addon-options-displayed event

VERIFIED INVALID

Status

()

defect
VERIFIED INVALID
8 years ago
8 years ago

People

(Reporter: Will, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

Reporter

Description

8 years ago
The "control" type of inline option relies on the addon-options-displayed event to attach functionality.

From the More Information page in the Add-ons Manager, enabling a disabled bootstrapped addon clearly causes the inline options to be displayed but the aforementioned event is not fired. Consequently a user must close and re-open the More Information page to use any "control" type options.
Working for me. Could it be that your observer is not added until after the settings are loaded?

Try running this code in the Error Console, it'll pop up an alert whenever that notification is fired:

Components.utils.import("resource://gre/modules/Services.jsm");
Services.obs.addObserver({
  observe: function(a,b,c) { Services.prompt.alert(null, b, c); }
}, "addon-options-displayed", false);
Reporter

Comment 2

8 years ago
Apologies, you are indeed correct regarding the cause - I shall have to explore how to detect if the page is already open at enable. The inline options display notification example at MDC could do with mentioning this limitation or (dare I say it) code to deal with it which I'd be happy to add if I can find a neat way to do it myself first.

I suppose this bug should now be marked invalid, which I can't do - thanks.
You should add your observer in the startup function, and deal with any dependencies from within the observer itself.
Status: UNCONFIRMED → RESOLVED
Closed: 8 years ago
Resolution: --- → INVALID
Reporter

Comment 4

8 years ago
Thanks for the pointer, I hadn't realised my use of AddonManager.getAddonByID in the startup function was causing the race condition (the addon-options-displayed event was fired before most of my startup code was executed asynchronously).
Sounds like it is working now. Marking bug as verified invalid.
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.