On Mar 10, 12:26 am, cc <[email protected]> wrote:
> On 2010-03-09 22:12, Dave Land wrote:
>
>
>
> > On Mar 9, 2010, at 9:44 PM, Dave Land wrote:
>
> >> The "anonymous function wrapper" ensures that the script's
> >> identifiers don't collide with identifiers in JavaScript in the page
> >> itself. All of the script's identifiers exist only within the
> >> anonymous function, so they can't "leak out" into the page, or vice
> >> versa � the script's identifiers are all local to the script.
>
> > And so forth...
>
> > I thought I could find where it is documented that this is an archaic
> > way of writing GM scripts, but I can't find it now.
>
> > I wonder if someone can explain to us: does GM automatically wrap user
> > scripts in an anonymous function (or the equivalent) to gain the
> > security and scoping benefits I named above? Is it overkill to add the
> > anon function in your own user scripts?
>
> Yes, it is. Seehttp://wiki.greasespot.net/Metadata_Block#.40unwrap
> (Actually, GM wraps *twice* -- once with an anonymous function, for
> compatibility and reliability, and once with evalInSandbox, for
> security. This last wrapping is what's responsible for unsafeWindow and
> friends, or more accurately for why there's a distinction possible
> between unsafeWindow and window.)
>
> --
> cc | pseudonymous |<http://carlclark.mp/>

Sounds good. If GM double-wraps my code, I don' really have to wrap it
myself :)

Thank you!

-- 
You received this message because you are subscribed to the Google Groups 
"greasemonkey-users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/greasemonkey-users?hl=en.

Reply via email to