diff options
| -rw-r--r-- | content_scripts/hud.coffee | 11 | ||||
| -rw-r--r-- | content_scripts/ui_component.coffee | 3 | ||||
| -rw-r--r-- | content_scripts/vimium_frontend.coffee | 3 |
3 files changed, 7 insertions, 10 deletions
diff --git a/content_scripts/hud.coffee b/content_scripts/hud.coffee index 92de975b..bbf7c5e9 100644 --- a/content_scripts/hud.coffee +++ b/content_scripts/hud.coffee @@ -23,13 +23,13 @@ HUD = @_showForDurationTimerId = setTimeout((=> @hide()), duration) show: (text) -> - return unless @enabled() + return unless @isReady() clearTimeout(@_showForDurationTimerId) @hudUI.show {name: "show", text} @tween.fade 1.0, 150 showFindMode: (@findMode = null) -> - return unless @enabled() + return unless @isReady() @hudUI.show {name: "showFindMode", text: ""} @tween.fade 1.0, 150 @@ -83,12 +83,7 @@ HUD = @findMode.exit() postExit?() - isReady: do -> - ready = false - DomUtils.documentReady -> ready = true - -> ready and document.body != null and @hudUI? - - enabled: -> true + isReady: -> @hudUI?.uiComponentIsReady class Tween opacity: 0 diff --git a/content_scripts/ui_component.coffee b/content_scripts/ui_component.coffee index 4c9b18e1..92640eb2 100644 --- a/content_scripts/ui_component.coffee +++ b/content_scripts/ui_component.coffee @@ -1,4 +1,5 @@ class UIComponent + uiComponentIsReady: false iframeElement: null iframePort: null showing: null @@ -53,6 +54,8 @@ class UIComponent @postMessage name: "frameFocused", focusFrameId: request.focusFrameId false # Free up the sendResponse handler. + @styleSheetGetter.use => @iframePort.use => Utils.nextTick => @uiComponentIsReady = true + # Posts a message (if one is provided), then calls continuation (if provided). The continuation is only # ever called *after* the message has been posted. postMessage: (message = null, continuation = null) -> diff --git a/content_scripts/vimium_frontend.coffee b/content_scripts/vimium_frontend.coffee index 58cf6115..39e87648 100644 --- a/content_scripts/vimium_frontend.coffee +++ b/content_scripts/vimium_frontend.coffee @@ -138,8 +138,7 @@ installModes = -> initializeOnEnabledStateKnown = Utils.makeIdempotent -> installModes() -initializeUIComponents = -> - # Both of these are idempotent. +initializeUIComponents = Utils.makeIdempotent -> DomUtils.documentReady -> HUD.init() Vomnibar.init() if DomUtils.isTopFrame() |
