I had a weird experience going on with Window.postmessage(). I had a JS file where i use it for creating an Iframe and insert another JS file. Once that JS file inside the iframe is loaded i'm sending a postMessage to the parent window as the file is loaded. But in few scenarios like with the slow network, listener in the parent window is not getting fired.
I tested adding network throttling in chrome browser i get the same behavior, but if i add a debugger in the JS file that i loaded through iframe it works fine, so i added a setTimeout for postMessage to 1000ms but it doesn't work. Not sure why adding a debugger in the child JS file is working fine. Did any one here went through this issue or any knowledge on why adding a debugger is working.
Appreciate any of your expertise here.
Thankyou