tor-browser

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

popup-noopener.https.html (2030B)


      1 <!DOCTYPE html>
      2 <title>Test popup created from a Fenced Frame Tree</title>
      3 <script src="/resources/testharness.js"></script>
      4 <script src="/resources/testharnessreport.js"></script>
      5 <script src="resources/utils.js"></script>
      6 <script src="/common/utils.js"></script>
      7 
      8 <body>
      9 <script>
     10 // This key is used by `resources/popup-noopener-destination.html` to let us know if a
     11 // a new popup window is correctly opened without an opener.
     12 const popup_noopener_key = token();
     13 const kAssertion = "window.opener is null ";
     14 
     15 // This key is used by `resources/popup-noopener-inner.html` and
     16 // `resources/create-popup.html to let us know if a
     17 // a new popup window is correctly opened without an openee reference.
     18 const popup_openee_key = token();
     19 const kAssertion_openee = "openee is null ";
     20 
     21 // This key is used by `resources/popup-noopener-destination.html` to let us know if a
     22 // a new popup window is correctly opened without a name.
     23 const popup_name_key = token();
     24 const kAssertion_name = "window.name is empty string ";
     25 
     26 async function runTest(test_type) {
     27  const fenced_frame =
     28    attachFencedFrame(generateURL(
     29        `resources/popup-noopener-inner.html`,
     30        [popup_noopener_key, popup_openee_key, popup_name_key, test_type]));
     31 
     32  result = await nextValueFromServer(popup_openee_key);
     33  assert_equals(result, "PASS", kAssertion_openee + test_type);
     34 
     35  result = await nextValueFromServer(popup_noopener_key);
     36  assert_equals(result, "PASS", kAssertion + test_type);
     37 
     38  result = await nextValueFromServer(popup_name_key);
     39  assert_equals(result, "PASS", kAssertion + test_type);
     40 
     41  // Clean up the fenced frame
     42  document.body.removeChild(fenced_frame);
     43 }
     44 
     45 promise_test(async () => {
     46  return runTest("top-level fenced frame");
     47 }, "Create popup from top-level fenced frame");
     48 
     49 promise_test(async () => {
     50  return runTest("nested iframe");
     51 }, "Create popup from iframe nested in a fenced frame");
     52 
     53 promise_test(async () => {
     54  return runTest("nested fenced frame");
     55 }, "Create popup from nested fenced frame");
     56 </script>
     57 </body>