From b7e13a1c2712ed76a299d4d28597197593556b66 Mon Sep 17 00:00:00 2001 From: Stephen Blott Date: Wed, 17 Jun 2015 07:06:23 +0100 Subject: 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. --- content_scripts/vimium_frontend.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'content_scripts') 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" ] -- cgit v1.2.3