Bug 1522529 - Remove focus hack from the gURLBar getter and properly implement UrlbarInput focus and blur methods. r=adw

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Dão Gottwald 2019-01-24 16:49:41 +00:00
Родитель dd194db5d7
Коммит 535429cd1f
2 изменённых файлов: 9 добавлений и 6 удалений

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

@ -190,11 +190,6 @@ XPCOMUtils.defineLazyGetter(this, "gURLBar", () => {
return element;
}
// Re-focus the input field if it was focused before switching bindings.
if (element.hasAttribute("focused")) {
element.inputField.focus();
}
return new UrlbarInput({
textbox: element,
panel: document.getElementById("urlbar-results"),

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

@ -62,7 +62,7 @@ class UrlbarInput {
// Forward textbox methods and properties.
const METHODS = ["addEventListener", "removeEventListener",
"setAttribute", "hasAttribute", "removeAttribute", "getAttribute",
"focus", "blur", "select"];
"select"];
const READ_ONLY_PROPERTIES = ["inputField", "editor"];
const READ_WRITE_PROPERTIES = ["placeholder", "readOnly",
"selectionStart", "selectionEnd"];
@ -141,6 +141,14 @@ class UrlbarInput {
this.view.close();
}
focus() {
this.inputField.focus();
}
blur() {
this.inputField.blur();
}
/**
* Converts an internal URI (e.g. a wyciwyg URI) into one which we can
* expose to the user.