tor-browser

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

resource-selection-candidate-insert-before.html (997B)


      1 <!doctype html>
      2 <title>inserting another source before the candidate</title>
      3 <script src="/resources/testharness.js"></script>
      4 <script src="/resources/testharnessreport.js"></script>
      5 <div id=log></div>
      6 <script>
      7 var v;
      8 function createSource(src) {
      9  var source = document.createElement('source');
     10  source.src = src;
     11  return source;
     12 }
     13 var t = async_test(function(t) {
     14  v = document.createElement('video');
     15  v.addEventListener('loadstart', t.step_func(function() {
     16    assert_equals(v.currentSrc.substr(v.currentSrc.lastIndexOf('#')), '#a');
     17    t.done();
     18  }), false);
     19  v.appendChild(createSource('#a')); // invokes resource selection
     20 });
     21 </script>
     22 <!-- now resource selection algorithm will continue its sync section (the </script> tag below provides a stable state) -->
     23 <!-- #a is candidate -->
     24 <!-- pointer is between #a and the end of the list -->
     25 <script>
     26 t.step(function() {
     27  v.insertBefore(createSource('#b'), v.firstChild); // pointer is unchanged, #a is still candidate
     28 });
     29 </script>