tor-browser

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

location-ancestorOrigins.https.html (2081B)


      1 <!DOCTYPE html>
      2 <title>Test location.ancestorOrigins</title>
      3 <script src="/resources/testharness.js"></script>
      4 <script src="/resources/testharnessreport.js"></script>
      5 <script src="/common/get-host-info.sub.js"></script>
      6 <script src="/common/utils.js"></script>
      7 <script src="resources/utils.js"></script>
      8 
      9 <body>
     10 
     11 <script>
     12 promise_test(async () => {
     13  const location_ao_key = token();
     14  const location_ao_ack_key = token();
     15 
     16  // We load the top-level fenced frame in a cross-origin, so that we can
     17  // more-completely verify the important cross-origin
     18  // `location.ancestorOrigins` case.
     19  const cross_origin = get_host_info().HTTPS_REMOTE_ORIGIN;
     20  const cross_origin_fenced_frame = getRemoteOriginURL(generateURL(
     21      'resources/location-ancestorOrigins-inner.https.html',
     22      [location_ao_key, location_ao_ack_key]
     23  ), https=true);
     24  attachFencedFrame(cross_origin_fenced_frame);
     25 
     26  // Get the result for the top-level fenced frame.
     27  const fenced_frame_result = await nextValueFromServer(location_ao_key);
     28  assert_equals(fenced_frame_result, "", "The top-level fenced frame has the " +
     29                                         "right ancestor origins");
     30 
     31  // Write an ACK, so that the fenced frame knows it can send message over the
     32  // `window_parent_key` channel again.
     33  writeValueToServer(location_ao_ack_key, "ACK");
     34 
     35  // Get the result for the iframe inside the fenced frame.
     36  const iframe_in_fenced_frame_result = await nextValueFromServer(location_ao_key);
     37  assert_equals(iframe_in_fenced_frame_result, cross_origin, "The iframe " +
     38                "inside the top-level fenced frame has the right " +
     39                "ancestor origins");
     40 
     41  writeValueToServer(location_ao_ack_key, "ACK");
     42 
     43  // Get the result for the nested fenced frame.
     44  const nested_fenced_frame_result = await nextValueFromServer(location_ao_key);
     45  assert_equals(nested_fenced_frame_result, "", "The nested fenced frame " +
     46                "inside the top-level fenced frame has the right ancestor " +
     47                "origins");
     48 }, "location.ancestorOrigins");
     49 </script>
     50 
     51 </body>