blob: 1b6188e5b4d442c8bfeca885ec2b07e82d3f94a2 [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<script src="../resources/js-test-pre.js"></script>
<script src="../resources/gc.js"></script>
</head>
<body>
<script>
description("Tests that using PerformanceObserver does not cause the document to get leaked.");
window.jsTestIsAsync = true;
window.onload = function () {
testDocumentIsNotLeaked(
async function initAndRemove(frameCount)
{
let frames = await new Promise((resolve, reject) => {
let frames = [];
let counter = 0;
function onLoad() {
counter++;
if (counter == frameCount)
resolve(frames);
}
for (let i = 0; i < frameCount; ++i) {
let frame = document.createElement('iframe');
frame.src = "resources/performance-observer-no-document-leak-frame.html";
frame.onload = onLoad;
document.body.appendChild(frame);
frames.push(frame);
}
});
let frameIdentifiers = [];
for (let i = 0; i < frameCount; ++i) {
let frame = frames[i];
frameIdentifiers.push(internals.documentIdentifier(frame.contentDocument));
frame.remove();
}
nukeArray(frames);
frames = null;
return frameIdentifiers;
}
).then(
() => testPassed("Document did not leak"),
(error) => testFailed(error.message)
).finally(finishJSTest);
};
</script>
<script src="../resources/js-test-post.js"></script>
</body>
</html>