Bug 247788
| Summary: | Invalid postfix operator and nullish coaleascing inside a block in strict mode | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | Kanguk Lee <p51lee> |
| Component: | JavaScriptCore | Assignee: | Nobody <webkit-unassigned> |
| Status: | RESOLVED CONFIGURATION CHANGED | ||
| Severity: | Normal | CC: | justin_michaud, mark.lam, ross.kirsling, webkit-bug-importer, ysuzuki |
| Priority: | P2 | Keywords: | InRadar |
| Version: | WebKit Local Build | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
Kanguk Lee
// input.js
"use strict";
function f() {
x = (``.p++) ?? 0;
let x;
}
f();
_____________________
Hello,
Executing the input.js using JSC, it throws ReferenceError but TypeError is expected.
Running the input.js with JSC results in:
---
$ jsc input.js
Exception: ReferenceError: Cannot access uninitialized variable.
f@input.js:3:10
global code@input.js:7:2
---
while other engines behave like:
---
# V8 (used console.log)
$ node input.js
input.js:3
x = (``.p++) ?? 0;
^
TypeError: Cannot create property 'p' on string ''
...
Node.js v18.11.0
# GraalJS
$ js input.js
TypeError: Cannot assign to read only property 'p' of
at <js> f(input.js:3:35-42)
at <js> :program(input.js:7:62-64)
---
WebKit version: 615.1.10
| Attachments | ||
|---|---|---|
| Add attachment proposed patch, testcase, etc. |
Radar WebKit Bug Importer
<rdar://problem/102324685>
Ross Kirsling
This is already a TypeError in current JSC; seems like something must have changed since the last Safari TP release.
Justin Michaud
Yes, this seems to be fixed. Thanks for reporting!