diff options
Diffstat (limited to 'LayoutTests/fast/leaks')
-rw-r--r-- | LayoutTests/fast/leaks/001-expected.txt | 4 | ||||
-rw-r--r-- | LayoutTests/fast/leaks/001.html | 22 | ||||
-rw-r--r-- | LayoutTests/fast/leaks/002-expected.txt | 4 | ||||
-rw-r--r-- | LayoutTests/fast/leaks/002.html | 20 | ||||
-rw-r--r-- | LayoutTests/fast/leaks/003-expected.txt | 4 | ||||
-rw-r--r-- | LayoutTests/fast/leaks/003.html-disabled | 61 |
6 files changed, 115 insertions, 0 deletions
diff --git a/LayoutTests/fast/leaks/001-expected.txt b/LayoutTests/fast/leaks/001-expected.txt new file mode 100644 index 0000000..4659dec --- /dev/null +++ b/LayoutTests/fast/leaks/001-expected.txt @@ -0,0 +1,4 @@ +This test exercises RenderBlock::bidiReorderCharacters in a specific way to test for BidiRun leaks as reported in rdar://problem/4987649. Its layout has no particular meaning. + +Test: + diff --git a/LayoutTests/fast/leaks/001.html b/LayoutTests/fast/leaks/001.html new file mode 100644 index 0000000..d3c728a --- /dev/null +++ b/LayoutTests/fast/leaks/001.html @@ -0,0 +1,22 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN"> +<html> + <head> + <title>BidiRun leak test</title> + <style type="text/css"> + .compact { display: compact; } + .block { display: block; color: red; background: lime; line-height: 0; margin-left: 10em; } + span { color: black; } + </style> + <script> + if (window.layoutTestController) + layoutTestController.dumpAsText(); + </script> + </head> + <body> + <p>This test exercises RenderBlock::bidiReorderCharacters in a specific way to + test for BidiRun leaks as reported in rdar://problem/4987649. Its layout has no + particular meaning.</p> + <div class="compact"> Test: </div> + <div class="block"></div> + </body> +</html> diff --git a/LayoutTests/fast/leaks/002-expected.txt b/LayoutTests/fast/leaks/002-expected.txt new file mode 100644 index 0000000..586c81e --- /dev/null +++ b/LayoutTests/fast/leaks/002-expected.txt @@ -0,0 +1,4 @@ +This test exercises RenderBlock::bidiReorderCharacters in a specific way to test for BidiRun leaks as reported in rdar://problem/4987649. Its layout has no particular meaning. + + + diff --git a/LayoutTests/fast/leaks/002.html b/LayoutTests/fast/leaks/002.html new file mode 100644 index 0000000..0b0ecd2 --- /dev/null +++ b/LayoutTests/fast/leaks/002.html @@ -0,0 +1,20 @@ +<p>This test exercises RenderBlock::bidiReorderCharacters in a specific way to +test for BidiRun leaks as reported in rdar://problem/4987649. Its layout has no +particular meaning. +</p> +<div><input type='file' id='input'></input></div> +<iframe id='iframe' src="data:text/html,<input type='file' id='input'></input>"></iframe> + +<script> +window.onload = function main() +{ + if (window.layoutTestController) + layoutTestController.dumpAsText(); + + // Repeat, to generate lots of leaks. + for (var i = 0; i < 20; i++) { //> + document.getElementById('input').focus(); + document.getElementById('iframe').contentDocument.getElementById('input').focus(); + } +} +</script> diff --git a/LayoutTests/fast/leaks/003-expected.txt b/LayoutTests/fast/leaks/003-expected.txt new file mode 100644 index 0000000..98a622b --- /dev/null +++ b/LayoutTests/fast/leaks/003-expected.txt @@ -0,0 +1,4 @@ +This test verifies that garbage collection successfully cleans up after the destruction of a frame containing a JavaScript interpreter. If the test passes, you'll see a PASS message below. + +PASS: 20 garbage JS objects or fewer left uncollected after destroying a frame. + diff --git a/LayoutTests/fast/leaks/003.html-disabled b/LayoutTests/fast/leaks/003.html-disabled new file mode 100644 index 0000000..dc7b0ba --- /dev/null +++ b/LayoutTests/fast/leaks/003.html-disabled @@ -0,0 +1,61 @@ +<p>This test verifies that garbage collection successfully cleans up after the destruction +of a frame containing a JavaScript interpreter. If the test passes, you'll see a PASS message below.</p> +<hr> +<pre id="log"></pre> + +<!-- The test: --> +<iframe id="iframe" src="data:text/html,<script>;</script>" style="display:none"></iframe> +<script> +function log(s) +{ + document.getElementById("log").appendChild(document.createTextNode(s)); +} + +var wiggleRoom = 20; + +window.onload = function main() +{ + if (!window.layoutTestController || !window.GCController) { + log("FAIL: This test uses the layoutTestController and the GCController, so it can only run in DumpRenderTree.\n"); + return; + } + + layoutTestController.dumpAsText(); + layoutTestController.waitUntilDone(); + + // Start with no garbage, so GC doesn't run automatically during the test. + GCController.collect(); + + // Create a little garbage, so we can detect failure in the case where the + // test doesn't produce any garbage because it fails to destroy the frame. + var garbage = [ { }, { }, { }, { }, { }, { }, { }, { }, { }, { } ]; + garbage = null; + + // Destroy a frame that has a JavaScript interpreter. + var iframe = document.getElementById("iframe"); + iframe.parentNode.removeChild(iframe); + + // Finish the test on a time-out, to allow the Frame keepAlive timer to fire + // and release the frame before we generate results. + var continueTest = function continueTest() + { + // Measure how many garbage JS objects are still around. + var jsObjectCountStart = GCController.getJSObjectCount(); + GCController.collect(); + var jsObjectCountDelta = jsObjectCountStart - GCController.getJSObjectCount(); + var garbageCount = jsObjectCountDelta > 0 ? jsObjectCountDelta : 0; + + // Fail if a lot of garbage was left behind. This can mean one of many things: + // the frame was not destroyed; the frame destruction did not trigger GC; or + // GC was not effective. + if (garbageCount > wiggleRoom) { + log("FAIL: " + garbageCount + " garbage JS objects left uncollected.\n"); + } else { + log("PASS: " + wiggleRoom + " garbage JS objects or fewer left uncollected after destroying a frame.\n"); + } + + layoutTestController.notifyDone(); + } + setTimeout(continueTest, 10); +} +</script> |