tor-browser

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

currentSrc.html (1507B)


      1 <!doctype html>
      2 <title>currentSrc</title>
      3 <script src="/resources/testharness.js"></script>
      4 <script src="/resources/testharnessreport.js"></script>
      5 <div id="log"></div>
      6 <script>
      7 ['audio', 'video'].forEach(function(tagName) {
      8  test(function() {
      9    assert_equals(document.createElement(tagName).currentSrc, '');
     10  }, tagName + '.currentSrc initial value');
     11 
     12  ['', '.', ' ', 'data:,'].forEach(function(src) {
     13    async_test(function(t) {
     14      var e = document.createElement(tagName);
     15      e.src = src;
     16      assert_equals(e.currentSrc, '');
     17      e.addEventListener('loadstart', function () {
     18        t.step_timeout(function () {
     19          if (src == '') {
     20            assert_equals(e.currentSrc, '');
     21          } else {
     22            assert_equals(e.currentSrc, e.src);
     23          }
     24          t.done();
     25        }, 0);
     26      })
     27    }, tagName + '.currentSrc after setting src attribute "' + src + '"');
     28 
     29    async_test(function(t) {
     30      var e = document.createElement(tagName);
     31      var s = document.createElement('source');
     32      s.src = src;
     33      e.appendChild(s);
     34      assert_equals(e.currentSrc, '');
     35      e.addEventListener('loadstart', function() {
     36        t.step_timeout(function () {
     37          if (src == '') {
     38            assert_equals(e.currentSrc, '');
     39          } else {
     40            assert_equals(e.currentSrc, s.src);
     41          }
     42          t.done();
     43        }, 0);
     44      });
     45    }, tagName + '.currentSrc after adding source element with src attribute "' + src + '"');
     46  });
     47 });
     48 </script>