test_document_timeline_origin_time_range.html (1011B)
1 <!doctype html> 2 <meta charset=utf-8> 3 <script src="/resources/testharness.js"></script> 4 <script src="/resources/testharnessreport.js"></script> 5 <script src="../testcommon.js"></script> 6 <body> 7 <div id="log"></div> 8 <script> 9 'use strict'; 10 11 // If the originTime parameter passed to the DocumentTimeline exceeds 12 // the range of the internal storage type (a signed 64-bit integer number 13 // of ticks--a platform-dependent unit) then we should throw. 14 // Infinity isn't allowed as an origin time value and clamping to just 15 // inside the allowed range will just mean we overflow elsewhere. 16 17 test(function(t) { 18 assert_throws({ name: 'TypeError'}, 19 function() { 20 new DocumentTimeline({ originTime: Number.MAX_SAFE_INTEGER }); 21 }); 22 }, 'Calculated current time is positive infinity'); 23 24 test(function(t) { 25 assert_throws({ name: 'TypeError'}, 26 function() { 27 new DocumentTimeline({ originTime: -1 * Number.MAX_SAFE_INTEGER }); 28 }); 29 }, 'Calculated current time is negative infinity'); 30 31 </script> 32 </body>