Bug 1376147 - Part 1. autocomplete widget should use setUserInput to allow undo transaction. r?mak
By
bug 1358025, input.value setter doesn't create undo transaction. Its behavior is same as all browsers.
But, since autocomplete widget that uses on url bar uses input.value instead of setUserInput, auto completion doesn't allow undo transaction. So for better user interaction, we should allow undo transaction on urlbar.
MozReview-Commit-ID: 7MJgXLCMcSc
--- a/toolkit/content/widgets/autocomplete.xml
+++ b/toolkit/content/widgets/autocomplete.xml
@@ -319,17 +319,24 @@
if (typeof this.onBeforeValueSet == "function")
val = this.onBeforeValueSet(val);
if (typeof this.trimValue == "function" && !this._disableTrim)
val = this.trimValue(val);
this.valueIsTyped = false;
- this.inputField.value = val;
+ if (this.focused) {
+ // auto completed value is set during focused.
+ // Since input.value setter doesn't generate undo stack, use
+ // setUserInput.
+ this.inputField.setUserInput(val);
+ } else {
+ this.inputField.value = val;
+ }
if (typeof this.formatValue == "function")
this.formatValue();
this.mIgnoreInput = false;
var event = document.createEvent("Events");
event.initEvent("ValueChange", true, true);
this.inputField.dispatchEvent(event);