Title: [141396] trunk/LayoutTests
Revision
141396
Author
yu...@chromium.org
Date
2013-01-31 03:25:30 -0800 (Thu, 31 Jan 2013)

Log Message

Web Inspector: test that references from DOM nodes to event listeners are presented in heap snapshots
https://bugs.webkit.org/show_bug.cgi?id=108322

Reviewed by Vsevolod Vlasov.

Test that links from DOM node wrappers to event listener functions are presented
in heap snapshots.

* inspector-protocol/heap-profiler/heap-snapshot-with-event-listener-expected.txt: Added.
* inspector-protocol/heap-profiler/heap-snapshot-with-event-listener.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (141395 => 141396)


--- trunk/LayoutTests/ChangeLog	2013-01-31 11:17:40 UTC (rev 141395)
+++ trunk/LayoutTests/ChangeLog	2013-01-31 11:25:30 UTC (rev 141396)
@@ -1,3 +1,16 @@
+2013-01-30  Yury Semikhatsky  <yu...@chromium.org>
+
+        Web Inspector: test that references from DOM nodes to event listeners are presented in heap snapshots
+        https://bugs.webkit.org/show_bug.cgi?id=108322
+
+        Reviewed by Vsevolod Vlasov.
+
+        Test that links from DOM node wrappers to event listener functions are presented
+        in heap snapshots.
+
+        * inspector-protocol/heap-profiler/heap-snapshot-with-event-listener-expected.txt: Added.
+        * inspector-protocol/heap-profiler/heap-snapshot-with-event-listener.html: Added.
+
 2013-01-31  Kent Tamura  <tk...@chromium.org>
 
         Click on a label element won't select input[type=date]

Added: trunk/LayoutTests/inspector-protocol/heap-profiler/heap-snapshot-with-event-listener-expected.txt (0 => 141396)


--- trunk/LayoutTests/inspector-protocol/heap-profiler/heap-snapshot-with-event-listener-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/inspector-protocol/heap-profiler/heap-snapshot-with-event-listener-expected.txt	2013-01-31 11:25:30 UTC (rev 141396)
@@ -0,0 +1,6 @@
+Test that all nodes from the detached DOM tree will get into one group in the heap snapshot. Bug 107819.
+
+ SUCCESS: found myEventListener
+SUCCESS: found link from HTMLBodyElement to HTMLBodyElement
+SUCCESS: didGetHeapSnapshot
+
Property changes on: trunk/LayoutTests/inspector-protocol/heap-profiler/heap-snapshot-with-event-listener-expected.txt
___________________________________________________________________

Added: svn:eol-style

Added: trunk/LayoutTests/inspector-protocol/heap-profiler/heap-snapshot-with-event-listener.html (0 => 141396)


--- trunk/LayoutTests/inspector-protocol/heap-profiler/heap-snapshot-with-event-listener.html	                        (rev 0)
+++ trunk/LayoutTests/inspector-protocol/heap-profiler/heap-snapshot-with-event-listener.html	2013-01-31 11:25:30 UTC (rev 141396)
@@ -0,0 +1,70 @@
+<html>
+<head>
+<script type="text/_javascript_" src=""
+<script>
+if (window.testRunner) {
+    testRunner.dumpAsText();
+    testRunner.waitUntilDone();
+}
+
+function addEventListenerAndRunTest()
+{
+    function myEventListener(e) {
+        console.log("myEventListener");
+    }
+    document.body.addEventListener("click", myEventListener, true);
+
+    runTest();
+}
+
+function test()
+{
+    InspectorTest.importScript("../../../../inspector-protocol/heap-profiler/resources/heap-snapshot-common.js");
+
+    function checkHeapSnapshot(snapshot)
+    {
+        var node;
+        for (var it = snapshot._allNodes(); it.hasNext(); it.next()) {
+            if (it.node.type() === "closure" && it.node.name() === "myEventListener") {
+                node = it.node;
+                break;
+            }
+        }
+        if (node)
+            InspectorTest.log("SUCCESS: found " + node.name());
+        else
+            return fail("cannot find detached DOM trees root");
+
+        var nativeRetainers = 0;
+        for (var iter = node.retainers(); iter.hasNext(); iter.next()) {
+            var node = iter.retainer.node();
+            var retainingEdge = iter.retainer;
+            if (retainingEdge.isInternal() && retainingEdge.name() === "native") {
+                if (++nativeRetainers === 1) {
+                    var retainerName = retainingEdge.node().name();
+                    if (retainerName === "HTMLBodyElement")
+                        InspectorTest.log("SUCCESS: found link from HTMLBodyElement to " + node.name());
+                    else
+                        return fail("unexpected retainer of " + node.name() + ": " + retainerName);
+                } else
+                    return fail("too many retainers of " + node.name());
+            } else if (!retainingEdge.isWeak())
+                return fail("unexpected retaining edge of " + node.name() + " type: " + retainingEdge.type() + ", name: " + retainingEdge.name());
+        }
+        if (!nativeRetainers)
+            return fail("cannot find HTMLBodyElement among retainers of " + node.name());
+    }
+
+    function fail(message) {
+        InspectorTest.log("FAIL: " + message);
+        InspectorTest.completeTest();
+    }
+
+    InspectorTest.takeHeapSnapshot(checkHeapSnapshot);
+}
+</script>
+</head>
+<body _onload_="addEventListenerAndRunTest()">
+<p>Test that all nodes from the detached DOM tree will get into one group in the heap snapshot. <a href="" 107819.</p>
+</body>
+</html>
Property changes on: trunk/LayoutTests/inspector-protocol/heap-profiler/heap-snapshot-with-event-listener.html
___________________________________________________________________

Added: svn:eol-style

_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to