RESOLVED FIXED 191677
[JSC] Implement "well-formed JSON.stringify" proposal
https://bugs.webkit.org/show_bug.cgi?id=191677
Summary [JSC] Implement "well-formed JSON.stringify" proposal
Yusuke Suzuki
Reported 2018-11-15 03:02:35 PST
[JSC] Implement "well-formed JSON.stringify" proposal
Attachments
Patch (4.73 KB, patch)
2018-11-15 03:04 PST, Yusuke Suzuki
no flags
Patch (4.73 KB, patch)
2018-11-15 03:07 PST, Yusuke Suzuki
no flags
Archive of layout-test-results from ews101 for mac-sierra (4.35 MB, application/zip)
2018-11-15 03:48 PST, EWS Watchlist
no flags
Archive of layout-test-results from ews104 for mac-sierra-wk2 (4.94 MB, application/zip)
2018-11-15 03:57 PST, EWS Watchlist
no flags
Archive of layout-test-results from ews114 for mac-sierra (4.21 MB, application/zip)
2018-11-15 05:03 PST, EWS Watchlist
no flags
Archive of layout-test-results from ews126 for ios-simulator-wk2 (4.09 MB, application/zip)
2018-11-15 05:07 PST, EWS Watchlist
no flags
Patch (8.38 KB, patch)
2018-11-15 23:46 PST, Yusuke Suzuki
no flags
Archive of layout-test-results from ews102 for mac-sierra (3.30 MB, application/zip)
2018-11-16 00:49 PST, EWS Watchlist
no flags
Archive of layout-test-results from ews104 for mac-sierra-wk2 (3.90 MB, application/zip)
2018-11-16 00:57 PST, EWS Watchlist
no flags
Archive of layout-test-results from ews112 for mac-sierra (3.09 MB, application/zip)
2018-11-16 01:39 PST, EWS Watchlist
no flags
Archive of layout-test-results from ews122 for ios-simulator-wk2 (3.32 MB, application/zip)
2018-11-16 01:50 PST, EWS Watchlist
no flags
Archive of layout-test-results from ews126 for ios-simulator-wk2 (3.28 MB, application/zip)
2018-11-16 03:47 PST, EWS Watchlist
no flags
Patch (8.38 KB, patch)
2018-11-17 01:53 PST, Yusuke Suzuki
no flags
Patch (10.52 KB, patch)
2018-11-17 01:56 PST, Yusuke Suzuki
no flags
Patch (10.54 KB, patch)
2018-11-17 05:52 PST, Yusuke Suzuki
no flags
Patch (11.75 KB, patch)
2018-12-20 10:09 PST, Yusuke Suzuki
darin: review+
Yusuke Suzuki
Comment 1 2018-11-15 03:04:40 PST
Yusuke Suzuki
Comment 2 2018-11-15 03:07:47 PST
EWS Watchlist
Comment 3 2018-11-15 03:48:43 PST
Comment on attachment 354907 [details] Patch Attachment 354907 [details] did not pass mac-ews (mac): Output: https://webkit-queues.webkit.org/results/10001803 New failing tests: js/dom/JSON-stringify.html js/dom/webidl-type-mapping.html css3/escape-dom-api.html
EWS Watchlist
Comment 4 2018-11-15 03:48:45 PST
Created attachment 354910 [details] Archive of layout-test-results from ews101 for mac-sierra The attached test failures were seen while running run-webkit-tests on the mac-ews. Bot: ews101 Port: mac-sierra Platform: Mac OS X 10.12.6
EWS Watchlist
Comment 5 2018-11-15 03:57:45 PST
Comment on attachment 354907 [details] Patch Attachment 354907 [details] did not pass mac-wk2-ews (mac-wk2): Output: https://webkit-queues.webkit.org/results/10001810 New failing tests: js/dom/JSON-stringify.html js/dom/webidl-type-mapping.html css3/escape-dom-api.html
EWS Watchlist
Comment 6 2018-11-15 03:57:47 PST
Created attachment 354911 [details] Archive of layout-test-results from ews104 for mac-sierra-wk2 The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews. Bot: ews104 Port: mac-sierra-wk2 Platform: Mac OS X 10.12.6
EWS Watchlist
Comment 7 2018-11-15 05:03:42 PST
Comment on attachment 354907 [details] Patch Attachment 354907 [details] did not pass mac-debug-ews (mac): Output: https://webkit-queues.webkit.org/results/10002068 New failing tests: js/dom/JSON-stringify.html js/dom/webidl-type-mapping.html css3/escape-dom-api.html
EWS Watchlist
Comment 8 2018-11-15 05:03:44 PST
Created attachment 354913 [details] Archive of layout-test-results from ews114 for mac-sierra The attached test failures were seen while running run-webkit-tests on the mac-debug-ews. Bot: ews114 Port: mac-sierra Platform: Mac OS X 10.12.6
EWS Watchlist
Comment 9 2018-11-15 05:07:28 PST
Comment on attachment 354907 [details] Patch Attachment 354907 [details] did not pass ios-sim-ews (ios-simulator-wk2): Output: https://webkit-queues.webkit.org/results/10002075 New failing tests: js/dom/JSON-stringify.html js/dom/webidl-type-mapping.html css3/escape-dom-api.html
EWS Watchlist
Comment 10 2018-11-15 05:07:30 PST
Created attachment 354915 [details] Archive of layout-test-results from ews126 for ios-simulator-wk2 The attached test failures were seen while running run-webkit-tests on the ios-sim-ews. Bot: ews126 Port: ios-simulator-wk2 Platform: Mac OS X 10.13.6
Yusuke Suzuki
Comment 11 2018-11-15 23:46:12 PST
EWS Watchlist
Comment 12 2018-11-16 00:49:08 PST
Comment on attachment 355026 [details] Patch Attachment 355026 [details] did not pass mac-ews (mac): Output: https://webkit-queues.webkit.org/results/10014029 New failing tests: js/dom/JSON-stringify.html js/dom/webidl-type-mapping.html js/dom/JSON-parse.html
EWS Watchlist
Comment 13 2018-11-16 00:49:10 PST
Created attachment 355030 [details] Archive of layout-test-results from ews102 for mac-sierra The attached test failures were seen while running run-webkit-tests on the mac-ews. Bot: ews102 Port: mac-sierra Platform: Mac OS X 10.12.6
EWS Watchlist
Comment 14 2018-11-16 00:57:50 PST
Comment on attachment 355026 [details] Patch Attachment 355026 [details] did not pass mac-wk2-ews (mac-wk2): Output: https://webkit-queues.webkit.org/results/10014035 New failing tests: js/dom/JSON-stringify.html js/dom/webidl-type-mapping.html js/dom/JSON-parse.html
EWS Watchlist
Comment 15 2018-11-16 00:57:52 PST
Created attachment 355032 [details] Archive of layout-test-results from ews104 for mac-sierra-wk2 The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews. Bot: ews104 Port: mac-sierra-wk2 Platform: Mac OS X 10.12.6
EWS Watchlist
Comment 16 2018-11-16 01:39:25 PST
Comment on attachment 355026 [details] Patch Attachment 355026 [details] did not pass mac-debug-ews (mac): Output: https://webkit-queues.webkit.org/results/10014105 New failing tests: js/dom/JSON-stringify.html js/dom/webidl-type-mapping.html
EWS Watchlist
Comment 17 2018-11-16 01:39:26 PST
Created attachment 355033 [details] Archive of layout-test-results from ews112 for mac-sierra The attached test failures were seen while running run-webkit-tests on the mac-debug-ews. Bot: ews112 Port: mac-sierra Platform: Mac OS X 10.12.6
EWS Watchlist
Comment 18 2018-11-16 01:50:14 PST
Comment on attachment 355026 [details] Patch Attachment 355026 [details] did not pass ios-sim-ews (ios-simulator-wk2): Output: https://webkit-queues.webkit.org/results/10014133 New failing tests: js/dom/JSON-stringify.html js/dom/webidl-type-mapping.html js/dom/JSON-parse.html
EWS Watchlist
Comment 19 2018-11-16 01:50:16 PST
Created attachment 355034 [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.13.6
EWS Watchlist
Comment 20 2018-11-16 03:47:26 PST
Comment on attachment 355026 [details] Patch Attachment 355026 [details] did not pass ios-sim-ews (ios-simulator-wk2): Output: https://webkit-queues.webkit.org/results/10014819 New failing tests: js/dom/JSON-stringify.html js/dom/webidl-type-mapping.html js/dom/JSON-parse.html
EWS Watchlist
Comment 21 2018-11-16 03:47:28 PST
Created attachment 355038 [details] Archive of layout-test-results from ews126 for ios-simulator-wk2 The attached test failures were seen while running run-webkit-tests on the ios-sim-ews. Bot: ews126 Port: ios-simulator-wk2 Platform: Mac OS X 10.13.6
Yusuke Suzuki
Comment 22 2018-11-17 01:53:21 PST
Yusuke Suzuki
Comment 23 2018-11-17 01:56:17 PST
Yusuke Suzuki
Comment 24 2018-11-17 05:52:23 PST
Yusuke Suzuki
Comment 25 2018-11-20 15:37:22 PST
Ping?
Yusuke Suzuki
Comment 26 2018-11-29 16:31:13 PST
Ping?
Ross Kirsling
Comment 27 2018-11-29 18:28:37 PST
Looks like there's a test262 test for this too, but it's newer than what's currently in the WebKit repo: https://github.com/tc39/test262/blob/master/test/built-ins/JSON/stringify/string-escape-unicode.js
Yusuke Suzuki
Comment 28 2018-11-29 18:36:36 PST
(In reply to Ross Kirsling from comment #27) > Looks like there's a test262 test for this too, but it's newer than what's > currently in the WebKit repo: > https://github.com/tc39/test262/blob/master/test/built-ins/JSON/stringify/ > string-escape-unicode.js Yes, and this patch passes this test.
Yusuke Suzuki
Comment 29 2018-11-30 21:04:21 PST
Ping?
Yusuke Suzuki
Comment 30 2018-12-07 06:25:46 PST
Ping?
Ross Kirsling
Comment 31 2018-12-07 15:33:43 PST
Informal r+. This seems quite straightforward (and even matches closely with the SpiderMonkey implementation).
Yusuke Suzuki
Comment 32 2018-12-10 21:11:42 PST
Ping review?
Yusuke Suzuki
Comment 33 2018-12-10 21:11:56 PST
(In reply to Ross Kirsling from comment #31) > Informal r+. > > This seems quite straightforward (and even matches closely with the > SpiderMonkey implementation). Thanks ;)
Yusuke Suzuki
Comment 34 2018-12-11 21:19:37 PST
Ping?
Darin Adler
Comment 35 2018-12-12 09:11:19 PST
Comment on attachment 355194 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=355194&action=review > Source/WTF/wtf/text/StringBuilderJSON.cpp:85 > + uint8_t upper = static_cast<uint32_t>(character) >> 8; I don’t understand what value the static_cast<uint32_t> has here. It seems the code would do the right thing without that. > Source/WTF/wtf/text/StringBuilderJSON.cpp:86 > + uint8_t lower = static_cast<uint8_t>(character); I don’t understand what value the static_cast<uint8_t> has here. It seems the code would do the right thing without that.
Darin Adler
Comment 36 2018-12-12 09:13:29 PST
Comment on attachment 355194 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=355194&action=review > Source/WTF/wtf/text/StringBuilderJSON.cpp:84 > + if (U16_IS_SURROGATE_TRAIL(character) || next == end || !U16_IS_SURROGATE_TRAIL(*next)) { Oops, this is wrong! Details to come.
Darin Adler
Comment 37 2018-12-12 09:17:21 PST
Comment on attachment 355194 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=355194&action=review >> Source/WTF/wtf/text/StringBuilderJSON.cpp:84 >> + if (U16_IS_SURROGATE_TRAIL(character) || next == end || !U16_IS_SURROGATE_TRAIL(*next)) { > > Oops, this is wrong! Details to come. This needs to use U16_IS_TRAIL, not U16_IS_SURROGATE_TRAIL, on *next. Test cases would be string where the last two characters are: 1) A surrogate head. 2) A non-surrogate character with the bit 0x400 set. That case would work incorrectly. I also think I would write it more like this to make the logic clearer: bool isValidSurrogatePair = U16_IS_SURROGATE_HEAD(character) && next != end && U16_IS_TRAIL(*next); if (!isValidSurrogatePair)
Yusuke Suzuki
Comment 38 2018-12-20 10:03:21 PST
(In reply to Darin Adler from comment #37) > Comment on attachment 355194 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=355194&action=review > > >> Source/WTF/wtf/text/StringBuilderJSON.cpp:84 > >> + if (U16_IS_SURROGATE_TRAIL(character) || next == end || !U16_IS_SURROGATE_TRAIL(*next)) { > > > > Oops, this is wrong! Details to come. > > This needs to use U16_IS_TRAIL, not U16_IS_SURROGATE_TRAIL, on *next. Test > cases would be string where the last two characters are: > > 1) A surrogate head. > 2) A non-surrogate character with the bit 0x400 set. > > That case would work incorrectly. > > I also think I would write it more like this to make the logic clearer: > > bool isValidSurrogatePair = U16_IS_SURROGATE_HEAD(character) && next != > end && U16_IS_TRAIL(*next); > if (!isValidSurrogatePair) Oops, super nice catch! Right. I'll fix this and update the patch soon.
Yusuke Suzuki
Comment 39 2018-12-20 10:09:14 PST
Yusuke Suzuki
Comment 40 2018-12-21 22:41:08 PST
Radar WebKit Bug Importer
Comment 41 2018-12-21 22:42:34 PST
Note You need to log in before you can comment on or make changes to this bug.