Closed
Bug 898040
Opened 12 years ago
Closed 12 years ago
Delay adding the event listeners for PanelUI until the panel menu is toggled
Categories
(Firefox :: Toolbars and Customization, defect)
Firefox
Toolbars and Customization
Tracking
()
RESOLVED
FIXED
Firefox 28
People
(Reporter: jaws, Assigned: jaws)
References
Details
(Whiteboard: [Australis:M8])
Attachments
(2 files)
5.08 KB,
patch
|
mconley
:
review+
|
Details | Diff | Splinter Review |
1.01 KB,
patch
|
MattN
:
review+
|
Details | Diff | Splinter Review |
We shouldn't need to run PanelUI.init until the panel is activated.
Assignee | ||
Comment 1•12 years ago
|
||
We still need the lazy getters, but the event listeners aren't needed and it looks like the retrieval of the panel element is causing the panel constructor to be run.
Summary: Delay initialization of the PanelUI until the panel menu is toggled → Delay adding the event listeners for PanelUI until the panel menu is toggled
Assignee | ||
Comment 2•12 years ago
|
||
I confirmed locally that the PanelUI.xml binding constructor isn't being run with this patch and that the panel opens and functions correctly.
Attachment #781091 -
Flags: review?(mconley)
Comment 3•12 years ago
|
||
Comment on attachment 781091 [details] [diff] [review]
898040.patch
Review of attachment 781091 [details] [diff] [review]:
-----------------------------------------------------------------
It's a little ugly that we have to run _ensureEventListenersAdded at the start of each of those functions, but I'll take performant code over pretty code at this point.
::: browser/components/customizableui/content/panelUI.js
@@ +25,5 @@
> panel: "PanelUI-popup"
> };
> },
>
> + _ensureInitialized: function() {
I guess we should add a
_initialized: false,
somewhere here as well.
@@ +65,5 @@
> uninit: function() {
> + if (!this._initialized) {
> + return;
> + }
> +
And I guess we don't need to remove these if !this._eventListenersAdded.
Attachment #781091 -
Flags: review?(mconley) → review+
Assignee | ||
Comment 4•12 years ago
|
||
Oh, I forgot to remove the _initialized business. It's not needed anymore.
Assignee | ||
Comment 5•12 years ago
|
||
Whiteboard: [Australis:M8][fixed-in-ux]
Assignee | ||
Comment 6•12 years ago
|
||
I forgot to add a check in uninit to only remove the event listeners if they were added. Without this check, the PanelUI.xml cstor will run when a window is closed.
Attachment #781242 -
Flags: review?(mconley)
Comment 7•12 years ago
|
||
Comment on attachment 781242 [details] [diff] [review]
followup patch
Review of attachment 781242 [details] [diff] [review]:
-----------------------------------------------------------------
r=me
Attachment #781242 -
Flags: review?(mconley) → review+
Assignee | ||
Comment 8•12 years ago
|
||
Landed the follow-up on UX, https://hg.mozilla.org/projects/ux/rev/91c9b0675e2b
Comment 9•12 years ago
|
||
Is adding event listeners for begin/end batch updates & showHelpView really needed? For the former, I don't think we need the listeners to be there. For the latter, that can't really be called without the panel having been opened before... right?
Assignee | ||
Comment 10•12 years ago
|
||
I was added them as defensive programming in case they become needed in the future, but we can remove them if you feel strongly about it.
Comment 11•12 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/89dfb5b64ed0
https://hg.mozilla.org/mozilla-central/rev/91c9b0675e2b
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Whiteboard: [Australis:M8][fixed-in-ux] → [Australis:M8]
Target Milestone: --- → Firefox 28
You need to log in
before you can comment on or make changes to this bug.
Description
•