Backed out changeset c602dc47afce (bug 1564830) ES lint failure on a CLOSED TREE

This commit is contained in:
Andreea Pavel 2019-07-10 19:11:54 +03:00
parent 579b3f8116
commit 5dae66b201
3 changed files with 19 additions and 4 deletions

View File

@ -2751,17 +2751,27 @@ function loadOneOrMoreURIs(aURIString, aTriggeringPrincipal, aCsp) {
/**
* Focuses the location bar input field and selects its contents.
*
* @param [optional] userInitiatedFocus
* Whether this focus is caused by an user interaction whose intention
* was to use the location bar. For example, using a shortcut to go to
* the location bar, or a contextual menu to search from it.
* The default is false and should be used in all those cases where the
* code focuses the location bar but that's not the primary user
* intention, like when opening a new tab.
*/
function focusAndSelectUrlBar() {
function focusAndSelectUrlBar(userInitiatedFocus = false) {
// In customize mode, the url bar is disabled. If a new tab is opened or the
// user switches to a different tab, this function gets called before we've
// finished leaving customize mode, and the url bar will still be disabled.
// We can't focus it when it's disabled, so we need to re-run ourselves when
// we've finished leaving customize mode.
if (CustomizationHandler.isCustomizing()) {
if (CustomizationHandler.isExitingCustomizeMode) {
gNavToolbox.addEventListener(
"aftercustomization",
focusAndSelectUrlBar,
function() {
focusAndSelectUrlBar(userInitiatedFocus);
},
{ once: true }
);
return;
@ -2771,12 +2781,14 @@ function focusAndSelectUrlBar() {
FullScreen.showNavToolbox();
}
gURLBar.userInitiatedFocus = userInitiatedFocus;
gURLBar.select();
gURLBar.userInitiatedFocus = false;
}
function openLocation() {
if (window.location.href == AppConstants.BROWSER_CHROME_URL) {
focusAndSelectUrlBar();
focusAndSelectUrlBar(true);
if (gURLBar.openViewOnFocus && !gURLBar.view.isOpen) {
gURLBar.startQuery();
}

View File

@ -96,6 +96,7 @@ class UrlbarInput {
this.controller.setInput(this);
this.view = new UrlbarView(this);
this.valueIsTyped = false;
this.userInitiatedFocus = false;
this.isPrivate = PrivateBrowsingUtils.isWindowPrivate(this.window);
this.lastQueryContextPromise = Promise.resolve();
this._actionOverrideKeyCount = 0;

View File

@ -329,6 +329,8 @@ Implements an input box *View*, owns an *UrlbarView*.
view;
// Whether the current value was typed by the user.
valueIsTyped;
// Whether the input box has been focused by a user action.
userInitiatedFocus;
// Whether the context is in Private Browsing mode.
isPrivate;
// Whether the input box is focused.