How to properly receive the DOMContentLoaded event from an XUL iframe?

后端 未结 2 1795
无人共我
无人共我 2021-01-13 17:58

I\'m working on a minimal Firefox extension that loads a web page into an XUL iframe. (I also tried the html:iframe, but met identical results.) The page may

相关标签:
2条回答
  • 2021-01-13 18:26

    Does the issue happen when you open your XUL page through the Firefox menu > Web Developer > Error Console > open("chrome://yourpage.xul", "", "width=640,height=480");? The browser that is beneath the location bar is marked as content-primary, which makes the pages in there run with restricted privileges, regardless of the protocol that the page is coming from (this is counter-intuitive, granted). It could be what's causing your issue, but I'd be unable to tell you the exact reason why, unfortunately.

    The next step for such subtle issues involves connecting to irc.mozilla.org#developers and asking about your problem when the west coast is awake :).

    0 讨论(0)
  • 2021-01-13 18:32

    According to the Gecko documentation, DOMFrameContentLoaded should work as an alternative event listener:

    The DOMFrameContentLoaded event is executed when a frame has finished loading and being parsed, without waiting for stylesheets, images, and subframes to be done loading. This event is similar to DOMContentLoaded but only applies to frames.

    Firefox and Opera(Mini or desktop 12 and under which use the Presto Engine) support this event:

    Currently, Firefox and Opera both implement DOMFrameContentLoaded events.

    When a frame has been loaded, Opera dispatches an event on the owner iframe. This event then bubbles up to the window.

    Firefox dispatches an event on the document on the owner iframe. It bubbles to the window. The target of that element is the iframe whose content has loaded. If the owner document is itself contained in a frame, an event is dispatched to the parent document. event target is still the frame when content has loaded (and so on to the top of the parent document chain).

    References

    • Webkit Bug 33604 - iframe.contentWindow doesn't fire DOMContentLoaded (implement DOMFrameContentLoaded?)
    0 讨论(0)
提交回复
热议问题