Closed Bug 299641 Opened 19 years ago Closed 19 years ago

the "LeftHandSideExpression" of a 'for .. in' statement is executed too often.

Categories

(Core :: JavaScript Engine, defect, P3)

defect

Tracking

()

VERIFIED FIXED
mozilla1.8beta4

People

(Reporter: mozilla, Assigned: brendan)

Details

(Keywords: js1.5)

Attachments

(2 files, 1 obsolete file)

User-Agent:       Mozilla/5.0 (compatible; Konqueror/3.4; Linux) KHTML/3.4.0 (like Gecko)
Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.6) 

According to section 12.6.4 of the ECMAscript spec the LeftHandSideExpression 
should be executed as often as there are properties in the object (returned by 
Expression). [ the syntax is: 'for ( LeftHandSideExpression in Expression ) 
Statement']. 
Firefox executes it one more time (probably first executing the LHSExpr before 
verifying, that there are still elements). 

Reproducible: Always
Attached file test-case. (obsolete) —
"infun" is printed 3 times, eventhough there are only 2 properties
in o. -> there should be only 2 "infun"s.
Assignee: nobody → general
Component: General → JavaScript Engine
Product: Firefox → Core
QA Contact: general → general
Version: unspecified → 1.0 Branch
Version: 1.0 Branch → 1.7 Branch
Comment on attachment 188202 [details]
test-case.

Wrong testcase?

/be
Assignee: general → brendan
Status: UNCONFIRMED → NEW
Ever confirmed: true
Flags: blocking1.8b4+
Keywords: js1.5
Priority: -- → P3
Target Milestone: --- → mozilla1.8beta4
This should print 0, not 1.

/be
Attachment #188202 - Attachment is obsolete: true
OS: Linux → All
Hardware: PC → All
Version: 1.7 Branch → Trunk
sorry. didn't get your first comment (probably missed it). 
your test-case illustrates the point. thx. 
Attached patch proposed fixSplinter Review
This is probably what you were after, but it required some knowledge of when to
fake out a subroutine with an auto-storage-class tree node ;-).

/be
Attachment #189137 - Flags: review?(mrbkap)
Trying to use ASSIGNED to mean "have patch"....

/be
Status: NEW → ASSIGNED
Comment on attachment 189137 [details] [diff] [review]
proposed fix

>+             * Set left and right so pn appears to be a TOK_LB node, instead
>+             * the TOK_DOT node it is (see the TOK_FOR case in js_EmitTree).

You're missing an 'of' at the end of the first line. r=me with that fixed.
Attachment #189137 - Flags: review?(mrbkap) → review+
Comment on attachment 189137 [details] [diff] [review]
proposed fix

Another spot-fix for an ECMA conformance bug.

/be
Attachment #189137 - Flags: superreview+
Comment on attachment 189137 [details] [diff] [review]
proposed fix

Another spot-fix for an ECMA conformance bug.

/be
Attachment #189137 - Flags: superreview+
Attachment #189137 - Flags: approval1.8b4+
Blug, didn't mean to double submit (or to sr my own patch).

Fixed.

/be
Status: ASSIGNED → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
Flags: testcase?
Checking in regress-299641.js;
/cvsroot/mozilla/js/tests/js1_5/Regress/regress-299641.js,v  <--  regress-299641.js
initial revision: 1.1
Flags: testcase? → testcase+
Keywords: fixed1.8
This was fixed well before 1.8 branched -- why does it need the fixed1.8 keyword?

/be
one the queries was broken and we thought we were seeing some false positives
due to the missing keyword, but it turned out to be our query string. Didn't
realize that was going to inconvience you, sorry :)
Keywords: fixed1.8
No inconvenience, just trying to keep score!

/be
verified fixed 1.8.x and trunk.
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: