if (focusedWindow == aWindow) {
if (focusedWindow == targetWindow) {
WindowStateHolder::WindowStateHolder(JSContext *cx, JSObject *aObject,                                     nsGlobalWindow *aWindow)  : mRuntime(::JS_GetRuntime(cx)), mJSObj(aObject){  NS_ASSERTION(aWindow, "null window");  // Prevent mJSObj from being gc'd for the lifetime of this object.  ::JS_AddNamedRoot(cx, &mJSObj, "WindowStateHolder::mJSObj");  aWindow->GetListenerManager(getter_AddRefs(mListenerManager));  mMutationBits = aWindow->mMutationBits;  // Clear the window's EventListenerManager pointer so that it can't have  // listeners removed from it later.  aWindow->mListenerManager = nsnull;  nsIFocusController *fc = aWindow->GetRootFocusController();  NS_ASSERTION(fc, "null focus controller");  // We want to save the focused element/window only if they are inside of  // this window.  nsCOMPtr<nsIDOMWindowInternal> focusWinInternal;  fc->GetFocusedWindow(getter_AddRefs(focusWinInternal));  nsCOMPtr<nsPIDOMWindow> focusedWindow = do_QueryInterface(focusWinInternal);  while (focusedWindow) {    if (focusedWindow == aWindow) {      fc->GetFocusedWindow(getter_AddRefs(mFocusedWindow));      fc->GetFocusedElement(getter_AddRefs(mFocusedElement));      break;    }    focusedWindow =      NS_STATIC_CAST(nsGlobalWindow*,                     NS_STATIC_CAST(nsPIDOMWindow*,                                    focusedWindow))->GetPrivateParent();  }  aWindow->SuspendTimeouts();  // Clear the timeout list for aWindow (but we don't need to for children)  mSavedTimeouts = aWindow->mTimeouts;  mTimeoutInsertionPoint = aWindow->mTimeoutInsertionPoint;  aWindow->mTimeouts = nsnull;  aWindow->mTimeoutInsertionPoint = &aWindow->mTimeouts;}