Html程序  |  19行  |  368 B

<!DOCTYPE html>

<p>
    Tests that reference cycles between the observer and the callback do not
    create leaks.
</p>

<script>
    if (window.testRunner)
        testRunner.dumpAsText();

    function leak() {
        var observer = new WebKitMutationObserver(function() { observer.disconnect(); });
    }

    for (i=0; i < 1000; i++) leak();
    gc();
</script>