The default bug view has changed. See this FAQ.

Delay autocomplete of pasted value

RESOLVED FIXED in Firefox 12

Status

()

Firefox
Location Bar
RESOLVED FIXED
5 years ago
3 years ago

People

(Reporter: mak, Assigned: mak)

Tracking

(Depends on: 1 bug)

Trunk
Firefox 12
Points:
---
Dependency tree / graph
Bug Flags:
in-testsuite +

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment, 3 obsolete attachments)

(Assignee)

Description

5 years ago
There are security concerns in allowing to inline autocomplete pasted partial urls, since a user may paste a partial url and click enter without noticing the url he is going to is actually different from what he expected.
(Assignee)

Comment 1

5 years ago
we may need a custom cmd_paste controller to detect this, similar to the _copyCutController one... I don't have better ideas atm, so any alternative idea is welcome.
(Assignee)

Comment 2

5 years ago
Created attachment 588430 [details] [diff] [review]
hack

I don't have better ideas atm, this works as far as the autocomplete fills up synchronously, that is not always true (if we fail matching on a domain it's likely a subpage and autofill for that happens asynchronously). So it's not yet the solution, it's a possible hook point though, that I would like some feedback or ideas on. Maybe we just care about not autocompleting domain matches and not subpages? in such a case it would be enough.
Otherwise we could maybe store the last pasted value and compare with it in the first textValue setter call. It's still sorta hackish though.
Attachment #588430 - Flags: feedback?(gavin.sharp)
How about differentiating between input events that add a single character and those that add multiple characters?
Comment on attachment 588430 [details] [diff] [review]
hack

>diff --git a/browser/base/content/urlbarBindings.xml b/browser/base/content/urlbarBindings.xml

>+      <field name="_pasteController"><![CDATA[

>+          isCommandEnabled: function(aCommand) {
>+            return this.urlbar.inputField.editor.canPaste(Ci.nsIClipboard.kGlobalClipboard);

The nsPasteCommand::isCommandEnabled implementation seems to also check editor.isSelectionEditable, I wonder whether that's necessary?

This doesn't really seem like a hack to me. It should be reliable, right? It would be nice to fix this problem for all autocomplete widgets, though (wait longer before starting the autocomplete searches triggered by pastes).
Attachment #588430 - Flags: feedback?(gavin.sharp) → feedback+
(Assignee)

Comment 5

5 years ago
Created attachment 588888 [details] [diff] [review]
wip

would something like this be fine? It delays autocomplete on paste by 1 second.
I should still make a test.
Attachment #588888 - Flags: feedback?(gavin.sharp)
(Assignee)

Comment 6

5 years ago
I tried making a chrome mochitest witha type=autocomplete textbox, but the controller complains inputField.editor is null, I wonder if there's a privileges problem, the scope looks correct.
(Assignee)

Comment 7

5 years ago
now it works, moving on.
(Assignee)

Comment 8

5 years ago
Created attachment 589169 [details] [diff] [review]
patch v1.0

There are still some things to define:
- if the idl changes may be fine
- if the delay should be configurable and how (pref/attribute)
Attachment #588888 - Attachment is obsolete: true
Attachment #588888 - Flags: feedback?(gavin.sharp)
Attachment #589169 - Flags: review?(gavin.sharp)
(Assignee)

Updated

5 years ago
Assignee: nobody → mak77
Status: NEW → ASSIGNED
(Assignee)

Comment 9

5 years ago
Comment on attachment 589169 [details] [diff] [review]
patch v1.0

new patch coming, according to irc discussion with Gavin.
Attachment #589169 - Attachment is obsolete: true
Attachment #589169 - Flags: review?(gavin.sharp)
(Assignee)

Updated

5 years ago
Attachment #588430 - Attachment is obsolete: true
(Assignee)

Comment 10

5 years ago
Created attachment 589505 [details] [diff] [review]
patch v2.0
Attachment #589505 - Flags: review?(gavin.sharp)
(Assignee)

Updated

5 years ago
Flags: in-testsuite+
Summary: Pasted partial urls should not be inline autocompleted → Delay autcomplete of pastes value
(Assignee)

Updated

5 years ago
Summary: Delay autcomplete of pastes value → Delay autocomplete of pasted value
Comment on attachment 589505 [details] [diff] [review]
patch v2.0

>diff --git a/toolkit/content/widgets/autocomplete.xml b/toolkit/content/widgets/autocomplete.xml

>+      <field name="_pasteController"><![CDATA[

>+          _clipboard: Components.interfaces.nsIClipboard.kGlobalClipboard,

"_kGlobalClipboard"? just "_clipboard" is misleading.
Attachment #589505 - Flags: review?(gavin.sharp) → review+
(Assignee)

Comment 12

5 years ago
addressed comment
https://hg.mozilla.org/integration/mozilla-inbound/rev/19a5e75b8ed8
Target Milestone: --- → Firefox 12
https://hg.mozilla.org/mozilla-central/rev/19a5e75b8ed8
Status: ASSIGNED → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → FIXED
Blocks: 727954

Updated

5 years ago
Depends on: 778391

Comment 14

3 years ago
This seems to have regressed; filed bug 1022399.
You need to log in before you can comment on or make changes to this bug.