If you think a bug might affect users in the 57 release, please set the correct tracking and status flags for Release Management.

"delete" operator does not evaluate embedded expressions

RESOLVED FIXED

Status

Rhino
Core
RESOLVED FIXED
6 years ago
6 years ago

People

(Reporter: André Bargull, Unassigned)

Tracking

Details

Attachments

(1 attachment)

(Reporter)

Description

6 years ago
Created attachment 596136 [details]
Simple JUnit test case

User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:10.0) Gecko/20100101 Firefox/10.0
Build ID: 20120129021758

Steps to reproduce:

"delete (bar,baz)" should evaluate the expression "(bar,baz)" before applying the "delete" operator. If either "bar" or "baz" is not defined in the current environment, a ReferenceError should be thrown. 
IRFactory#createUnary(int, Node) simplifies (optimizes?) the "delete" operator to return just "true" instead of evaluating any embedded expression.

Also see bug 508547 for a similar bug report.


Actual results:

"delete (bar,baz)" just returns "true" instead of throwing a ReferenceError


Expected results:

"delete (bar,baz)" needs to throw a ReferenceError. Ouput from SpiderMonkey interacting shell:
---
js> delete (bar,baz)
typein:17: ReferenceError: bar is not defined
---

Comment 1

6 years ago
Thanks for the report. ES5 makes it quite clear that the operand expression always has to be evaluated (step 1 in 11.4.1). Fixed in master and rhino_1_8.

https://github.com/mozilla/rhino/commit/9e3d434569218fc5ae2a14a0241582e7939956c9
Status: UNCONFIRMED → RESOLVED
Last Resolved: 6 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.