[webkit-reviews] review requested: [Bug 12850] Leaks >10k objects : [Attachment 13311] fix RemoveEventListener

bugzilla-request-daemon at macosforge.org bugzilla-request-daemon at macosforge.org
Thu Feb 22 00:32:48 PST 2007

Ian Eng <ian.eng.webkit at gmail.com> has asked  for review:
Bug 12850: Leaks >10k objects

Attachment 13311: fix RemoveEventListener

------- Additional Comments from Ian Eng <ian.eng.webkit at gmail.com>
I think the problem is in kjs_window.cpp, Window::getJSEventListener, which
creates a JSEventListener object if it does not exist. The constructor of
JSEventListener makes JSValue GC-protected.

In Window::RemoveEventListener and DOMEventTargetNode::RemoveEventListener,
both calls getJSEventListener to check if a listener exists. This leaks both
JSEventListener and the JavaScript event listener object.

I added a new function Window::hasJSEventListener for checking if a
JSEventListener exists for a JS event listener object without creating a new

Before the change, run-safari and visit Gmail, then exist. Safari reports:
LEAK: 2102 Node
LEAK: 158688 KJS::Node

After applying the patch, no message reported.

More information about the webkit-reviews mailing list