Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Deferred display of XUL panel containing embedded iframe

64 views
Skip to first unread message

Matthew Gertner

unread,
May 16, 2013, 11:27:21 AM5/16/13
to
I have a toolbar button that displays a XUL panel when pressed. The panel contains an iframe into which an HTML page is loaded. To avoid "flicker", I'd like to defer display of the panel until the HTML page has finished loading (DOMContentLoaded).

I tried setting the panel's hidden property to true in the popupshowing handler and then setting it back to true when the iframe has finished loading. The DOMContentLoaded handler for the iframe is called, but the panel remains invisible even after setting hidden back to false. The state of the panel is 'closed' at this point.

It seems like the panel is automatically being closed when its hidden property is set to true. (The same happens when I set style.display to 'none' or collapsed to true). I nosed around the source code a bit but ended it quickly in the bowels of nsBoxObject.cpp. Before I start debugging the box object code, does anyone have any insights into why setting the hidden property of the panel's XUL element to true causes it to be closed (and thus remain invisible even when hidden is set back to false)?

Gavin Sharp

unread,
May 16, 2013, 1:20:33 PM5/16/13
to Matthew Gertner, dev-platform
Can't you just avoid calling openPopup until the page is loaded, and
avoid messing with the panel's "hidden" state completely?

Gavin
> _______________________________________________
> dev-platform mailing list
> dev-pl...@lists.mozilla.org
> https://lists.mozilla.org/listinfo/dev-platform

Matthew Gertner

unread,
May 16, 2013, 4:17:42 PM5/16/13
to
On Thursday, May 16, 2013 7:20:33 PM UTC+2, Gavin Sharp wrote:
> Can't you just avoid calling openPopup until the page is loaded, and
> avoid messing with the panel's "hidden" state completely?

I tried that but it seemed like the iframe didn't have a docShell until after the popup is shown so I couldn't load the document into it. If that seems strange then I'm probably doing something wrong (I only did a quick test earlier today). I'll have to investigate further.

Neil

unread,
May 16, 2013, 6:20:13 PM5/16/13
to
Matthew Gertner wrote:

>It seems like the panel is automatically being closed when its hidden property is set to true.
>
display: none; destroys the nsIFrame object (in this case an
nsMenuPopupFrame), thus closing the panel.

--
Warning: May contain traces of nuts.

Matthew Gertner

unread,
May 17, 2013, 4:40:12 AM5/17/13
to
On Friday, May 17, 2013 12:20:13 AM UTC+2, Neil wrote:
> display: none; destroys the nsIFrame object (in this case an
> nsMenuPopupFrame), thus closing the panel.

Is there another way to make the panel invisible without destroying the nsIFrame?

I can't see how to open the popup after the content is loaded since as far as I can see the iframe doesn't have a docshell until the popup is first opened.

nipi...@gmail.com

unread,
May 17, 2013, 7:06:51 AM5/17/13
to

Matthew Gertner

unread,
May 17, 2013, 11:59:32 AM5/17/13
to
On Friday, May 17, 2013 10:40:12 AM UTC+2, Matthew Gertner wrote:
> Is there another way to make the panel invisible without destroying the nsIFrame?

For the record two people emailed me separately to suggest panel.style.visibility = 'hidden'. This works fine. The only caveat is that I still see the panel's old content for a split second if I make it visible again in the 'DOMContentLoaded' handler. If I wait for readystate to change to 'complete' then it works fine and I see the new content with no blinking. I'm not sure if this is because rendering has not necessarily finished when readystate is 'interactive' or if it's just coincidence (since 'complete' happens later).

Yonggang Luo

unread,
Sep 5, 2014, 10:52:05 AM9/5/14
to
I was also insert a iframe into panel, but the problem that i faced is the autohide doesn't works, the panel act like this: it's weirdly calling the hidden and show event, that's should not be happen.
0 new messages