Backed out changeset ca442067af90 due to unit test hang in test_417798.js.
authorL. David Baron <dbaron@dbaron.org>
Wed, 16 Jul 2008 12:56:30 -0700
changeset 15979 341f9199d4d3a236d1697a2d9d75a9b9397685d1
parent 15975 ca442067af90a7133858f0d9957f24eadbd0d677
child 15980 233d692e9f7544f092aefe6eae4f1af16e5705b9
push idunknown
push userunknown
push dateunknown
milestone1.9.1a1pre
backs outca442067af90a7133858f0d9957f24eadbd0d677
Backed out changeset ca442067af90 due to unit test hang in test_417798.js.
toolkit/components/autocomplete/src/nsAutoCompleteController.cpp
toolkit/content/widgets/autocomplete.xml
--- a/toolkit/components/autocomplete/src/nsAutoCompleteController.cpp
+++ b/toolkit/components/autocomplete/src/nsAutoCompleteController.cpp
@@ -122,66 +122,66 @@ nsAutoCompleteController::SetInput(nsIAu
   if (mInput) {
     // Stop all searches in case they are async.
     StopSearch();
     ClearResults();
     if (mIsOpen)
       ClosePopup();
     mSearches->Clear();
   }
-
+    
   mInput = aInput;
 
   // Nothing more to do if the input was just being set to null.
   if (!aInput)
     return NS_OK;
 
   nsAutoString newValue;
   aInput->GetTextValue(newValue);
-
+  
   // Clear out this reference in case the new input's popup has no tree
   mTree = nsnull;
-
+  
   // Reset all search state members to default values
   mSearchString = newValue;
   mEnterAfterSearch = 0;
   mDefaultIndexCompleted = PR_FALSE;
   mBackspaced = PR_FALSE;
   mSearchStatus = nsIAutoCompleteController::STATUS_NONE;
   mRowCount = 0;
   mSearchesOngoing = 0;
-
+  
   // Initialize our list of search objects
   PRUint32 searchCount;
   aInput->GetSearchCount(&searchCount);
   mResults->SizeTo(searchCount);
   mSearches->SizeTo(searchCount);
   mMatchCounts.SetLength(searchCount);
 
   const char *searchCID = kAutoCompleteSearchCID;
 
   for (PRUint32 i = 0; i < searchCount; ++i) {
     // Use the search name to create the contract id string for the search service
     nsCAutoString searchName;
     aInput->GetSearchAt(i, searchName);
     nsCAutoString cid(searchCID);
     cid.Append(searchName);
-
+    
     // Use the created cid to get a pointer to the search service and store it for later
     nsCOMPtr<nsIAutoCompleteSearch> search = do_GetService(cid.get());
     if (search)
       mSearches->AppendElement(search);
   }
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsAutoCompleteController::StartSearch(const nsAString &aSearchString)
-{
+{ 
   mSearchString = aSearchString;
   StartSearchTimer();
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsAutoCompleteController::HandleText(PRBool aIgnoreSelection)
 {
@@ -239,17 +239,17 @@ nsAutoCompleteController::HandleText(PRB
   {
     // We need to throw away previous results so we don't try to search through them again
     ClearResults();
     mBackspaced = PR_TRUE;
   } else
     mBackspaced = PR_FALSE;
 
   if (mRowCount == 0)
-    // XXX Handle the case where we have no results because of an ignored prefix.
+    // XXX Handle the case where we have no results because of an ignored prefix. 
     // This is just a hack. I have no idea what I'm doing. Hewitt, fix this the right
     // way when you get a chance. -dwh
     ClearResults();
 
   mSearchString = newValue;
 
   // Don't search if the value is empty
   if (newValue.Length() == 0) {
@@ -287,38 +287,38 @@ nsAutoCompleteController::HandleEnter(PR
     mInput->GetPopup(getter_AddRefs(popup));
 
     if (popup) {
       PRInt32 selectedIndex;
       popup->GetSelectedIndex(&selectedIndex);
       *_retval = selectedIndex >= 0;
     }
   }
-
+  
   // clear the search timer only if we are not searching.
   // if we are searching, EnterMatch() will not handle the enter
   // immediately.  instead, we will handle it on the next result we process
-  // but we need the search timer to fire to kick of that search
+  // but we need the search timer to fire to kick of that search 
   if (mSearchStatus != nsIAutoCompleteController::STATUS_SEARCHING)
     ClearSearchTimer();
   EnterMatch(aIsPopupSelection);
-
+  
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsAutoCompleteController::HandleEscape(PRBool *_retval)
 {
   *_retval = PR_FALSE;
   if (!mInput)
     return NS_OK;
 
   // allow the event through if the popup is closed
   mInput->GetPopupOpen(_retval);
-
+  
   // Stop all searches in case they are async.
   StopSearch();
   ClearResults();
   RevertTextValue();
   ClosePopup();
 
   return NS_OK;
 }
@@ -406,32 +406,32 @@ nsAutoCompleteController::HandleKeyNavig
   input->GetPopup(getter_AddRefs(popup));
   NS_ENSURE_TRUE(popup != nsnull, NS_ERROR_FAILURE);
 
   PRBool disabled;
   input->GetDisableAutoComplete(&disabled);
   NS_ENSURE_TRUE(!disabled, NS_OK);
 
   if (aKey == nsIDOMKeyEvent::DOM_VK_UP ||
-      aKey == nsIDOMKeyEvent::DOM_VK_DOWN ||
-      aKey == nsIDOMKeyEvent::DOM_VK_PAGE_UP ||
+      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;
     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
       // if the completeSelectedIndex attribute is set.  We check this before
       // calling SelectBy of an earlier attempt to avoid crashing.
       PRBool completeSelection;
       input->GetCompleteSelectedIndex(&completeSelection);
 
       // Instruct the result view to scroll by the given amount and direction
       popup->SelectBy(reverse, page);
@@ -481,19 +481,19 @@ nsAutoCompleteController::HandleKeyNavig
         mResults->Count(&resultCount);
         if (resultCount) {
           if (mRowCount) {
             OpenPopup();
           }
         } else
           StartSearchTimer();
       }
-    }
-  } else if (   aKey == nsIDOMKeyEvent::DOM_VK_LEFT
-             || aKey == nsIDOMKeyEvent::DOM_VK_RIGHT
+    }    
+  } 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;
     input->GetPopupOpen(&isOpen);
@@ -514,17 +514,17 @@ nsAutoCompleteController::HandleKeyNavig
     }
     // Update last-searched string to the current input, since the input may
     // have changed.  Without this, subsequent backspaces look like text
     // additions, not text deletions.
     nsAutoString value;
     input->GetTextValue(value);
     mSearchString = value;
   }
-
+  
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsAutoCompleteController::HandleDelete(PRBool *_retval)
 {
   *_retval = PR_FALSE;
   if (!mInput)
@@ -533,17 +533,17 @@ nsAutoCompleteController::HandleDelete(P
   nsCOMPtr<nsIAutoCompleteInput> input(mInput);
   PRBool isOpen = PR_FALSE;
   input->GetPopupOpen(&isOpen);
   if (!isOpen || mRowCount <= 0) {
     // Nothing left to delete, proceed as normal
     HandleText(PR_FALSE);
     return NS_OK;
   }
-
+  
   nsCOMPtr<nsIAutoCompletePopup> popup;
   input->GetPopup(getter_AddRefs(popup));
 
   PRInt32 index, searchIndex, rowIndex;
   popup->GetSelectedIndex(&index);
   RowIndexToSearch(index, &searchIndex, &rowIndex);
   NS_ENSURE_TRUE(searchIndex >= 0 && rowIndex >= 0, NS_ERROR_FAILURE);
 
@@ -556,17 +556,17 @@ nsAutoCompleteController::HandleDelete(P
 
   // Clear the row in our result and in the DB.
   result->RemoveValueAt(rowIndex, PR_TRUE);
   --mRowCount;
 
   // Unselect the current item.
   popup->SetSelectedIndex(-1);
 
-  // Tell the tree that the row count changed.
+  // Tell the tree that the row count changed. 
   if (mTree)
     mTree->RowCountChanged(mRowCount, -1);
 
   // Adjust index, if needed.
   if (index >= (PRInt32)mRowCount)
     index = mRowCount - 1;
 
   if (mRowCount > 0) {
@@ -593,75 +593,75 @@ nsAutoCompleteController::HandleDelete(P
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsAutoCompleteController::GetValueAt(PRInt32 aIndex, nsAString & _retval)
 {
   GetResultValueAt(aIndex, PR_FALSE, _retval);
-
+  
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsAutoCompleteController::GetCommentAt(PRInt32 aIndex, nsAString & _retval)
 {
   PRInt32 searchIndex;
   PRInt32 rowIndex;
   RowIndexToSearch(aIndex, &searchIndex, &rowIndex);
   NS_ENSURE_TRUE(searchIndex >= 0 && rowIndex >= 0, NS_ERROR_FAILURE);
-
+  
   nsCOMPtr<nsIAutoCompleteResult> result;
   mResults->GetElementAt(searchIndex, getter_AddRefs(result));
   NS_ENSURE_TRUE(result, NS_ERROR_FAILURE);
 
   return result->GetCommentAt(rowIndex, _retval);
 }
 
 NS_IMETHODIMP
 nsAutoCompleteController::GetStyleAt(PRInt32 aIndex, nsAString & _retval)
 {
   PRInt32 searchIndex;
   PRInt32 rowIndex;
   RowIndexToSearch(aIndex, &searchIndex, &rowIndex);
   NS_ENSURE_TRUE(searchIndex >= 0 && rowIndex >= 0, NS_ERROR_FAILURE);
-
+  
   nsCOMPtr<nsIAutoCompleteResult> result;
   mResults->GetElementAt(searchIndex, getter_AddRefs(result));
   NS_ENSURE_TRUE(result, NS_ERROR_FAILURE);
 
   return result->GetStyleAt(rowIndex, _retval);
 }
 
 NS_IMETHODIMP
 nsAutoCompleteController::GetImageAt(PRInt32 aIndex, nsAString & _retval)
 {
   PRInt32 searchIndex;
   PRInt32 rowIndex;
   RowIndexToSearch(aIndex, &searchIndex, &rowIndex);
   NS_ENSURE_TRUE(searchIndex >= 0 && rowIndex >= 0, NS_ERROR_FAILURE);
-
+  
   nsCOMPtr<nsIAutoCompleteResult> result;
   mResults->GetElementAt(searchIndex, getter_AddRefs(result));
   NS_ENSURE_TRUE(result, NS_ERROR_FAILURE);
 
   return result->GetImageAt(rowIndex, _retval);
 }
 
 NS_IMETHODIMP
 nsAutoCompleteController::SetSearchString(const nsAString &aSearchString)
-{
+{ 
   mSearchString = aSearchString;
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsAutoCompleteController::GetSearchString(nsAString &aSearchString)
-{
+{ 
   aSearchString = mSearchString;
   return NS_OK;
 }
 
 
 ////////////////////////////////////////////////////////////////////////
 //// nsIAutoCompleteObserver
 
@@ -673,17 +673,17 @@ nsAutoCompleteController::OnSearchResult
   mSearches->Count(&count);
   for (PRUint32 i = 0; i < count; ++i) {
     nsCOMPtr<nsIAutoCompleteSearch> search;
     mSearches->GetElementAt(i, getter_AddRefs(search));
     if (search == aSearch) {
       ProcessResult(i, aResult);
     }
   }
-
+  
   return NS_OK;
 }
 
 ////////////////////////////////////////////////////////////////////////
 //// nsITimerCallback
 
 NS_IMETHODIMP
 nsAutoCompleteController::Notify(nsITimer *timer)
@@ -705,45 +705,45 @@ nsAutoCompleteController::GetRowCount(PR
 
 NS_IMETHODIMP
 nsAutoCompleteController::GetRowProperties(PRInt32 index, nsISupportsArray *properties)
 {
   // XXX This is a hack because the tree doesn't seem to be painting the selected row
   //     the normal way.  Please remove this ASAP.
   PRInt32 currentIndex;
   mSelection->GetCurrentIndex(&currentIndex);
-
+  
   /*
   if (index == currentIndex) {
     nsCOMPtr<nsIAtomService> atomSvc = do_GetService("@mozilla.org/atom-service;1");
     nsCOMPtr<nsIAtom> atom;
     atomSvc->GetAtom(NS_LITERAL_STRING("menuactive").get(), getter_AddRefs(atom));
     properties->AppendElement(atom);
   }
   */
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsAutoCompleteController::GetCellProperties(PRInt32 row, nsITreeColumn* col, nsISupportsArray* properties)
 {
   GetRowProperties(row, properties);
-
+  
   if (row >= 0) {
     nsAutoString className;
     GetStyleAt(row, className);
     if (!className.IsEmpty()) {
       nsCOMPtr<nsIAtomService> atomSvc = do_GetService("@mozilla.org/atom-service;1");
       nsCOMPtr<nsIAtom> atom;
       atomSvc->GetAtom(className.get(), getter_AddRefs(atom));
       properties->AppendElement(atom);
     }
   }
-
+  
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsAutoCompleteController::GetColumnProperties(nsITreeColumn* col, nsISupportsArray* properties)
 {
   return NS_OK;
 }
@@ -764,32 +764,32 @@ NS_IMETHODIMP
 nsAutoCompleteController::GetProgressMode(PRInt32 row, nsITreeColumn* col, PRInt32* _retval)
 {
   NS_NOTREACHED("tree has no progress cells");
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsAutoCompleteController::GetCellValue(PRInt32 row, nsITreeColumn* col, nsAString& _retval)
-{
+{  
   NS_NOTREACHED("all of our cells are text");
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsAutoCompleteController::GetCellText(PRInt32 row, nsITreeColumn* col, nsAString& _retval)
 {
   const PRUnichar* colID;
   col->GetIdConst(&colID);
-
+  
   if (NS_LITERAL_STRING("treecolAutoCompleteValue").Equals(colID))
     GetValueAt(row, _retval);
   else if (NS_LITERAL_STRING("treecolAutoCompleteComment").Equals(colID))
     GetCommentAt(row, _retval);
-
+     
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsAutoCompleteController::IsContainer(PRInt32 index, PRBool *_retval)
 {
   *_retval = PR_FALSE;
   return NS_OK;
@@ -953,17 +953,17 @@ nsAutoCompleteController::OpenPopup()
 {
   PRUint32 minResults;
   mInput->GetMinResultsForPopup(&minResults);
 
   if (mRowCount >= minResults) {
     mIsOpen = PR_TRUE;
     return mInput->SetPopupOpen(PR_TRUE);
   }
-
+  
   return NS_OK;
 }
 
 nsresult
 nsAutoCompleteController::ClosePopup()
 {
   if (!mInput) {
     return NS_OK;
@@ -984,79 +984,79 @@ nsAutoCompleteController::ClosePopup()
 
 nsresult
 nsAutoCompleteController::StartSearch()
 {
   NS_ENSURE_STATE(mInput);
   nsCOMPtr<nsIAutoCompleteInput> input(mInput);
   mSearchStatus = nsIAutoCompleteController::STATUS_SEARCHING;
   mDefaultIndexCompleted = PR_FALSE;
-
+  
   PRUint32 count;
   mSearches->Count(&count);
   mSearchesOngoing = count;
   mFirstSearchResult = PR_TRUE;
 
   // notify the input that the search is beginning
   input->OnSearchBegin();
-
+  
   PRUint32 searchesFailed = 0;
   for (PRUint32 i = 0; i < count; ++i) {
     nsCOMPtr<nsIAutoCompleteSearch> search;
     mSearches->GetElementAt(i, getter_AddRefs(search));
     nsCOMPtr<nsIAutoCompleteResult> result;
     mResults->GetElementAt(i, getter_AddRefs(result));
-
+    
     if (result) {
       PRUint16 searchResult;
       result->GetSearchResult(&searchResult);
       if (searchResult != nsIAutoCompleteResult::RESULT_SUCCESS &&
           searchResult != nsIAutoCompleteResult::RESULT_SUCCESS_ONGOING)
         result = nsnull;
     }
-
+    
     nsAutoString searchParam;
     nsresult rv = input->GetSearchParam(searchParam);
     if (NS_FAILED(rv))
         return rv;
-
+    
     rv = search->StartSearch(mSearchString, searchParam, result, static_cast<nsIAutoCompleteObserver *>(this));
     if (NS_FAILED(rv)) {
       ++searchesFailed;
       --mSearchesOngoing;
     }
   }
-
+  
   if (searchesFailed == count)
     PostSearchCleanup();
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsAutoCompleteController::StopSearch()
 {
   // Stop the timer if there is one
   ClearSearchTimer();
 
   // Stop any ongoing asynchronous searches
   if (mSearchStatus == nsIAutoCompleteController::STATUS_SEARCHING) {
     PRUint32 count;
     mSearches->Count(&count);
-
+  
     for (PRUint32 i = 0; i < count; ++i) {
       nsCOMPtr<nsIAutoCompleteSearch> search;
       mSearches->GetElementAt(i, getter_AddRefs(search));
       search->StopSearch();
     }
     mSearchesOngoing = 0;
     // since we were searching, but now we've stopped,
     // we need to call PostSearchCleanup()
     PostSearchCleanup();
-  }
+  } 
   return NS_OK;
 }
 
 nsresult
 nsAutoCompleteController::StartSearchTimer()
 {
   // Don't create a new search timer if we're already waiting for one to fire.
   // If we don't check for this, we won't be able to cancel the original timer
@@ -1069,17 +1069,17 @@ nsAutoCompleteController::StartSearchTim
 
   nsresult rv;
   mTimer = do_CreateInstance("@mozilla.org/timer;1", &rv);
   if (NS_FAILED(rv))
       return rv;
   rv = mTimer->InitWithCallback(this, timeout, nsITimer::TYPE_ONE_SHOT);
   if (NS_FAILED(rv))
       mTimer = nsnull;
-
+  
   return rv;
 }
 
 nsresult
 nsAutoCompleteController::ClearSearchTimer()
 {
   if (mTimer) {
     mTimer->Cancel();
@@ -1093,41 +1093,41 @@ nsAutoCompleteController::EnterMatch(PRB
 {
   // If a search is still ongoing, bail out of this function
   // and let the search finish, and tell it to come back here when it's done
   if (mSearchStatus == nsIAutoCompleteController::STATUS_SEARCHING) {
     mEnterAfterSearch = aIsPopupSelection ? 2 : 1;
     return NS_OK;
   }
   mEnterAfterSearch = 0;
-
+  
   nsCOMPtr<nsIAutoCompleteInput> input(mInput);
   nsCOMPtr<nsIAutoCompletePopup> popup;
   input->GetPopup(getter_AddRefs(popup));
   NS_ENSURE_TRUE(popup != nsnull, NS_ERROR_FAILURE);
-
+  
   PRBool forceComplete;
   input->GetForceComplete(&forceComplete);
-
+  
   // Ask the popup if it wants to enter a special value into the textbox
   nsAutoString value;
   popup->GetOverrideValue(value);
   if (value.IsEmpty()) {
     PRBool completeSelection;
     input->GetCompleteSelectedIndex(&completeSelection);
 
     // If completeselectedindex is false or a row was selected from the popup,
     // enter it into the textbox. If completeselectedindex is true, or
     // EnterMatch was called via other means, for instance pressing Enter,
     // don't fill in the value as it will have already been filled in as needed.
     PRInt32 selectedIndex;
     popup->GetSelectedIndex(&selectedIndex);
     if (selectedIndex >= 0 && (!completeSelection || aIsPopupSelection))
       GetResultValueAt(selectedIndex, PR_TRUE, value);
-
+    
     if (forceComplete && value.IsEmpty()) {
       // Since nothing was selected, and forceComplete is specified, that means
       // we have to find the first default match and enter it instead
       PRUint32 count;
       mResults->Count(&count);
       for (PRUint32 i = 0; i < count; ++i) {
         nsCOMPtr<nsIAutoCompleteResult> result;
         mResults->GetElementAt(i, getter_AddRefs(result));
@@ -1138,51 +1138,51 @@ nsAutoCompleteController::EnterMatch(PRB
           if (defaultIndex >= 0) {
             result->GetValueAt(defaultIndex, value);
             break;
           }
         }
       }
     }
   }
-
+  
   nsCOMPtr<nsIObserverService> obsSvc =
     do_GetService("@mozilla.org/observer-service;1");
   NS_ENSURE_STATE(obsSvc);
   obsSvc->NotifyObservers(input, "autocomplete-will-enter-text", nsnull);
 
   if (!value.IsEmpty()) {
     input->SetTextValue(value);
     input->SelectTextRange(value.Length(), value.Length());
     mSearchString = value;
   }
-
+  
   obsSvc->NotifyObservers(input, "autocomplete-did-enter-text", nsnull);
   ClosePopup();
-
+  
   PRBool cancel;
   input->OnTextEntered(&cancel);
-
+  
   return NS_OK;
 }
 
 nsresult
 nsAutoCompleteController::RevertTextValue()
 {
   // StopSearch() can call PostSearchCleanup() which might result
   // in a blur event, which could null out mInput, so we need to check it
   // again.  See bug #408463 for more details
   if (!mInput)
     return NS_OK;
 
   nsAutoString oldValue(mSearchString);
   nsCOMPtr<nsIAutoCompleteInput> input(mInput);
-
+  
   PRBool cancel = PR_FALSE;
-  input->OnTextReverted(&cancel);
+  input->OnTextReverted(&cancel);  
 
   if (!cancel) {
     nsCOMPtr<nsIObserverService> obsSvc =
       do_GetService("@mozilla.org/observer-service;1");
     NS_ENSURE_STATE(obsSvc);
     obsSvc->NotifyObservers(input, "autocomplete-will-revert-text", nsnull);
 
     input->SetTextValue(oldValue);
@@ -1230,17 +1230,17 @@ nsAutoCompleteController::ProcessResult(
   else {
     // replace the cached result
     mResults->ReplaceElementAt(aResult, oldIndex);
     oldMatchCount = mMatchCounts[aSearchIndex];
     mMatchCounts[oldIndex] = matchCount;
   }
 
   PRUint32 oldRowCount = mRowCount;
-  // If the search failed, increase the match count
+  // If the search failed, increase the match count 
   // to include the error description
   if (result == nsIAutoCompleteResult::RESULT_FAILURE) {
     nsAutoString error;
     aResult->GetErrorDescription(error);
     if (!error.IsEmpty()) {
       ++mRowCount;
       if (mTree)
         mTree->RowCountChanged(oldRowCount, 1);
@@ -1257,17 +1257,17 @@ nsAutoCompleteController::ProcessResult(
     CompleteDefaultIndex(aSearchIndex);
   }
 
   // Refresh the popup view to display the new search results
   nsCOMPtr<nsIAutoCompletePopup> popup;
   input->GetPopup(getter_AddRefs(popup));
   NS_ENSURE_TRUE(popup != nsnull, NS_ERROR_FAILURE);
   popup->Invalidate();
-
+  
   // Make sure the popup is open, if necessary, since we now have at least one
   // search result ready to display. Don't force the popup closed if we might
   // get results in the future to avoid unnecessarily canceling searches.
   if (mRowCount)
     OpenPopup();
   else if (result != nsIAutoCompleteResult::RESULT_NOMATCH_ONGOING)
     ClosePopup();
 
@@ -1281,38 +1281,31 @@ nsAutoCompleteController::ProcessResult(
     StopSearch();
   }
 
   return NS_OK;
 }
 
 nsresult
 nsAutoCompleteController::PostSearchCleanup()
-{
+{  
   NS_ENSURE_STATE(mInput);
   nsCOMPtr<nsIAutoCompleteInput> input(mInput);
   if (mRowCount) {
     OpenPopup();
     mSearchStatus = nsIAutoCompleteController::STATUS_COMPLETE_MATCH;
   } else {
     mSearchStatus = nsIAutoCompleteController::STATUS_COMPLETE_NO_MATCH;
-    PRUint32 minResults;
-    mInput->GetMinResultsForPopup(&minResults);
-    if (minResults == 0) {
-      // check if the popup may be opened even when there are no results
-      mIsOpen = PR_TRUE;
-      return mInput->SetPopupOpen(PR_TRUE);
-    }
     ClosePopup();
   }
-
+  
   // notify the input that the search is complete
   input->OnSearchComplete();
-
-  // if mEnterAfterSearch was set, then the user hit enter while the
+  
+  // if mEnterAfterSearch was set, then the user hit enter while the 
   // search was ongoing, so we need to enter a match now that the search is done
   if (mEnterAfterSearch)
     EnterMatch(mEnterAfterSearch == 2);
 
   return NS_OK;
 }
 
 nsresult
@@ -1349,47 +1342,47 @@ nsAutoCompleteController::CompleteDefaul
   if (!shouldComplete)
     return NS_OK;
 
   nsCOMPtr<nsIAutoCompleteSearch> search;
   mSearches->GetElementAt(aSearchIndex, getter_AddRefs(search));
   nsCOMPtr<nsIAutoCompleteResult> result;
   mResults->GetElementAt(aSearchIndex, getter_AddRefs(result));
   NS_ENSURE_TRUE(result != nsnull, NS_ERROR_FAILURE);
-
+  
   // The search must explicitly provide a default index in order
-  // for us to be able to complete
+  // for us to be able to complete 
   PRInt32 defaultIndex;
   result->GetDefaultIndex(&defaultIndex);
   NS_ENSURE_TRUE(defaultIndex >= 0, NS_OK);
 
   nsAutoString resultValue;
   result->GetValueAt(defaultIndex, resultValue);
   CompleteValue(resultValue, PR_TRUE);
-
+  
   mDefaultIndexCompleted = PR_TRUE;
 
   return NS_OK;
 }
 
 nsresult
-nsAutoCompleteController::CompleteValue(nsString &aValue,
+nsAutoCompleteController::CompleteValue(nsString &aValue, 
                                         PRBool selectDifference)
 /* mInput contains mSearchString, which we want to autocomplete to aValue.  If
- * selectDifference is true, select the remaining portion of aValue not
+ * selectDifference is true, select the remaining portion of aValue not 
  * contained in mSearchString. */
 {
   const PRInt32 mSearchStringLength = mSearchString.Length();
   PRInt32 endSelect = aValue.Length();  // By default, select all of aValue.
 
-  if (aValue.IsEmpty() ||
+  if (aValue.IsEmpty() || 
       StringBeginsWith(aValue, mSearchString,
                        nsCaseInsensitiveStringComparator())) {
-    // aValue is empty (we were asked to clear mInput), or mSearchString
-    // matches the beginning of aValue.  In either case we can simply
+    // aValue is empty (we were asked to clear mInput), or mSearchString 
+    // matches the beginning of aValue.  In either case we can simply 
     // autocomplete to aValue.
     mInput->SetTextValue(aValue);
   } else {
     PRInt32 findIndex;  // Offset of mSearchString within aValue.
 
     nsresult rv;
     nsCOMPtr<nsIIOService> ios = do_GetService(NS_IOSERVICE_CONTRACTID, &rv);
     NS_ENSURE_SUCCESS(rv, rv);
@@ -1412,99 +1405,99 @@ nsAutoCompleteController::CompleteValue(
       // can just go ahead and autocomplete the missing final portion; this
       // seems like a problematic assumption...
       nsString::const_iterator iter, end;
       aValue.BeginReading(iter);
       aValue.EndReading(end);
       const nsString::const_iterator::pointer start = iter.get();
       ++iter;  // Skip past beginning since we know that doesn't match
 
-      FindInReadable(mSearchString, iter, end,
+      FindInReadable(mSearchString, iter, end, 
                      nsCaseInsensitiveStringComparator());
 
       findIndex = iter.get() - start;
     }
 
-    mInput->SetTextValue(mSearchString +
+    mInput->SetTextValue(mSearchString + 
                          Substring(aValue, mSearchStringLength + findIndex,
                                    endSelect));
 
     endSelect -= findIndex; // We're skipping this many characters of aValue.
   }
 
-  mInput->SelectTextRange(selectDifference ?
+  mInput->SelectTextRange(selectDifference ? 
                           mSearchStringLength : endSelect, endSelect);
 
   return NS_OK;
 }
 
 nsresult
 nsAutoCompleteController::GetResultValueAt(PRInt32 aIndex, PRBool aValueOnly, nsAString & _retval)
 {
   NS_ENSURE_TRUE(aIndex >= 0 && (PRUint32) aIndex < mRowCount, NS_ERROR_ILLEGAL_VALUE);
 
   PRInt32 searchIndex;
   PRInt32 rowIndex;
   RowIndexToSearch(aIndex, &searchIndex, &rowIndex);
   NS_ENSURE_TRUE(searchIndex >= 0 && rowIndex >= 0, NS_ERROR_FAILURE);
-
+  
   nsCOMPtr<nsIAutoCompleteResult> result;
   mResults->GetElementAt(searchIndex, getter_AddRefs(result));
   NS_ENSURE_TRUE(result != nsnull, NS_ERROR_FAILURE);
-
+  
   PRUint16 searchResult;
   result->GetSearchResult(&searchResult);
-
+  
   if (searchResult == nsIAutoCompleteResult::RESULT_FAILURE) {
     if (aValueOnly)
       return NS_ERROR_FAILURE;
     result->GetErrorDescription(_retval);
   } else if (searchResult == nsIAutoCompleteResult::RESULT_SUCCESS ||
              searchResult == nsIAutoCompleteResult::RESULT_SUCCESS_ONGOING) {
     result->GetValueAt(rowIndex, _retval);
   }
-
+  
   return NS_OK;
 }
 
 /**
  * Given the index of a row in the autocomplete popup, find the
- * corresponding nsIAutoCompleteSearch index, and sub-index into
+ * corresponding nsIAutoCompleteSearch index, and sub-index into 
  * the search's results list.
  */
 nsresult
 nsAutoCompleteController::RowIndexToSearch(PRInt32 aRowIndex, PRInt32 *aSearchIndex, PRInt32 *aItemIndex)
 {
   *aSearchIndex = -1;
   *aItemIndex = -1;
-
+  
   PRUint32 count;
   mSearches->Count(&count);
   PRUint32 index = 0;
 
-  // Move index through the results of each registered nsIAutoCompleteSearch
+  // Move index through the results of each registered nsIAutoCompleteSearch 
   // until we find the given row
   for (PRUint32 i = 0; i < count; ++i) {
     nsCOMPtr<nsIAutoCompleteResult> result;
     mResults->GetElementAt(i, getter_AddRefs(result));
     if (!result)
       continue;
-
+      
     PRUint16 searchResult;
     result->GetSearchResult(&searchResult);
-
-    // Find out how many results were provided by the
+    
+    // Find out how many results were provided by the 
     // current nsIAutoCompleteSearch
     PRUint32 rowCount = 0;
     if (searchResult == nsIAutoCompleteResult::RESULT_SUCCESS ||
         searchResult == nsIAutoCompleteResult::RESULT_SUCCESS_ONGOING) {
       result->GetMatchCount(&rowCount);
     }
-
-    // If the given row index is within the results range
+    
+    // If the given row index is within the results range 
     // of the current nsIAutoCompleteSearch then return the
     // search index and sub-index into the results array
     if ((rowCount != 0) && (index + rowCount-1 >= (PRUint32) aRowIndex)) {
       *aSearchIndex = i;
       *aItemIndex = aRowIndex - index;
       return NS_OK;
     }
 
@@ -1520,26 +1513,26 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(nsAutoCom
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsAutoCompleteSimpleResult)
 #ifdef MOZ_MORK
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsAutoCompleteMdbResult)
 #endif
 
 static const nsModuleComponentInfo components[] =
 {
   { "AutoComplete Controller",
-    NS_AUTOCOMPLETECONTROLLER_CID,
+    NS_AUTOCOMPLETECONTROLLER_CID, 
     NS_AUTOCOMPLETECONTROLLER_CONTRACTID,
     nsAutoCompleteControllerConstructor },
 
   { "AutoComplete Simple Result",
-    NS_AUTOCOMPLETESIMPLERESULT_CID,
+    NS_AUTOCOMPLETESIMPLERESULT_CID, 
     NS_AUTOCOMPLETESIMPLERESULT_CONTRACTID,
     nsAutoCompleteSimpleResultConstructor },
 
 #ifdef MOZ_MORK
   { "AutoComplete Mdb Result",
-    NS_AUTOCOMPLETEMDBRESULT_CID,
+    NS_AUTOCOMPLETEMDBRESULT_CID, 
     NS_AUTOCOMPLETEMDBRESULT_CONTRACTID,
     nsAutoCompleteMdbResultConstructor },
 #endif
 };
 
 NS_IMPL_NSGETMODULE(tkAutoCompleteModule, components)
--- a/toolkit/content/widgets/autocomplete.xml
+++ b/toolkit/content/widgets/autocomplete.xml
@@ -105,17 +105,17 @@
         var popup = null;
         var popupId = this.getAttribute("autocompletepopup");
         if (popupId)
           popup = document.getElementById(popupId);
         if (!popup) {
           popup = document.createElement("panel");
           popup.setAttribute("type", "autocomplete");
           popup.setAttribute("noautofocus", "true");
-
+          
           var popupset = document.getAnonymousElementByAttribute(this, "anonid", "popupset");
           popupset.appendChild(popup);
         }
         popup.mInput = this;
         popup;
       ]]></field>
 
       <property name="controller" onget="return this.mController;" readonly="true"/>
@@ -137,17 +137,17 @@
                 onget="return this.getAttribute('completeselectedindex') == 'true';"/>
 
       <property name="forceComplete"
                 onset="this.setAttribute('forcecomplete', val); return val;"
                 onget="return this.getAttribute('forcecomplete') == 'true';"/>
 
       <property name="minResultsForPopup"
                 onset="this.setAttribute('minresultsforpopup', val); return val;"
-                onget="var m = parseInt(this.getAttribute('minresultsforpopup')); return isNaN(m) ? 1 : m;"/>
+                onget="return parseInt(this.getAttribute('minresultsforpopup')) || 0;"/>
 
       <property name="showCommentColumn"
                 onset="this.setAttribute('showcommentcolumn', val); return val;"
                 onget="return this.getAttribute('showcommentcolumn') == 'true';"/>
 
       <property name="showImageColumn"
                 onset="this.setAttribute('showimagecolumn', val); return val;"
                 onget="return this.getAttribute('showimagecolumn') == 'true';"/>
@@ -288,17 +288,17 @@
                 onset="return this.setAttribute('tabscrolling', val); return val;"
                 onget="return this.getAttribute('tabscrolling') == 'true';"/>
 
       <!-- disable key navigation handling in the popup results -->
       <property name="disableKeyNavigation"
                 onset="this.setAttribute('disablekeynavigation', val); return val;"
                 onget="return this.getAttribute('disablekeynavigation') == 'true';"/>
 
-      <!-- option to completely ignore any blur events while
+      <!-- option to completely ignore any blur events while  
            searches are still going on.  This is useful so that nothing
            gets autopicked if the window is required to lose focus for
            some reason (eg in LDAP autocomplete, another window may be
            brought up so that the user can enter a password to authenticate
            to an LDAP server).  -->
       <property name="ignoreBlurWhileSearching"
                 onset="this.setAttribute('ignoreblurwhilesearching', val); return val;"
                 onget="return this.getAttribute('ignoreblurwhilesearching') == 'true';"/>
@@ -310,22 +310,22 @@
       <method name="attachController">
         <body><![CDATA[
           this.mController.input = this;
         ]]></body>
       </method>
 
       <method name="detachController">
         <body><![CDATA[
-          try {
+          try { 
             if  (this.mController.input == this)
             this.mController.input = null;
           } catch (ex) {
             // nothing really to do.
-          }
+          }       
         ]]></body>
       </method>
 
       <!-- ::::::::::::: popup opening ::::::::::::: -->
 
       <method name="openPopup">
         <body><![CDATA[
           this.popup.openAutocompletePopup(this, this);
@@ -486,17 +486,17 @@
               break;
 #endif
           }
 
           if (cancel) {
             aEvent.stopPropagation();
             aEvent.preventDefault();
           }
-
+          
           return true;
         ]]></body>
       </method>
 
       <!-- ::::::::::::: miscellaneous ::::::::::::: -->
 
       <method name="initSearchNames">
         <body><![CDATA[
@@ -652,19 +652,19 @@
           // detect the desired height of the tree
           var bx = this.tree.treeBoxObject;
           var view = this.tree.view;
           if (!view)
             return;
           var rows = this.maxRows;
           if (!view.rowCount || (rows && view.rowCount < rows))
             rows = view.rowCount;
-
+          
           var height = rows * bx.rowHeight;
-
+          
           if (height == 0)
             this.tree.setAttribute("collapsed", "true");
           else {
             if (this.tree.hasAttribute("collapsed"))
               this.tree.removeAttribute("collapsed");
 
             this.tree.setAttribute("height", height);
           }
@@ -704,18 +704,18 @@
             var docShell = nav.QueryInterface(Components.interfaces.nsIDocShell);
             var docViewer = docShell.contentViewer.QueryInterface(Components.interfaces.nsIMarkupDocumentViewer);
             var width = (rect.right - rect.left) * docViewer.fullZoom;
             this.setAttribute("width", width > 100 ? width : 100);
 
             // setConsumeRollupEvent() before we call openPopup()
             var nsIPopupBO = Components.interfaces.nsIPopupBoxObject;
             this.popupBoxObject.setConsumeRollupEvent(
-              this.mInput.consumeRollupEvent ?
-                nsIPopupBO.ROLLUP_CONSUME :
+              this.mInput.consumeRollupEvent ? 
+                nsIPopupBO.ROLLUP_CONSUME : 
                 nsIPopupBO.ROLLUP_NO_CONSUME);
             this.openPopup(aElement, "after_start", 0, 0, false, false);
           }
         ]]></body>
       </method>
 
       <method name="invalidate">
         <body><![CDATA[
@@ -747,17 +747,17 @@
       <field name="tree">
         document.getAnonymousElementByAttribute(this, "anonid", "tree");
       </field>
 
       <field name="treecols">
         document.getAnonymousElementByAttribute(this, "anonid", "treecols");
       </field>
 
-      <property name="view"
+      <property name="view" 
                 onget="return this.mView;">
         <setter><![CDATA[
           // We must do this by hand because the tree binding may not be ready yet
           this.mView = val;
           var bx = this.tree.boxObject;
           bx = bx.QueryInterface(Components.interfaces.nsITreeBoxObject);
           bx.view = val;
         ]]></setter>
@@ -825,28 +825,28 @@
       <method name="getNextIndex">
         <parameter name="aReverse"/>
         <parameter name="aAmount"/>
         <parameter name="aIndex"/>
         <parameter name="aMaxRow"/>
         <body><![CDATA[
           if (aMaxRow < 0)
             return -1;
-
+          
           var newIdx = aIndex + (aReverse?-1:1)*aAmount;
           if (aReverse && aIndex == -1 || newIdx > aMaxRow && aIndex != aMaxRow)
             newIdx = aMaxRow;
           else if (!aReverse && aIndex == -1 || newIdx < 0 && aIndex != 0)
             newIdx = 0;
-
+          
           if (newIdx < 0 && aIndex == 0 || newIdx > aMaxRow && aIndex == aMaxRow)
             aIndex = -1;
           else
             aIndex = newIdx;
-
+          
           return aIndex;
         ]]></body>
       </method>
 
       <method name="onPopupClick">
         <parameter name="aEvent"/>
         <body><![CDATA[
           var controller = this.view.QueryInterface(Components.interfaces.nsIAutoCompleteController);
@@ -897,32 +897,29 @@
 
   <binding id="autocomplete-rich-result-popup" extends="chrome://global/content/bindings/autocomplete.xml#autocomplete-base-popup">
     <resources>
       <stylesheet src="chrome://global/skin/autocomplete.css"/>
     </resources>
 
     <content ignorekeys="true">
       <xul:richlistbox anonid="richlistbox" class="autocomplete-richlistbox" flex="1"/>
-      <xul:hbox>
-        <children/>
-      </xul:hbox>
     </content>
 
     <implementation implements="nsIAutoCompletePopup">
       <field name="_currentIndex">0</field>
 
       <!-- =================== nsIAutoCompletePopup =================== -->
 
       <property name="selectedIndex"
                 onget="return this.richlistbox.selectedIndex;">
         <setter>
           <![CDATA[
           this.richlistbox.selectedIndex = val;
-
+ 
           // when clearing the selection (val == -1, so selectedItem will be
           // null), we want to scroll back to the top.  see bug #406194
           this.richlistbox.ensureElementIsVisible(
             this.richlistbox.selectedItem || this.richlistbox.firstChild);
 
           return val;
         ]]>
         </setter>
@@ -954,18 +951,18 @@
             var width = rect.right - rect.left;
             this.setAttribute("width", width > 100 ? width : 100);
             // invalidate() depends on the width attribute
             this._invalidate();
 
             // setConsumeRollupEvent() before we call openPopup()
             var nsIPopupBO = Components.interfaces.nsIPopupBoxObject;
             this.popupBoxObject.setConsumeRollupEvent(
-              this.mInput.consumeRollupEvent ?
-                nsIPopupBO.ROLLUP_CONSUME :
+              this.mInput.consumeRollupEvent ? 
+                nsIPopupBO.ROLLUP_CONSUME : 
                 nsIPopupBO.ROLLUP_NO_CONSUME);
             this.openPopup(aElement, "after_start", 0, 0, false, false);
           }
         ]]>
         </body>
       </method>
 
       <method name="invalidate">
@@ -1055,17 +1052,17 @@
           for (let i = 0; i < this.maxRows; i++) {
             if (this._currentIndex >= this._matchCount)
               return;
 
             var existingItemsCount = this.richlistbox.childNodes.length;
             var item;
 
             // trim the leading/trailing whitespace
-            var trimmedSearchString = controller.searchString.replace(/^\s+/, "").replace(/\s+$/, "");
+            var trimmedSearchString = controller.searchString.replace(/^\s+/, "").replace(/\s+$/, "");  
 
             // Unescape the URI spec for showing as an entry in the popup
             let url = Components.classes["@mozilla.org/intl/texttosuburi;1"].
               getService(Components.interfaces.nsITextToSubURI).
               unEscapeURIForUI("UTF-8", controller.getValueAt(this._currentIndex));
 
             if (this._currentIndex < existingItemsCount) {
               // re-use the existing item
@@ -1079,31 +1076,31 @@
                 continue;
               }
             }
             else {
               // need to create a new item
               item = document.createElementNS("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul", "richlistitem");
             }
 
-            // set these attributes before we set the class
-            // so that we can use them from the contructor
+            // set these attributes before we set the class 
+            // so that we can use them from the contructor         
             item.setAttribute("image", controller.getImageAt(this._currentIndex));
             item.setAttribute("url", url);
             item.setAttribute("title", controller.getCommentAt(this._currentIndex));
             item.setAttribute("type", controller.getStyleAt(this._currentIndex));
             item.setAttribute("text", trimmedSearchString);
-
+        
             if (this._currentIndex < existingItemsCount) {
               // re-use the existing item
               item._adjustAcItem();
               item.collapsed = false;
             }
             else {
-              // set the class at the end so we can use the attributes
+              // set the class at the end so we can use the attributes 
               // in the xbl constructor
               item.className = "autocomplete-richlistitem";
               this.richlistbox.appendChild(item);
             }
 
             this._currentIndex++;
           }
 
@@ -1115,17 +1112,17 @@
 
       <method name="selectBy">
         <parameter name="aReverse"/>
         <parameter name="aPage"/>
         <body>
           <![CDATA[
           try {
             var amount = aPage ? 5 : 1;
-
+            
             // because we collapsed unused items, we can't use this.richlistbox.getRowCount(), we need to use the matchCount
             this.selectedIndex = this.getNextIndex(aReverse, amount, this.selectedIndex, this._matchCount - 1);
             if (this.selectedIndex == -1) {
               this.input._focus();
             }
           } catch (ex) {
             // do nothing - occasionally timer-related js errors happen here
             // e.g. "this.selectedIndex has no properties", when you type fast and hit a
@@ -1134,17 +1131,17 @@
             ]]>
         </body>
       </method>
 
       <field name="richlistbox">
         document.getAnonymousElementByAttribute(this, "anonid", "richlistbox");
       </field>
 
-      <property name="view"
+      <property name="view" 
                 onget="return this.mInput.controller;"
                 onset="return val;"/>
 
     </implementation>
   </binding>
 
   <binding id="autocomplete-richlistitem" extends="chrome://global/content/bindings/richlistbox.xml#richlistitem">
     <content>
@@ -1157,23 +1154,23 @@
             <xul:image class="ac-result-type-tag"/>
             <xul:description anonid="extra" class="ac-normal-text ac-comment" xbl:inherits="selected"/>
           </xul:hbox>
         </xul:hbox>
         <xul:label anonid="title-overflow-ellipsis" xbl:inherits="selected"
                    class="ac-ellipsis-after ac-comment" hidden="true"/>
         <xul:image anonid="type-image" class="ac-type-icon"/>
       </xul:hbox>
-      <xul:hbox align="center" class="ac-url-box">
+      <xul:hbox align="center">
         <xul:spacer class="ac-site-icon"/>
         <xul:hbox anonid="url-box" class="ac-url" flex="1"
                   onunderflow="_doUnderflow('_url');">
           <xul:description anonid="url" class="ac-normal-text ac-url-text" xbl:inherits="selected"/>
         </xul:hbox>
-        <xul:label anonid="url-overflow-ellipsis" xbl:inherits="selected"
+        <xul:label anonid="url-overflow-ellipsis" xbl:inherits="selected" 
                    class="ac-ellipsis-after ac-url-text" hidden="true"/>
         <xul:spacer class="ac-type-icon"/>
       </xul:hbox>
     </content>
     <implementation implements="nsIDOMXULSelectControlItemElement">
       <constructor>
         <![CDATA[
             let ellipsis = "\u2026";
@@ -1181,17 +1178,17 @@
               ellipsis = Components.classes["@mozilla.org/preferences-service;1"].
                 getService(Components.interfaces.nsIPrefBranch).
                 getComplexValue("intl.ellipsis",
                   Components.interfaces.nsIPrefLocalizedString).data;
             } catch (ex) {
               // Do nothing.. we already have a default
             }
 
-            this._urlOverflowEllipsis = document.getAnonymousElementByAttribute(this, "anonid", "url-overflow-ellipsis");
+            this._urlOverflowEllipsis = document.getAnonymousElementByAttribute(this, "anonid", "url-overflow-ellipsis");  
             this._titleOverflowEllipsis = document.getAnonymousElementByAttribute(this, "anonid", "title-overflow-ellipsis");
 
             this._urlOverflowEllipsis.value = ellipsis;
             this._titleOverflowEllipsis.value = ellipsis;
 
             this._typeImage = document.getAnonymousElementByAttribute(this, "anonid", "type-image");
 
             this._urlBox = document.getAnonymousElementByAttribute(this, "anonid", "url-box");
@@ -1209,22 +1206,22 @@
 
       <property name="label" readonly="true">
         <getter>
           <![CDATA[
             var title = this.getAttribute("title");
             var url = this.getAttribute("url");
             var panel = this.parentNode.parentNode;
 
-            // allow consumers that have extended popups to override
+            // allow consumers that have extended popups to override 
             // the label values for the richlistitems
             if (panel.createResultLabel)
               return panel.createResultLabel(title, url, this.getAttribute("type"));
 
-            // aType (ex: "ac-result-type-<aType>") is related to the class of the image,
+            // aType (ex: "ac-result-type-<aType>") is related to the class of the image, 
             // and is not "visible" text so don't use it for the label (for accessibility).
             return title + " " + url;
           ]]>
         </getter>
       </property>
 
       <field name="_boundaryCutoff">null</field>
 
@@ -1501,17 +1498,17 @@
         // don't call onPopupClick for the scrollbar buttons, thumb, slider, etc.
         var item = event.originalTarget;
 
         while (item && item.localName != "richlistitem")
           item = item.parentNode;
 
         if (!item)
           return;
-
+        
         this.parentNode.onPopupClick(event);
       ]]>
       </handler>
 
       <handler event="mousemove">
         <![CDATA[
         if (Date.now() - this.mLastMoveTime > 30) {
          var item = event.target;
@@ -1580,8 +1577,9 @@
     <handlers>
       <handler event="mousedown" button="0"><![CDATA[
         this.showPopup();
       ]]></handler>
     </handlers>
   </binding>
 
 </bindings>
+