Hi, I'm trying to understand what happens when you declare a variable
in an in-content (@grant none) and unwrapped script.

Consider this example:

// ==UserScript==
// @name          Test script
// @include       *
// @grant         none
// ==/UserScript==

var testvar = 1;


As I understand it, this script will be run in the content scope and
without an anonymous function wrapper. So I expected that 'testvar'
would get added to the global window object and be available to the
page's scripts (and possibly over-write an existing global 'testvar'
variable set by the page), but that doesn't appear to be the case.

I've probably misunderstood something, but does that mean that even
when a script is run unwrapped and in content scope, it's safe to
declare variables at the top level of the script, and they won't
affect any in-page global variables of the same name?

-- 
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