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 |
||
Line 11: | Line 11: | ||
= Problem Summary = | = Problem Summary = | ||
Plugins frequently need to make security decisions based on document URLs. This is usually done using NPRuntime to access | Plugins frequently need to make security decisions based on document URLs. 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 and instance's document URL. | ||
= Current Proposal = | = Current Proposal = | ||
Line 19: | Line 19: | ||
NPNVdocumentURL = TBA | NPNVdocumentURL = TBA | ||
The value for this variable will be an NFKC-encoded (normalized) UTF-8 URL. | The value for this variable will be an NFKC-encoded (normalized) UTF-8 URL. Memory for this string must be freed by the plugin via <code>NPN_MemFree</code>. | ||
char *docURL = NULL; | |||
NPError error = NPN_GetValue(instance, NPNVdocumentURL, ); | NPError error = NPN_GetValue(instance, NPNVdocumentURL, (void*)&docURL); | ||
/* ... use URL ... */ | |||
NPN_MemFree(docURL); | |||
= Open Issues = | = Open Issues = | ||
* None | * None |
Revision as of 03:17, 8 August 2011
Status
Under Consideration
Contributors
- Last modified: August 7, 2011
- Authors: Josh Aas (Mozilla Corporation)
- Contributors:
Problem Summary
Plugins frequently need to make security decisions based on document URLs. This is usually done using NPRuntime to access window.location
in the DOM. We should provide a secure and convenient way to access and instance's document URL.
Current Proposal
The following NPAPI variable will be added:
NPNVdocumentURL = TBA
The value for this variable will be an NFKC-encoded (normalized) UTF-8 URL. Memory for this string must be freed by the plugin via NPN_MemFree
.
char *docURL = NULL; NPError error = NPN_GetValue(instance, NPNVdocumentURL, (void*)&docURL); /* ... use URL ... */ NPN_MemFree(docURL);
Open Issues
- None