tor-browser

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

empty-iframe-load-event.html (1236B)


      1 <!doctype html>
      2 <title>load event for empty iframe in relation to the event loop</title>
      3 <script src=/resources/testharness.js></script>
      4 <script src=/resources/testharnessreport.js></script>
      5 <script>
      6 setup({explicit_done:true});
      7 let ran = false;
      8 
      9 onload = function() {
     10    let iframe = document.createElement("iframe");
     11    iframe.onload = function() {
     12        test(function() {
     13            assert_equals(ran, false, 'Expected onload to run first');
     14        }, "Check execution order on load handler");
     15        if (ran) {
     16            done();
     17        } else {
     18            ran = true;
     19        }
     20    };
     21    document.body.appendChild(iframe);
     22 
     23    // Nested timeout to accommodate Gecko, because the it seems
     24    // the outer setTimeout takes its slot in the event queue right away
     25    // but the load event task takes its slot only at the end of this script.
     26    setTimeout(function() {
     27        setTimeout(function() {
     28            test(function() {
     29                assert_equals(ran, true, 'Expected nested setTimeout to run second');
     30            }, "Check execution order from nested timeout");
     31            if (ran) {
     32                done();
     33            } else {
     34                ran = true;
     35            }
     36        });
     37    });
     38 };
     39 </script>