"addon-options-displayed" notification fires before XBL bindings apply

RESOLVED FIXED in mozilla11

Status

()

defect
RESOLVED FIXED
8 years ago
8 years ago

People

(Reporter: gaubugzilla, Assigned: darktrojan)

Tracking

Trunk
mozilla11
Points:
---
Dependency tree / graph
Bug Flags:
in-testsuite +
in-litmus -

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

I have a boolean setting that isn't bound to a pref and is initialized "manually":

<setting id="foo" type="bool" title="Foo"/>

I tried setting document.getElementById("foo").value when handling "addon-options-displayed" notification and noticed that it has no effect. In fact, the value property is completely broken after that. Eventually I figured out that "addon-options-displayed" is fired before XBL bindings apply - meaning before the value property is defined. Setting it at that point masks getter and setter on the prototype that are added later.

Clearly, this notification should fire when the UI is fully initialized (as happening in Fennec right now). For reference, on XBL bindings not applying synchronously: bug 407311.

Tested in 20111207 nightly build on Windows 7 x64.
Assignee: nobody → geoff
Status: NEW → ASSIGNED
Posted patch patchSplinter Review
I suspect I'll get told off for using .clientTop in product code, but I see no way around it.
Attachment #580563 - Flags: review?(bmcbride)
Comment on attachment 580563 [details] [diff] [review]
patch

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

(In reply to Geoff Lankow (:darktrojan) from comment #1)
> I suspect I'll get told off for using .clientTop in product code, but I see
> no way around it.

Certainly not the only time this hack has been used.
Attachment #580563 - Flags: review?(bmcbride) → review+
Comment on attachment 580563 [details] [diff] [review]
patch

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

::: toolkit/mozapps/extensions/content/extensions.js
@@ +2914,5 @@
> +    if (gViewController.viewPort.selectedPanel.hasAttribute("loading")) {
> +      gDetailView.node.addEventListener("ViewChanged", function viewChangedEventListener() {
> +        gDetailView.node.removeEventListener("ViewChanged", viewChangedEventListener, false);
> +        if (firstSetting)
> +          firstSetting.clientTop;

Would be good to have a comment here.

@@ +2919,5 @@
> +        Services.obs.notifyObservers(document, "addon-options-displayed", gDetailView._addon.id);
> +      }, false);
> +    } else {
> +      if (firstSetting)
> +        firstSetting.clientTop;

And here.
https://hg.mozilla.org/mozilla-central/rev/4b71b1e9cc0c
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
Flags: in-testsuite+
Flags: in-litmus-
Resolution: --- → FIXED
Target Milestone: --- → mozilla11
You need to log in before you can comment on or make changes to this bug.