Trying to access contentWindow caused error in FF+Greasemonkey.
This works in both FF and Chromium.
This commit is contained in:
parent
395726aef0
commit
d3cf221e77
@ -3,7 +3,10 @@ class Connection
|
|||||||
$.on window, 'message', @onMessage
|
$.on window, 'message', @onMessage
|
||||||
|
|
||||||
targetWindow: ->
|
targetWindow: ->
|
||||||
@target.contentWindow or @target
|
if @target instanceof window.HTMLIFrameElement
|
||||||
|
@target.contentWindow
|
||||||
|
else
|
||||||
|
@target
|
||||||
|
|
||||||
send: (data) =>
|
send: (data) =>
|
||||||
@targetWindow().postMessage "#{g.NAMESPACE}#{JSON.stringify data}", @origin
|
@targetWindow().postMessage "#{g.NAMESPACE}#{JSON.stringify data}", @origin
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user