blob: 7f0f7324ec5bd9968deabcc155a288301e5e9701 [file] [log] [blame]
<!DOCTYPE html>
<html>
<body>
<script src="../../resources/js-test.js"></script>
<script>
description("Tests that lazy image loading doesn't cause Document leaks.");
jsTestIsAsync = true;
frameDocumentID = 0;
checkCount = 0;
popup = null;
function runTest()
{
popup.close();
popup = null;
handle = setInterval(() => {
gc();
if (!internals.isDocumentAlive(frameDocumentID)) {
clearInterval(handle);
testPassed("The popup document didn't leak.");
finishJSTest();
}
checkCount++;
if (checkCount > 500) {
clearInterval(handle);
testFailed("The popup document leaked.");
finishJSTest();
}
}, 10);
}
onload = () => {
popup = window.open("resources/lazy-image-loading-document-leak-popup.html");
popup.onload = () => {
popup.onload = null;
frameDocumentID = internals.documentIdentifier(popup.document);
shouldBeTrue("internals.isDocumentAlive(frameDocumentID)");
setTimeout(runTest, 0);
}
};
</script>
</body>
</html>