tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

window-frames.html (1523B)


      1 <!DOCTYPE html>
      2 <html>
      3 <head>
      4 <meta name='author' title='Google' href='http://www.google.com'>
      5 <meta name='assert' content='Shadow DOM should not leak via window.frames.'>
      6 <link rel='help' href='https://w3c.github.io/webcomponents/spec/shadow/'>
      7 <script src='/resources/testharness.js'></script>
      8 <script src='/resources/testharnessreport.js'></script>
      9 </head>
     10 <body>
     11 <div id='log'></div>
     12 <iframe src='about:blank' name='mainFrame1'></iframe>
     13 <div id='host-open'></div>
     14 <div id='host-closed'></div>
     15 </body>
     16 <script>
     17 'use strict';
     18 
     19 var host_open = document.getElementById('host-open');
     20 var root_open = host_open.attachShadow({mode: 'open'});
     21 root_open.innerHTML = '<iframe src="about:blank" name="shadowFrame1"></iframe>';
     22 
     23 var host_closed = document.getElementById('host-closed');
     24 var root_closed = host_closed.attachShadow({mode: 'closed'});
     25 root_closed.innerHTML = '<iframe src="about:blank" name="shadowFrame2"></iframe>';
     26 
     27 test(() => {
     28  assert_equals(window.frames.length, 1, 'window.frames should return only frames in document.');
     29  assert_equals(window.frames[0].name, 'mainFrame1', 'window.frames[0] should be mainFrame1.');
     30  assert_equals(window.frames['mainFrame1'], window.frames[0], 'window.frames[\'mainFrame1\'] should be equal to mainFrame1.');
     31  assert_equals(window.frames['shadowFrame1'], undefined, 'shadowFrame1 should not leak.');
     32  assert_equals(window.frames['shadowFrame2'], undefined, 'shadowFrame2 should not leak.');
     33 
     34 }, 'window.frames should not leak frames in Shadow DOM.');
     35 </script>
     36 </html>