aboutsummaryrefslogtreecommitdiffstats
path: root/content_scripts/ui_component.coffee
diff options
context:
space:
mode:
Diffstat (limited to 'content_scripts/ui_component.coffee')
-rw-r--r--content_scripts/ui_component.coffee11
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, =>