summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/resources/page-with-top-navigating-iframe.html
blob: 568e44296f10dfc083e2358ae4b3a5b7d4916a38 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<!DOCTYPE html>
<meta charset="utf-8">
<script src=/common/get-host-info.sub.js></script>
<script src=/resources/testdriver.js></script>
<script src=/resources/testdriver-vendor.js></script>
<title>Page that embeds an iframe that navigates its top</title>
<script>
function addIframe() {
  const iframe = document.createElement('iframe');
  const path = new URL("top-navigating-page.html", window.location).pathname;
  iframe.src = get_host_info().HTTP_NOTSAMESITE_ORIGIN + path;
  document.body.appendChild(iframe);
}

addEventListener('load', () => {
  const urlParams = new URLSearchParams(location.search);
  const parentUserGesture = urlParams.get('parent_user_gesture') === 'true';
  if (parentUserGesture)
    test_driver.bless("Giving parent frame user activation").then(addIframe);
  else
    addIframe();
});
</script>