Bug 198574

Summary: JSON.parse throws incorrect exception when called w/o arguments
Product: WebKit Reporter: Alexey Shvayka <ashvayka>
Component: JavaScriptCoreAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Minor CC: commit-queue, ews-watchlist, fpizlo, keith_miller, mark.lam, msaboff, saam, webkit-bug-importer, ysuzuki
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: All   
OS: All   
See Also: https://bugs.webkit.org/show_bug.cgi?id=190343
Attachments:
Description Flags
Patch
none
Archive of layout-test-results from ews124 for ios-simulator-wk2 none

Description Alexey Shvayka 2019-06-05 11:19:48 PDT
Test case:
  JSON.parse()

Expected:
  SyntaxError: JSON Parse error: Unexpected identifier "undefined"

Actual:
  Error: JSON.parse requires at least one parameter

ECMA-262: https://tc39.github.io/ecma262/#sec-json.parse
No matter how many arguments are passed, `JSON.parse` always coerces first arg to string (step 1) and attempts to parse it (step 2).
Other browsers throw SyntaxError.
Comment 1 Alexey Shvayka 2019-06-05 11:52:09 PDT
Created attachment 371426 [details]
Patch
Comment 2 EWS Watchlist 2019-06-05 13:13:22 PDT
Comment on attachment 371426 [details]
Patch

Attachment 371426 [details] did not pass ios-sim-ews (ios-simulator-wk2):
Output: https://webkit-queues.webkit.org/results/12387336

New failing tests:
http/tests/resourceLoadStatistics/website-data-removal-for-site-navigated-to-with-link-decoration.html
Comment 3 EWS Watchlist 2019-06-05 13:13:23 PDT
Created attachment 371431 [details]
Archive of layout-test-results from ews124 for ios-simulator-wk2

The attached test failures were seen while running run-webkit-tests on the ios-sim-ews.
Bot: ews124  Port: ios-simulator-wk2  Platform: Mac OS X 10.14.5
Comment 4 Yusuke Suzuki 2019-06-06 12:03:11 PDT
Comment on attachment 371426 [details]
Patch

r=me
Comment 5 WebKit Commit Bot 2019-06-06 12:08:01 PDT
Comment on attachment 371426 [details]
Patch

Clearing flags on attachment: 371426

Committed r246162: <https://trac.webkit.org/changeset/246162>
Comment 6 WebKit Commit Bot 2019-06-06 12:08:03 PDT
All reviewed patches have been landed.  Closing bug.
Comment 7 Radar WebKit Bug Importer 2019-06-06 12:09:17 PDT
<rdar://problem/51493975>