Html程序  |  31行  |  859 B

<!DOCTYPE html>

<p>Test that using mutation observers from the non-main world doesn't leak the document.</p>
<p>Expected output of this test is LEAK: 28 WebCoreNode</p>

<iframe></iframe>

<script>
testRunner.dumpAsText();
testRunner.waitUntilDone();

var iframe = document.querySelector('iframe');
var count = 0;
var totalRuns = 5;

iframe.onload = function() {
    if (count++ < totalRuns) {
        testRunner.evaluateScriptInIsolatedWorld(1, 'new MutationObserver(function(){}).observe(document, {childList: true, subtree: true});');
        iframe.srcdoc = "<body><input autofocus></body>";
        GCController.collect();
    } else {
        GCController.collect();
        testRunner.notifyDone();
    }
};

// Need autofocus since evaluateScriptInIsolatedWorld runs in the focused frame.
iframe.srcdoc = "<body><input autofocus></body>";
</script>