tor-browser

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

test_bug270414.html (3475B)


      1 <!DOCTYPE html>
      2 <html>
      3 <head>
      4    <script src="/tests/SimpleTest/SimpleTest.js"></script>
      5    <script src="/tests/SimpleTest/EventUtils.js"></script>
      6    <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
      7    <script type="text/javascript" src="NavigationUtils.js"></script>
      8    <style type="text/css">
      9      iframe { width: 90%; height: 50px; }
     10    </style>
     11 <script>
     12 /* eslint-disable no-useless-concat */
     13 /* global window0:true, window1:true, window2:true, window3:true */
     14 var headerHTML = "<html><head>" +
     15                 "<script src='/tests/SimpleTest/EventUtils.js'><\/script>" +
     16                 "<script src='NavigationUtils.js'><\/script>" +
     17                 "</head><body>";
     18 var footerHTML = "</body></html>";
     19 
     20 function testChild0() {
     21  if (!window.window0) {
     22    window0 = window.open("", "window0", "width=10,height=10");
     23    window0.document.open();
     24    window0.document.write(headerHTML);
     25    window0.document.write("<script>navigateByLocation(opener.frames[0])<\/script>");
     26    window0.document.write(footerHTML);
     27    window0.document.close();
     28  }
     29 }
     30 
     31 function testChild1() {
     32  if (!window.window1) {
     33    window1 = window.open("", "window1", "width=10,height=10");
     34    window1.document.open();
     35    window1.document.write(headerHTML);
     36    window1.document.write("<script>navigateByOpen('child1');<\/script>");
     37    window1.document.write(footerHTML);
     38    window1.document.close();
     39  }
     40 }
     41 
     42 function testChild2() {
     43  if (!window.window2) {
     44    window2 = window.open("", "window2", "width=10,height=10");
     45    window2.document.open();
     46    window2.document.write(headerHTML);
     47    window2.document.write("<script>navigateByForm('child2');<\/script>");
     48    window2.document.write(footerHTML);
     49    window2.document.close();
     50  }
     51 }
     52 
     53 function testChild3() {
     54  if (!window.window3) {
     55    window3 = window.open("", "window3", "width=10,height=10");
     56    window3.document.open();
     57    window3.document.write(headerHTML);
     58    window3.document.write("<script>navigateByHyperlink('child3');<\/script>");
     59    window3.document.write(footerHTML);
     60    window3.document.close();
     61  }
     62 }
     63 
     64 add_task(async function() {
     65  await waitForFinishedFrames(4);
     66 
     67  await isNavigated(frames[0], "Should be able to navigate on-domain opener's children by setting location.");
     68  await isNavigated(frames[1], "Should be able to navigate on-domain opener's children by calling window.open.");
     69  await isNavigated(frames[2], "Should be able to navigate on-domain opener's children by submitting form.");
     70  await isNavigated(frames[3], "Should be able to navigate on-domain opener's children by targeted hyperlink.");
     71 
     72  window0.close();
     73  window1.close();
     74  window2.close();
     75  window3.close();
     76 
     77  await cleanupWindows();
     78 });
     79 
     80 </script>
     81 </head>
     82 <body>
     83 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=270414">Mozilla Bug 270414</a>
     84 <div id="frames">
     85 <iframe onload="testChild0();" name="child0" src="http://test1.example.org:80/tests/docshell/test/navigation/blank.html"></iframe>
     86 <iframe onload="testChild1();" name="child1" src="http://test1.example.org:80/tests/docshell/test/navigation/blank.html"></iframe>
     87 <iframe onload="testChild2();" name="child2" src="http://test1.example.org:80/tests/docshell/test/navigation/blank.html"></iframe>
     88 <iframe onload="testChild3();" name="child3" src="http://test1.example.org:80/tests/docshell/test/navigation/blank.html"></iframe>
     89 </div>
     90 <pre id="test">
     91 <script type="text/javascript">
     92 </script>
     93 </pre>
     94 </body>
     95 </html>