tor-browser

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

scroll-into-view.https.html (1464B)


      1 <!DOCTYPE html>
      2 <title>Test scrollIntoView() inside a fenced frame</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 <!-- This spacer is used to ensure that the fenced frame will be out of view
     11     unless a scroll is performed. -->
     12 <div style="height: 2000px;"></div>
     13 <script>
     14 promise_test(async(t) => {
     15  const fencedframe = await attachFencedFrameContext();
     16 
     17  const start_y_offset = window.pageYOffset;
     18 
     19  await fencedframe.execute(() => {
     20    // Ensure that any elements created are out of view until a scroll is
     21    // performed.
     22    const spacer = document.createElement("div");
     23    spacer.style = "height: 2000px;";
     24    document.body.appendChild(spacer);
     25 
     26    const start_fenced_y_offset = window.pageYOffset;
     27 
     28    const button = document.createElement("button");
     29    document.body.appendChild(button);
     30    button.scrollIntoView();
     31 
     32    const end_fenced_y_offset = window.pageYOffset;
     33    assert_not_equals(start_fenced_y_offset, end_fenced_y_offset,
     34      "The inner page should have scrolled.");
     35  }, []);
     36 
     37  const end_y_offset = window.pageYOffset;
     38  assert_equals(start_y_offset, end_y_offset,
     39      "The outer page should not have scrolled.");
     40 
     41 }, 'scrollIntoView() inside a fenced frame should not scroll ancestors');
     42 
     43 </script>
     44 </body>