Bug 247431 - Ignored TypeError upon optional function call chain
Summary: Ignored TypeError upon optional function call chain
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: WebKit Local Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Ross Kirsling
URL:
Keywords: InRadar
: 247434 (view as bug list)
Depends on:
Blocks:
 
Reported: 2022-11-03 09:03 PDT by Kanguk Lee
Modified: 2022-11-24 21:45 PST (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Kanguk Lee 2022-11-03 09:03:35 PDT
// input.js
var x = function ( ) { } ?. ( ) . x ;
__________________________________________

Hello,

Executing the input.js using JSC, it is terminated normally.
However, it is expected to throw TypeError since `function ( ) { } ?. ( )` is `undefined`.

Running the input.js with JSC results in:

---
$ jsc input.js
// no error
---

while other engines behave like:

---
# V8
$ node input.js
input.js:1: TypeError: Cannot read properties of undefined (reading 'x')
var x = function ( ) { } ?. ( ) . x ;
                                ^
TypeError: Cannot read properties of undefined (reading 'x')
    at input.js:1:33

# GraalJS
$ js input.js
TypeError: Cannot read property 'x' of undefined
	at <js> :program(input.js:1:8-34)
---


WebKit version: 615.1.10
Comment 1 Radar WebKit Bug Importer 2022-11-03 18:13:16 PDT
<rdar://problem/101940388>
Comment 2 Ross Kirsling 2022-11-24 17:26:24 PST
*** Bug 247434 has been marked as a duplicate of this bug. ***
Comment 3 Ross Kirsling 2022-11-24 17:58:17 PST
Pull request: https://github.com/WebKit/WebKit/pull/6799
Comment 4 EWS 2022-11-24 21:45:03 PST
Committed 257004@main (23879e6bd1a0): <https://commits.webkit.org/257004@main>

Reviewed commits have been landed. Closing PR #6799 and removing active labels.