diff options
| author | Stephen Blott | 2016-04-18 07:43:52 +0100 |
|---|---|---|
| committer | Stephen Blott | 2016-04-18 07:45:36 +0100 |
| commit | 289798866a332f52253c4c52f8d6874211d25611 (patch) | |
| tree | 4a8d37fb7c5daafa045d148cc1a03ba1f0d62232 /content_scripts/ui_component.coffee | |
| parent | 9c4c79eef9267d4bde62a996f82fcb0eff66df91 (diff) | |
| download | vimium-289798866a332f52253c4c52f8d6874211d25611.tar.bz2 | |
Wait for documentReady() when whoeing ui components.
Previously, requests (like opening the Vomnibar) would be silently
discarded if they arrive before the document is ready. Here, we queue
them instead.
Diffstat (limited to 'content_scripts/ui_component.coffee')
| -rw-r--r-- | content_scripts/ui_component.coffee | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/content_scripts/ui_component.coffee b/content_scripts/ui_component.coffee index c7038f17..1a7a1634 100644 --- a/content_scripts/ui_component.coffee +++ b/content_scripts/ui_component.coffee @@ -67,12 +67,13 @@ class UIComponent when "hide" then @hide() else @handleMessage event - # Post a message (if provided), then call continuation (if provided). Because the constructor waits for - # documentReady(), @iframePort may not yet be ready. + # Post a message (if provided), then call continuation (if provided). We wait for documentReady() to ensure + # that the @iframePort set (so that we can use @iframePort.use()). postMessage: (message = null, continuation = null) -> - @iframePort?.use (port) => - port.postMessage message if message? - continuation?() + DomUtils.documentReady => + @iframePort.use (port) -> + port.postMessage message if message? + continuation?() activate: (@options = null) -> @postMessage @options, => |
