NEW 152181
Refactoring HTMLMediaElement getStartDate() implementation
https://bugs.webkit.org/show_bug.cgi?id=152181
Summary Refactoring HTMLMediaElement getStartDate() implementation
Pascal Jacquemart
Reported 2015-12-11 11:41:29 PST
The spec says [1]: The getStartDate() method must return a new Date object representing the current timeline offset. where "a new Date object" is defined as: When this specification requires a user agent to create a Date object representing a particular time (which could be the special value Not-a-Number) ... Current implementation have some JSC quirks to return NaN directly instaead of a valid Date object
Attachments
Just checking if this change may not break other tests (5.09 KB, patch)
2015-12-11 11:46 PST, Pascal Jacquemart
darin: review-
darin: commit-queue-
Just checking if this change may not break other tests 2 (4.99 KB, patch)
2015-12-21 05:48 PST, Pascal Jacquemart
buildbot: commit-queue-
Archive of layout-test-results from ews103 for mac-yosemite (905.12 KB, application/zip)
2015-12-21 06:41 PST, Build Bot
no flags
Archive of layout-test-results from ews107 for mac-yosemite-wk2 (1.05 MB, application/zip)
2015-12-21 06:44 PST, Build Bot
no flags
Archive of layout-test-results from ews113 for mac-yosemite (804.42 KB, application/zip)
2015-12-21 06:50 PST, Build Bot
no flags
Just checking if this change may not break other tests 3 (4.62 KB, patch)
2015-12-21 07:41 PST, Pascal Jacquemart
no flags
For testing (1.31 KB, patch)
2016-01-05 09:00 PST, Pascal Jacquemart
darin: review-
Make sure HTMLMediaElement getStartDate() always returns a valid Date object (4.35 KB, patch)
2016-01-28 07:18 PST, Pascal Jacquemart
eric.carlson: review+
Pascal Jacquemart
Comment 1 2015-12-11 11:46:39 PST
Created attachment 267179 [details] Just checking if this change may not break other tests Just checking if this change may not break other tests
Darin Adler
Comment 2 2015-12-12 16:08:22 PST
Comment on attachment 267179 [details] Just checking if this change may not break other tests View in context: https://bugs.webkit.org/attachment.cgi?id=267179&action=review This patch should only contain the change to HTMLMediaElement.idl. Deleting all the unneeded code can be done in a follow-up that does not change behavior. > Source/WebCore/bindings/js/JSDOMBinding.cpp:124 > JSValue jsDateOrNull(ExecState* exec, double value) > { > - if (!std::isfinite(value)) > + if (std::isinf(value)) > return jsNull(); > + if (std::isnan(value)) > + return DateInstance::create(exec, exec->lexicalGlobalObject()->dateStructure()); > return DateInstance::create(exec->vm(), exec->lexicalGlobalObject()->dateStructure(), value); > } This changes the behavior for every callers of jsDateOrNull when the value is a NaN. We do not want to make that global change.
Pascal Jacquemart
Comment 3 2015-12-21 05:48:00 PST
Created attachment 267745 [details] Just checking if this change may not break other tests 2
Build Bot
Comment 4 2015-12-21 06:41:13 PST
Comment on attachment 267745 [details] Just checking if this change may not break other tests 2 Attachment 267745 [details] did not pass mac-ews (mac): Output: http://webkit-queues.webkit.org/results/588913 New failing tests: imported/w3c/web-platform-tests/html/dom/interfaces.html http/tests/media/hls/video-controller-getStartDate.html http/tests/local/fileapi/file-last-modified.html imported/w3c/web-platform-tests/html/semantics/forms/the-input-element/text.html imported/w3c/web-platform-tests/html/semantics/forms/the-input-element/hidden.html
Build Bot
Comment 5 2015-12-21 06:41:16 PST
Created attachment 267746 [details] Archive of layout-test-results from ews103 for mac-yosemite The attached test failures were seen while running run-webkit-tests on the mac-ews. Bot: ews103 Port: mac-yosemite Platform: Mac OS X 10.10.5
Build Bot
Comment 6 2015-12-21 06:44:47 PST
Comment on attachment 267745 [details] Just checking if this change may not break other tests 2 Attachment 267745 [details] did not pass mac-wk2-ews (mac-wk2): Output: http://webkit-queues.webkit.org/results/588915 New failing tests: imported/w3c/web-platform-tests/html/dom/interfaces.html imported/w3c/web-platform-tests/html/semantics/forms/the-input-element/hidden.html imported/w3c/web-platform-tests/html/semantics/forms/the-input-element/text.html http/tests/media/hls/video-controller-getStartDate.html
Build Bot
Comment 7 2015-12-21 06:44:50 PST
Created attachment 267747 [details] Archive of layout-test-results from ews107 for mac-yosemite-wk2 The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews. Bot: ews107 Port: mac-yosemite-wk2 Platform: Mac OS X 10.10.5
Build Bot
Comment 8 2015-12-21 06:50:55 PST
Comment on attachment 267745 [details] Just checking if this change may not break other tests 2 Attachment 267745 [details] did not pass mac-debug-ews (mac): Output: http://webkit-queues.webkit.org/results/588914 New failing tests: http/tests/local/fileapi/file-last-modified.html imported/w3c/web-platform-tests/html/semantics/forms/the-input-element/hidden.html imported/w3c/web-platform-tests/html/semantics/forms/the-input-element/text.html http/tests/media/hls/video-controller-getStartDate.html
Build Bot
Comment 9 2015-12-21 06:50:58 PST
Created attachment 267748 [details] Archive of layout-test-results from ews113 for mac-yosemite The attached test failures were seen while running run-webkit-tests on the mac-debug-ews. Bot: ews113 Port: mac-yosemite Platform: Mac OS X 10.10.5
Pascal Jacquemart
Comment 10 2015-12-21 07:41:25 PST
Created attachment 267750 [details] Just checking if this change may not break other tests 3
Pascal Jacquemart
Comment 11 2016-01-05 09:00:49 PST
Created attachment 268284 [details] For testing
Eric Carlson
Comment 12 2016-01-06 10:11:01 PST
Comment on attachment 268284 [details] For testing This looks fine, but should this patch also change HTMLMediaElement.idl because getStartDate will now always return a valid Date object?
Darin Adler
Comment 13 2016-01-18 19:19:33 PST
Comment on attachment 268284 [details] For testing View in context: https://bugs.webkit.org/attachment.cgi?id=268284&action=review > Source/WebCore/bindings/js/JSDOMBinding.cpp:120 > JSValue jsDateOrNaN(ExecState* exec, double value) > { > - if (std::isnan(value)) > - return jsDoubleNumber(value); > - return jsDateOrNull(exec, value); > + return DateInstance::create(exec->vm(), exec->lexicalGlobalObject()->dateStructure(), value); > } If this function no longer returns a NaN when passed a NaN, then it should not be named jsDateOrNaN. We should not change what it does without changing its name.
Pascal Jacquemart
Comment 14 2016-01-28 07:18:05 PST
Created attachment 270113 [details] Make sure HTMLMediaElement getStartDate() always returns a valid Date object
Eric Carlson
Comment 15 2016-01-28 07:23:08 PST
Comment on attachment 270113 [details] Make sure HTMLMediaElement getStartDate() always returns a valid Date object Thank you for sticking with this Pascal!
Darin Adler
Comment 16 2016-01-28 08:20:42 PST
Comment on attachment 270113 [details] Make sure HTMLMediaElement getStartDate() always returns a valid Date object View in context: https://bugs.webkit.org/attachment.cgi?id=270113&action=review This doesn’t seem right. Is it really acceptable to create a date object with the value NaN? Why no new test case? What’s the point of making this change if it doesn’t fix a bug? > Source/WebCore/bindings/js/JSDOMBinding.cpp:120 > +JSValue jsDate(ExecState* exec, double value) > +{ > + return DateInstance::create(exec->vm(), exec->lexicalGlobalObject()->dateStructure(), value); > +} What does this function do if it’s passed null or infinity? Is it legal to create a date instance with such values? Is it a programming error to call this? If so, then should something ASSERT(std::isfinite(value))? Maybe DateInstance::create already does that?
Radar WebKit Bug Importer
Comment 17 2016-04-02 19:23:14 PDT
Note You need to log in before you can comment on or make changes to this bug.