diff --git a/browser/base/content/urlbarBindings.xml b/browser/base/content/urlbarBindings.xml index cee8fc9bcde3..7f040bf8c5a8 100644 --- a/browser/base/content/urlbarBindings.xml +++ b/browser/base/content/urlbarBindings.xml @@ -255,6 +255,7 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/. + @@ -402,6 +410,9 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/. // defaultPrevented. That's the purpose of this expando. If we could // figure out what's setting defaultPrevented and prevent it, then we // could get rid of this. + if (event.urlbarDeferred) { + throw new Error("Key event already deferred!"); + } event.urlbarDeferred = true; this._deferredKeyEventQueue.push({ @@ -419,20 +430,17 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/. // the user's input. let elapsed = Cu.now() - this._searchStartDate; let remaining = this._deferredKeyEventTimeoutMs - elapsed; - if (remaining <= 0) { + this._deferredKeyEventTimeout = setTimeout(() => { this.replayAllDeferredKeyEvents(); - } else { - this._deferredKeyEventTimeout = setTimeout(() => { - this.replayAllDeferredKeyEvents(); - this._deferredKeyEventTimeout = null; - }, remaining); - } + this._deferredKeyEventTimeout = null; + }, Math.max(0, remaining)); } ]]> new Set([ + KeyboardEvent.DOM_VK_RETURN, KeyboardEvent.DOM_VK_DOWN, KeyboardEvent.DOM_VK_TAB, ]) @@ -482,7 +490,7 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/. @@ -1481,6 +1489,7 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/. +