author | Marco Bonardo <mbonardo@mozilla.com> |
Wed, 07 Sep 2016 18:22:23 +0200 | |
changeset 314177 | eed372e27a7adb4b09237193cf87a39529161484 |
parent 314176 | 1d99d855d1a9f3ba3f89dccb3ce2f2449f43f49a |
child 314178 | 85ec67dd11e5626a4cf0efc2abda9e3d44cb63b2 |
push id | 32340 |
push user | mak77@bonardo.net |
push date | Fri, 16 Sep 2016 10:28:51 +0000 |
treeherder | autoland@85ec67dd11e5 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | adw |
bugs | 1301093 |
milestone | 51.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/browser/base/content/urlbarBindings.xml +++ b/browser/base/content/urlbarBindings.xml @@ -121,17 +121,23 @@ file, You can obtain one at http://mozil this.inputField.removeEventListener("mousemove", this, false); this.inputField.removeEventListener("mouseout", this, false); this.inputField.removeEventListener("overflow", this, false); this.inputField.removeEventListener("underflow", this, false); ]]></destructor> <field name="_value">""</field> <field name="gotResultForCurrentQuery">false</field> - <field name="handleEnterWhenGotResult">false</field> + + <!-- + This is set around HandleHenter so it can be used in handleCommand. + It is also used to track whether we must handle a delayed handleEnter, + by checking if it has been cleared. + --> + <field name="searchStringOnHandleEnter">""</field> <!-- For performance reasons we want to limit the size of the text runs we build and show to the user. --> <field name="textRunsMaxLen">255</field> <!-- @@ -464,18 +470,18 @@ file, You can obtain one at http://mozil }); ]]></body> </method> <property name="oneOffSearchQuery"> <getter><![CDATA[ // this.textValue may be an autofilled string. Search only with the // portion that the user typed, if any, by preferring the autocomplete - // controller's searchString (including _searchStringOnHandleEnter). - return this._searchStringOnHandleEnter || + // controller's searchString (including searchStringOnHandleEnter). + return this.searchStringOnHandleEnter || this.mController.searchString || this.textValue; ]]></getter> </property> <method name="_loadURL"> <parameter name="url"/> <parameter name="postData"/> @@ -1028,28 +1034,29 @@ file, You can obtain one at http://mozil // result selected. // If anything other than the default (first) result is selected, then // it must have been manually selected by the human. We let this // explicit choice be used, even if it may be related to a previous // input. // However, if the default result is automatically selected, we // ensure that it corresponds to the current input. + // Store the current search string so it can be used in + // handleCommand, which will be called as a result of + // mController.handleEnter(). + // Note this is also used to detect if we should perform a delayed + // handleEnter, in such a case it won't have been cleared. + this.searchStringOnHandleEnter = this.mController.searchString; + if (this.popup.selectedIndex != 0 || this.gotResultForCurrentQuery) { - // Store the current search string so it can be used in - // handleCommand, which will be called as a result of - // mController.handleEnter(). handleEnter will reset it. - this._searchStringOnHandleEnter = this.mController.searchString; let rv = this.mController.handleEnter(false, event); - delete this._searchStringOnHandleEnter; + this.searchStringOnHandleEnter = ""; return rv; } - this.handleEnterWhenGotResult = true; - return true; ]]></body> </method> <method name="handleDelete"> <body><![CDATA[ // If the heuristic result is selected, then the autocomplete // controller's handleDelete implementation will remove it, which is @@ -1764,19 +1771,27 @@ file, You can obtain one at http://mozil this.richlistbox.suppressMenuItemEvent = true; this.selectedIndex = 0; this.richlistbox.suppressMenuItemEvent = false; this._ignoreNextSelect = false; } this.input.gotResultForCurrentQuery = true; - if (this.input.handleEnterWhenGotResult) { - this.input.handleEnterWhenGotResult = false; - this.input.mController.handleEnter(false); + + // Check if we should perform a delayed handleEnter. + if (this.input.searchStringOnHandleEnter) { + try { + // Safety check: handle only if the search string didn't change. + if (this.input.mController.searchString == this.input.searchStringOnHandleEnter) { + this.input.mController.handleEnter(false); + } + } finally { + this.input.searchStringOnHandleEnter = ""; + } } ]]> </body> </method> </implementation> <handlers>