non-fully-active.html (1973B)
1 <!DOCTYPE html> 2 <meta charset="utf-8" /> 3 <meta viewport="width=device-width, initial-scale=1" /> 4 <script src="/resources/testharness.js"></script> 5 <script src="/resources/testharnessreport.js"></script> 6 <script src="/resources/testdriver.js"></script> 7 <script src="/resources/testdriver-vendor.js"></script> 8 <body> 9 <script type="module"> 10 import { attachIframe, getOppositeOrientation } from "./resources/orientation-utils.js"; 11 12 promise_test(async (t) => { 13 const iframe = await attachIframe(); 14 const { orientation } = iframe.contentWindow.screen; 15 16 const frameDOMException = iframe.contentWindow.DOMException; 17 iframe.remove(); 18 19 await promise_rejects_dom( 20 t, 21 "InvalidStateError", 22 frameDOMException, 23 orientation.lock(getOppositeOrientation()) 24 ); 25 }, "Attempting to lock non-fully active documents results in a InvalidStateError"); 26 27 promise_test(async (t) => { 28 const iframe = await attachIframe(); 29 const { orientation } = iframe.contentWindow.screen; 30 31 const frameDOMException = iframe.contentWindow.DOMException; 32 iframe.remove(); 33 34 assert_throws_dom("InvalidStateError", frameDOMException, () => { orientation.unlock() }); 35 }, "Attempting to unlock non-fully active documents results in a InvalidStateError"); 36 37 promise_test(async (t) => { 38 const iframe = await attachIframe(); 39 const { orientation } = iframe.contentWindow.screen; 40 41 await test_driver.bless("request full screen", null, iframe.contentWindow); 42 await iframe.contentDocument.documentElement.requestFullscreen(); 43 44 const p = orientation.lock(getOppositeOrientation()); 45 46 const frameDOMException = iframe.contentWindow.DOMException; 47 iframe.remove(); 48 49 await promise_rejects_dom(t, "AbortError", frameDOMException, p); 50 assert_throws_dom("InvalidStateError", frameDOMException, () => { orientation.unlock() }); 51 }, "Making a document non-fully active while locking results in an AbortError"); 52 </script> 53 </body>