I'm developing a Lightning Component in which I'd like to re-use some functionality I have developed and hosted externally. I created an iframe to display that functionality, and was expecting to be able to use parent.postMessage() to be able to communicate back to the host Lightning Component which registers an event listener on the window. To test, I've referenced the component in a standalone Lightning App (which is how I expect the component to be used- not in tabs/pages in Salesforce).
However, when I do so, I get an error of the form:
Uncaught SecurityError: Blocked a frame with origin "https://...-dev-ed.lightning.force.com" from accessing a cross-origin frame.
throws at https://...-dev-ed.lightning.force.com/auraFW/javascript/aFPQVaW6aCRCwKFhEzY2OA/aura_prod.js:545:476
Note that this only occurs from iframe to parent, not the other way around. In the controller for my Lightning component, I can get a reference to the iframe contentWindow and successfully postMessage into the iframe.
Is this expected behavior for Lightning Apps- that they can communicate to iframes via postMessage, but they cannot receive replies back (via postMessage in the iframe to parent)?