aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Blott2015-06-17 07:06:23 +0100
committerStephen Blott2015-06-17 07:06:23 +0100
commitb7e13a1c2712ed76a299d4d28597197593556b66 (patch)
treedb1dfd7b026e182ad19a37e4147eaf7d167c91ca
parentaa00e29dc2533b6701c65935223599671c5833b1 (diff)
downloadvimium-b7e13a1c2712ed76a299d4d28597197593556b66.tar.bz2
Initialise modes and install listeners at the same time.
Previously, we initialised modes early, but then installed our listeners only after DOM ready, and then only after we'd heard back from the background page in `checkIfEnabledForUrl`. This creates a gap during which modes are installed, but they're not receiving events. If an input is focused during that gap, then we don't pick it up when the modes are installed, and we don't pick it up when the input is focussed (because we're not listening). This commit moves these two initialisation steps together, so they happen at the same time and there is no gap. Fixes #1738.
-rw-r--r--content_scripts/vimium_frontend.coffee2
1 files changed, 1 insertions, 1 deletions
diff --git a/content_scripts/vimium_frontend.coffee b/content_scripts/vimium_frontend.coffee
index 8c28b4e6..bffbd457 100644
--- a/content_scripts/vimium_frontend.coffee
+++ b/content_scripts/vimium_frontend.coffee
@@ -126,7 +126,6 @@ window.initializeModes = ->
# Complete initialization work that sould be done prior to DOMReady.
#
initializePreDomReady = ->
- initializeModes()
checkIfEnabledForUrl()
refreshCompletionKeys()
@@ -190,6 +189,7 @@ installListener = (element, event, callback) ->
installedListeners = false
window.installListeners = ->
unless installedListeners
+ initializeModes()
# Key event handlers fire on window before they do on document. Prefer window for key events so the page
# can't set handlers to grab the keys before us.
for type in [ "keydown", "keypress", "keyup", "click", "focus", "blur", "mousedown", "scroll" ]