WebKit Bugzilla
Attachment 371426 Details for
Bug 198574
: JSON.parse throws incorrect exception when called w/o arguments
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-198574-20190605215208.patch (text/plain), 2.89 KB, created by
Alexey Shvayka
on 2019-06-05 11:52:09 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Alexey Shvayka
Created:
2019-06-05 11:52:09 PDT
Size:
2.89 KB
patch
obsolete
>Index: Source/JavaScriptCore/ChangeLog >=================================================================== >--- Source/JavaScriptCore/ChangeLog (revision 246117) >+++ Source/JavaScriptCore/ChangeLog (working copy) >@@ -1,3 +1,16 @@ >+2019-06-05 Alexey Shvayka <shvaikalesh@gmail.com> >+ >+ JSON.parse throws incorrect exception when called w/o arguments >+ https://bugs.webkit.org/show_bug.cgi?id=198574 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ 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-04 Michael Catanzaro <mcatanzaro@igalia.com> > > Fix miscellaneous build warnings >Index: Source/JavaScriptCore/runtime/JSONObject.cpp >=================================================================== >--- Source/JavaScriptCore/runtime/JSONObject.cpp (revision 246067) >+++ Source/JavaScriptCore/runtime/JSONObject.cpp (working copy) >@@ -801,10 +801,7 @@ EncodedJSValue JSC_HOST_CALL JSONProtoFu > { > 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; > >Index: LayoutTests/ChangeLog >=================================================================== >--- LayoutTests/ChangeLog (revision 246067) >+++ LayoutTests/ChangeLog (working copy) >@@ -1,3 +1,15 @@ >+2019-06-05 Alexey Shvayka <shvaikalesh@gmail.com> >+ >+ JSON.parse throws incorrect exception when called w/o arguments >+ https://bugs.webkit.org/show_bug.cgi?id=198574 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ 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-04 Antoine Quint <graouts@apple.com> > > The "mouseenter" and "pointerenter" events are fired from the bottom up >Index: LayoutTests/js/dom/JSON-parse-expected.txt >=================================================================== >--- LayoutTests/js/dom/JSON-parse-expected.txt (revision 246067) >+++ LayoutTests/js/dom/JSON-parse-expected.txt (working copy) >@@ -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(''); > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 198574
: 371426 |
371431