Changeset 246162 in webkit
- Timestamp:
- Jun 6, 2019 12:07:55 PM (5 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r246156 r246162 1 2019-06-06 Alexey Shvayka <shvaikalesh@gmail.com> 2 3 JSON.parse throws incorrect exception when called w/o arguments 4 https://bugs.webkit.org/show_bug.cgi?id=198574 5 6 Reviewed by Yusuke Suzuki. 7 8 SyntaxError should be thrown if JSON.parse is called w/o arguments. 9 (steps 1-2 of https://tc39.github.io/ecma262/#sec-json.parse) 10 11 * js/dom/JSON-parse-expected.txt: 12 1 13 2019-06-06 Antti Koivisto <antti@apple.com> 2 14 -
trunk/LayoutTests/js/dom/JSON-parse-expected.txt
r245028 r246162 2 2 return jsonObject.parse(); 3 3 } 4 PASS tests[i](nativeJSON) threw exception Error: JSON.parse requires at least one parameter.4 PASS tests[i](nativeJSON) threw exception SyntaxError: JSON Parse error: Unexpected identifier "undefined". 5 5 function (jsonObject){ 6 6 return jsonObject.parse(''); -
trunk/Source/JavaScriptCore/ChangeLog
r246160 r246162 1 2019-06-06 Alexey Shvayka <shvaikalesh@gmail.com> 2 3 JSON.parse throws incorrect exception when called w/o arguments 4 https://bugs.webkit.org/show_bug.cgi?id=198574 5 6 Reviewed by Yusuke Suzuki. 7 8 Always coerce first argument to string and attempt to parse it. 9 (steps 1-2 of https://tc39.github.io/ecma262/#sec-json.parse) 10 11 * runtime/JSONObject.cpp: 12 (JSC::JSONProtoFuncParse): Remove argumentCount check. 13 1 14 2019-06-06 Keith Miller <keith_miller@apple.com> 2 15 -
trunk/Source/JavaScriptCore/runtime/JSONObject.cpp
r246034 r246162 802 802 VM& vm = exec->vm(); 803 803 auto scope = DECLARE_THROW_SCOPE(vm); 804 805 if (!exec->argumentCount()) 806 return throwVMError(exec, scope, createError(exec, "JSON.parse requires at least one parameter"_s)); 807 auto viewWithString = exec->uncheckedArgument(0).toString(exec)->viewWithUnderlyingString(exec); 804 auto viewWithString = exec->argument(0).toString(exec)->viewWithUnderlyingString(exec); 808 805 RETURN_IF_EXCEPTION(scope, { }); 809 806 StringView view = viewWithString.view;
Note: See TracChangeset
for help on using the changeset viewer.