Bug 519478 - UMR in nsAutoCompleteController::ClosePopup. r=gavin.sharp
--- a/toolkit/components/autocomplete/src/nsAutoCompleteController.cpp
+++ b/toolkit/components/autocomplete/src/nsAutoCompleteController.cpp
@@ -323,17 +323,17 @@ nsAutoCompleteController::HandleStartCom
PRBool disabled;
input->GetDisableAutoComplete(&disabled);
if (disabled)
return NS_OK;
// Stop all searches in case they are async.
StopSearch();
- PRBool isOpen;
+ PRBool isOpen = PR_FALSE;
input->GetPopupOpen(&isOpen);
if (isOpen)
ClosePopup();
mPopupClosedByCompositionStart = isOpen;
return NS_OK;
}
NS_IMETHODIMP
@@ -399,17 +399,17 @@ nsAutoCompleteController::HandleKeyNavig
aKey == nsIDOMKeyEvent::DOM_VK_DOWN ||
aKey == nsIDOMKeyEvent::DOM_VK_PAGE_UP ||
aKey == nsIDOMKeyEvent::DOM_VK_PAGE_DOWN)
{
// Prevent the input from handling up/down events, as it may move
// the cursor to home/end on some systems
*_retval = PR_TRUE;
- PRBool isOpen;
+ PRBool isOpen = PR_FALSE;
input->GetPopupOpen(&isOpen);
if (isOpen) {
PRBool reverse = aKey == nsIDOMKeyEvent::DOM_VK_UP ||
aKey == nsIDOMKeyEvent::DOM_VK_PAGE_UP ? PR_TRUE : PR_FALSE;
PRBool page = aKey == nsIDOMKeyEvent::DOM_VK_PAGE_UP ||
aKey == nsIDOMKeyEvent::DOM_VK_PAGE_DOWN ? PR_TRUE : PR_FALSE;
// Fill in the value of the textbox with whatever is selected in the popup
@@ -473,17 +473,17 @@ nsAutoCompleteController::HandleKeyNavig
} else if ( aKey == nsIDOMKeyEvent::DOM_VK_LEFT
|| aKey == nsIDOMKeyEvent::DOM_VK_RIGHT
#ifndef XP_MACOSX
|| aKey == nsIDOMKeyEvent::DOM_VK_HOME
#endif
)
{
// The user hit a text-navigation key.
- PRBool isOpen;
+ PRBool isOpen = PR_FALSE;
input->GetPopupOpen(&isOpen);
if (isOpen) {
PRInt32 selectedIndex;
popup->GetSelectedIndex(&selectedIndex);
PRBool shouldComplete;
input->GetCompleteDefaultIndex(&shouldComplete);
if (selectedIndex >= 0) {
// The pop-up is open and has a selection, take its value
@@ -944,17 +944,17 @@ nsAutoCompleteController::OpenPopup()
nsresult
nsAutoCompleteController::ClosePopup()
{
if (!mInput) {
return NS_OK;
}
- PRBool isOpen;
+ PRBool isOpen = PR_FALSE;
mInput->GetPopupOpen(&isOpen);
if (!isOpen)
return NS_OK;
nsCOMPtr<nsIAutoCompletePopup> popup;
mInput->GetPopup(getter_AddRefs(popup));
NS_ENSURE_TRUE(popup != nsnull, NS_ERROR_FAILURE);
popup->SetSelectedIndex(-1);
--- a/toolkit/components/satchel/src/nsFormFillController.cpp
+++ b/toolkit/components/satchel/src/nsFormFillController.cpp
@@ -194,16 +194,18 @@ nsFormFillController::GetController(nsIA
return NS_OK;
}
NS_IMETHODIMP
nsFormFillController::GetPopupOpen(PRBool *aPopupOpen)
{
if (mFocusedPopup)
mFocusedPopup->GetPopupOpen(aPopupOpen);
+ else
+ *aPopupOpen = PR_FALSE;
return NS_OK;
}
NS_IMETHODIMP
nsFormFillController::SetPopupOpen(PRBool aPopupOpen)
{
if (mFocusedPopup) {
if (aPopupOpen) {