NPAPI:DocumentOrigin: Difference between revisions

From MozillaWiki
Jump to navigation Jump to search
Line 5: Line 5:
= Contributors =
= Contributors =


* Last modified: August 7, 2011
* Last modified: August 8, 2011
* Authors: Josh Aas (Mozilla Corporation)
* Authors: Josh Aas (Mozilla Corporation)
* Contributors:  
* Contributors:


= Problem Summary =
= Problem Summary =

Revision as of 15:31, 8 August 2011

Status

Under Consideration

Contributors

  • Last modified: August 8, 2011
  • Authors: Josh Aas (Mozilla Corporation)
  • Contributors:

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 = TBA

The value for this variable will be an NFKC-encoded (normalized) UTF-8 origin. 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