tor-browser

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

nested-opaque-ad-sizes.https.html (1814B)


      1 <!DOCTYPE html>
      2 <title>Test cases when fenced frame size shouldn't be restricted..</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="/common/dispatcher/dispatcher.js"></script>
      7 <script src="resources/utils.js"></script>
      8 
      9 <body>
     10 <script>
     11 promise_test(async () => {
     12  const allowed_width = 320;
     13  const allowed_height = 50;
     14 
     15  // Create an opaque-ads fenced frame with an invalid size.
     16  const frame = await attachFencedFrameContext({
     17    generator_api: "fledge",
     18    resolve_to_config: true,
     19    attributes: [["width", allowed_width+1], ["height", allowed_height+1]],
     20    num_components: 1
     21  });
     22 
     23  await frame.execute(async (allowed_width, allowed_height) => {
     24    // Observe that the size gets coerced to the nearest allowed size.
     25    assert_equals(window.innerWidth, allowed_width,
     26        "The outer opaque-ads fenced frame has its width coerced.");
     27    assert_equals(window.innerHeight, allowed_height,
     28        "The outer opaque-ads fenced frame has its height coerced.");
     29 
     30    const component_ad_frame = await attachComponentFencedFrameContext(0, {
     31        attributes:
     32        [["width", allowed_width+1], ["height", allowed_height+1]]});
     33 
     34    await component_ad_frame.execute((allowed_width, allowed_height) => {
     35      // Observe that the nested frame's size doesn't get coerced.
     36      assert_equals(window.innerWidth, allowed_width+1,
     37          "The nested opaque-ads fenced frame has its requested size.");
     38      assert_equals(window.innerHeight, allowed_height+1,
     39          "The nested opaque-ads fenced frame has its requested size.");
     40    }, [allowed_width, allowed_height]);
     41  }, [allowed_width, allowed_height]);
     42 }, "nested fenced frames don't use the size list");
     43 </script>
     44 </body>