tor-browser

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

constructor-exceptions.html (1121B)


      1 <!doctype html>
      2 <title>VTTCue constructor exceptions</title>
      3 <script src="/resources/testharness.js"></script>
      4 <script src="/resources/testharnessreport.js"></script>
      5 <div id=log></div>
      6 <script>
      7 test(function() {
      8    assert_throws_js(TypeError, function() { new VTTCue(NaN, 0, 'foo'); });
      9    assert_throws_js(TypeError, function() { new VTTCue(Infinity, 0, 'foo'); });
     10    assert_throws_js(TypeError, function() { new VTTCue('tomorrow', 0, 'foo'); });
     11 }, document.title+', invalid start time');
     12 test(function() {
     13    assert_throws_js(TypeError, function() { new VTTCue(0, NaN, 'foo'); });
     14    assert_throws_js(TypeError, function() { new VTTCue(0, -Infinity, 'foo'); });
     15    assert_throws_js(TypeError, function() { new VTTCue(0, 'tomorrow', 'foo'); });
     16 }, document.title+', invalid end time');
     17 test(function() {
     18    var start = { valueOf: function() { return 42; } };
     19    var end = { valueOf: function() { return 84; } };
     20    var cue = new VTTCue(start, end, 'bar');
     21    assert_equals(cue.startTime, 42);
     22    assert_equals(cue.endTime, 84);
     23    assert_equals(cue.text, 'bar');
     24 }, document.title+', valueOf');
     25 </script>