VTTCue constructor should use 'double' type for startTime / endTime
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 21 Feb 2018 19:36:47 +0000 (19:36 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 21 Feb 2018 19:36:47 +0000 (19:36 +0000)
commit3590e1e6719aa0d97f0485ff1c52c4d49a14f9aa
treebc5df07136349c23cd5fa31d2c79c18fe0a68528
parent7e86eacf12e8b0f53e91af428917ed79c773398e
VTTCue constructor should use 'double' type for startTime / endTime
https://bugs.webkit.org/show_bug.cgi?id=182988

Reviewed by Eric Carlson.

Source/WebCore:

VTTCue constructor should use 'double' type for startTime / endTime, not
'unrestricted double':
- https://w3c.github.io/webvtt/#the-vttcue-interface

Otherwise, we end up potentially returning NaN for TextTrackCue.startTime / endTime,
even though those correctly use type 'double':
- https://html.spec.whatwg.org/multipage/media.html#texttrackcue

The new behavior is consistent with Firefox and Chrome.

No new tests, updated existing test.

* bindings/js/JSDOMConvertNumbers.h:
(WebCore::JSConverter<IDLDouble>::convert):
Add assertion to make sure our implementation never tries to return NaN
for an IDL attribute of type 'double'. This would be invalid as per Web
IDL spec and would crash if the NaN being returned was impure as JSValue
could not store it as a double.

* html/track/VTTCue.idl:
Update constructor parameters to use 'double' type instead of 'unrestricted
double', as per:
- https://w3c.github.io/webvtt/#the-vttcue-interface

LayoutTests:

Update existing test to reflect behavior change.

* media/track/track-add-remove-cue-expected.txt:
* media/track/track-add-remove-cue.html:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@228886 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/media/track/track-add-remove-cue-expected.txt
LayoutTests/media/track/track-add-remove-cue.html
LayoutTests/media/track/track-cue-negative-timestamp-expected.txt
LayoutTests/media/track/track-cue-negative-timestamp.html
Source/WebCore/ChangeLog
Source/WebCore/bindings/js/JSDOMConvertNumbers.h
Source/WebCore/html/track/VTTCue.idl