Reviewed by Darin.
<rdar://problem/
3977973> pages on ebay leak referenced JavaScript objects -- over time browsing becomes super-slow
I fixed this by removing all event listeners for a document, it's
children, and any disconnected nodes that used to be in the
document at document detach time. Mozilla temporarily disables
event listeners on such nodes, but re-enables them if you
re-parant a node into a new document. However, in WebCore, you
can't re-parent a node into another document, so there is no
observable change in behavior.
We have to do this to break the possible reference cycles between
event listeners and the dom nodes they are attached to (e.g. via
scope chain, as in this case).
* khtml/xml/dom_docimpl.cpp:
(DocumentImpl::detach):
(DocumentImpl::removeAllEventListenersFromAllNodesx):
(DocumentImpl::registerDisconnectedNodeWithEventListeners):
(DocumentImpl::unregisterDisconnectedNodeWithEventListeners):
(DocumentImpl::removeAllDisconnectedNodeEventListeners):
* khtml/xml/dom_docimpl.h:
* khtml/xml/dom_nodeimpl.cpp:
(NodeImpl::~NodeImpl):
(NodeImpl::addEventListener):
(NodeImpl::removeEventListener):
(NodeImpl::removeAllEventListeners):
(NodeImpl::removeHTMLEventListener):
(NodeImpl::insertedIntoDocument):
(NodeImpl::removedFromDocument):
* khtml/xml/dom_nodeimpl.h:
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@8557
268f45cc-cd09-0410-ab3c-
d52691b4dbfc