RESOLVED FIXED 198495
Date.prototype.toJSON throws if toISOString returns an object
https://bugs.webkit.org/show_bug.cgi?id=198495
Summary Date.prototype.toJSON throws if toISOString returns an object
Alexey Shvayka
Reported 2019-06-03 14:00:33 PDT
Test case: > Date.prototype.toJSON.call({toISOString: () => []}) Expected: < [] Actual: < TypeError: toISOString did not return a primitive value ECMA262: https://tc39.github.io/ecma262/#sec-date.prototype.tojson (step 4) Test262: https://github.com/tc39/test262/pull/2190
Attachments
Patch (1.35 KB, patch)
2019-06-03 14:23 PDT, Alexey Shvayka
no flags
Archive of layout-test-results from ews103 for mac-highsierra (3.23 MB, application/zip)
2019-06-03 15:13 PDT, EWS Watchlist
no flags
Archive of layout-test-results from ews107 for mac-highsierra-wk2 (3.03 MB, application/zip)
2019-06-03 15:30 PDT, EWS Watchlist
no flags
Archive of layout-test-results from ews215 for win-future (13.71 MB, application/zip)
2019-06-03 15:54 PDT, EWS Watchlist
no flags
Archive of layout-test-results from ews117 for mac-highsierra (3.02 MB, application/zip)
2019-06-03 16:01 PDT, EWS Watchlist
no flags
Archive of layout-test-results from ews122 for ios-simulator-wk2 (2.60 MB, application/zip)
2019-06-03 16:20 PDT, EWS Watchlist
no flags
Patch (3.52 KB, patch)
2019-06-03 19:57 PDT, Alexey Shvayka
no flags
Archive of layout-test-results from ews105 for mac-highsierra-wk2 (3.01 MB, application/zip)
2019-06-04 01:33 PDT, EWS Watchlist
no flags
Archive of layout-test-results from ews211 for win-future (13.77 MB, application/zip)
2019-06-04 02:59 PDT, EWS Watchlist
no flags
Patch (3.68 KB, patch)
2019-06-05 05:33 PDT, Alexey Shvayka
no flags
Patch (6.10 KB, patch)
2019-06-18 12:47 PDT, Alexey Shvayka
no flags
Patch (5.74 KB, patch)
2019-08-19 14:01 PDT, Alexey Shvayka
no flags
Radar WebKit Bug Importer
Comment 1 2019-06-03 14:12:08 PDT
Alexey Shvayka
Comment 2 2019-06-03 14:23:02 PDT
EWS Watchlist
Comment 3 2019-06-03 15:13:19 PDT
Comment on attachment 371211 [details] Patch Attachment 371211 [details] did not pass mac-ews (mac): Output: https://webkit-queues.webkit.org/results/12366422 New failing tests: js/dom/JSON-stringify.html
EWS Watchlist
Comment 4 2019-06-03 15:13:21 PDT
Created attachment 371218 [details] Archive of layout-test-results from ews103 for mac-highsierra The attached test failures were seen while running run-webkit-tests on the mac-ews. Bot: ews103 Port: mac-highsierra Platform: Mac OS X 10.13.6
EWS Watchlist
Comment 5 2019-06-03 15:30:47 PDT
Comment on attachment 371211 [details] Patch Attachment 371211 [details] did not pass mac-wk2-ews (mac-wk2): Output: https://webkit-queues.webkit.org/results/12366518 New failing tests: js/dom/JSON-stringify.html
EWS Watchlist
Comment 6 2019-06-03 15:30:48 PDT
Created attachment 371219 [details] Archive of layout-test-results from ews107 for mac-highsierra-wk2 The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews. Bot: ews107 Port: mac-highsierra-wk2 Platform: Mac OS X 10.13.6
EWS Watchlist
Comment 7 2019-06-03 15:54:14 PDT
Comment on attachment 371211 [details] Patch Attachment 371211 [details] did not pass win-ews (win): Output: https://webkit-queues.webkit.org/results/12366610 New failing tests: js/dom/JSON-stringify.html
EWS Watchlist
Comment 8 2019-06-03 15:54:16 PDT
Created attachment 371222 [details] Archive of layout-test-results from ews215 for win-future The attached test failures were seen while running run-webkit-tests on the win-ews. Bot: ews215 Port: win-future Platform: CYGWIN_NT-10.0-17763-3.0.5-338.x86_64-x86_64-64bit
EWS Watchlist
Comment 9 2019-06-03 16:01:44 PDT
Comment on attachment 371211 [details] Patch Attachment 371211 [details] did not pass mac-debug-ews (mac): Output: https://webkit-queues.webkit.org/results/12366526 New failing tests: js/dom/JSON-stringify.html
EWS Watchlist
Comment 10 2019-06-03 16:01:46 PDT
Created attachment 371223 [details] Archive of layout-test-results from ews117 for mac-highsierra The attached test failures were seen while running run-webkit-tests on the mac-debug-ews. Bot: ews117 Port: mac-highsierra Platform: Mac OS X 10.13.6
EWS Watchlist
Comment 11 2019-06-03 16:20:00 PDT
Comment on attachment 371211 [details] Patch Attachment 371211 [details] did not pass ios-sim-ews (ios-simulator-wk2): Output: https://webkit-queues.webkit.org/results/12366676 New failing tests: js/dom/JSON-stringify.html
EWS Watchlist
Comment 12 2019-06-03 16:20:02 PDT
Created attachment 371226 [details] Archive of layout-test-results from ews122 for ios-simulator-wk2 The attached test failures were seen while running run-webkit-tests on the ios-sim-ews. Bot: ews122 Port: ios-simulator-wk2 Platform: Mac OS X 10.14.5
Alexey Shvayka
Comment 13 2019-06-03 19:57:43 PDT
EWS Watchlist
Comment 14 2019-06-04 01:33:00 PDT
Comment on attachment 371240 [details] Patch Attachment 371240 [details] did not pass mac-wk2-ews (mac-wk2): Output: https://webkit-queues.webkit.org/results/12370562 New failing tests: http/wpt/service-workers/service-worker-networkprocess-crash.html
EWS Watchlist
Comment 15 2019-06-04 01:33:02 PDT
Created attachment 371255 [details] Archive of layout-test-results from ews105 for mac-highsierra-wk2 The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews. Bot: ews105 Port: mac-highsierra-wk2 Platform: Mac OS X 10.13.6
EWS Watchlist
Comment 16 2019-06-04 02:59:21 PDT
Comment on attachment 371240 [details] Patch Attachment 371240 [details] did not pass win-ews (win): Output: https://webkit-queues.webkit.org/results/12370787 New failing tests: fast/shadow-dom/svg-text-path-href-change-in-shadow-tree.html
EWS Watchlist
Comment 17 2019-06-04 02:59:24 PDT
Created attachment 371260 [details] Archive of layout-test-results from ews211 for win-future The attached test failures were seen while running run-webkit-tests on the win-ews. Bot: ews211 Port: win-future Platform: CYGWIN_NT-10.0-17763-3.0.5-338.x86_64-x86_64-64bit
Alex Christensen
Comment 18 2019-06-04 16:36:13 PDT
Comment on attachment 371240 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=371240&action=review > Source/JavaScriptCore/ChangeLog:8 > + Don't throw TypeError if result of toISOString call is not a primitive. What's the motivation for this change? Is there a relevant specification? How do other browsers behave?
Keith Miller
Comment 19 2019-06-05 01:50:06 PDT
Comment on attachment 371240 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=371240&action=review Are there no test262 tests for this? Can you run `./Tools/Scripts/test262-runner` and see it this fixes any tests? >> Source/JavaScriptCore/ChangeLog:8 >> + Don't throw TypeError if result of toISOString call is not a primitive. > > What's the motivation for this change? Is there a relevant specification? How do other browsers behave? I think Alexsey commented on this in the bugzilla. It's part of https://tc39.github.io/ecma262/#sec-date.prototype.tojson. Although, I think it'd be good to have a link to the spec in the ChangeLog.
Alexey Shvayka
Comment 20 2019-06-05 05:33:59 PDT
Alexey Shvayka
Comment 21 2019-06-05 05:51:38 PDT
I've updated change logs to include spec link. Other browsers agree on spec: please see CI results of https://github.com/tc39/test262/pull/2190
Alexey Shvayka
Comment 22 2019-06-18 12:47:43 PDT
Created attachment 372363 [details] Patch With test262 imported, this patch now fixes a few tests.
Alexey Shvayka
Comment 23 2019-08-19 14:01:23 PDT
Created attachment 376709 [details] Patch Rebase patch.
WebKit Commit Bot
Comment 24 2019-08-19 16:28:03 PDT
Comment on attachment 376709 [details] Patch Clearing flags on attachment: 376709 Committed r248876: <https://trac.webkit.org/changeset/248876>
WebKit Commit Bot
Comment 25 2019-08-19 16:28:05 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.