From MozillaWiki
Jump to: navigation, search


Accepted, ready for implementation.


  • 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 ... */

Open Issues

  • None