Open Bug 721225 Opened 14 years ago Updated 3 years ago

getTextValue is not guaranteed to return the same string that was set through setTextValue

Categories

(Toolkit :: Autocomplete, defect, P3)

defect

Tracking

()

REOPENED

People

(Reporter: mak, Unassigned)

References

Details

(Whiteboard: [inline-autocomplete:minor])

Attachments

(1 file)

We do things like this: else if (shouldComplete) { // We usually try to preserve the casing of what user has typed, but // if he wants to autocomplete, we will replace the value with the // actual autocomplete result. // The user wants explicitely to use that result, so this ensures // association of the result with the autocompleted text. nsAutoString value; nsAutoString inputValue; input->GetTextValue(inputValue); if (NS_SUCCEEDED(GetDefaultCompleteValue(-1, false, value)) && value.Equals(inputValue, nsCaseInsensitiveStringComparator())) { input->SetTextValue(value); input->SelectTextRange(value.Length(), value.Length()); } unfortunately when we called setTextValue earlier, the urlbar binding decided to apply trimming to the url, removing "http://", now we compare with a result value that is not trimmed, and obviously this can't work. Similar things may happen in other parts of the controller, where we compare GetTextValue to results values.
Blocks: 719888
a possible approach: - add a SetTextValue helper, that caches the value and then sets it - replace all direct calls with the helper - add a GetUnmodifiedTextValue helper that returns the cached value - replace all getTextValue calls with GetUnmodifiedTextValue
Attached patch patch v1.0Splinter Review
possible patch, though I'm not extremely happy with it
as a side note, this bug hits us when the user types the same exact string found by the autocomplete, and he tries to confirm it. The controller would like to set proper casing according to the result, but it can't. It's a pretty edge-case, so low priority.
Whiteboard: [inline-autocomplete:minor]
Per policy at https://wiki.mozilla.org/Bug_Triage/Projects/Bug_Handling/Bug_Husbandry#Inactive_Bugs. If this bug is not an enhancement request or a bug not present in a supported release of Firefox, then it may be reopened.
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → INACTIVE
Status: RESOLVED → REOPENED
Priority: -- → P3
Resolution: INACTIVE → ---
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: