Closed Bug 574299 Opened 15 years ago Closed 15 years ago

TM: implement a runtime-wide wrap hook

Categories

(Core :: JavaScript Engine, defect)

Other Branch
x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: gal, Assigned: gal)

Details

(Whiteboard: fixed-in-tracemonkey)

Attachments

(1 file, 1 obsolete file)

Add a wrap hook that the engine invokes every time an object crosses a compartment boundary. This can be used to wrap objects into specialized JSCrossCompartmentWrappers that implement an access policy in addition to the mere cross compartment functionality. virtual bool filter(JSContext *cx, JSObject *proxy, jsval id = JSVAL_VOID); virtual bool enter(JSContext *cx, JSObject *proxy, void **statep); virtual void leave(JSContext *cx, JSObject *proxy, void *state); filter() can be used to filter out properties. enter() and leave() are called around wrapper operations (PIERCE). For-each iterator objects are censored since there is no good way to filter them. A specific wrapper can overwrite this behavior by providing its own implementations for this derived API: virtual bool filterProps(JSContext *cx, JSObject *proxy, js::AutoValueVector &props); virtual bool filterIterator(JSContext *cx, JSObject *proxy, jsval *vp); A highly transparent wrapper might want to overwrite filterIterator() and always permit it (just return "true", don't filter).
Attached patch patch (obsolete) — Splinter Review
Assignee: general → gal
Attachment #453678 - Flags: review?(jorendorff)
Attached patch patchSplinter Review
Attachment #453678 - Attachment is obsolete: true
Attachment #453678 - Flags: review?(jorendorff)
Attachment #453807 - Attachment is patch: true
Attachment #453807 - Attachment mime type: application/octet-stream → text/plain
Attachment #453807 - Flags: review?(jorendorff)
Comment on attachment 453807 [details] [diff] [review] patch Good first cut.
Attachment #453807 - Flags: review?(jorendorff) → review+
Whiteboard: fixed-in-tracemonkey
Status: NEW → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: