Closed Bug 344959 Opened 19 years ago Closed 19 years ago

Functions may lose part or all of their scope chain after an exception

Categories

(Core :: JavaScript Engine, defect, P1)

All
Windows Server 2003
defect

Tracking

()

VERIFIED FIXED
mozilla1.8.1beta2

People

(Reporter: Seno.Aiko, Assigned: brendan)

References

Details

(Keywords: verified1.8.0.7, verified1.8.1)

Attachments

(4 files, 2 obsolete files)

(Build identifier: latest CVS head JS shell) If an exception happens during the execution of a function then the function cannot access the variables in its scope chain any longer. As an example, this statement works as expected and yields "with": with ({x:"with"}) (function() { try {} catch(exc) {}; return x })() But this (same as above, just a |throw 1| added) produces a reference error (or the value of x in the global scope, if it exists): with ({x:"with"}) (function() { try { throw 1 } catch(exc) {}; return x })() This also happens if you use the new |let| statement instead of |with|, but it's not a regression from JS 1.7, I also see this in Firefox 1.5.0.4.
Attached file testcase
Taking, patch next. /be
Assignee: general → brendan
Attached patch fix (obsolete) — Splinter Review
This is an old bug, which goes back to a fix that shaver and I did -- it would be good to get shaver's sr. I didn't dress up the JS_SetPrivate calls with any kind of with-specific veneer, preferring to keep things concrete and avoid yet another layer. /be
Attachment #229551 - Flags: superreview?(shaver)
Attachment #229551 - Flags: review?(mrbkap)
Fairly significant standards-conformance bug, more severe in light of "let". /be
Status: NEW → ASSIGNED
Flags: blocking1.8.1?
Priority: -- → P1
Hardware: PC → All
Target Milestone: --- → mozilla1.8.1beta2
Attachment #229551 - Flags: review?(mrbkap) → review+
Comment on attachment 229551 [details] [diff] [review] fix sr=shaver.
Attachment #229551 - Flags: superreview?(shaver) → superreview+
Attached patch fix, v2Splinter Review
Attachment #229551 - Attachment is obsolete: true
Attachment #229566 - Flags: superreview?(shaver)
Attachment #229566 - Flags: review?(mrbkap)
Nominating for 1.8.0.6/Firefox 1.5.0.6 since this regressed after Firefox 1.0, in February 2005 (rev 3.162 of jsinterp.c). /be
Flags: blocking1.8.0.6?
Summary: Functions lose their scope chain after an exception → Functions may lose part or all of their scope chain after an exception
Attachment #229566 - Flags: review?(mrbkap) → review+
Attachment #229566 - Flags: approval1.8.1?
Fixed on trunk. /be
Status: ASSIGNED → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
Checking in regress-344959.js; /cvsroot/mozilla/js/tests/js1_5/Regress/regress-344959.js,v <-- regress-344959.js initial revision: 1.1
Flags: in-testsuite+
Attachment #229566 - Flags: approval1.8.1? → approval1.8.1+
Fixed on the 1.8 branch. /be
Keywords: fixed1.8.1
Attachment #229525 - Attachment description: tetcase → testcase
Calling for code review just because 1.8.0 branch lacks let/block-scope. /be
Attachment #229723 - Flags: superreview?(shaver)
Attachment #229723 - Flags: review?(mrbkap)
Attachment #229723 - Flags: approval1.8.0.6?
Attachment #229723 - Flags: review?(mrbkap) → review+
Comment on attachment 229723 [details] [diff] [review] 1.8.0 branch patch sr=shaver.
Attachment #229723 - Flags: superreview?(shaver) → superreview+
*** Bug 345182 has been marked as a duplicate of this bug. ***
verified fixed 1.8.1, trunk 20060723 win/linux/mac(ppc|tel)
Status: RESOLVED → VERIFIED
Flags: blocking1.8.0.7? → blocking1.8.0.7-
Comment on attachment 229723 [details] [diff] [review] 1.8.0 branch patch Not blocking, but we'll take the patch if you get it in by the deadline. approved for 1.8.0 branch, a=dveditz for drivers
Attachment #229723 - Flags: approval1.8.0.7? → approval1.8.0.7+
I'm checking this in -- it would be wrong not to fix bug 347674, since the patch for this bug contains the regression (by way of bug 343765). /be
Attachment #233115 - Flags: superreview+
Attachment #233115 - Flags: review+
Oops, copied wrong patch to staging directory. /be
Attachment #233115 - Attachment is obsolete: true
Attachment #233116 - Flags: superreview+
Attachment #233116 - Flags: review+
Fixed on the 1.8.0 branch. /be
Keywords: fixed1.8.0.7
Flags: blocking1.8.1?
2006081103 1.8.0.7 appears to assert in shell windows/mactel/linux and browser windows/mac(ppc|tel)/linux on js1_5/Regress/regress-344959.js, JSVAL_TO_OBJECT(v) == OBJ_GET_PARENT(cx, thisp), at jsinterp.c:506
Whiteboard: [not-fixed1.8.0.7]
Blocks: 348635
verified fixed 1.8.0.7 20060818 windows/mac*/linux
I'm removing the whiteboard "not-fixed1.8.0.7" comment on the assumption it was due to the assertion covered by bug 337378, since Bob later added the verified1.8.0.7 keyword.
Whiteboard: [not-fixed1.8.0.7]
Attachment #229566 - Flags: superreview?(shaver)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: