Closed Bug 643101 Opened 14 years ago Closed 12 years ago

lookupProperty, deleteProperty, get/setAttributes, setProperty need to pass through the receiver object

Categories

(Core :: JavaScript Engine, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: gal, Assigned: gal)

References

Details

Attachments

(3 files, 3 obsolete files)

proxy traps want it, amongst others
Attached patch lookupProperty (obsolete) — Splinter Review
Assignee: general → gal
This doesn't pipe receiver into Set/GetAttribute and Delete yet. The next patch will do that.
Comment on attachment 520419 [details] [diff] [review] lookupProperty Bounce to jorendorff if you are overloaded?
Attachment #520419 - Flags: review?(brendan)
Blocks: 643100
Summary: lookupProperty needs to pass through the receiver object → lookupProperty, deleteProperty, get/setAttributes, setProperty need to pass through the receiver object
Attachment #520419 - Attachment description: patch → lookupProperty
Attached patch deleteProperty (step 2) (obsolete) — Splinter Review
Attachment #520427 - Flags: review?(brendan)
Attachment #520428 - Flags: review?(brendan)
Attached patch setProperty (step 4) (obsolete) — Splinter Review
Attachment #520429 - Flags: review?(brendan)
I found at least 3 bugs reviewing the code (obj instead of obj2 used after FindProperty, with_getProperty didn't pass receiver through). Please look over my changes very carefully. I really don't like that we have the shortcut signature for lookupProperty without receiver. That hides bugs imo.
jorendorff, waldo, if either of you wants to steal this I am sure Brendan doesn't mind. This needs some very carefully looking and reasoning for every hunk.
Attachment #520419 - Attachment is obsolete: true
Attachment #520419 - Flags: review?(brendan)
Attachment #520430 - Attachment is patch: true
Attachment #520430 - Attachment mime type: application/octet-stream → text/plain
Attachment #520430 - Flags: review?(brendan)
Attachment #520427 - Attachment description: deleteProperty → deleteProperty (step 2)
Attachment #520428 - Attachment description: get/setAttributes → get/setAttributes (step 3)
Attachment #520429 - Attachment description: setProperty → setProperty (step 4)
I had to back off the change in FOR_GNAME (I picked up obj2 there instead of obj, but obj2 can be NULL). It should be the global obj either way. No need to mess with this I guess.
Attachment #520429 - Attachment is obsolete: true
Attachment #520429 - Flags: review?(brendan)
Attachment #520431 - Flags: review?(brendan)
Attachment #520427 - Attachment is obsolete: true
Attachment #520427 - Flags: review?(brendan)
Attachment #520431 - Flags: review?(brendan) → review?(jorendorff)
Attachment #520430 - Flags: review?(brendan) → review?(jorendorff)
Attachment #520428 - Flags: review?(brendan) → review?(jorendorff)
Um. What happened to part 2? Still wanted, right?
Jason, lets touch base real quick.
Comment on attachment 520431 [details] [diff] [review] setProperty (part4) part 4 first, naturally... In jsfun.cpp, StrictArgSetter > return js_DeleteProperty(cx, obj, obj, id, tvr.addr(), strict) && >- js_SetProperty(cx, obj, id, vp, strict); >+ js_SetProperty(cx, obj, obj, id, vp, strict); Micro-nit: The indentation was right before. In jsobj.cpp: > static JSBool > with_GetProperty(JSContext *cx, JSObject *obj, JSObject *receiver, jsid id, Value *vp) > { >- return obj->getProto()->getProperty(cx, id, vp); >+ return obj->getProto()->getProperty(cx, receiver, id, vp); > } We don't ever want to pass the With object anywhere an actual *object* is expected--With objects aren't even supposed to exist, right? So pass obj->getProto() instead. If you want, this could even JS_ASSERT(receiver == obj); in both with_GetProperty and with_SetProperty. For that to fail, the object would have to have already been exposed--a capital offense. I can't get this to bite in a test, because we have defense in depth against With objects escaping. But please do fix it. In jsproxy.cpp: > static JSBool >-proxy_SetProperty(JSContext *cx, JSObject *obj, jsid id, Value *vp, JSBool strict) >+proxy_SetProperty(JSContext *cx, JSObject *obj, JSObject *receiver, jsid id, Value *vp, JSBool strict) > { > return JSProxy::set(cx, obj, obj, id, strict, vp); > } Huh. This looks wrong to me--should be (cx, obj, receiver...), right? Again, I can't trip it up in the shell. Does this just never get called?
Attachment #520431 - Flags: review?(jorendorff) → review+
Attachment #520430 - Flags: review?(jorendorff)
Comment on attachment 520428 [details] [diff] [review] get/setAttributes (step 3) Clearing review flags for now (we don’t think the other patches are needed).
Attachment #520428 - Flags: review?(jorendorff)
Marking this bug as invalid since it is not relevant with the direct proxies design. Feel free to change the status if I'm mistaken.
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: