[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [tor-browser] 213/311: Bug 1757376: Continue post processing of Enter key when any keyup event is detected on URL bar. r=adw a=pascalc
This is an automated email from the git hooks/post-receive script.
pierov pushed a commit to branch geckoview-99.0.1-11.0-1
in repository tor-browser.
commit 3e1f72f7555027745ea0d8ecea0d352004349bdc
Author: Daisuke Akatsuka <daisuke@xxxxxxxxxxxxxx>
AuthorDate: Tue Mar 15 02:16:40 2022 +0000
Bug 1757376: Continue post processing of Enter key when any keyup event is detected on URL bar. r=adw a=pascalc
Differential Revision: https://phabricator.services.mozilla.com/D140908
---
browser/components/urlbar/UrlbarInput.jsm | 26 ++++++++++++----------
.../urlbar/tests/browser/browser_enter.js | 22 ++++++++++++++++++
2 files changed, 36 insertions(+), 12 deletions(-)
diff --git a/browser/components/urlbar/UrlbarInput.jsm b/browser/components/urlbar/UrlbarInput.jsm
index 8c568fac368ad..56f58f4cedb75 100644
--- a/browser/components/urlbar/UrlbarInput.jsm
+++ b/browser/components/urlbar/UrlbarInput.jsm
@@ -3250,10 +3250,17 @@ class UrlbarInput {
}
async _on_keyup(event) {
- if (
- event.keyCode === KeyEvent.DOM_VK_RETURN &&
- this._keyDownEnterDeferred
- ) {
+ if (event.keyCode === KeyEvent.DOM_VK_CONTROL) {
+ this._isKeyDownWithCtrl = false;
+ }
+
+ this._toggleActionOverride(event);
+
+ // Pressing Enter key while pressing Meta key, and next, even when releasing
+ // Enter key before releasing Meta key, the keyup event is not fired.
+ // Therefore, if Enter keydown is detecting, continue the post processing
+ // for Enter key when any keyup event is detected.
+ if (this._keyDownEnterDeferred) {
if (this._keyDownEnterDeferred.loadedContent) {
try {
const loadingBrowser = await this._keyDownEnterDeferred.promise;
@@ -3263,24 +3270,19 @@ class UrlbarInput {
// Make sure the domain name stays visible for spoof protection and usability.
this.selectionStart = this.selectionEnd = 0;
}
- this._keyDownEnterDeferred = null;
} catch (ex) {
// Not all the Enter actions in the urlbar will cause a navigation, then it
// is normal for this to be rejected.
// If _keyDownEnterDeferred was rejected on keydown, we don't nullify it here
// to ensure not overwriting the new value created by keydown.
}
- return;
+ } else {
+ // Discard the _keyDownEnterDeferred promise to receive any key inputs immediately.
+ this._keyDownEnterDeferred.resolve();
}
- // Discard the _keyDownEnterDeferred promise to receive any key inputs immediately.
- this._keyDownEnterDeferred.resolve();
this._keyDownEnterDeferred = null;
- } else if (event.keyCode === KeyEvent.DOM_VK_CONTROL) {
- this._isKeyDownWithCtrl = false;
}
-
- this._toggleActionOverride(event);
}
_on_compositionstart(event) {
diff --git a/browser/components/urlbar/tests/browser/browser_enter.js b/browser/components/urlbar/tests/browser/browser_enter.js
index 41f3b81712d87..439496bd9bde9 100644
--- a/browser/components/urlbar/tests/browser/browser_enter.js
+++ b/browser/components/urlbar/tests/browser/browser_enter.js
@@ -303,3 +303,25 @@ add_task(async function typeCharWhileProcessingEnter() {
// Cleanup.
BrowserTestUtils.removeTab(tab);
});
+
+add_task(async function keyupEnterWhilePressingMeta() {
+ const tab = await BrowserTestUtils.openNewForegroundTab(gBrowser);
+
+ info("Keydown Meta+Enter");
+ gURLBar.focus();
+ gURLBar.value = "";
+ EventUtils.synthesizeKey("KEY_Enter", { type: "keydown", metaKey: true });
+
+ // Pressing Enter key while pressing Meta key, and next, even when releasing
+ // Enter key before releasing Meta key, the keyup event is not fired.
+ // Therefor, we fire Meta keyup event only.
+ info("Keyup Meta");
+ EventUtils.synthesizeKey("KEY_Meta", { type: "keyup" });
+
+ // Check whether we can input on URL bar.
+ EventUtils.synthesizeKey("a");
+ is(gURLBar.value, "a", "Can input a char");
+
+ // Cleanup.
+ BrowserTestUtils.removeTab(tab);
+});
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits