tor-browser

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

test_onload2.xhtml (1390B)


      1 <html xmlns="http://www.w3.org/1999/xhtml">
      2 <!--
      3 https://bugzilla.mozilla.org/show_bug.cgi?id=1474311
      4 -->
      5 <head>
      6  <title>Test onload behaviour</title>
      7  <script src="/tests/SimpleTest/SimpleTest.js"></script>
      8  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
      9 </head>
     10 <body>
     11 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1474311">Mozilla Bug 1474311</a>
     12 <p id="display"></p>
     13 <script class="testbody" type="text/javascript">
     14 <![CDATA[
     15 
     16 SimpleTest.waitForExplicitFinish();
     17 
     18 function run() {
     19 
     20  let doc = document.implementation.createHTMLDocument('');
     21 
     22  doc.body.innerHTML = '<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><image id="image" xlink:href="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" height="200" width="200"/></svg>';
     23 
     24  let img = doc.body.firstChild.firstChild;
     25 
     26  document.getElementById('svg').appendChild(img);
     27 
     28  img.addEventListener('load', function () {
     29    ok(true, "onload method called");
     30    SimpleTest.finish();
     31  });
     32 
     33  img.addEventListener('error', function () {
     34    ok(false, "onerror method called");
     35  });
     36 }
     37 
     38 ]]>
     39 </script>
     40 <div id="content">
     41 
     42  <svg id="svg" onload="run()" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="100%" height="1">
     43  </svg>
     44 </div>
     45 <pre id="test">
     46 </pre>
     47 </body>
     48 </html>