NPAPI:DocumentOrigin: Difference between revisions
Jump to navigation
Jump to search
(Created page with "= Status = Under Consideration = Contributors = * Last modified: August 7, 2011 * Authors: Josh Aas (Mozilla Corporation) * Contributors: = Problem Summary = Plugins freque...") |
No edit summary |
||
(10 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
= Status = | = Status = | ||
Accepted, ready for implementation. | |||
= Contributors = | = Contributors = | ||
* Last modified: | * Last modified: September 9, 2011 | ||
* Authors: Josh Aas (Mozilla Corporation) | * Authors: Josh Aas (Mozilla Corporation) | ||
* Contributors: | * Contributors: Boris Zbarsky (Mozilla Corporation) | ||
= Problem Summary = | = Problem Summary = | ||
Plugins frequently need to make security decisions based on document | Plugins frequently need to make security decisions based on document origins. This is usually done using NPRuntime to access <code>window.location</code> in the DOM. We should provide a secure and convenient way to access an instance's document origin. | ||
= Current Proposal = | = Current Proposal = | ||
Line 17: | Line 17: | ||
The following NPAPI variable will be added: | The following NPAPI variable will be added: | ||
NPNVdocumentOrigin = 22 | |||
The value for this variable will be an NFKC-encoded (normalized) UTF-8 | The value for this variable will be the [http://www.whatwg.org/specs/web-apps/current-work/multipage/origin-0.html#unicode-serialization-of-an-origin Unicode serialization] of the origin converted to NFKC-encoded (normalized) UTF-8. Memory for this string must be freed by the plugin via <code>NPN_MemFree</code>. | ||
char *docOrigin = NULL; | |||
NPError error = NPN_GetValue(instance, | NPError error = NPN_GetValue(instance, NPNVdocumentOrigin, &docOrigin); | ||
/* ... use URL ... */ | |||
NPN_MemFree(docOrigin); | |||
= Open Issues = | = Open Issues = | ||
* None | * None |
Latest revision as of 17:18, 9 September 2011
Status
Accepted, ready for implementation.
Contributors
- Last modified: September 9, 2011
- Authors: Josh Aas (Mozilla Corporation)
- Contributors: Boris Zbarsky (Mozilla Corporation)
Problem Summary
Plugins frequently need to make security decisions based on document origins. This is usually done using NPRuntime to access window.location
in the DOM. We should provide a secure and convenient way to access an instance's document origin.
Current Proposal
The following NPAPI variable will be added:
NPNVdocumentOrigin = 22
The value for this variable will be the Unicode serialization of the origin converted to NFKC-encoded (normalized) UTF-8. Memory for this string must be freed by the plugin via NPN_MemFree
.
char *docOrigin = NULL; NPError error = NPN_GetValue(instance, NPNVdocumentOrigin, &docOrigin); /* ... use URL ... */ NPN_MemFree(docOrigin);
Open Issues
- None