test_getUserMedia_trackCloneCleanup.html (981B)
1 <!DOCTYPE HTML> 2 <html> 3 <head> 4 <script type="application/javascript" src="mediaStreamPlayback.js"></script> 5 </head> 6 <body> 7 <pre id="test"> 8 <script type="application/javascript"> 9 "use strict"; 10 11 createHTML({ 12 title: "Stopping a MediaStreamTrack and its clones should deallocate the device", 13 bug: "1294605" 14 }); 15 16 runTest(async () => { 17 await pushPrefs(["media.navigator.permission.fake", true]); 18 const stream = await getUserMedia({audio: true, video: true, fake: true}); 19 const clone = stream.clone(); 20 stream.getTracks().forEach(t => t.stop()); 21 stream.clone().getTracks().forEach(t => stream.addTrack(t)); 22 is(stream.getTracks().filter(t => t.readyState == "live").length, 0, 23 "Cloning ended tracks should make them ended"); 24 [...stream.getTracks(), ...clone.getTracks()].forEach(t => t.stop()); 25 26 // Bug 1295352: better to be explicit about noGum here wrt future refactoring. 27 return noGum(); 28 }); 29 </script> 30 </pre> 31 </body> 32 </html>