nsCOMPtr<nsIWebShellWindow> webShellWin(do_QueryInterface(aWindow)); NS_ENSURE_TRUE(webShellWin, NS_ERROR_FAILURE); return webShellWin->Close();
nsresult closerv, unregrv; void     *data;  aWindow->GetClientData(data); if (data == nsnull) closerv = NS_ERROR_NULL_POINTER; else { nsWebShellWindow* window = (nsWebShellWindow *) data; closerv = window->Close(); }  unregrv = UnregisterTopLevelWindow(aWindow); if (0 == mWindowList->Count()) mAppShell->Exit();  return closerv == NS_OK ? unregrv : closerv;
nsAppShellService::CloseTopLevelWindow(nsIXULWindow* aWindow){   nsCOMPtr<nsIWebShellWindow> webShellWin(do_QueryInterface(aWindow));   NS_ENSURE_TRUE(webShellWin, NS_ERROR_FAILURE);   return webShellWin->Close();}