tor-browser

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

nav2-test-navigate-iframe.html (1762B)


      1 <!DOCTYPE HTML>
      2 <html>
      3  <head>
      4    <meta charset=utf-8>
      5    <title>PerformanceNavigationTiming.name updated in iframes</title>
      6    <script src="/resources/testharness.js"></script>
      7    <script src="/resources/testharnessreport.js"></script>
      8  </head>
      9  <body>
     10    <script>
     11 promise_test(async function (t) {
     12  var ifr = document.createElement("iframe");
     13  document.body.appendChild(ifr);
     14 
     15  ifr.src="resources/blank_page_green.html";
     16  await new Promise(resolve => {
     17    ifr.onload = function() {
     18      assert_equals(ifr.contentWindow.performance.getEntriesByType("navigation").length, 1, "Only one navigation time entry");
     19      assert_equals(ifr.contentWindow.performance.getEntriesByType("navigation")[0].name, ifr.contentWindow.location.toString(), "navigation name matches the window.location");
     20      assert_true(ifr.contentWindow.performance.getEntriesByType("navigation")[0].name.endsWith("blank_page_green.html"), "navigation name is blank_page_green.html");
     21      resolve();
     22    }
     23  });
     24 
     25 
     26  await new Promise(resolve => { setTimeout(resolve, 100); });
     27  ifr.src ="resources/blank_page_yellow.html";
     28 
     29  await new Promise(resolve => {
     30    ifr.onload = function() {
     31      assert_equals(ifr.contentWindow.performance.getEntriesByType("navigation").length, 1, "Only one navigation time entry");
     32      assert_equals(ifr.contentWindow.performance.getEntriesByType("navigation")[0].name, ifr.contentWindow.location.toString(), "navigation name matches the window.location");
     33      assert_true(ifr.contentWindow.performance.getEntriesByType("navigation")[0].name.endsWith("blank_page_yellow.html"), "navigation name is blank_page_yellow.html");
     34      resolve();
     35    }
     36  });
     37 }, "navigation.name updated when iframe URL changes");
     38    </script>
     39  </body>
     40 </html>