bug 191871: fayt stops working after Alt+F C. r+sr=jst

git-svn-id: svn://10.0.0.236/trunk@162881 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
aaronleventhal%moonset.net
2004-09-28 18:42:59 +00:00
parent f1458f847f
commit b881039b79

View File

@@ -388,6 +388,10 @@ nsTypeAheadFind::Observe(nsISupports *aSubject, const char *aTopic,
// -- Attach/Remove window listeners --
nsCOMPtr<nsIDOMWindow> topLevelWindow(do_QueryInterface(aSubject));
NS_ENSURE_TRUE(topLevelWindow, NS_OK);
nsCOMPtr<nsPIDOMWindow> privateWindow = do_QueryInterface(aSubject);
nsIFocusController *focusController =
privateWindow->GetRootFocusController();
NS_ENSURE_TRUE(focusController, NS_ERROR_FAILURE);
if (isOpening) {
if (mAutoStartPref) {
@@ -396,16 +400,11 @@ nsTypeAheadFind::Observe(nsISupports *aSubject, const char *aTopic,
// Attach nsTypeAheadController to window
// so it can handle / and ' shortcuts to start text and link search
nsCOMPtr<nsPIDOMWindow> privateWindow = do_QueryInterface(aSubject);
if (privateWindow) {
nsCOMPtr<nsIControllers> controllers;
privateWindow->GetControllers(getter_AddRefs(controllers));
NS_ENSURE_TRUE(controllers, NS_ERROR_FAILURE);
nsIFocusController *focusController =
privateWindow->GetRootFocusController();
NS_ENSURE_TRUE(focusController, NS_ERROR_FAILURE);
nsCOMPtr<nsIController> controller =
new nsTypeAheadController(focusController);
NS_ENSURE_TRUE(controller, NS_ERROR_FAILURE);
@@ -416,6 +415,10 @@ nsTypeAheadFind::Observe(nsISupports *aSubject, const char *aTopic,
return NS_OK;
}
nsCOMPtr<nsIDOMWindowInternal> activeWindowInternal;
focusController->GetFocusedWindow(getter_AddRefs(activeWindowInternal));
nsCOMPtr<nsIDOMWindow> activeWindow = do_QueryInterface(activeWindowInternal);
RemoveWindowListeners(topLevelWindow);
// -- Prevent leaks ---
@@ -460,6 +463,11 @@ nsTypeAheadFind::Observe(nsISupports *aSubject, const char *aTopic,
RemoveDocListeners();
CancelFind();
}
if (domWin == activeWindow) {
// If popup was still open as its parent window closes, don't stay in
// menu active state which prevents us from operating
mIsMenuBarActive = mIsMenuPopupActive = PR_FALSE;
}
}
}