I was wondering the differences between nsIDOMWindow (returned by Services.wm.getWindowEnumerator and nsIXULWindow returned by Services.wm.getXULWindowEnumerator.
The reason I ask is because i heavily use the windowListener (https://developer.mozilla.org/en-US/docs/XPCOM_Interface_Reference/nsIWindowMediator?redirectlocale=en-US&redirectslug=nsIWindowMediator#addListener%28%29)
I created an example on MDN but don't understand the difference between the two windows. I was thinking if I do i can make a better example. Thanks
NSIXULWindow is a XUL Application Object Model(AOM) window:
#document window main-window ... browser #document window myExtensionWindow
Just as HTML is reflected in the DOM as nodes like
link
,layer
, andimg
, XUL is reflected in the Application Object Model in the hierarchy of XUL widgets:browser
,menu
,menuitem
, and so on. The DOM and the AOM form a kind of continuum, the whole of which is manipulable from the standards upon which XUL is based.
NSIDOMWindow is a HTML Document Object Model(DOM) window:
When a XUL window contains a widget capable of displaying a page, such as
<browser>
or<iframe>
, the document in that widget is, naturally, separate from the document of the chrome window itself. There also is a Window object for each sub-document, although there's no window in a common sense for the sub-document.The same holds for chrome windows opened inside a tab of
<tabbrowser>
. The elements above the chrome document opened in the tab are separate from your chrome document.
References