blob: 9f406d42942a6e96a7e5b94e4ddbcf1c3cd42f53 [file] [log] [blame]
<!DOCTYPE html>
<html>
<body>
<script src="../../resources/js-test.js"></script>
<script>
description("Tests that IntersectionObserver doesn't cause Document leaks.");
jsTestIsAsync = true;
frameDocumentID = 0;
checkCount = 0;
onload = () => {
window.open("resources/intersection-observer-document-leak-popup.html");
};
function popupDocumentWasCreated(frameDocument)
{
if (!window.internals)
return;
frameDocumentID = internals.documentIdentifier(frameDocument);
shouldBeTrue("internals.isDocumentAlive(frameDocumentID)");
handle = setInterval(() => {
gc();
if (!internals.isDocumentAlive(frameDocumentID)) {
clearInterval(handle);
testPassed("The iframe document didn't leak.");
finishJSTest();
}
checkCount++;
if (checkCount > 500) {
clearInterval(handle);
testFailed("The iframe document leaked.");
finishJSTest();
}
}, 10);
}
</script>
</body>
</html>