<svg xmlns="http://www.w3.org/2000/svg" onload="load()">
This test passes if it doesn't crash when run under gmalloc.
<rect x="10" y="10" width="100" height="100" fill="green"/>
<text x="50" y="50" id="log"/>
<script>
<![CDATA[
function log(message) {
    var logDiv = document.getElementById('log');
    logDiv.appendChild(document.createTextNode(message));
}

function load() {
    if (window.testRunner && window.GCController && window.internals)
        testRunner.dumpAsText();
    else {
        log("This test only works when run with the testRunner, GCController, and internals available.");
        return;
    }

    var rect = document.getElementsByTagName("rect")[0];
    var baseValReference = rect.x.baseVal;
    
    // Collect garbage before recording starting live node count, in case there are live elements from previous tests.
    GCController.collect();
    // FIXME(crbug.com/307614): one call to GCController.collect() should be enough.
    GCController.collect();
    var originalLiveElements = window.internals.numberOfLiveNodes();

    rect.parentNode.removeChild(rect);
    rect = 0;
    
    GCController.collect();
    
    // The rest of this test should FAIL without requiring gmalloc if this test has regressed.
    var liveDelta = window.internals.numberOfLiveNodes() - originalLiveElements;
    
    // Make sure that the <rect> is still alive; if it's not, liveDelta will be -1.
    if (liveDelta == 0)
        log(" PASS");
    else
        log(" FAIL: " + liveDelta + " extra live node(s)");
        
    // This line will crash with gmalloc if this test has regressed.
    log(" x = " + baseValReference.value);
}
]]>
</script>
</svg>

Remove introspection on GC behavior from SVG tearoff regression test
Remove introspection on GC behavior from SVG tearoff regression test

This test is really just a "test passes if it does not crash" test showing
that tearoffs can still be accessed after their elements are dead. There's
no need to use internals.numberOfLiveNodes (which is flaky due to the fact
that we run multiple tests in the same renderer) in this test.

R=pdr@chromium.org

Review URL: https://codereview.chromium.org/27741003

git-svn-id: bf5cd6ccde378db821296732a091cfbcf5285fbd@159905 bbb929c8-8fbe-4397-9dbb-9b2b20218538
