Automattic/engine.io-client — pull request #349 by aaronk6 (2014-09-30 10:45:50+00:00)
Title: Fixed "jsonp polling iframe removal error" on connection close

When using the polling transport with JSONP and the server closes the connection, the client will be stuck in an endless `jsonp polling iframe removal error` loop until the stack is full.

![screen shot 2014-09-30 at 12 35 48](https://cloud.githubusercontent.com/assets/446063/4456788/98fba02c-488e-11e4-9ed5-b390e0ca560f.png)

**Reason:**

In the `JSONPPolling.prototype.doClose` method, the form that contains the hidden iframe is removed from the DOM. Next time the `initIframe` method is entered (in `JSONPPolling.prototype.doWrite`), it will try to remove the `iframe` which is stored in `self.iframe` but isn't attached to the DOM anymore since the parent `form` has already been destroyed. This leads to the exception.

**Fix:**

I fixed this by clearing the reference to the `iframe` in `JSONPPolling.prototype.doClose` after the `form` was removed.

This bug is most likely related and fixed by this pull request: https://github.com/Automattic/socket.io/issues/1738