Title: [237095] trunk
- Revision
- 237095
- Author
- [email protected]
- Date
- 2018-10-15 06:48:11 -0700 (Mon, 15 Oct 2018)
Log Message
[JSC] JSON.stringify can accept call-with-no-arguments
https://bugs.webkit.org/show_bug.cgi?id=190343
Reviewed by Mark Lam.
JSTests:
* stress/json-stringify-no-arguments.js: Added.
(shouldBe):
Source/_javascript_Core:
JSON.stringify can accept `JSON.stringify()` call (call-with-no-arguments) according to the spec[1].
Instead of throwing an error, we should take the first argument as `undefined` if it is not given.
[1]: https://tc39.github.io/ecma262/#sec-json.stringify
* runtime/JSONObject.cpp:
(JSC::JSONProtoFuncStringify):
Modified Paths
Added Paths
Diff
Modified: trunk/JSTests/ChangeLog (237094 => 237095)
--- trunk/JSTests/ChangeLog 2018-10-15 12:27:37 UTC (rev 237094)
+++ trunk/JSTests/ChangeLog 2018-10-15 13:48:11 UTC (rev 237095)
@@ -1,3 +1,13 @@
+2018-10-13 Yusuke Suzuki <[email protected]>
+
+ [JSC] JSON.stringify can accept call-with-no-arguments
+ https://bugs.webkit.org/show_bug.cgi?id=190343
+
+ Reviewed by Mark Lam.
+
+ * stress/json-stringify-no-arguments.js: Added.
+ (shouldBe):
+
2018-10-08 Yusuke Suzuki <[email protected]>
[JSC] JSC should have "parseFunction" to optimize Function constructor
Added: trunk/JSTests/stress/json-stringify-no-arguments.js (0 => 237095)
--- trunk/JSTests/stress/json-stringify-no-arguments.js (rev 0)
+++ trunk/JSTests/stress/json-stringify-no-arguments.js 2018-10-15 13:48:11 UTC (rev 237095)
@@ -0,0 +1,7 @@
+function shouldBe(actual, expected) {
+ if (actual !== expected)
+ throw new Error('bad value: ' + actual);
+}
+
+shouldBe(JSON.stringify(), undefined);
+shouldBe(JSON.stringify(undefined), undefined);
Modified: trunk/Source/_javascript_Core/ChangeLog (237094 => 237095)
--- trunk/Source/_javascript_Core/ChangeLog 2018-10-15 12:27:37 UTC (rev 237094)
+++ trunk/Source/_javascript_Core/ChangeLog 2018-10-15 13:48:11 UTC (rev 237095)
@@ -1,3 +1,18 @@
+2018-10-13 Yusuke Suzuki <[email protected]>
+
+ [JSC] JSON.stringify can accept call-with-no-arguments
+ https://bugs.webkit.org/show_bug.cgi?id=190343
+
+ Reviewed by Mark Lam.
+
+ JSON.stringify can accept `JSON.stringify()` call (call-with-no-arguments) according to the spec[1].
+ Instead of throwing an error, we should take the first argument as `undefined` if it is not given.
+
+ [1]: https://tc39.github.io/ecma262/#sec-json.stringify
+
+ * runtime/JSONObject.cpp:
+ (JSC::JSONProtoFuncStringify):
+
2018-10-12 Tadeu Zagallo <[email protected]>
Gardening: Build fix after r237084.
Modified: trunk/Source/_javascript_Core/runtime/JSONObject.cpp (237094 => 237095)
--- trunk/Source/_javascript_Core/runtime/JSONObject.cpp 2018-10-15 12:27:37 UTC (rev 237094)
+++ trunk/Source/_javascript_Core/runtime/JSONObject.cpp 2018-10-15 13:48:11 UTC (rev 237095)
@@ -829,11 +829,9 @@
VM& vm = exec->vm();
auto scope = DECLARE_THROW_SCOPE(vm);
- if (!exec->argumentCount())
- return throwVMError(exec, scope, createError(exec, "No input to stringify"_s));
Stringifier stringifier(exec, exec->argument(1), exec->argument(2));
RETURN_IF_EXCEPTION(scope, { });
- RELEASE_AND_RETURN(scope, JSValue::encode(stringifier.stringify(exec->uncheckedArgument(0))));
+ RELEASE_AND_RETURN(scope, JSValue::encode(stringifier.stringify(exec->argument(0))));
}
JSValue JSONParse(ExecState* exec, const String& json)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes