Unable to post message from widget to parent after refresh

The WebViewWidget that i had implemented is shown in the main/center area as a tab.
The iFrame inside the widget shows the web contents.

The web content that is shown inside the iframe has a button. On clicking that button, a message is sent to a parent by calling

window.parent.postMessage('test-message', '*');

When the widget is created and the button was clicked, i could see the message getting posted in chrome debug tools console after monitor(postmessage) , also it was successfully handled by one of the FrontendContribution class.
But, when i refresh theia ide, the widget also gets refreshed and re-instantiated. But, after refresh, when I click the button inside the iframe, the message is not sent at all.

Any idea why the widget is unable to post the message after refresh ?

I don’t think it is feasible to help without seeing the code. Getting iframes is generally very hard and especially in Theia case to integrate it well with our shell, like proper focusing, keybinding handling, theming and so on. You can look at how webviews are implemented in the plugin system.

@akosyakov, Thank you. I had an issue with subscribing to window messages event. It is solved now.