non-fully-active.https.html (1158B)
1 <!DOCTYPE html> 2 <title>Badging: attempting to badge non-fully active document</title> 3 <script src="/resources/testharness.js"></script> 4 <script src="/resources/testharnessreport.js"></script> 5 <body></body> 6 <script> 7 promise_test(async (t) => { 8 const iframe = document.createElement("iframe"); 9 document.body.appendChild(iframe); 10 await new Promise((resolve) => { 11 iframe.onload = resolve; 12 iframe.src = "about:blank"; 13 }); 14 const exceptionCtor = iframe.contentWindow.DOMException; 15 const { navigator: nav } = iframe.contentWindow; 16 iframe.remove(); 17 18 await promise_rejects_dom( 19 t, 20 "InvalidStateError", 21 exceptionCtor, 22 nav.setAppBadge() 23 ); 24 25 await promise_rejects_dom( 26 t, 27 "InvalidStateError", 28 exceptionCtor, 29 nav.setAppBadge(1) 30 ); 31 32 await promise_rejects_dom( 33 t, 34 "InvalidStateError", 35 exceptionCtor, 36 nav.setAppBadge(0) 37 ); 38 39 await promise_rejects_dom( 40 t, 41 "InvalidStateError", 42 exceptionCtor, 43 nav.clearAppBadge() 44 ); 45 }, "badging a non-fully active document should reject with InvalidStateError"); 46 </script>