Can't get "DOMContentLoaded" event from iframe inside a Firefox tab (XUL and chrome:// document)
Boris Zbarsky
bzbarsky at MIT.EDU
Tue Aug 20 17:34:59 UTC 2013
On 8/20/13 9:25 AM, Paul Rouget wrote:
> A XUL document: chrome://browser/content/devtools/framework/toolbox-window.xul
> It contains many iframes. We listen to the DOMContentLoaded event from these iframes.
>
>> let iframe = document.createElement("iframe");
>> iframe.addEventListener("DOMContentLoaded", callback);
This will only work if the iframe in question is a content boundary (or
maybe it's enough to be in a chrome docshell; it needs to be the "chrome
event handler" for the contained window), as far as I can tell.
> Event is received if toolbox-window.xul lives in its own window.
> Event is NOT received if toolbox-window.xul lives in a Firefox tab (inside <browser>).
In the latter case, the xul:iframe is most definitely not in a chrome
docshell.
> How can I get the window behavior inside a tab?
You can't, without fixing tabbrowser to allow chrome tabs.
-Boris
More information about the firefox-dev
mailing list