Commit 2082428d authored by ggaren@apple.com's avatar ggaren@apple.com

WebCore:

2009-04-18  Geoffrey Garen  <ggaren@apple.com>

        Reviewed by Cameron Zwarich.

        Fixed <rdar://problem/6797442> | https://bugs.webkit.org/show_bug.cgi?id=25285
        REGRESSION (r42569): Profiles cannot be selected in inspector profiler
        
        EventListeners are shared; RegisteredEventListeners are not. Therefore,
        when a node wrapper needs to invalidate the node's JS event listeners,
        it should invalidate its RegisteredEventListeners, not its EventListeners.
        Otherwise, it might invalidate an EventListener shared by another node.

        * dom/RegisteredEventListener.h:
        (WebCore::invalidateEventListeners): ditto

LayoutTests:

2009-04-18  Geoffrey Garen  <ggaren@apple.com>

        Reviewed by Cameron Zwarich.
        
        Test for <rdar://problem/6797442> | https://bugs.webkit.org/show_bug.cgi?id=25285
        REGRESSION (r42569): Profiles cannot be selected in inspector profiler

        * fast/events/event-listener-sharing-expected.txt: Added.
        * fast/events/event-listener-sharing.html: Added.
        * fast/events/resources/event-listener-sharing.js: Added.
        (gc):
        (clickHandler):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@42645 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent b4d548d9
2009-04-18 Geoffrey Garen <ggaren@apple.com>
Reviewed by Cameron Zwarich.
Test for <rdar://problem/6797442> | https://bugs.webkit.org/show_bug.cgi?id=25285
REGRESSION (r42569): Profiles cannot be selected in inspector profiler
* fast/events/event-listener-sharing-expected.txt: Added.
* fast/events/event-listener-sharing.html: Added.
* fast/events/resources/event-listener-sharing.js: Added.
(gc):
(clickHandler):
2009-04-18 Justin Garcia <justin.garcia@apple.com>
Updated test results for https://bugs.webkit.org/show_bug.cgi?id=25277
......
Tests that an event handler registered on two nodes still fires after one of the nodes has been GC'd.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS clickCount is 100
PASS successfullyParsed is true
TEST COMPLETE
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<link rel="stylesheet" href="../js/resources/js-test-style.css">
<script src="../js/resources/js-test-pre.js"></script>
</head>
<body>
<p id="description"></p>
<div id="console"></div>
<script src="resources/event-listener-sharing.js"></script>
<script src="../js/resources/js-test-post.js"></script>
</body>
</html>
description(
"Tests that an event handler registered on two nodes still fires after one of the nodes has been GC'd."
);
function gc() {
if (window.GCController)
GCController.collect();
else {
for (var i = 0; i < 10000; ++i)
new Object;
}
}
var clickCount = 0;
function clickHandler() {
++clickCount;
};
(function () {
// Register 'clickHandler' on some referenced divs.
var divs = [];
for (var i = 0; i < 100; ++i) {
var div = document.createElement("div");
div.addEventListener("click", clickHandler, false);
divs.push(div);
}
// Register 'clickHandler' on some garbage divs.
for (var i = 0; i < 100; ++i) {
var div = document.createElement("div");
div.addEventListener("click", clickHandler, false);
}
// GC the garbage divs.
gc();
for (var i = 0; i < 100; ++i) {
var clickEvent = document.createEvent("MouseEvents");
clickEvent.initMouseEvent("click", true, true, null, 1, 1, 1, 1, 1, false, false, false, false, 0, document);
divs[i].dispatchEvent(clickEvent);
}
shouldBe("clickCount", "100");
})();
var successfullyParsed = true;
2009-04-18 Geoffrey Garen <ggaren@apple.com>
Reviewed by Cameron Zwarich.
Fixed <rdar://problem/6797442> | https://bugs.webkit.org/show_bug.cgi?id=25285
REGRESSION (r42569): Profiles cannot be selected in inspector profiler
EventListeners are shared; RegisteredEventListeners are not. Therefore,
when a node wrapper needs to invalidate the node's JS event listeners,
it should invalidate its RegisteredEventListeners, not its EventListeners.
Otherwise, it might invalidate an EventListener shared by another node.
* dom/RegisteredEventListener.h:
(WebCore::invalidateEventListeners): ditto
2009-04-18 Pierre d'Herbemont <pdherbemont@apple.com>
Reviewed by Mark Rowe.
......@@ -63,8 +63,11 @@ namespace WebCore {
inline void invalidateEventListeners(const RegisteredEventListenerVector& listeners)
{
// For efficiency's sake, we just set the "removed" bit, instead of
// actually removing the event listener. The node that owns these
// listeners is about to be deleted, anyway.
for (size_t i = 0; i < listeners.size(); ++i)
listeners[i]->listener()->clearJSFunction();
listeners[i]->setRemoved(true);
}
#endif
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment