Trying to access contentWindow caused error in FF+Greasemonkey.

This works in both FF and Chromium.
This commit is contained in:
ccd0 2015-06-21 15:13:04 -07:00
parent 395726aef0
commit d3cf221e77

View File

@ -3,7 +3,10 @@ class Connection
$.on window, 'message', @onMessage
targetWindow: ->
@target.contentWindow or @target
if @target instanceof window.HTMLIFrameElement
@target.contentWindow
else
@target
send: (data) =>
@targetWindow().postMessage "#{g.NAMESPACE}#{JSON.stringify data}", @origin