Open Bug 1908360 Opened 3 months ago Updated 3 months ago

Evaluate removing .valueIsTyped

Categories

(Firefox :: Address Bar, task, P3)

task

Tracking

()

People

(Reporter: mak, Unassigned)

References

Details

(Whiteboard: [sng][search-tech-debt])

Attachments

(1 file)

While working on Bug 1903266 I noticed how .valueIsTyped is used in a confusing way.
It is not actually indicating a user typed value, as we also set it from setURI that is not a user action.
It seems to often overlap with pageproxystate, and sometimes it's apparently used to track whether the value changed from the last load.

I started the process of removing it, and I ended up in a big chunk of changes that are worth their own separate bug (this), and likely to be split and landed in multiple parts.

One issue is with autofill.untrimmedValue.
It's not set by the autofill provider on the returned result, so when we setValue we don't set untrimmedValue properly
Though, fixing that means the trimmed part may not be anymore just the protocol, but also "www." as that's what autofill does. Then we should rename _protocolIsTrimmed to #preDomainIsTrimmed... And we should track the trimmed part in a #trimmedPreDomain property.
While there it would also be reasonable to rename autocomplete.untrimmedValue to .untrimmedUrl as it's always a URL (there's other autofill cases where we don't want to pass untrimmedValue, like for search engine autofill, for example).

Doing that means the urlbar will try to untrim autofilled strings when the user confirms that, and we likely don't want that cause the text jumps badly. Thus we must track whether the user confirmed/cleared an autofilled part (_autofillPlaceholder could be used).

In the end I had to give up because this was becoming too much, but I think long term the handling would be nicer if we'd always track untrimmedValue properly (also for autofill) and allow the trimmed part to go past the protocol (so in the future we can trim www.).
Plus removing valueIsTyped seems reasonable as it's just a confusing property.

The valueIsTyped property was introduced mostly to modify the copy behavior,
though it's misleading since it's also used by setURI, and it's not taking
into account other cases where the url is trimmed.
This removes it in favor of using the more precise userTypedValue and
_protocolIsTrimmed.
This is properly passing the untrimmedUrl value in the autofill case, also
renaming untrimmedValue to untrimmedUrl as the only case where it makes
sense to pass it is when it's a URL.

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: