Summary: | [JSC] JSON.stringify can accept call-with-no-arguments | ||||||
---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | Prasanneswar Ramachandran <rvspeswar> | ||||
Component: | JavaScriptCore | Assignee: | Yusuke Suzuki <ysuzuki> | ||||
Status: | RESOLVED FIXED | ||||||
Severity: | Major | CC: | ews-watchlist, fpizlo, keith_miller, mark.lam, msaboff, saam, webkit-bug-importer, ysuzuki | ||||
Priority: | P2 | Keywords: | InRadar | ||||
Version: | Other | ||||||
Hardware: | All | ||||||
OS: | All | ||||||
Attachments: |
|
Description
Prasanneswar Ramachandran
2018-10-07 17:27:13 PDT
Can we have the code reproducing the issue? 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. 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. 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()); } Created attachment 352254 [details]
Patch
Comment on attachment 352254 [details]
Patch
r=me
HI, Yes this is correct and added as expected Committed r237095: <https://trac.webkit.org/changeset/237095> |