Closed Bug 315990 Opened 20 years ago Closed 20 years ago

"this.statement.causes.an.error" is ignored instead of throwing

Categories

(Core :: JavaScript Engine, defect, P1)

1.8 Branch
defect

Tracking

()

VERIFIED FIXED
mozilla1.9alpha1

People

(Reporter: jruderman, Assigned: brendan)

Details

(Keywords: regression, verified1.8.1)

Attachments

(2 files)

The statement "this.statement.causes.an.error" is ignored instead of throwing an exception. It seems like the statement is being optimized away. This regressed on the MOZILLA_1_8_BRANCH between 2005-09-22 and 2005-09-23. Gecko/20050923 Firefox/1.4 FAIL (does not throw an error) "Warning: useless expression" Gecko/20050922 Firefox/1.4 PASS (throws an error) "Warning: reference to undefined property this.statement"
Attached file testcase —
I hit this bug because I had used "this.line.causes.an.error" as an example for the http://www.squarefree.com/jsenv/. I changed the example to "this.statement.causes(an.error)" to work around this bug.
Useless useless expression eliminator! /be
Assignee: general → brendan
Blocks: js1.6rc1
Keywords: js1.6
OS: Windows XP → All
Priority: -- → P1
Hardware: PC → All
Target Milestone: --- → mozilla1.9alpha
Attached patch fix — — Splinter Review
The fix for bug 308085 exposed a very old latent logic bug. Patch should be easy to follow: any foo.bar expression (it doesn't matter whether foo is an identifier, this, true, false, null, or a more complex expression) might call a getters, so it must be presumed useful. The pn2->pn_type == TOK_NAME condition was in the wrong place, alas -- it should not prevent a dotted expression in pn from being handled by the then clause of the outer if, but it should guard the call to LookupArgOrVar. /be
Attachment #202630 - Flags: review?(mrbkap)
Comment on attachment 202630 [details] [diff] [review] fix r=mrbkap
Attachment #202630 - Flags: review?(mrbkap) → review+
Fixed on trunk. /be
Status: NEW → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
/cvsroot/mozilla/js/tests/js1_5/Regress/regress-315990.js,v <-- regress-315990.js initial revision: 1.1
Flags: testcase+
verified windows/linux/mac trunk
Status: RESOLVED → VERIFIED
Flags: blocking1.8.1?
Flags: blocking1.8.1? → blocking1.8.1+
Attachment #202630 - Flags: approval1.8.1+
Whiteboard: [checkin needed]
Keywords: fixed1.8.1
Whiteboard: [checkin needed]
verified fixed 1.8.1 20060707 win/macppc/linux
not fixed on 1.8.0, not making js16
No longer blocks: js1.6rc1
Keywords: js1.6
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: