Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(308)

Unified Diff: webkit/data/listener/listener_leak1.html

Issue 164318: Added regression test for event listeners memory leak. (Closed)
Patch Set: Removed some unused includes. Created 11 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | webkit/data/listener/listener_leak2.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/data/listener/listener_leak1.html
diff --git a/webkit/data/listener/listener_leak1.html b/webkit/data/listener/listener_leak1.html
new file mode 100644
index 0000000000000000000000000000000000000000..ba2c93255e43ce583ea07b7561aec90084026489
--- /dev/null
+++ b/webkit/data/listener/listener_leak1.html
@@ -0,0 +1,37 @@
+<html>
+<head><title>Event Listener Leak Test 1</title></head>
+<body onload="leak()">
+<script>
+if (typeof(gc) == "undefined") gc = function() {};
+
+function EventListenerLeakTestObject1() {}
+
+function createListener(node) {
+ var foo = new EventListenerLeakTestObject1();
+ return function(evt) {
+ // This closure references |node| and an instance of leak object.
+ node.foo = foo;
+ };
+}
+
+function doLeak() {
+ for (var i = 0; i < 10000; i++) {
+ var node = document.createElement('span');
+ node.onclick = createListener(node);
+ }
+}
+
+function leak() {
+ doLeak();
+ gc();
+ gc();
+}
+</script>
+
+<p>This page leaks memory.</p>
+
+<!-- Allow leaking manually. -->
+<input type="button" value="Leak More" onclick="leak()">
+
+</body>
+</html>
« no previous file with comments | « no previous file | webkit/data/listener/listener_leak2.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698