oyvindkinsey / easyXDM

A javascript library providing cross-browser, cross-site messaging/method invocation.
http://easyxdm.net
MIT License
2.37k stars 265 forks source link

Resolve 'frame is null' errors #269

Closed kennethkufluk closed 8 years ago

kennethkufluk commented 8 years ago

As shown in pull request #120 and currently shown on twitter.com home timeline when scrolling rapidly, the waitForReady function can complain that the frame is null. The probable cause is that the waitForReady method isn't torn down in the destroy method. So if an iframe is destroyed before it initialises, it can throw this kind of error.

twitter.com: Uncaught TypeError: Cannot read property 'contentWindow' of null

I've pulled out the function and added an unbind. I think this makes sense. (Edited through github editor - needs verification/testing)