Bug 198574 - JSON.parse throws incorrect exception when called w/o arguments
Summary: JSON.parse throws incorrect exception when called w/o arguments
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: WebKit Nightly Build
Hardware: All All
: P2 Minor
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2019-06-05 11:19 PDT by Alexey Shvayka
Modified: 2019-06-06 12:09 PDT (History)
9 users (show)

See Also:


Attachments
Patch (2.89 KB, patch)
2019-06-05 11:52 PDT, Alexey Shvayka
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from ews124 for ios-simulator-wk2 (2.48 MB, application/zip)
2019-06-05 13:13 PDT, Build Bot
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
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 Build Bot 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 Build Bot 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>