JSON.stringify replacer function calls with numeric array indices
https://bugs.webkit.org/show_bug.cgi?id=158262
Source/JavaScriptCore:

rdar://problem/26613876

Patch by Benjamin Poulain <bpoulain@apple.com> on 2016-06-03
Reviewed by Saam Barati.

The spec of SerializeJSONArray is pretty clear that the index
should be transformed into a string before calling SerializeJSONProperty.
See http://www.ecma-international.org/ecma-262/6.0/#sec-serializejsonarray

* runtime/JSONObject.cpp:
(JSC::PropertyNameForFunctionCall::value):

LayoutTests:

Patch by Benjamin Poulain <bpoulain@apple.com> on 2016-06-03
Reviewed by Saam Barati.

* js/JSON-stringify-exposes-array-indices-as-strings-expected.txt: Added.
* js/JSON-stringify-exposes-array-indices-as-strings.html: Added.
* js/script-tests/JSON-stringify-exposes-array-indices-as-strings.js: Added.
(replacer):
(testObject.toJSON):
(toJSONArrayHelper):
* js/resources/JSON-stringify.js:
* js/dom/JSON-stringify-expected.txt:
Update the test results for the native implementation.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@201674 268f45cc-cd09-0410-ab3c-d52691b4dbfc
8 files changed