blob: 76ef11006cfcc8409ddcbf3a2436d171e7bb8418 [file] [log] [blame]
<html>
<head>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="../../resources/gc.js"></script>
</head>
<body>
<script>
promise_test(async t => {
// In case other tests that leak peerconnections have run before,
// we record the number of peerconnections at start. Promise_test
// is not supposed to execute in parallel with other tests.
const basePeerConnectionCount = internals.peerConnectionCount();
let iframe = document.createElement("iframe");
document.body.appendChild( iframe );
let iframe_pc = new iframe.contentWindow.RTCPeerConnection();
assert_equals(iframe_pc.signalingState, 'stable');
iframe.remove();
assert_equals(iframe_pc.signalingState, 'closed');
assert_equals(internals.peerConnectionCount(), basePeerConnectionCount + 1);
iframe_pc = null;
await asyncGC();
assert_equals(internals.peerConnectionCount(), basePeerConnectionCount);
}, 'PeerConnection in iframe is closed and garbage collected');
</script>
</body>
</html>