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

Jump to navigation Jump to search
m
jsval
m (popped)
m (jsval)
Line 40: Line 40:
A new 'context stack' will be invented:
A new 'context stack' will be invented:
* nsIScriptContexts to be used directly on the stack, rather than JSContext (hmm - is this necessary?  I guess a "void *" would still work so long as it was associated with the language)
* nsIScriptContexts to be used directly on the stack, rather than JSContext (hmm - is this necessary?  I guess a "void *" would still work so long as it was associated with the language)
* Contexts for *all* languages are pushed and popped as a single operation - a new context applies to all languages in the environment, not just a single one.  This is so when calls cross multiple language boundaries, they always have a correct context, not just the last one that happened to be pushed for their language.
* Contexts for *all* languages are pushed and poped as a single operation - a new context applies to all languages in the environment, not just a single one.  This is so when calls cross multiple language boundaries, they always have a correct context, not just the last one that happened to be pushed for their language.


The special casing for js in nsDOMClassInfo will need a fair bit of work, and significant help from Mozilla resources.
The special casing for js in nsDOMClassInfo will need a fair bit of work, and significant help from Mozilla resources.
Line 64: Line 64:
* FinalizeClasses method - JS does the ClearScope/ClearWatchpointsForObject/ClearRegExpStatistics?
* FinalizeClasses method - JS does the ClearScope/ClearWatchpointsForObject/ClearRegExpStatistics?


* nsIArray to be used in place of JSVal argc/argv used now.  nsIPropertyBag may be a better choice in some cases - eg, event args are less "argv" in concept and more "list of public names to put in the namespace".
* nsIArray to be used in place of jsval argc/argv used now.  nsIPropertyBag may be a better choice in some cases - eg, event args are less "argv" in concept and more "list of public names to put in the namespace".


* Maybe some kind of "SetProperty" function - as needed by nsGlobalWindow - "arguments", "navigator" etc.  http://lxr.mozilla.org/seamonkey/source/dom/src/base/nsGlobalWindow.cpp#871 [Not sure this is needed. IMO we should make "arguments" be XPCOM objects, i.e. [nsIArray -- markh] and we'd finally be able to get to the arguments passed to window.open() from *any* language. "navigator" is just a property of a window like all others, except that there's some JS:isms around it that I think we can easily ignore for Python -- jst]
* Maybe some kind of "SetProperty" function - as needed by nsGlobalWindow - "arguments", "navigator" etc.  http://lxr.mozilla.org/seamonkey/source/dom/src/base/nsGlobalWindow.cpp#871 [Not sure this is needed. IMO we should make "arguments" be XPCOM objects, i.e. [nsIArray -- markh] and we'd finally be able to get to the arguments passed to window.open() from *any* language. "navigator" is just a property of a window like all others, except that there's some JS:isms around it that I think we can easily ignore for Python -- jst]
8

edits

Navigation menu