3 <script src="../http/tests/inspector/inspector-test.js"></script>
8 function callback(error, result)
10 for (var i = 0; i < result.length; i++) {
11 var url = result[i].documentURI;
14 var index = url.lastIndexOf("/");
16 url = url.substring(index + 1);
17 result[i].documentURI = "..." + url;
19 result[i].nodeCount.sort(function(a, b) {
20 return a.nodeName.localeCompare(b.nodeName);
22 result[i].listenerCount.sort(function(a, b) {
23 return a.type.localeCompare(b.type);
27 function stringCompare(a, b)
30 return a.localeCompare(b);
38 result.sort(function(a, b) {
39 var r = stringCompare(a.documentURI, b.documentURI);
42 return stringCompare(a.title, b.title);
45 InspectorTest.addResult("result = " + JSON.stringify(result, null, 4));
46 InspectorTest.completeTest();
48 MemoryAgent.getDOMNodeCount(callback);
51 var detachedDivs = [];
52 function createDetachedNode()
54 var detachedDiv = document.createElement("div");
55 detachedDiv.addEventListener("click", function(e) {});
56 detachedDiv.addEventListener("mouseover", function(e) {});
57 detachedDiv.appendChild(document.createElement("div"));
61 function prepareAndRunTest()
63 var p = document.getElementById("paragraph");
64 p.addEventListener("click", function(e) {});
65 p.addEventListener("mouseover", function(e) {});
66 document.body.appendChild(document.createElement("div"));
67 detachedDivs.push(createDetachedNode());
68 detachedDivs.push(createDetachedNode());
76 <body onload="prepareAndRunTest()">
77 <iframe src="about:blank"></iframe>
78 <p id="paragraph" onclick="alert(1)">
79 Tests that per document Node count is correctly calculated by the Memory agent.
80 <a href="https://bugs.webkit.org/show_bug.cgi?id=74100">Bug 74100.</a>
81 <a href="https://bugs.webkit.org/show_bug.cgi?id=74298">Bug 74298.</a>