Plugins:CustomScriptTypeSupport
Status
Being written
Background
The HTML specification of the <script> tag defines a type attribute that allows for languages other than javascript to be used. There is even a META declaration that allows changing the default script type for a whole page.
The current revision of NPAPI cannot be used to provide custom script interpreters. Projects like PyDOM and Kamen Lisp must rely on the deprecated XPCOM plugin API to work. Current NPAPI solutions require passing the custom script text through javascript as strings; this second-class treatment introduces problems such as an added level of escape sequences.
Since NPAPI provides a good framework for loading plugins based on MIME type and otherwise interacting with the browser, it may be reasonable to add the missing hook(s) to make custom script types possible.
Current Proposal
When a custom script type is first detected on a page,
- Look for a plugin handling the script's type (can be cached)
- Query NP_GetValue to see if it supports custom scripts of the given type (can be cached)
- If so, NPP_New a windowless plugin instance to handle all scripts on the page. Otherwise use the current behavior of ignoring the script. (It might be good to print a status message or log an error.)
- NPP_Destroy this instance when the page is closed