Add @grant metadata #1425

Closed
arantius opened this Issue Sep 23, 2011 · 3 comments

Comments

Projects
None yet
2 participants
@arantius
Collaborator

arantius commented Sep 23, 2011

There should be a metadata imperative like @grant that would grant access to special APIs.

A value of @grant none would mean that the script has no special API access, and will instead execute within the content scope.

Any other value provided to @grant would run the script in legacy (sandbox / wrappers) mode, with only the named APIs provided. This imperative can be repeated as many times as necessary to request access to all necessary functions.

If a script has no @grant at all, at install time, it and its @requires will be scanned for implied APIs. The appropriate @grants to provide the discovered APIs will be implicitly provided.

@johan

This comment has been minimized.

Show comment
Hide comment
@johan

johan Sep 23, 2011

Collaborator

The implication that an explicit @grant none makes all undeclared GM_* identifiers used in the script (or its @require files) syntax errors sounds good.

I could see surfacing @grant status (mostly the boolean "none" vs "some", and maybe also vs "undeclared") in the script list at some point too, as a dev / power user aid.

Collaborator

johan commented Sep 23, 2011

The implication that an explicit @grant none makes all undeclared GM_* identifiers used in the script (or its @require files) syntax errors sounds good.

I could see surfacing @grant status (mostly the boolean "none" vs "some", and maybe also vs "undeclared") in the script list at some point too, as a dev / power user aid.

@arantius

This comment has been minimized.

Show comment
Hide comment
@arantius

arantius Sep 26, 2011

Collaborator

The implication that an explicit @grant none makes all undeclared GM_* identifiers used in the script (or its @require files) syntax errors sounds good.

Well, today they're all functions, and they would be undefined, so calling undefined will be a syntax error without us doing anything.

Collaborator

arantius commented Sep 26, 2011

The implication that an explicit @grant none makes all undeclared GM_* identifiers used in the script (or its @require files) syntax errors sounds good.

Well, today they're all functions, and they would be undefined, so calling undefined will be a syntax error without us doing anything.

arantius added a commit to arantius/greasemonkey that referenced this issue May 22, 2012

arantius added a commit to arantius/greasemonkey that referenced this issue May 22, 2012

arantius added a commit to arantius/greasemonkey that referenced this issue May 22, 2012

@arantius

This comment has been minimized.

Show comment
Hide comment
@arantius

arantius Jun 15, 2012

Collaborator

This seems to be working.

Collaborator

arantius commented Jun 15, 2012

This seems to be working.

@arantius arantius closed this Jun 15, 2012

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