tor-browser

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

load-event-iframe-element.html (2399B)


      1 <!DOCTYPE html>
      2 <meta charset="UTF-8">
      3 <title>"load" event fires on the iframe element when loading the initial empty document</title>
      4 <script src="/resources/testharness.js"></script>
      5 <script src="/resources/testharnessreport.js"></script>
      6 <script src="resources/helpers.js"></script>
      7 <body></body>
      8 <script>
      9 "use strict";
     10 
     11 promise_test(async t => {
     12  const iframe = document.createElement("iframe");
     13  let loadCount = 0;
     14  iframe.addEventListener("load", () => {
     15    loadCount++;
     16  });
     17  document.body.appendChild(iframe);
     18  assert_equals(loadCount, 1);
     19  assert_equals(iframe.contentDocument.location.href, "about:blank");
     20 }, "load event fires synchronously on <iframe> element created with no src");
     21 
     22 promise_test(async t => {
     23  const iframe = document.createElement("iframe");
     24  iframe.src = "";
     25  let loadCount = 0;
     26  iframe.addEventListener("load", () => {
     27    loadCount++;
     28  });
     29  document.body.appendChild(iframe);
     30  assert_equals(loadCount, 1);
     31  assert_equals(iframe.contentDocument.location.href, "about:blank");
     32 }, "load event fires synchronously on <iframe> element created with src=''");
     33 
     34 promise_test(async t => {
     35  const iframe = document.createElement("iframe");
     36  iframe.src = "about:blank";
     37  let loadCount = 0;
     38  iframe.addEventListener("load", () => {
     39    loadCount++;
     40  });
     41  document.body.appendChild(iframe);
     42  assert_equals(loadCount, 1);
     43  assert_equals(iframe.contentDocument.location.href, "about:blank");
     44 }, "load event fires synchronously on <iframe> element created with src='about:blank'");
     45 
     46 promise_test(async t => {
     47  const iframe = document.createElement("iframe");
     48  iframe.src = "about:blank#foo";
     49  let loadCount = 0;
     50  iframe.addEventListener("load", () => {
     51    loadCount++;
     52  });
     53  document.body.appendChild(iframe);
     54  assert_equals(loadCount, 1);
     55  assert_equals(iframe.contentDocument.location.href, "about:blank#foo");
     56 }, "load event fires synchronously on <iframe> element created with src='about:blank#foo'");
     57 
     58 promise_test(async t => {
     59  const iframe = document.createElement("iframe");
     60  iframe.src = "about:blank?foo";
     61  let loadCount = 0;
     62  iframe.addEventListener("load", () => {
     63    loadCount++;
     64  });
     65  document.body.appendChild(iframe);
     66  assert_equals(loadCount, 1);
     67  assert_equals(iframe.contentDocument.location.href, "about:blank?foo");
     68 }, "load event fires synchronously on <iframe> element created with src='about:blank?foo'");
     69 </script>