blob: 84ca196d2c480af662ade079b7edcba0002a8be7 [file] [log] [blame]
<!DOCTYPE html>
<meta charset="utf-8">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
function waitFor(duration)
{
return new Promise((resolve) => setTimeout(resolve, duration));
}
var resolveCallback, rejectCallback;
var promise = new Promise((resolve, reject) => {
resolveCallback = resolve;
rejectCallback = reject;
});
async function done()
{
try {
const frameIdentifier = internals.documentIdentifier(iframe.contentDocument);
iframe.src = "non-existent-frame";
let counter = 0;
while (++counter < 50) {
if (!internals.isDocumentAlive(frameIdentifier)) {
resolveCallback();
return;
}
if (window.GCController)
GCController.collect();
await waitFor(50);
}
rejectCallback("Test failed");
} catch (e) {
rejectCallback("Test failed: exception " + e);
}
}
window.addEventListener("message", done);
promise_test((test) => {
if (!window.internals)
rejectCallback("Test require internals API");
return promise;
}, "Ensuring frame document gets collected after being stopped in the middle of IDB operations");
</script>
<iframe src="resources/myidbframe.htm" id="iframe"></iframe>