Breaking the grip JS has on the DOM: Difference between revisions

m
Line 41: Line 41:
The existing nsIScriptContext interface will remain tied to a specific language.  The "void *" params in its interface will remain.  This means that a "void *" and a suitable nsIScriptContext must always be treated as a pair (ie, given just a "void *", there is no way to determine an appropriate nsIScriptContext suitable for it.  See [[#nsIScriptContext]]
The existing nsIScriptContext interface will remain tied to a specific language.  The "void *" params in its interface will remain.  This means that a "void *" and a suitable nsIScriptContext must always be treated as a pair (ie, given just a "void *", there is no way to determine an appropriate nsIScriptContext suitable for it.  See [[#nsIScriptContext]]


nsIProgrammingLanguage constants will internally identify a language offering an efficient array-based implementation whenever a language object is required.  The nsIDOMScriptObjectFactory will be able to convert language named to IDs and will be responsible for instantiating new language runtimes.
nsIProgrammingLanguage constants will internally identify a language offering an efficient array-based implementation for multiple languages.  The nsIDOMScriptObjectFactory will be able to convert language names to IDs and will be responsible for instantiating new language runtimes.


The existing nsIScriptGlobalObject interface will move towards a model where there is a global nsIScriptContext per language.  GetGlobalJSObject and GetContext would be replaced with GetLanguage* methods (hard-coding nsIProgrammingLanguage::JAVASCRIPT) where necessary.  Thus, nsIScriptGlobalObject may have many nsIScriptContexts associated with it (one per supported and initialized language).  The script global itself is responsible for preparing itself to work with a specific language.  See [[#nsIScriptGlobalObject and nsGlobalWindow]]
The existing nsIScriptGlobalObject interface will move towards a model where there is a global nsIScriptContext per language.  GetGlobalJSObject and GetContext would be replaced with GetLanguageGlobal and GetLanguageContext methods (hard-coding nsIProgrammingLanguage::JAVASCRIPT) where necessary.  Thus, nsIScriptGlobalObject may have many nsIScriptContexts associated with it (one per supported and initialized language).  The script global itself is responsible for preparing itself to work with a specific language, but will only do so via an explicit request to EnsureScriptEnvironment() for a language.  See [[#nsIScriptGlobalObject and nsGlobalWindow]]


A new context stack may need to be invented - see [[#Context Stack]]
A new context stack may need to be invented - see [[#Context Stack]]
32

edits