Closed Bug 321757 Opened 20 years ago Closed 20 years ago

Compound assignment operators (+= etc.) prematurely bind LHS of assignment

Categories

(Core :: JavaScript Engine, defect, P1)

defect

Tracking

()

VERIFIED FIXED
mozilla1.9alpha1

People

(Reporter: brendan, Assigned: brendan)

References

()

Details

(Keywords: verified1.8.1)

Attachments

(1 file)

Reported by Joaquin Cuenca Abela in news://news.mozilla.org/netscape.public.mozilla.jseng. Primordial bug. /be
Status: NEW → ASSIGNED
Summary: assignment operators (+= etc.) prematurely bind LHS of assignment → Compound assignment operators (+= etc.) prematurely bind LHS of assignment
Priority: -- → P1
To answer your question from the newsgroup post, Navigator versions 2.02, 3.01 and 4.04 all say "x is not defined", 4.08 says "NaN". See, this bug is not _that_ ancient. :-)
Ok, primordial to the dawn of SpiderMonkey, then. SpiderMonkey was written by me in the fall of 1996, based on the Mocha runtime I'd written way too quickly (with Ken Smith transcribing the fatally flawed java.util.Date into the Date class's native implementation) in Spring 1995. So Netscape 2 and 3 used the Mocha runtime while Netscape 4 and of course the Mozilla-based 6 and 7 series used SpiderMonkey. /be
/cvsroot/mozilla/js/tests/js1_5/Regress/regress-321757.js,v <-- regress-321757.js
Flags: testcase+
Attached patch proposed fixSplinter Review
Straightforward fix, minimized by virtue of existing strict warning check in js_GetProperty. Note that SpiderMonkey already requires the global object to be native (to satisfy OBJ_IS_NATIVE). This patch ups the ante slightly by requiring the global object's JSObjectOp.getProperty to be js_GetProperty or a wrapper around js_GetProperty, or else to contain this kind of extant property op check and error code. /be
Attachment #210210 - Flags: superreview?(shaver)
Attachment #210210 - Flags: review?(mrbkap)
Comment on attachment 210210 [details] [diff] [review] proposed fix r=mrbkap
Attachment #210210 - Flags: review?(mrbkap) → review+
Fixed, with the extra "not" in the jsopcode.tbl comment removed. /be
Status: ASSIGNED → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
verified fixed trunk 20060328 win/mac/linux
Status: RESOLVED → VERIFIED
fixed by Bug 336373 on the 1.8.1 branch. verified fixed 1.8.1 with windows/macppc/linux 20060707
Keywords: verified1.8.1
Attachment #210210 - Flags: superreview?(shaver)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: