Scripts with @grant none and early return never run #1568

Closed
Ventero opened this Issue Jun 17, 2012 · 1 comment

Comments

Projects
None yet
2 participants
@Ventero
Contributor

Ventero commented Jun 17, 2012

When installing a script which doesn't use the GM_* API (or explicitly contains @grant none) and contains an early return, the script is never run. An example script can be found here, with GM 0.9, this script would show an alert, with GM HEAD it doesn't.

The reason is that since the script has an implicit (or explicit) @grant none, it isn't initially wrapped inside an anonymous function in service#injectScripts. But since it also doesn't specify an @unwrap metadata key, it's not run again (wrapped in an anonymous function) after throwing a "return not in function" error.

For backwards compatibility, one of the two checks should be removed.

@arantius

This comment has been minimized.

Show comment
Hide comment
@arantius

arantius Jun 17, 2012

Collaborator

it isn't initially wrapped inside an anonymous function in service#injectScripts.

That seems to be the real bug. I shouldn't have done that.

Collaborator

arantius commented Jun 17, 2012

it isn't initially wrapped inside an anonymous function in service#injectScripts.

That seems to be the real bug. I shouldn't have done that.

@arantius arantius closed this in 361d9ff Jun 17, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment