tor-browser

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

window-outer-dimensions.https.html (1830B)


      1 <!DOCTYPE html>
      2 <title>Test window.prompt</title>
      3 <script src="/resources/testharness.js"></script>
      4 <script src="/resources/testharnessreport.js"></script>
      5 <script src="/common/utils.js"></script>
      6 <script src="resources/utils.js"></script>
      7 
      8 <body>
      9  <script>
     10    async function runTest(dimension, extra_children) {
     11      const window_outer_size_key = token();
     12      const window_inner_size_key = token();
     13 
     14      const window_outer_size_from_top_frame = (dimension == "width" ?
     15        window.outerWidth : window.outerHeight).toString();
     16 
     17      const frame_url = generateURL(
     18        'resources/window-outer-dimensions-inner.html',
     19        [window_outer_size_key, window_inner_size_key, dimension, extra_children]);
     20      const new_frame = attachFencedFrame(frame_url);
     21 
     22      // Get the outer and inner width/height from either the top level
     23      // fencedframe or the nested iframe.
     24      const result_outer = await nextValueFromServer(window_outer_size_key);
     25      const result_inner = await nextValueFromServer(window_inner_size_key);
     26 
     27      assert_not_equals(result_outer,
     28                        window_outer_size_from_top_frame,
     29                        "Outer " + dimension + " not read in fenced frame"
     30                        + " tree.");
     31 
     32      assert_equals(result_outer,
     33                    result_inner,
     34                    "Fencedframe's outer/inner " + dimension + " match.");
     35    }
     36 
     37    promise_test(async () => {
     38      return runTest("width", 0);
     39    }, "window.outerWidth");
     40 
     41    promise_test(async () => {
     42      return runTest("height", 0);
     43    }, "window.outerHeight");
     44 
     45    promise_test(async () => {
     46      return runTest("width", 1);
     47    }, "window.outerWidth nested iframe");
     48 
     49    promise_test(async () => {
     50      return runTest("height", 1);
     51    }, "window.outerHeight nested iframe");
     52  </script>
     53 </body>