getMostRecentWindow() doesn't find windowtype if in a tab

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

getMostRecentWindow() doesn't find windowtype if in a tab

opto
Background: I amm trying to put the search dialog into a tab by loading the xul into a chromeTab.

Later, I want to get the window and then the document to change some elements that are lost when loading into the chrometab.

I am using services.wm.getMostRecentWindow() with the windowtype mailnews:search.If the search dialog is in a dialogwindow, getMostRecentWindow returns a window.

If it is in a tab, it returns an undefined object. Using DOMInspector, the tab has a window with the correct windowtype (mailsnews:sarch).

Why doesn't getMostRecentWindow find that?

Any help is appreciated.

Klaus


_______________________________________________
dev-apps-thunderbird mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-apps-thunderbird
Reply | Threaded
Open this post in threaded view
|

Re: getMostRecentWindow() doesn't find windowtype if in a tab

Philipp Kewisch-2
On 9/4/17 10:36 PM, opto wrote:

> Background: I amm trying to put the search dialog into a tab by loading the xul into a chromeTab.
>
> Later, I want to get the window and then the document to change some elements that are lost when loading into the chrometab.
>
> I am using services.wm.getMostRecentWindow() with the windowtype mailnews:search.If the search dialog is in a dialogwindow, getMostRecentWindow returns a window.
>
> If it is in a tab, it returns an undefined object. Using DOMInspector, the tab has a window with the correct windowtype (mailsnews:sarch).
>
> Why doesn't getMostRecentWindow find that?
>
> Any help is appreciated.
>
> Klaus
>
>

This is probably the obvious answer, but that API is meant to find
window types on actual windows, not DOM window objects. Therefore, it
does not work in the tab. You'll have to use different commands to find
that window, mostly by you knowing where it is and accessing it through
dom commands.

Philipp
_______________________________________________
dev-apps-thunderbird mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-apps-thunderbird
Reply | Threaded
Open this post in threaded view
|

Re: getMostRecentWindow() doesn't find windowtype if in a tab

opto
Thanks Philipp,

I was afraid that might be the answer.
The fact that the functions returns an nsIDOMWindow (MDN) suggests it might work. So it seems a tab is not a window in the sense of this function.

Klaus
_______________________________________________
dev-apps-thunderbird mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-apps-thunderbird