Hello,

I think my question was not clear. I try to explain the issue i am
facing with some code snippet below:

I am embedding xulrunner in a java application. The application will
launch new window with some URL to measure performance metrics like
DNS time, Connection time, Time to First byte , Time to last byte,
Start render time and document complete.

I used following code to launch the window:

nsIThread thread = threadMgr.getMainThread();
windowWatcher =
(nsIWindowWatcher)serviceManager.getServiceByContractID("@mozilla.org/
embedcomp/window-watcher;1", nsIWindowWatcher.NS_IWINDOWWATCHER_IID);
nsIWindowWatcher watcherProxy =
(nsIWindowWatcher)proxy.getProxyForObject(thread,nsIWindowWatcher.NS_IWINDOWWATCHER_IID,windowWatcher,nsIProxyObjectManager.INVOKE_SYNC);
nsIDOMWindow window=watcherProxy.openWindow(null,
"about:blank","window1",
"chrome,centerscreen,resizable,width=1024,height=768", null);//NO I18N
nsIInterfaceRequestor ir = (nsIInterfaceRequestor)
window.queryInterface(nsIInterfaceRequestor.NS_IINTERFACEREQUESTOR_IID);
nsIWebNavigation webNav
=(nsIWebNavigation)ir.getInterface(nsIWebNavigation.NS_IWEBNAVIGATION_IID);
nsIWebNavigation webNavProxy =
(nsIWebNavigation)proxy.getProxyForObject(thread,nsIWebNavigation.NS_IWEBNAVIGATION_IID,webNav,nsIProxyObjectManager.INVOKE_SYNC);
webNavProxy.loadURI(url,nsIWebNavigation.LOAD_FLAGS_BYPASS_PROXY,
null, postDataStream, headers);


And i am adding listener for the events MozAfterPaint,
DomContentLoaded, Load as below using nsIWindowMediatorListener

windowMediator.addListener(this);

public void onOpenWindow(nsIXULWindow xulWin)
{
        nsIDOMWindow window = (nsIDOMWindow)
((nsIInterfaceRequestor)xulWin.getDocShell().queryInterface(nsIInterfaceRequestor.NS_IINTERFACEREQUESTOR_IID)).getInterface(nsIDOMWindow.NS_IDOMWINDOW_IID);
        nsIDOMEventTarget winTarget = (nsIDOMEventTarget)
window.queryInterface(nsIDOMEventTarget.NS_IDOMEVENTTARGET_IID);
        winTarget.addEventListener("MozAfterPaint",this,true);
        winTarget.addEventListener("load",this,true);
        winTarget.addEventListener("DOMContentLoaded",this,true);
}

I am able to get notification for the url given in
windowWatcher.openWindow. For the URL loaded via
nsIWebNavigation.LoadURI, no notification is coming.

Kindly help me to resolve this.

Regards,
Raghavan


On Mar 30, 4:54 pm, "raghavan.s" <[email protected]> wrote:
> Hi,
>
> I am embedding xulrunner in java.
>
> I will be launching new window with the given URL and will get
> performance metrics like time for rendering, document complete. There
> will be lot of new window will be open up.
>
> I want to get notified for "MozAfterPaint", "DomContentLoaded" and
> "Load" event on a window.
>
> To get notified for the above events, i registered listener when
> window is opened (listening to
> nsIWindowMediatorListener.onOpenWindow). But i got notified for
> about:blank which is given while launching the window and it is
> notified only once.
>
> I will be loading the required URL through nsIWebNavigation.loadURI.
> For which i never received any event.
>
> Am i doing anything wrong ?
>
> Please help.
>
> Raghavan

_______________________________________________
dev-embedding mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-embedding

Reply via email to