| OLD | NEW |
| (Empty) |
| 1 <html> | |
| 2 <head> | |
| 3 <script src="../http/tests/inspector/inspector-test.js"></script> | |
| 4 <script> | |
| 5 | |
| 6 function test() | |
| 7 { | |
| 8 function callback(error, result) | |
| 9 { | |
| 10 for (var i = 0; i < result.length; i++) { | |
| 11 var url = result[i].documentURI; | |
| 12 if (!url) | |
| 13 continue; | |
| 14 var index = url.lastIndexOf("/"); | |
| 15 if (index != -1) | |
| 16 url = url.substring(index + 1); | |
| 17 result[i].documentURI = "..." + url; | |
| 18 | |
| 19 result[i].nodeCount.sort(function(a, b) { | |
| 20 return a.nodeName.localeCompare(b.nodeName); | |
| 21 }); | |
| 22 result[i].listenerCount.sort(function(a, b) { | |
| 23 return a.type.localeCompare(b.type); | |
| 24 }); | |
| 25 } | |
| 26 | |
| 27 function stringCompare(a, b) | |
| 28 { | |
| 29 if (a && b) | |
| 30 return a.localeCompare(b); | |
| 31 if (!a && !b) | |
| 32 return 0; | |
| 33 if (a) | |
| 34 return 1; | |
| 35 return -1; | |
| 36 } | |
| 37 | |
| 38 result.sort(function(a, b) { | |
| 39 var r = stringCompare(a.documentURI, b.documentURI); | |
| 40 if (r) | |
| 41 return r; | |
| 42 return stringCompare(a.title, b.title); | |
| 43 }); | |
| 44 | |
| 45 InspectorTest.addResult("result = " + JSON.stringify(result, null, 4)); | |
| 46 InspectorTest.completeTest(); | |
| 47 } | |
| 48 MemoryAgent.getDOMNodeCount(callback); | |
| 49 } | |
| 50 | |
| 51 var detachedDivs = []; | |
| 52 function createDetachedNode() | |
| 53 { | |
| 54 var detachedDiv = document.createElement("div"); | |
| 55 detachedDiv.addEventListener("click", function(e) {}); | |
| 56 detachedDiv.addEventListener("mouseover", function(e) {}); | |
| 57 detachedDiv.appendChild(document.createElement("div")); | |
| 58 return detachedDiv; | |
| 59 } | |
| 60 | |
| 61 function prepareAndRunTest() | |
| 62 { | |
| 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()); | |
| 69 | |
| 70 runTest(); | |
| 71 } | |
| 72 | |
| 73 </script> | |
| 74 </head> | |
| 75 | |
| 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> | |
| 82 </p> | |
| 83 </body> | |
| 84 </html> | |
| OLD | NEW |