Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- This WPT test may be referenced by the following Test IDs:
- /mediacapture-streams/crashtests/enumerateDevices-after-discard-1.https.html - WPT Dashboard Interop Dashboard
<html class="test-wait">
<head>
<title>
Test enumerateDevices() calls either side of browsing context discard
</title>
</head>
<script>
const frame = document.createElement('frame');
document.documentElement.appendChild(frame);
const devices = frame.contentWindow.navigator.mediaDevices;
devices.enumerateDevices();
frame.remove();
devices.enumerateDevices();
// Wait long enough to expect the async enumerateDevices() code to complete.
navigator.mediaDevices.enumerateDevices().then(
() => document.documentElement.removeAttribute("class"));
</script>
</html>