Title: [246162] trunk
- Revision
- 246162
- Author
- [email protected]
- Date
- 2019-06-06 12:07:55 -0700 (Thu, 06 Jun 2019)
Log Message
JSON.parse throws incorrect exception when called w/o arguments
https://bugs.webkit.org/show_bug.cgi?id=198574
Patch by Alexey Shvayka <[email protected]> on 2019-06-06
Reviewed by Yusuke Suzuki.
Source/_javascript_Core:
Always coerce first argument to string and attempt to parse it.
(steps 1-2 of https://tc39.github.io/ecma262/#sec-json.parse)
* runtime/JSONObject.cpp:
(JSC::JSONProtoFuncParse): Remove argumentCount check.
LayoutTests:
SyntaxError should be thrown if JSON.parse is called w/o arguments.
(steps 1-2 of https://tc39.github.io/ecma262/#sec-json.parse)
* js/dom/JSON-parse-expected.txt:
Modified Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (246161 => 246162)
--- trunk/LayoutTests/ChangeLog 2019-06-06 18:54:44 UTC (rev 246161)
+++ trunk/LayoutTests/ChangeLog 2019-06-06 19:07:55 UTC (rev 246162)
@@ -1,3 +1,15 @@
+2019-06-06 Alexey Shvayka <[email protected]>
+
+ JSON.parse throws incorrect exception when called w/o arguments
+ https://bugs.webkit.org/show_bug.cgi?id=198574
+
+ Reviewed by Yusuke Suzuki.
+
+ SyntaxError should be thrown if JSON.parse is called w/o arguments.
+ (steps 1-2 of https://tc39.github.io/ecma262/#sec-json.parse)
+
+ * js/dom/JSON-parse-expected.txt:
+
2019-06-06 Antti Koivisto <[email protected]>
Position fixed is buggy with overflow:auto scrolling inside iframes
Modified: trunk/LayoutTests/js/dom/JSON-parse-expected.txt (246161 => 246162)
--- trunk/LayoutTests/js/dom/JSON-parse-expected.txt 2019-06-06 18:54:44 UTC (rev 246161)
+++ trunk/LayoutTests/js/dom/JSON-parse-expected.txt 2019-06-06 19:07:55 UTC (rev 246162)
@@ -1,7 +1,7 @@
function (jsonObject){
return jsonObject.parse();
}
-PASS tests[i](nativeJSON) threw exception Error: JSON.parse requires at least one parameter.
+PASS tests[i](nativeJSON) threw exception SyntaxError: JSON Parse error: Unexpected identifier "undefined".
function (jsonObject){
return jsonObject.parse('');
}
Modified: trunk/Source/_javascript_Core/ChangeLog (246161 => 246162)
--- trunk/Source/_javascript_Core/ChangeLog 2019-06-06 18:54:44 UTC (rev 246161)
+++ trunk/Source/_javascript_Core/ChangeLog 2019-06-06 19:07:55 UTC (rev 246162)
@@ -1,3 +1,16 @@
+2019-06-06 Alexey Shvayka <[email protected]>
+
+ JSON.parse throws incorrect exception when called w/o arguments
+ https://bugs.webkit.org/show_bug.cgi?id=198574
+
+ Reviewed by Yusuke Suzuki.
+
+ Always coerce first argument to string and attempt to parse it.
+ (steps 1-2 of https://tc39.github.io/ecma262/#sec-json.parse)
+
+ * runtime/JSONObject.cpp:
+ (JSC::JSONProtoFuncParse): Remove argumentCount check.
+
2019-06-06 Keith Miller <[email protected]>
Unrevied build fix for FTL without Gigacage.
Modified: trunk/Source/_javascript_Core/runtime/JSONObject.cpp (246161 => 246162)
--- trunk/Source/_javascript_Core/runtime/JSONObject.cpp 2019-06-06 18:54:44 UTC (rev 246161)
+++ trunk/Source/_javascript_Core/runtime/JSONObject.cpp 2019-06-06 19:07:55 UTC (rev 246162)
@@ -801,10 +801,7 @@
{
VM& vm = exec->vm();
auto scope = DECLARE_THROW_SCOPE(vm);
-
- if (!exec->argumentCount())
- return throwVMError(exec, scope, createError(exec, "JSON.parse requires at least one parameter"_s));
- auto viewWithString = exec->uncheckedArgument(0).toString(exec)->viewWithUnderlyingString(exec);
+ auto viewWithString = exec->argument(0).toString(exec)->viewWithUnderlyingString(exec);
RETURN_IF_EXCEPTION(scope, { });
StringView view = viewWithString.view;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes