Closed Bug 56206 Opened 24 years ago Closed 24 years ago

superglobal-based JS embeddings burned by fun_resolve

Categories

(Core :: JavaScript Engine, defect, P1)

defect

Tracking

()

VERIFIED FIXED
mozilla0.8

People

(Reporter: brendan, Assigned: brendan)

Details

(Keywords: js1.5)

Attachments

(2 files)

because fun_resolve uses js_NewObject(cx, &js_ObjectClass, proto, NULL) where proto is the "parent proto" or superglobal's function.prototype property value, and NULL as the 4th arg causes js_NewObject to default the new object's parent from proto.constructor.__parent__ (which is the superglobal). You end up with cloned function objects have .prototypes that are proto-clones of the original function object's .prototype, but the child .prototypes have as their __parent__ the superglobal! Bad parenting here can lead to other bugs and confusion later. Patch coming up. /be
Severity: normal → major
Status: NEW → ASSIGNED
Target Milestone: --- → mozilla0.9
Attached patch proposed fixSplinter Review
I can't write today to save my ass. Sorry for the mangled syntax there! Gimme r= and a= love, ok? /be
Better patch coming up. No need for separate JS_SetPrototype given non-null parent arg to js_NewObject. /be
Keywords: js1.5
Anyone have time to study this patch? Ask me questions! /be
Adding r= buddies, soliciting r= and a=. /be
Target Milestone: mozilla0.9 → mozilla0.8
High priority for me, want to get this patch in soon. /be
Priority: P3 → P1
Meow? /be
Wow, I want to use 'ad perniciem' in my comments. Is there an essay somewhere on just how superglobals work? r=mccabe.
Superglobals are mainly documented by newsgroup postings, such as http://x53.deja.com/%5BST_rn=ps%5D/getdoc.xp?AN=541478652&CONTEXT=975966602.402128927&hitnum=8 (That flagrant latinism was from shaver. ;-) Thanks for the r= -- on to jband. /be
Keywords: mozilla0.8
sr=jband
Fixed. /be
Status: ASSIGNED → RESOLVED
Closed: 24 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: