From 7004420e178416cc680416091a23dd804fb9370c Mon Sep 17 00:00:00 2001 From: Stephen Blott Date: Tue, 12 May 2015 06:01:08 +0100 Subject: 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. --- content_scripts/hud.coffee | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'content_scripts') 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 -- cgit v1.2.3