Closed
Bug 121744
Opened 23 years ago
Closed 23 years ago
JS should error on |for(i in undefined)|, |for(i in null)|
Categories
(Core :: JavaScript Engine, defect)
Core
JavaScript Engine
Tracking
()
VERIFIED
FIXED
People
(Reporter: pschwartau, Assigned: khanson)
Details
(Keywords: js1.5)
Attachments
(1 file)
675 bytes,
patch
|
shaver
:
review+
shaver
:
superreview+
asa
:
approval+
|
Details | Diff | Splinter Review |
Reported by gonzalom@docent.com and nboyd@atg.com: JS should throw TypeError exceptions on the statements |for(i in undefined)|, |for(i in null)|. Why? From the ECMA-262 3rd Edition Final: 12.6.4 The for-in Statement The production IterationStatement : for ( LeftHandSideExpression in Expression ) Statement is evaluated as follows: 1. Evaluate the Expression. 2. Call GetValue(Result(1)). 3. Call ToObject(Result(2)). ... 9.9 ToObject Input Type : Result Undefined : Throw a TypeError exception. Null : Throw a TypeError exception. ... Currently, SpiderMonkey does not error on either statement: js> for (var i in undefined) {print(i);} js> js> for (var i in null) {print(i);} js>
Comment 1•23 years ago
|
||
Comment 2•23 years ago
|
||
Comment on attachment 66477 [details] [diff] [review] fix, too easy Looks fine from over here, unless we want to condition the error on ECMAness. r=shaver
Attachment #66477 -
Flags: review+
Comment 3•23 years ago
|
||
Kenton, can you review? shaver, how about I take your r= as sr=? /be
Assignee | ||
Comment 4•23 years ago
|
||
Comment on attachment 66477 [details] [diff] [review] fix, too easy r=khanson Works for me. =Kenton=
Reporter | ||
Comment 5•23 years ago
|
||
Testcase added to JS testsuite: mozilla/js/tests/ecma_3/Statements/regress-121744.js Currently passing in Rhino. Currently failing in SpiderMonkey (before patch).
Comment 6•23 years ago
|
||
Comment on attachment 66477 [details] [diff] [review] fix, too easy sr=shaver, sure.
Attachment #66477 -
Flags: superreview+
Comment 7•23 years ago
|
||
Fixed. /be
Status: NEW → RESOLVED
Closed: 23 years ago
Resolution: --- → FIXED
Reporter | ||
Comment 8•23 years ago
|
||
Marking Verified FIXED. The above testcase now passes in the debug/optimized SpiderMonkey shell on WinNT, Linux, Mac9.1.
Status: RESOLVED → VERIFIED
Comment 9•23 years ago
|
||
Comment on attachment 66477 [details] [diff] [review] fix, too easy a=asa (on behalf of drivers) for checkin to the 1.0 branch
Attachment #66477 -
Flags: approval+
Updated•19 years ago
|
Flags: testcase+
You need to log in
before you can comment on or make changes to this bug.
Description
•