| <html> |
| <head> |
| <script src="../http/tests/inspector/inspector-test.js"></script> |
| <script> |
| |
| function test() |
| { |
| function callback(error, result) |
| { |
| for (var i = 0; i < result.length; i++) { |
| var url = result[i].documentURI; |
| if (!url) |
| continue; |
| var index = url.lastIndexOf("/"); |
| if (index != -1) |
| url = url.substring(index + 1); |
| result[i].documentURI = "..." + url; |
| |
| result[i].nodeCount.sort(function(a, b) { |
| return a.nodeName.localeCompare(b.nodeName); |
| }); |
| result[i].listenerCount.sort(function(a, b) { |
| return a.type.localeCompare(b.type); |
| }); |
| } |
| |
| function stringCompare(a, b) |
| { |
| if (a && b) |
| return a.localeCompare(b); |
| if (!a && !b) |
| return 0; |
| if (a) |
| return 1; |
| return -1; |
| } |
| |
| result.sort(function(a, b) { |
| var r = stringCompare(a.documentURI, b.documentURI); |
| if (r) |
| return r; |
| return stringCompare(a.title, b.title); |
| }); |
| |
| InspectorTest.addResult("result = " + JSON.stringify(result, null, 4)); |
| InspectorTest.completeTest(); |
| } |
| MemoryAgent.getDOMNodeCount(callback); |
| } |
| |
| var detachedDivs = []; |
| function createDetachedNode() |
| { |
| var detachedDiv = document.createElement("div"); |
| detachedDiv.addEventListener("click", function(e) {}); |
| detachedDiv.addEventListener("mouseover", function(e) {}); |
| detachedDiv.appendChild(document.createElement("div")); |
| return detachedDiv; |
| } |
| |
| function prepareAndRunTest() |
| { |
| var p = document.getElementById("paragraph"); |
| p.addEventListener("click", function(e) {}); |
| p.addEventListener("mouseover", function(e) {}); |
| document.body.appendChild(document.createElement("div")); |
| detachedDivs.push(createDetachedNode()); |
| detachedDivs.push(createDetachedNode()); |
| |
| runTest(); |
| } |
| |
| </script> |
| </head> |
| |
| <body onload="prepareAndRunTest()"> |
| <iframe src="about:blank"></iframe> |
| <p id="paragraph" onclick="alert(1)"> |
| Tests that per document Node count is correctly calculated by the Memory agent. |
| <a href="https://bugs.webkit.org/show_bug.cgi?id=74100">Bug 74100.</a> |
| <a href="https://bugs.webkit.org/show_bug.cgi?id=74298">Bug 74298.</a> |
| </p> |
| </body> |
| </html> |