Bug 1599070 - Replace references to textbox.reset(). r=Standard8

Differential Revision: https://phabricator.services.mozilla.com/D54742

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Tim Nguyen 2019-11-27 17:36:13 +00:00
parent ee46777322
commit 99ee4cbf44
4 changed files with 14 additions and 19 deletions

View File

@ -377,7 +377,11 @@ var PlacesOrganizer = {
// At this point, resetSearchBox is true, because the left pane selection
// has changed; otherwise we would have returned earlier.
PlacesSearchBox.searchFilter.reset();
let input = PlacesSearchBox.searchFilter;
input.value = "";
try {
input.editor.transactionManager.clear();
} catch (e) {}
this._setSearchScopeForNode(node);
this.updateDetailsPane();
},

View File

@ -411,13 +411,14 @@ var Sanitizer = {
)) {
let currentDocument = currentWindow.document;
// searchBar.textbox may not exist due to the search bar binding
// not having been constructed yet if the search bar is in the
// overflow or menu panel. It won't have a value or edit history in
// that case.
// searchBar may not exist if it's in the customize mode.
let searchBar = currentDocument.getElementById("searchbar");
if (searchBar && searchBar.textbox) {
searchBar.textbox.reset();
if (searchBar) {
let input = searchBar.textbox;
input.value = "";
try {
input.editor.transactionManager.clear();
} catch (e) {}
}
let tabBrowser = currentWindow.gBrowser;

View File

@ -62,10 +62,10 @@ function doTests() {
textbox.value = "foo";
is(icons.selectedPanel, clearIcon, "clear icon is displayed when setting a value");
textbox.reset();
textbox.value = "";
is(textbox.defaultValue, "", "defaultValue is empty");
is(textbox.value, "", "reset method clears the textbox");
is(icons.selectedPanel, searchIcon, "search icon is displayed after textbox.reset()");
is(icons.selectedPanel, searchIcon, "search icon is displayed after clearing value");
textbox.value = "foo";
gExpectedValue = "";

View File

@ -201,16 +201,6 @@
return this.inputField.disabled;
}
reset() {
this.value = this.defaultValue;
// XXX: Is this still needed ?
try {
this.editor.transactionManager.clear();
return true;
} catch (e) {}
return false;
}
_fireCommand(me) {
if (me._timer) {
clearTimeout(me._timer);