Bug 1294733 - Awesomebar search buttons show auto completed text not user input. r=florian

MozReview-Commit-ID: BmxFd7fgdA6

--HG--
extra : rebase_source : 92a6a2259761f16e078c2b765ff3e747af79c477
This commit is contained in:
Drew Willcoxon 2016-08-13 12:20:42 -07:00
Родитель 0d0d1992db
Коммит 560391bae0
2 изменённых файлов: 17 добавлений и 12 удалений

Просмотреть файл

@ -434,12 +434,7 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
// search query (or "keyword" in URI-fixup terminology), then load a
// search using the one-off's engine.
if (selectedOneOff && selectedOneOff.engine) {
// `url` (which is this.value) may be an autofilled string. Search
// only with the portion that the user typed, if any, by preferring
// the autocomplete controller's searchString.
let value = this._searchStringOnHandleEnter ||
this.mController.searchString ||
url;
let value = this.oneOffSearchQuery;
let fixup;
try {
fixup = Services.uriFixup.getFixupURIInfo(
@ -470,6 +465,17 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
]]></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 ||
this.mController.searchString ||
this.textValue;
]]></getter>
</property>
<method name="_loadURL">
<parameter name="url"/>
<parameter name="postData"/>

Просмотреть файл

@ -1277,12 +1277,11 @@
<body><![CDATA[
switch (event.type) {
case "input":
// The urlbar's value property can be a moz-action URI, but we
// want the value that the user sees, which is textValue. So see
// if the textbox has a textValue property, and use it if so.
this.query = typeof(event.target.textValue) == "string" ?
event.target.textValue :
event.target.value;
// Allow the consumer's input to override its value property with
// a oneOffSearchQuery property. That way if the value is not
// actually what the user typed (e.g., it's autofilled, or it's a
// mozaction URI), the consumer has some way of providing it.
this.query = event.target.oneOffSearchQuery || event.target.value;
break;
case "popupshowing":
this._rebuild();