mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-05 16:46:26 +00:00
04eeab08bf
- Fix for bug 13419 - xpconnect calls wrapped JS objects on wrong JSContext. Added code to use the nsThreadJSContextStack in order to call wrapped JS object on the JSContext that is current for the running thread. We've made the rule that xpconnect only supports one JSRuntime. We partially enforce that here by enforcing that the JSContext on which we will run code hails from the same JSRuntime as the JSContext on which the wrapper for the JS code was built. Because it is perfectly legal for the nsThreadJSContextStack to be empty if a wrapped JS object is being called from code other than a DOM event, this system will lazily create a JSContext for the current thread and maintain it in TLS. This JSContext is used as necessary. If it uses such a JSContext that was not already on the nsThreadJSContextStack then the system will temporarily push that JSContext onto the nsThreadJSContextStack during the course of the function call being performed. This is all managed my a new auto class: AutoPushCompatibleJSContext. This is used in the two places where wrapped JS code is called from native code. [the two places where this system is invoked are currently disabled due to the fact that the DOM code makes bad assumptions about the JSContext on which DOM objects can be accessed. We are working to fix that and then this code will be enabled.] - Add #ifdef XPC_DETECT_LEADING_UPPERCASE_ACCESS_ERRORS code that will help users when we do things like fix bug 14460. As soon as we make more of the idl declarations of methods leadingLowercase then we will have LeadingUppercase calls from JS breaking at runtime. It is expected that this will especially be a problem for coders working with the same interfaces from both C++ and JS (since from C++ an interface has LeadingUpper methods and the *same* interface seen from JS has leadingLowecase names). This code (as suggested by shaver) will print out an informative error message when it detects the misuse. This is currently enabled for DEBUG builds only. - Copy code from xpcshell to TestXPC to use the JSRuntimeSerivce. r=norris@netscape.com - Check to see if a wrapped JS object has a QueryInterface property before trying to call that method. This is a speed optimization. It also and makes norris happy because his perrenial breakpoint in jsReportErrorNumber is not getting hit (even though the old code was safe). |
||
---|---|---|
.. | ||
benchmarks | ||
js2/java | ||
jsd | ||
jsdj | ||
jsj | ||
macbuild | ||
ref | ||
rhino | ||
semantics | ||
src | ||
tests | ||
.cvsignore | ||
landbranch.pl | ||
Makefile.in | ||
makefile.win |