Bug 1500080 - UrlbarInput::value getter should return the untrimmed value. r=mak
☠☠ backed out by 8b9c8d77185a ☠ ☠
authorDão Gottwald <dao@mozilla.com>
Fri, 19 Oct 2018 11:36:40 +0000
changeset 490487 f6c89db3520cca62fc39ec0915beecf5e9a22278
parent 490486 d46116aa35273c5da6a5970ee683fedaa81dd628
child 490488 9645a734546be91c08cdba441d7003259e51bda8
push id247
push userfmarier@mozilla.com
push dateSat, 27 Oct 2018 01:06:44 +0000
reviewersmak
bugs1500080
milestone64.0a1
Bug 1500080 - UrlbarInput::value getter should return the untrimmed value. r=mak Differential Revision: https://phabricator.services.mozilla.com/D9088
browser/components/urlbar/UrlbarInput.jsm
--- a/browser/components/urlbar/UrlbarInput.jsm
+++ b/browser/components/urlbar/UrlbarInput.jsm
@@ -47,16 +47,17 @@ class UrlbarInput {
     this.document = this.window.document;
     this.controller = options.controller || new UrlbarController({
       window: this.window,
     });
     this.view = new UrlbarView(this);
     this.valueIsTyped = false;
     this.userInitiatedFocus = false;
     this.isPrivate = PrivateBrowsingUtils.isWindowPrivate(this.window);
+    this._untrimmedValue = "";
 
     // Forward textbox methods and properties.
     const METHODS = ["addEventListener", "removeEventListener",
       "setAttribute", "hasAttribute", "removeAttribute", "getAttribute",
       "focus", "blur", "select"];
     const READ_ONLY_PROPERTIES = ["inputField", "editor"];
     const READ_WRITE_PROPERTIES = ["placeholder", "readOnly",
       "selectionStart", "selectionEnd"];
@@ -240,20 +241,22 @@ class UrlbarInput {
   }
 
   get goButton() {
     return this.document.getAnonymousElementByAttribute(this.textbox, "anonid",
       "urlbar-go-button");
   }
 
   get value() {
-    return this.inputField.value;
+    return this._untrimmedValue;
   }
 
   set value(val) {
+    this._untrimmedValue = val;
+
     val = this.trimValue(val);
 
     this.valueIsTyped = false;
     this.inputField.value = val;
     this.formatValue();
 
     // Dispatch ValueChange event for accessibility.
     let event = this.document.createEvent("Events");
@@ -422,21 +425,24 @@ class UrlbarInput {
         event.detail == 2 &&
         UrlbarPrefs.get("doubleClickSelectsAll")) {
       this.editor.selectAll();
       event.preventDefault();
     }
   }
 
   _on_input(event) {
+    let value = event.target.value;
     this.valueIsTyped = true;
+    this._untrimmedValue = value;
+    this.window.gBrowser.userTypedValue = value;
 
     // XXX Fill in lastKey, and add anything else we need.
     this.controller.startQuery(new QueryContext({
-      searchString: event.target.value,
+      searchString: value,
       lastKey: "",
       maxResults: UrlbarPrefs.get("maxRichResults"),
       isPrivate: this.isPrivate,
     }));
   }
 
   _on_select(event) {
     if (!Services.clipboard.supportsSelectionClipboard()) {