screen-detached-frame.html (1615B)
1 <!doctype html> 2 <meta charset="utf-8"> 3 <link rel="help" href="https://drafts.csswg.org/cssom-view/#dom-window-screen"> 4 <link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1858977"> 5 <link rel="author" href="mailto:emilio@crisal.io" title="Emilio Cobos Álvarez"> 6 <link rel="author" href="https://mozilla.org" title="Mozilla"> 7 <script src="/resources/testharness.js"></script> 8 <script src="/resources/testharnessreport.js"></script> 9 <iframe></iframe> 10 <script> 11 onload = function() { 12 test(() => { 13 let frame = document.querySelector("iframe"); 14 let win = frame.contentWindow; 15 frame.remove(); 16 assert_true(!!win.screen, "Window.screen should be available"); 17 for (let prop of ["top", "left", "width", "height"]) { 18 let availProp = "avail" + prop[0].toUpperCase() + prop.substr(1); 19 if (prop == "width" || prop == "height") { 20 assert_true(prop in win.screen, prop + "must be implemented per spec") 21 assert_true(availProp in win.screen, availProp + "must be implemented per spec") 22 } 23 if (prop in win.screen) { 24 assert_equals(win.screen[prop], 0, prop); 25 } 26 if (availProp in win.screen) { 27 assert_equals(win.screen[availProp], 0, availProp); 28 } 29 } 30 31 // https://drafts.csswg.org/cssom-view/#dom-screen-colordepth 32 // If the user agent does not know the color depth or does not want to 33 // return it for privacy considerations, it should return 24. 34 for (let prop of ["colorDepth", "pixelDepth"]) { 35 assert_equals(win.screen[prop], 24, prop); 36 } 37 }, "Window.screen on detached frame"); 38 }; 39 </script>