mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-20 16:55:40 +00:00
Bug 1564830 - Remove userInitiatedFocus flag. r=harry
Differential Revision: https://phabricator.services.mozilla.com/D37540 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
7105b782dc
commit
190d05c07e
@ -2751,27 +2751,17 @@ function loadOneOrMoreURIs(aURIString, aTriggeringPrincipal, aCsp) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Focuses the location bar input field and selects its contents.
|
* 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(userInitiatedFocus = false) {
|
function focusAndSelectUrlBar() {
|
||||||
// In customize mode, the url bar is disabled. If a new tab is opened or the
|
// 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
|
// 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.
|
// 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 can't focus it when it's disabled, so we need to re-run ourselves when
|
||||||
// we've finished leaving customize mode.
|
// we've finished leaving customize mode.
|
||||||
if (CustomizationHandler.isExitingCustomizeMode) {
|
if (CustomizationHandler.isCustomizing()) {
|
||||||
gNavToolbox.addEventListener(
|
gNavToolbox.addEventListener(
|
||||||
"aftercustomization",
|
"aftercustomization",
|
||||||
function() {
|
focusAndSelectUrlBar,
|
||||||
focusAndSelectUrlBar(userInitiatedFocus);
|
|
||||||
},
|
|
||||||
{ once: true }
|
{ once: true }
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
@ -2781,14 +2771,12 @@ function focusAndSelectUrlBar(userInitiatedFocus = false) {
|
|||||||
FullScreen.showNavToolbox();
|
FullScreen.showNavToolbox();
|
||||||
}
|
}
|
||||||
|
|
||||||
gURLBar.userInitiatedFocus = userInitiatedFocus;
|
|
||||||
gURLBar.select();
|
gURLBar.select();
|
||||||
gURLBar.userInitiatedFocus = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function openLocation() {
|
function openLocation() {
|
||||||
if (window.location.href == AppConstants.BROWSER_CHROME_URL) {
|
if (window.location.href == AppConstants.BROWSER_CHROME_URL) {
|
||||||
focusAndSelectUrlBar(true);
|
focusAndSelectUrlBar();
|
||||||
if (gURLBar.openViewOnFocus && !gURLBar.view.isOpen) {
|
if (gURLBar.openViewOnFocus && !gURLBar.view.isOpen) {
|
||||||
gURLBar.startQuery();
|
gURLBar.startQuery();
|
||||||
}
|
}
|
||||||
|
@ -96,7 +96,6 @@ class UrlbarInput {
|
|||||||
this.controller.setInput(this);
|
this.controller.setInput(this);
|
||||||
this.view = new UrlbarView(this);
|
this.view = new UrlbarView(this);
|
||||||
this.valueIsTyped = false;
|
this.valueIsTyped = false;
|
||||||
this.userInitiatedFocus = false;
|
|
||||||
this.isPrivate = PrivateBrowsingUtils.isWindowPrivate(this.window);
|
this.isPrivate = PrivateBrowsingUtils.isWindowPrivate(this.window);
|
||||||
this.lastQueryContextPromise = Promise.resolve();
|
this.lastQueryContextPromise = Promise.resolve();
|
||||||
this._actionOverrideKeyCount = 0;
|
this._actionOverrideKeyCount = 0;
|
||||||
|
@ -329,8 +329,6 @@ Implements an input box *View*, owns an *UrlbarView*.
|
|||||||
view;
|
view;
|
||||||
// Whether the current value was typed by the user.
|
// Whether the current value was typed by the user.
|
||||||
valueIsTyped;
|
valueIsTyped;
|
||||||
// Whether the input box has been focused by a user action.
|
|
||||||
userInitiatedFocus;
|
|
||||||
// Whether the context is in Private Browsing mode.
|
// Whether the context is in Private Browsing mode.
|
||||||
isPrivate;
|
isPrivate;
|
||||||
// Whether the input box is focused.
|
// Whether the input box is focused.
|
||||||
|
Loading…
Reference in New Issue
Block a user