Closed Bug 65553 Opened 24 years ago Closed 24 years ago

var x = 0 and x = 0 may set x differently due to JS API bug

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

VERIFIED FIXED
mozilla0.8

People

(Reporter: brendan, Assigned: brendan)

References

()

Details

(Keywords: js1.5)

Attachments

(4 files)

JS_Evaluate*Script* and JS_ExecuteScript all call js_Execute, passing the "obj"
API param as the "chain" formal param.  js_Execute uses that chain object for
the scope chain of the new execution context, and also as the variables object
(ECMA parlance) of the new frame when called from these API entry points (not
when called from eval or eval-like entry points).

That's wrong: the variables object should be the global object, which is the
last object on the scope chain that starts at "obj" (API param) or "chain"
(js_Execute param).  Trivial patch in a minute, please review and approve ASAP.
Thanks,

/be
Status: NEW → ASSIGNED
Keywords: js1.5, mozilla0.8
Target Milestone: --- → mozilla0.8
Attached patch proposed fixSplinter Review
r=mccabe.

I also ran the testsuite and saw no new failures with this bug.  (Good to be
careful with scoping changes.)
sr=jband
Fix checked in -- thanks all!

/be
Status: ASSIGNED → RESOLVED
Closed: 24 years ago
Resolution: --- → FIXED
This fix caused bugs 65860 and 65828. We're going to back it out.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Changes backed out ... r=attinasi@netscape.com (sheriff)

mozilla/js/src/jsapi.c     revision 3.83
mozilla/js/src/jsdbgapi.c  revision 3.22
mozilla/js/src/jsemit.c    revision 3.44
mozilla/js/src/jsinterp.c  revision 3.68
mozilla/js/src/jsinterp.h  revision 3.18
mozilla/js/src/jsobj.c     revision 3.76
mozilla/js/src/jsscript.c  revision 3.26
Curses -- prefs and xpinstall count on an API bug.  I'll do a patch that cleans
up the internals, adds a better API, and keeps the old APIs working as before.

/be
Status: REOPENED → ASSIGNED
Seems like an obscure flag to tweak for those not in the know; I'd add a verbose
comment.
sr=jband
r=mccabe.

Wow, big comment!  Maybe 'Use of this option recommended' in it's own paragraph
early, for lazy readers.

Bye.  See me soon at mike+mozilla@meer.net, or bang on Dawn if it doesn't
change.
This time for sure!

/be
Status: ASSIGNED → RESOLVED
Closed: 24 years ago24 years ago
*Sorry for the SPAM*
Mid Air collision / bugzilla cleanup
Current bug state Resolved and NO Resolution.
Status: RESOLVED → REOPENED
marking Resolved / fixed
Status: REOPENED → RESOLVED
Closed: 24 years ago24 years ago
Resolution: --- → FIXED
Marking Verified - 
Status: RESOLVED → VERIFIED
Keywords: mozilla0.8
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: