aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Blott2015-05-12 06:01:08 +0100
committerStephen Blott2015-05-12 06:01:08 +0100
commit7004420e178416cc680416091a23dd804fb9370c (patch)
tree05bb7d6082c8d84ec419fb104ec11880651c3b5c
parentd844f27fdc880f466c1aee41ffc811045cb36df4 (diff)
downloadvimium-7004420e178416cc680416091a23dd804fb9370c.tar.bz2
Fix HUD on options page (temporary fix).
Following on from #1652, vimium was failing to initialize correctly on the options page. Specifically, installListeners() was running before initializeOnDomReady(), hence before HUD.init(). installListeners() runs new GrabBackFocus(), which hides the HUD, which is not yet initialized - so it fails. This is a temporary fix. Could you take a look, @mrmr1993? Perhaps there is a race condition which only arises on the options page. It may be enough to just have HUD.hide() silently pass if @tween is not yet set.
-rw-r--r--content_scripts/hud.coffee4
1 files changed, 3 insertions, 1 deletions
diff --git a/content_scripts/hud.coffee b/content_scripts/hud.coffee
index 2f95c4fe..dcb95fd9 100644
--- a/content_scripts/hud.coffee
+++ b/content_scripts/hud.coffee
@@ -11,13 +11,14 @@ HUD =
# it doesn't sit on top of horizontal scrollbars like Chrome's HUD does.
init: ->
- @tween = new Tween ".vimiumHUD.vimiumUIComponentVisible"
+ @tween ?= new Tween ".vimiumHUD.vimiumUIComponentVisible"
showForDuration: (text, duration) ->
@show(text)
@_showForDurationTimerId = setTimeout((=> @hide()), duration)
show: (text) ->
+ @init()
return unless @enabled()
clearTimeout(@_showForDurationTimerId)
@displayElement().innerText = text
@@ -41,6 +42,7 @@ HUD =
# If :updateIndicator is truthy, then we also refresh the mode indicator. The only time we don't update the
# mode indicator, is when hide() is called for the mode indicator itself.
hide: (immediate = false, updateIndicator = true) ->
+ @init()
@tween.stop()
if immediate
unless updateIndicator