Closed Bug 717772 Opened 10 years ago Closed 10 years ago

Delay autocomplete of pasted value


(Firefox :: Address Bar, defect)

Not set



Firefox 12


(Reporter: mak, Assigned: mak)




(1 file, 3 obsolete files)

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.
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.
Attached patch hack (obsolete) — Splinter Review
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?(
How about differentiating between input events that add a single character and those that add multiple characters?
Comment on attachment 588430 [details] [diff] [review]

>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?( → feedback+
Attached patch wip (obsolete) — Splinter Review
would something like this be fine? It delays autocomplete on paste by 1 second.
I should still make a test.
Attachment #588888 - Flags: feedback?(
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.
now it works, moving on.
Attached patch patch v1.0 (obsolete) — Splinter Review
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?(
Attachment #589169 - Flags: review?(
Assignee: nobody → mak77
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?(
Attachment #588430 - Attachment is obsolete: true
Attached patch patch v2.0Splinter Review
Attachment #589505 - Flags: review?(
Flags: in-testsuite+
Summary: Pasted partial urls should not be inline autocompleted → Delay autcomplete of pastes value
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?( → review+
addressed comment
Target Milestone: --- → Firefox 12
Closed: 10 years ago
Resolution: --- → FIXED
Depends on: 778391
This seems to have regressed; filed bug 1022399.
Blocks: 776408
You need to log in before you can comment on or make changes to this bug.