From c5198e1b6cc90389e15979fb72cccd314feb73b8 Mon Sep 17 00:00:00 2001 From: Stephen Blott Date: Thu, 21 Apr 2016 06:59:28 +0100 Subject: Reinstate Vomnibar init on load. This effectively reverts 4b564e8517dd3415cb8e2209ce019fa024e88770. Reinstate pre-initialization of the Vomnibar. Without pre-initialization, there is a small but noticable sluggishness the first time the Vomnibar is opened. --- content_scripts/vimium_frontend.coffee | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'content_scripts') diff --git a/content_scripts/vimium_frontend.coffee b/content_scripts/vimium_frontend.coffee index 68cd402d..06b447fc 100644 --- a/content_scripts/vimium_frontend.coffee +++ b/content_scripts/vimium_frontend.coffee @@ -138,8 +138,13 @@ installModes = -> new GrabBackFocus if isEnabledForUrl normalMode # Return the normalMode object (for the tests). -initializeOnEnabledStateKnown = Utils.makeIdempotent -> - installModes() +initializeOnEnabledStateKnown = (isEnabledForUrl) -> + installModes() unless normalMode + if isEnabledForUrl + # We only initialize (and activate) the Vomnibar in the top frame. Also, we do not initialize the + # Vomnibar until we know that Vimium is enabled. Thereafter, there's no more initialization to do. + Vomnibar.init() if DomUtils.isTopFrame() + initializeOnEnabledStateKnown = -> # # Complete initialization work that should be done prior to DOMReady. @@ -450,7 +455,7 @@ extend window, checkIfEnabledForUrl = do -> Frame.addEventListener "isEnabledForUrl", (response) -> {isEnabledForUrl, passKeys, frameIsFocused} = response - initializeOnEnabledStateKnown() + initializeOnEnabledStateKnown isEnabledForUrl normalMode.setPassKeys passKeys # Hide the HUD if we're not enabled. HUD.hide true, false unless isEnabledForUrl -- cgit v1.2.3