test_bug1451199-2.html (1256B)
1 <!DOCTYPE HTML> 2 <html> 3 <!-- 4 https://bugzilla.mozilla.org/show_bug.cgi?id=1451199 5 --> 6 <head> 7 <meta charset="utf-8"> 8 <title>Test for Bug 1451199</title> 9 <script src="/tests/SimpleTest/SimpleTest.js"></script> 10 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> 11 <script type="application/javascript"> 12 13 /** Test for Bug 1451199 */ 14 SimpleTest.waitForExplicitFinish(); 15 16 addLoadEvent(async function() { 17 // We have to be careful to not check l.matches until the very end 18 // of the test. 19 const l = frames[0].matchMedia("(orientation: portrait)"); 20 const iframe = document.querySelector("iframe"); 21 iframe.width = "50"; 22 23 await new Promise(r => requestAnimationFrame(() => requestAnimationFrame(r))); 24 25 l.addEventListener("change", function() { 26 is(l.matches, false, 27 "Should not match portrait by the time we get notified"); 28 SimpleTest.finish(); 29 }, { once: true }); 30 iframe.width = "200"; 31 }); 32 </script> 33 </head> 34 <body> 35 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1451199">Mozilla Bug 1451199</a> 36 <p id="display"><iframe height="100" width="200"></iframe></p> 37 <div id="content" style="display: none"> 38 39 </div> 40 <pre id="test"> 41 </pre> 42 </body> 43 </html>