On Sat, Nov 28, 2009 at 6:52 PM, Stephan Beal <[email protected]> wrote: > On Sat, Nov 28, 2009 at 5:09 PM, Christian Plesner Hansen > <[email protected]> wrote: >> >> Try reading a property, invoking a method, or generally doing any >> nontrivial operation that involves an external. If you're lucky the >> results will just be unpredictable but you probably don't have to try >> too many things before you find something that crashes the vm. > > i believe there's a partial workaround, though: you can create an arbitrary > object and use SetHiddenField() (not SetInternalField(), which is different) > to store your external in it. Then JS won't ever get a handle to the > external, and you can extract it in your callback functions. The > HiddenField() mechanism also offers an additional level of safety, since you > can apply an arbitrary name to the field (as opposed to an internal field > _number_), which simplifies verification of the object's origin.
Oh right. I've used that before, but I always forget about it. What is the difference internally between SetInternalField(), which is a bit annoying because you need to do SetInternalFieldSize() on the function template, and the simpler SetHiddenField()? Would it make sense to remove SetInteralField() and only have SetHiddenField() (modulo compatibility problems)? -- v8-users mailing list [email protected] http://groups.google.com/group/v8-users
