tor-browser

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

text.html (1415B)


      1 <!doctype html>
      2 <title>VTTCue.text</title>
      3 <link rel="help" href="https://w3c.github.io/webvtt/#dom-vttcue-text">
      4 <script src=/resources/testharness.js></script>
      5 <script src=/resources/testharnessreport.js></script>
      6 <script src=common.js></script>
      7 <div id=log></div>
      8 <script>
      9 setup(function(){
     10    window.video = document.createElement('video');
     11    window.t1 = video.addTextTrack('subtitles');
     12    document.body.appendChild(video);
     13 });
     14 test(function(){
     15    var c1 = new VTTCue(0, 1, 'text1\r\n\n\u0000');
     16    assert_true('text' in c1, 'text is not supported');
     17    assert_equals(c1.text, 'text1\r\n\n\u0000');
     18    c1.text = c1.text;
     19    assert_equals(c1.text, 'text1\r\n\n\u0000');
     20    c1.text = null;
     21    assert_equals(c1.text, 'null');
     22 }, document.title+', script-created cue');
     23 
     24 var t_parsed = async_test(document.title+', parsed cue');
     25 t_parsed.step(function(){
     26    var t = document.createElement('track');
     27    t.onload = this.step_func(function(){
     28        var c = t.track.cues;
     29        assert_equals(c[0].text, '');
     30        assert_equals(c[1].text, 'test');
     31        this.done();
     32    });
     33    t.onerror = this.step_func(function() {
     34      assert_unreached('got error event');
     35    });
     36    t.src = make_vtt_track('WEBVTT\n\n00:00:00.000 --> 00:00:00.001\n'+
     37                           '\n\nfoobar\n00:00:00.000 --> 00:00:00.001\ntest', this);
     38    t.track.mode = 'showing';
     39    video.appendChild(t);
     40 });
     41 </script>