aboutsummaryrefslogtreecommitdiffstats
path: root/content_scripts
diff options
context:
space:
mode:
authorStephen Blott2016-04-21 06:59:28 +0100
committerStephen Blott2016-04-21 06:59:28 +0100
commitc5198e1b6cc90389e15979fb72cccd314feb73b8 (patch)
tree3fc533cc6e8cd1ca1924b167dafb254e76e21ec5 /content_scripts
parent810dafcb7c4d76bf0bebfab12bbb869e0e19bd3a (diff)
downloadvimium-c5198e1b6cc90389e15979fb72cccd314feb73b8.tar.bz2
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.
Diffstat (limited to 'content_scripts')
-rw-r--r--content_scripts/vimium_frontend.coffee11
1 files changed, 8 insertions, 3 deletions
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