blob: f33c4e135a3ccad391125978e50940db50fe7f06 [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;
}, "Ensure that the frame's document get collected after being stopped while using MediaDevices");
</script>
<iframe src="resources/mymediadevicesframe.htm" id="iframe"></iframe>