Skip to content
This repository

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

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

2 participants

Ventero arantius
Ventero

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

arantius arantius closed this issue from a commit June 17, 2012
arantius Properly anon wrap with @grant none.
Still don't wrap by default, but now _do_ wrap when early return is
detected.

Fixes #1568
361d9ff
arantius arantius closed this in 361d9ff June 17, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.