tor-browser

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

non-active-document.html (1735B)


      1 <!doctype html>
      2 <meta charset=utf-8>
      3 <title>img in non-active document should not perform loads</title>
      4 <script src=/resources/testharness.js></script>
      5 <script src=/resources/testharnessreport.js></script>
      6 <div id=log></div>
      7 
      8 <!-- Per load the image so that any loads in this test would be cached. -->
      9 <img src=/images/green-1x1.png>
     10 
     11 <!-- tests -->
     12 <template>
     13 <img>
     14 </template>
     15 
     16 <script>
     17 
     18 onload = function() {
     19  async_test(function(t) {
     20    var p = new DOMParser();
     21    var d = p.parseFromString('<img>', 'text/html');
     22    var i = d.querySelector('img');
     23    i.onerror = t.unreached_func('got unexpected error event');
     24    i.onload = t.unreached_func('got unexpected load event');
     25    i.src = '/images/green-1x1.png';
     26    // delay to ensure there is no load/error event fired.
     27    t.step_timeout(t.step_func_done(), 0);
     28  }, "DOMParser");
     29 
     30  async_test(function(t) {
     31    var d = document.implementation.createHTMLDocument('');
     32    d.body.innerHTML = '<img>';
     33    var i = d.querySelector('img');
     34    i.onerror = this.unreached_func('got unexpected error event');
     35    i.onload = this.unreached_func('got unexpected load event');
     36    i.src = '/images/green-1x1.png';
     37    // delay to ensure there is no load/error event fired.
     38    t.step_timeout(t.step_func_done(), 0);
     39  }, "createHTMLDocument");
     40 
     41  async_test(function(t) {
     42    var template = document.querySelector('template');
     43    var i = template.content.querySelector('img');
     44    i.onerror = this.unreached_func('got unexpected error event');
     45    i.onload = this.unreached_func('got unexpected load event');
     46    i.src = '/images/green-1x1.png';
     47    // delay to ensure there is no load/error event fired.
     48    t.step_timeout(t.step_func_done(), 0);
     49  }, "<template>");
     50 };
     51 
     52 </script>