if (mWindowWatcher) { nsCOMPtr<nsIDocShell> docShell; aWindow->GetDocShell(getter_AddRefs(docShell)); if (docShell) { nsCOMPtr<nsIDOMWindow> domWindow(do_GetInterface(docShell)); if (domWindow) mWindowWatcher->AddWindow(domWindow, 0);
aWindow->GetClientData(data); if (data == nsnull) rv = NS_ERROR_NULL_POINTER; else { #if 0 nsWebShellWindow* window = (nsWebShellWindow *) data; nsIWebShellWindow * webShellWin; rv = window->QueryInterface(kIWebShellWindowIID, (void **) &webShellWin); if (NS_SUCCEEDED(rv)) { mWindowList->AppendElement(webShellWin);
nsAppShellService::RegisterTopLevelWindow(nsIXULWindow* aWindow){  // tell the window mediator about the new window  if (mWindowMediator)    mWindowMediator->RegisterWindow(aWindow);  // tell the window watcher about the new window  if (mWindowWatcher) {    nsCOMPtr<nsIDocShell> docShell;    aWindow->GetDocShell(getter_AddRefs(docShell));    if (docShell) {      nsCOMPtr<nsIDOMWindow> domWindow(do_GetInterface(docShell));      if (domWindow)        mWindowWatcher->AddWindow(domWindow, 0);    }  }  return NS_OK;}