Changeset 201674 in webkit
- Timestamp:
- Jun 3, 2016 6:08:27 PM (8 years ago)
- Location:
- trunk
- Files:
-
- 3 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r201667 r201674 1 2016-06-03 Benjamin Poulain <bpoulain@apple.com> 2 3 JSON.stringify replacer function calls with numeric array indices 4 https://bugs.webkit.org/show_bug.cgi?id=158262 5 6 Reviewed by Saam Barati. 7 8 * js/JSON-stringify-exposes-array-indices-as-strings-expected.txt: Added. 9 * js/JSON-stringify-exposes-array-indices-as-strings.html: Added. 10 * js/script-tests/JSON-stringify-exposes-array-indices-as-strings.js: Added. 11 (replacer): 12 (testObject.toJSON): 13 (toJSONArrayHelper): 14 * js/resources/JSON-stringify.js: 15 * js/dom/JSON-stringify-expected.txt: 16 Update the test results for the native implementation. 17 1 18 2016-06-03 Ryosuke Niwa <rniwa@webkit.org> 2 19 -
trunk/LayoutTests/js/dom/JSON-stringify-expected.txt
r187016 r201674 148 148 return allString; 149 149 } 150 PASS tests[i](nativeJSON) is tests[i] (JSON)150 PASS tests[i](nativeJSON) is tests[i].expected 151 151 function (jsonObject){ 152 152 var allString = true; -
trunk/LayoutTests/js/resources/JSON-stringify.js
r187016 r201674 145 145 return allString; 146 146 }); 147 result[result.length - 1].expected = true; 147 148 result.push(function(jsonObject){ 148 149 var allString = true; … … 347 348 return replaceTracker; 348 349 }); 349 result[result.length - 1].expected = '(string)[1,2,3,null,null,null,4,5,6];0( number)1;1(number)2;2(number)3;3(number)undefined;4(number)undefined;5(number)undefined;6(number)4;7(number)5;8(number)6;'350 result[result.length - 1].expected = '(string)[1,2,3,null,null,null,4,5,6];0(string)1;1(string)2;2(string)3;3(string)undefined;4(string)undefined;5(string)undefined;6(string)4;7(string)5;8(string)6;' 350 351 result.push(function(jsonObject){ 351 352 replaceTracker = ""; … … 428 429 return cycleTracker; 429 430 }); 430 result[result.length - 1].expected = "0( number):[object Object]first, -> exception";431 result[result.length - 1].expected = "0(string):[object Object]first, -> exception"; 431 432 function createArray(len, o) { var r = []; for (var i = 0; i < len; i++) r[i] = o; return r; } 432 433 var getterCalls; -
trunk/Source/JavaScriptCore/ChangeLog
r201672 r201674 1 2016-06-03 Benjamin Poulain <bpoulain@apple.com> 2 3 JSON.stringify replacer function calls with numeric array indices 4 https://bugs.webkit.org/show_bug.cgi?id=158262 5 rdar://problem/26613876 6 7 Reviewed by Saam Barati. 8 9 The spec of SerializeJSONArray is pretty clear that the index 10 should be transformed into a string before calling SerializeJSONProperty. 11 See http://www.ecma-international.org/ecma-262/6.0/#sec-serializejsonarray 12 13 * runtime/JSONObject.cpp: 14 (JSC::PropertyNameForFunctionCall::value): 15 1 16 2016-06-03 Saam barati <sbarati@apple.com> 2 17 -
trunk/Source/JavaScriptCore/runtime/JSONObject.cpp
r201448 r201674 201 201 if (m_identifier) 202 202 m_value = jsString(exec, m_identifier->string()); 203 else 204 m_value = jsNumber(m_number); 203 else { 204 VM& vm = exec->vm(); 205 if (m_number <= 9) 206 return vm.smallStrings.singleCharacterString(m_number + '0'); 207 m_value = jsNontrivialString(&vm, vm.numericStrings.add(m_number)); 208 } 205 209 } 206 210 return m_value;
Note: See TracChangeset
for help on using the changeset viewer.