WindowStateHolder::WindowStateHolder(nsGlobalWindow *aWindow, nsIXPConnectJSObjectHolder *aHolder, nsNavigator *aNavigator) : mInnerWindow(aWindow), mInnerWindowHolder(aHolder), mNavigator(aNavigator)
WindowStateHolder::WindowStateHolder(JSContext *cx, JSObject *aObject, nsGlobalWindow *aWindow) : mRuntime(::JS_GetRuntime(cx)), mJSObj(aObject)
WindowStateHolder::WindowStateHolder(nsGlobalWindow *aWindow,                                     nsIXPConnectJSObjectHolder *aHolder,                                     nsNavigator *aNavigator)  : mInnerWindow(aWindow),    mInnerWindowHolder(aHolder),    mNavigator(aNavigator){  NS_PRECONDITION(aWindow, "null window");  NS_PRECONDITION(aWindow->IsInnerWindow(), "Saving an outer window");  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);  // The outer window is used for focus purposes, so make sure that's what  // we're looking for.  nsPIDOMWindow *targetWindow = aWindow->GetOuterWindow();  while (focusedWindow) {    if (focusedWindow == targetWindow) {      fc->GetFocusedWindow(getter_AddRefs(mFocusedWindow));      fc->GetFocusedElement(getter_AddRefs(mFocusedElement));      break;    }    focusedWindow =      NS_STATIC_CAST(nsGlobalWindow*,                     NS_STATIC_CAST(nsPIDOMWindow*,                                    focusedWindow))->GetPrivateParent();  }  aWindow->SuspendTimeouts();}