WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
190343
[JSC] JSON.stringify can accept call-with-no-arguments
https://bugs.webkit.org/show_bug.cgi?id=190343
Summary
[JSC] JSON.stringify can accept call-with-no-arguments
Prasanneswar Ramachandran
Reported
2018-10-07 17:27:13 PDT
In JSON3 , they have used to stringify the non passing parameter as JSON. Stringify () so in json object omits this due to non argument count. Herewith need to add the dummy stringify for the JSON3 object. If added that JSON works as expected.
Attachments
Patch
(3.03 KB, patch)
2018-10-13 08:29 PDT
,
Yusuke Suzuki
mark.lam
: review+
Details
Formatted Diff
Diff
View All
Add attachment
proposed patch, testcase, etc.
Radar WebKit Bug Importer
Comment 1
2018-10-07 17:27:37 PDT
<
rdar://problem/45077333
>
Yusuke Suzuki
Comment 2
2018-10-08 13:16:49 PDT
Can we have the code reproducing the issue?
Prasanneswar Ramachandran
Comment 3
2018-10-11 11:39:14 PDT
Hi, Just save a cookies in the name of "{"times:{"time" :"0"}" with JSON3 library which already having in GITHUB and stringify the mentioned JSON string . webkit enters with 0 argument count using the JSON3. Note: If we dont use the JSON3 code in our testcode we can't reproduce the issue.
Prasanneswar Ramachandran
Comment 4
2018-10-11 11:43:35 PDT
Hi, Just save a cookies in the name of "{"times:{"time" :"0"}" with JSON3 library which already having in GITHUB and stringify the mentioned JSON string . webkit enters with 0 argument count using the JSON3. Note: If we dont use the JSON3 code in our testcode we can't reproduce the issue.
Prasanneswar Ramachandran
Comment 5
2018-10-11 11:45:51 PDT
For this I have fixed as below mentioned // ECMA-262 v5 15.12.3 EncodedJSValue JSC_HOST_CALL JSONProtoFuncStringify(ExecState* exec) { if (!exec->argumentCount()) return throwVMError(exec, createError(exec, ASCIILiteral("No input to stringify"))); LocalScope scope(exec->globalData()); Local<Unknown> value(exec->globalData(), exec->argument(0)); Local<Unknown> replacer(exec->globalData(), exec->argument(1)); Local<Unknown> space(exec->globalData(), exec->argument(2)); return JSValue::encode(Stringifier(exec, replacer, space).stringify(value).get()); } Modified: ======== // ECMA-262 v5 15.12.3 EncodedJSValue JSC_HOST_CALL JSONProtoFuncStringify(ExecState* exec) { if (!exec->argumentCount()){ LocalScope scope(exec->globalData()); Local<Unknown> value(exec->globalData(), jsnull()); Local<Unknown> replacer(exec->globalData(), jsnull()); Local<Unknown> space(exec->globalData(), jsnull()); return JSValue::encode(Stringifier(exec, replacer, space).stringify(value).get() } LocalScope scope(exec->globalData()); Local<Unknown> value(exec->globalData(), exec->argument(0)); Local<Unknown> replacer(exec->globalData(), exec->argument(1)); Local<Unknown> space(exec->globalData(), exec->argument(2)); return JSValue::encode(Stringifier(exec, replacer, space).stringify(value).get()); }
Yusuke Suzuki
Comment 6
2018-10-13 08:29:57 PDT
Created
attachment 352254
[details]
Patch
Mark Lam
Comment 7
2018-10-13 10:44:13 PDT
Comment on
attachment 352254
[details]
Patch r=me
Prasanneswar Ramachandran
Comment 8
2018-10-13 12:23:42 PDT
HI, Yes this is correct and added as expected
Yusuke Suzuki
Comment 9
2018-10-15 06:48:16 PDT
Committed
r237095
: <
https://trac.webkit.org/changeset/237095
>
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug