sandbox_004.htm (840B)
1 <!DOCTYPE html> 2 <meta charset="utf-8"> 3 <title>Sandbox: Block plugins inside iframe with sandbox attribute</title> 4 <script src="/resources/testharness.js"></script> 5 <script src="/resources/testharnessreport.js"></script> 6 7 <!-- 8 https://github.com/whatwg/html/issues/3958 9 https://github.com/whatwg/html/pull/6946 10 --> 11 12 <iframe sandbox="allow-same-origin" src="support/iframe_sandbox_004.htm" height="400" width ="600"></iframe> 13 14 <script> 15 "use strict"; 16 setup({ explicit_done: true }); 17 18 window.onload = () => { 19 test(() => { 20 const object = document.querySelector("iframe").contentWindow.document.querySelector("object"); 21 const rect = object.getBoundingClientRect(); 22 assert_less_than(rect.width, 300); 23 assert_less_than(rect.height, 300); 24 }, "Fallback content is always displayed for sandboxed PDFs"); 25 done(); 26 }; 27 </script>