Hi, I want to track the creation and removal of docshells from a top level content docshell. Is it possible ?
*TLDR;* I am working on the backend of a Storage Inspector devtool to be able to inspect storages like cookies, local storage etc. For this, I want to get a list of all the inner windows (iframes) present on a page and then maintain that list when any new iframe is created or an existing one is destroyed. I am doing this via docshells to be cross platform compatible. Initially, I get a list of all windows present on the page by fetching the top level content docshell of the page and then iterating over its children recursively. The code looks something like this [0]. This works perfectly fine. To observe changes in windows, I add a load and unload event on the chromeEventHandler of the top level content docshell like [1]. Now I am facing two issues regarding the load and unload events : 1) Some windows corresponding to the top level content docshell do not emit "unload" event at all. You can see this behavior by going to "google.co.in", opening Scratchpad in browser mode and then running this script [2], you will see no log in browser console. But navigate to some other website in the same tab, you will see logs for unload events 2) The "load" event only fires after the complete load of the webpage and its inner windows. This is too late for things such as "cookie-changed" observer notifications which start happening even before the DOMContentLoaded event. Due to these two reasons, I want to somehow track the creation and removal of docshells itself. Feel free to suggest other approach to tackle the problem too :) [0] https://pastebin.mozilla.org/4267203 [1] https://pastebin.mozilla.org/4267200 [2] https://pastebin.mozilla.org/4267286 -- Girish Sharma _______________________________________________ dev-platform mailing list dev-platform@lists.mozilla.org https://lists.mozilla.org/listinfo/dev-platform