blob: a73ddd0a2e5f90646bb911341d14cb2309800eb1 [file] [log] [blame]
<!DOCTYPE html>
<meta charset="utf-8">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/gc.js"></script>
<script>
var promise = new Promise((resolve, reject) => {
if (!window.internals) {
reject("Test require internals API");
return;
}
window.onload = function () {
let promise = testDocumentIsNotLeaked(
async function initAndRemove(frameCount)
{
let frames = await new Promise((resolve, reject) => {
let frames = [];
let counter = 0;
function onMessage() {
counter++;
if (counter == frameCount)
resolve(frames);
}
window.addEventListener("message", onMessage);
for (let i = 0; i < frameCount; ++i) {
let frame = document.createElement('iframe');
frame.src = "resources/myidbframe.htm";
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.src = "non-existent-frame";
}
nukeArray(frames);
frames = null;
return frameIdentifiers;
}
);
resolve(promise);
};
});
promise_test((test) => {
return promise;
}, "Ensuring frame document gets collected after being stopped in the middle of IDB operations");
</script>