On Wed, Mar 13, 2013 at 4:44 PM, Benjamin Kalman <[email protected]>wrote:

> Not really feasible, monkey patching is an idiom that JS developers would
> get very upset about being taken away from them. Plus lots of libraries do
> it. We had a hard enough problem (and in fact failed) forbidding eval. And
> likewise freezing globals etc. Philosophically it's just sad if we forbid
> existing features of a platform because it's too hard to implement.
>

Well, but "too hard to implement" is not the reason. You're not asking how
you can implement monkey-patching; you're asking how you can
stop/limit/blacklist/undo/circumvent it because it's harmful. The way I see
it, the platform is shooting itself in the foot, repeatedly, but it gets
angry at us when we suggest to take away its gun.

 Lastly - I am not really sure about how harmony proxies work, but it
> sounds like we're told after they change not before they change? If not,
> that would certainly be a neater solution than what we're doing for JSON
> (saving function references on load), but I can see it getting messy with
> prototypes.
>

I guess the best you can do is before you hand the context over to the
extension, create a copy of all the library functions/objects you care
about. Then you can restore that as necessary when control comes back to
your code. It should be possible to package this behavior relatively
nicely; maybe a custom alternate global object helps (so you wouldn't have
to restore anything, you'd just mechanically
s/Array/original_global.Array/g in your code). You don't need proxies for
this, nor any other way to observe what the extension is mucking with.


> Cheers,
> Ben.
>
> --
> --
> v8-users mailing list
> [email protected]
> http://groups.google.com/group/v8-users
> ---
> You received this message because you are subscribed to the Google Groups
> "v8-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
-- 
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to