OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <!-- |
| 3 Distributed under both the W3C Test Suite License [1] and the W3C |
| 4 3-clause BSD License [2]. To contribute to a W3C Test Suite, see the |
| 5 policies and contribution forms [3]. |
| 6 |
| 7 [1] http://www.w3.org/Consortium/Legal/2008/04-testsuite-license |
| 8 [2] http://www.w3.org/Consortium/Legal/2008/03-bsd-license |
| 9 [3] http://www.w3.org/2004/10/27-testcases |
| 10 --> |
| 11 <html> |
| 12 <head> |
| 13 <title>Shadow DOM Test: Window object named properties: Frames</title> |
| 14 <link rel="author" title="Aleksei Yu. Semenov" href="mailto:a.semenov@unipro.ru"
> |
| 15 <link rel="author" title="Sergey G. Grekhov" href="mailto:sgrekhov@unipro.ru"> |
| 16 <link rel="author" title="Yuta Kitamura" href="mailto:yutak@google.com"> |
| 17 <link rel="help" href="http://www.w3.org/TR/2013/WD-shadow-dom-20130514/#upper-b
oundary-encapsulation"> |
| 18 <meta name="assert" content="Upper-boundary encapsulation: The nodes and named e
lements are not accessible from Window object named properties."> |
| 19 <script src="../../../../../resources/testharness.js"></script> |
| 20 <script src="../../../../../resources/testharnessreport.js"></script> |
| 21 <script src="../../testcommon.js"></script> |
| 22 <link rel="stylesheet" href="../../../../../resources/testharness.css"> |
| 23 </head> |
| 24 <body> |
| 25 <div id="log"></div> |
| 26 <script> |
| 27 test(function () { |
| 28 var host = document.createElement('div'); |
| 29 try { |
| 30 host.style.display = 'none'; |
| 31 document.body.appendChild(host); |
| 32 var shadowRoot = host.createShadowRoot(); |
| 33 var iframe = document.createElement('iframe'); |
| 34 iframe.style.display = 'none'; |
| 35 iframe.name = 'test-name'; |
| 36 shadowRoot.appendChild(iframe); |
| 37 assert_false('test-name' in window); |
| 38 } finally { |
| 39 if (host.parentNode) |
| 40 host.parentNode.removeChild(host); |
| 41 } |
| 42 }, |
| 43 'An iframe element in a shadow tree should not be accessible from ' + |
| 44 'window\'s named properties with its "name" attribute value.' |
| 45 ); |
| 46 |
| 47 var frameTest = async_test( |
| 48 'A frame element in a shadow tree should not be accessible from ' + |
| 49 'window\'s named properties with its "name" attribute value.'); |
| 50 |
| 51 frameTest.step(function () { |
| 52 // To test a document with frames, an iframe containing frames is created. |
| 53 var srcdoc = [ |
| 54 '<!DOCTYPE html>', |
| 55 '<html>', |
| 56 '<head>', |
| 57 '<title>Frames Test</title>', |
| 58 '<script src="../../testcommon.js"><' + '/script>', |
| 59 '</head>', |
| 60 '<frameset id="host" cols="50%,*">', |
| 61 '<frame src="about:blank" name="host-frame1">', |
| 62 '<frame src="about:blank" name="host-frame2">', |
| 63 '</frameset>', |
| 64 '</html>' |
| 65 ].join('\n'); |
| 66 var iframe = document.createElement('iframe'); |
| 67 iframe.srcdoc = srcdoc; |
| 68 iframe.style.display = 'none'; |
| 69 |
| 70 iframe.addEventListener('load', frameTest.step_func(function (event) { |
| 71 try { |
| 72 var doc = iframe.contentDocument; |
| 73 var win = iframe.contentWindow; |
| 74 var shadowRoot = doc.getElementById('host').createShadowRoot(); |
| 75 shadowRoot.innerHTML = |
| 76 '<frame src="about:blank" name="shadow-frame1">\n' + |
| 77 '<frame src="about:blank" name="shadow-frame2">'; |
| 78 assert_false('shadow-frame1' in win); |
| 79 assert_false('shadow-frame2' in win); |
| 80 frameTest.done(); |
| 81 } finally { |
| 82 if (iframe.parentNode) |
| 83 iframe.parentNode.removeChild(iframe); |
| 84 } |
| 85 })); |
| 86 |
| 87 document.body.appendChild(iframe); |
| 88 }); |
| 89 </script> |
| 90 </body> |
| 91 </html> |
OLD | NEW |