summaryrefslogtreecommitdiff
path: root/components/autocomplete
diff options
context:
space:
mode:
Diffstat (limited to 'components/autocomplete')
-rw-r--r--components/autocomplete/nsAutoCompleteController.cpp15
-rw-r--r--components/autocomplete/nsIAutoCompleteInput.idl9
2 files changed, 18 insertions, 6 deletions
diff --git a/components/autocomplete/nsAutoCompleteController.cpp b/components/autocomplete/nsAutoCompleteController.cpp
index 37b2e5dfa..971a7abaf 100644
--- a/components/autocomplete/nsAutoCompleteController.cpp
+++ b/components/autocomplete/nsAutoCompleteController.cpp
@@ -1160,11 +1160,16 @@ nsAutoCompleteController::BeforeSearches()
mSearchStatus = nsIAutoCompleteController::STATUS_SEARCHING;
mDefaultIndexCompleted = false;
- // The first search result will clear mResults array, though we should pass
- // the previous result to each search to allow them to reuse it. So we
- // temporarily cache current results till AfterSearches().
- if (!mResultCache.AppendObjects(mResults)) {
- return NS_ERROR_OUT_OF_MEMORY;
+ bool invalidatePreviousResult = false;
+ mInput->GetInvalidatePreviousResult(&invalidatePreviousResult);
+
+ if (!invalidatePreviousResult) {
+ // ClearResults will clear the mResults array, but we should pass the
+ // previous result to each search to allow reusing it. So we temporarily
+ // cache the current results until AfterSearches().
+ if (!mResultCache.AppendObjects(mResults)) {
+ return NS_ERROR_OUT_OF_MEMORY;
+ }
}
mSearchesOngoing = mSearches.Length();
diff --git a/components/autocomplete/nsIAutoCompleteInput.idl b/components/autocomplete/nsIAutoCompleteInput.idl
index 26a75ea77..98f36d11b 100644
--- a/components/autocomplete/nsIAutoCompleteInput.idl
+++ b/components/autocomplete/nsIAutoCompleteInput.idl
@@ -7,7 +7,7 @@
interface nsIAutoCompletePopup;
-[scriptable, uuid(B068E70F-F82C-4C12-AD87-82E271C5C180)]
+[scriptable, uuid(224d9847-d743-47e3-8c9e-07e1bcedf569)]
interface nsIAutoCompleteInput : nsISupports
{
/*
@@ -178,4 +178,11 @@ interface nsIAutoCompleteInput : nsISupports
* The userContextId of the current browser.
*/
readonly attribute unsigned long userContextId;
+
+ /**
+ * Indicates whether the previous result should be invalidated due to dynamic
+ * list updates. If search content is updated, we shouldn't use the previous
+ * search result.
+ */
+ readonly attribute boolean invalidatePreviousResult;
};