tor-browser

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

test_window_open_close.html (1366B)


      1 <!DOCTYPE HTML>
      2 <html>
      3 <head>
      4  <meta charset="utf-8">
      5  <script src="/tests/SimpleTest/SimpleTest.js"></script>
      6  <script src="/tests/SimpleTest/EventUtils.js"></script>
      7  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
      8 </head>
      9 <script type="application/javascript">
     10 
     11 SimpleTest.waitForExplicitFinish();
     12 
     13 // Opens a popup. Link should load in main browser window. Popup should be closed when link clicked.
     14 function openWindow1() {
     15  return window.open('file_window_open_close_outer.html','','width=300,height=200');
     16 }
     17 
     18 // Opens a new tab T1. Link opens in another new tab T2. T1 should close when link clicked.
     19 function openWindow2() {
     20  return window.open('file_window_open_close_outer.html');
     21 }
     22 
     23 // Opens a new window. Link should open in a new tab of that window, but then both windows should close.
     24 function openWindow3() {
     25  return window.open('file_window_open_close_outer.html', '', 'toolbar=1');
     26 }
     27 
     28 var TESTS = [openWindow1, openWindow2, openWindow3];
     29 
     30 function popupLoad(win)
     31 {
     32  info("Sending click");
     33  sendMouseEvent({type: "click"}, "link", win);
     34  ok(true, "Didn't crash");
     35 
     36  next();
     37 }
     38 
     39 function next()
     40 {
     41  if (!TESTS.length) {
     42    SimpleTest.finish();
     43  } else {
     44    var test = TESTS.shift();
     45    var w = test();
     46    w.addEventListener("load", (e) => popupLoad(w));
     47  }
     48 }
     49 </script>
     50 
     51 <body onload="next()">
     52 </body>
     53 </html>