mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-04 14:58:37 +09:00
Issue #1509 - Invalidate previous result when datalist is changed.
Even if `<datalist>` is dynamically changed, the autocomplete controller still uses the previous search result. If changed, we have to ignore the previous result that may now be invalid. Also, even if `<datalist>` is changed, we have to keep the selected index (See Mozilla Bug 595069), so we cannot use `ResetInternalState` in this situation because it resets the selected index. This resolves #1509.
This commit is contained in:
parent
fd04893c34
commit
046b81d062
4 changed files with 31 additions and 5 deletions
|
|
@ -1183,11 +1183,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();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue