1608286.html (1440B)
1 <html class="reftest-wait"> 2 <head> 3 <script> 4 function test() { 5 function checkResolve(value) { 6 // Let the test timeout and fail 7 throw new Error("This promise should not resolve"); 8 } 9 10 function checkReject(reason) { 11 if (reason.message !== "Browsing context is no longer available") { 12 // Let the test timeout and fail 13 throw new Error("Unexpected rejected promise reason"); 14 } 15 // Otherwise, successfully rejected a request not attached to a 16 // window without crashing 17 } 18 19 var i = document.querySelector("iframe"); 20 var nav = i.contentWindow.navigator; 21 i.remove(); 22 23 // First, check with valid args 24 nav.requestMediaKeySystemAccess( 25 "com.widevine.alpha", 26 [{ 27 initDataTypes: ["webm"], 28 videoCapabilities: [{ contentType: 'video/webm; codecs="vp9"' }] 29 }] 30 ).then( 31 checkResolve, 32 (reason) => { 33 checkReject(reason); 34 35 // Then, check with invalid args 36 nav.requestMediaKeySystemAccess("", []).then( 37 checkResolve, 38 (reason) => { 39 checkReject(reason); 40 document.documentElement.removeAttribute("class"); 41 } 42 ); 43 }); 44 } 45 </script> 46 </head> 47 <body onload="test()"> 48 <iframe></iframe> 49 </body> 50 </html>