Backed out changeset 79fd90e2dd87, n810s all orange -- yay! Something fruitful to investigate!

This commit is contained in:
Jeff Walden 2010-03-29 19:46:37 -07:00
parent fa7bcd268b
commit fbc0da3a62
5 changed files with 22 additions and 22 deletions

View File

@ -2108,11 +2108,15 @@ nsJSContext::CallEventHandler(nsISupports* aTarget, void *aScope, void *aHandler
return NS_OK; return NS_OK;
} }
jsval targetVal = JSVAL_VOID;
JSAutoTempValueRooter tvr(mContext, 1, &targetVal);
JSObject* target = nsnull; JSObject* target = nsnull;
nsresult rv = JSObjectFromInterface(aTarget, aScope, &target); nsresult rv = JSObjectFromInterface(aTarget, aScope, &target);
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
js::AutoObjectRooter targetVal(mContext, target); targetVal = OBJECT_TO_JSVAL(target);
jsval rval = JSVAL_VOID; jsval rval = JSVAL_VOID;
// This one's a lot easier than EvaluateString because we don't have to // This one's a lot easier than EvaluateString because we don't have to
@ -2136,7 +2140,7 @@ nsJSContext::CallEventHandler(nsISupports* aTarget, void *aScope, void *aHandler
jsval *argv = nsnull; jsval *argv = nsnull;
js::LazilyConstructed<nsAutoPoolRelease> poolRelease; js::LazilyConstructed<nsAutoPoolRelease> poolRelease;
js::LazilyConstructed<js::AutoArrayRooter> tvr; js::LazilyConstructed<JSAutoTempValueRooter> tvr;
// Use |target| as the scope for wrapping the arguments, since aScope is // Use |target| as the scope for wrapping the arguments, since aScope is
// the safe scope in many cases, which isn't very useful. Wrapping aTarget // the safe scope in many cases, which isn't very useful. Wrapping aTarget
@ -2650,7 +2654,7 @@ nsJSContext::SetProperty(void *aTarget, const char *aPropName, nsISupports *aArg
JSAutoRequest ar(mContext); JSAutoRequest ar(mContext);
js::LazilyConstructed<nsAutoPoolRelease> poolRelease; js::LazilyConstructed<nsAutoPoolRelease> poolRelease;
js::LazilyConstructed<js::AutoArrayRooter> tvr; js::LazilyConstructed<JSAutoTempValueRooter> tvr;
nsresult rv; nsresult rv;
rv = ConvertSupportsTojsvals(aArgs, GetNativeGlobal(), &argc, rv = ConvertSupportsTojsvals(aArgs, GetNativeGlobal(), &argc,
@ -2685,7 +2689,7 @@ nsJSContext::ConvertSupportsTojsvals(nsISupports *aArgs,
PRUint32 *aArgc, PRUint32 *aArgc,
jsval **aArgv, jsval **aArgv,
js::LazilyConstructed<nsAutoPoolRelease> &aPoolRelease, js::LazilyConstructed<nsAutoPoolRelease> &aPoolRelease,
js::LazilyConstructed<js::AutoArrayRooter> &aRooter) js::LazilyConstructed<JSAutoTempValueRooter> &aRooter)
{ {
nsresult rv = NS_OK; nsresult rv = NS_OK;

View File

@ -49,11 +49,8 @@
class nsIXPConnectJSObjectHolder; class nsIXPConnectJSObjectHolder;
class nsAutoPoolRelease; class nsAutoPoolRelease;
namespace js { class JSAutoTempValueRooter;
class AutoObjectRooter; namespace js { template <class> class LazilyConstructed; }
class AutoArrayRooter;
template <class> class LazilyConstructed;
}
class nsJSContext : public nsIScriptContext, class nsJSContext : public nsIScriptContext,
public nsIXPCScriptNotify public nsIXPCScriptNotify
@ -218,7 +215,7 @@ protected:
PRUint32 *aArgc, PRUint32 *aArgc,
jsval **aArgv, jsval **aArgv,
js::LazilyConstructed<nsAutoPoolRelease> &aPoolRelease, js::LazilyConstructed<nsAutoPoolRelease> &aPoolRelease,
js::LazilyConstructed<js::AutoArrayRooter> &aRooter); js::LazilyConstructed<JSAutoTempValueRooter> &aRooter);
nsresult AddSupportsPrimitiveTojsvals(nsISupports *aArg, jsval *aArgv); nsresult AddSupportsPrimitiveTojsvals(nsISupports *aArg, jsval *aArgv);

View File

@ -5226,11 +5226,11 @@ js_InitRegExpStatics(JSContext *cx)
JS_FRIEND_API(void) JS_FRIEND_API(void)
js_SaveAndClearRegExpStatics(JSContext *cx, JSRegExpStatics *statics, js_SaveAndClearRegExpStatics(JSContext *cx, JSRegExpStatics *statics,
AutoValueRooter *tvr) JSTempValueRooter *tvr)
{ {
*statics = cx->regExpStatics; *statics = cx->regExpStatics;
if (statics->input) JS_PUSH_TEMP_ROOT_STRING(cx, statics->input, tvr);
tvr->setString(statics->input);
/* /*
* Prevent JS_ClearRegExpStatics from freeing moreParens, since we've only * Prevent JS_ClearRegExpStatics from freeing moreParens, since we've only
* moved it elsewhere (into statics->moreParens). * moved it elsewhere (into statics->moreParens).
@ -5241,11 +5241,12 @@ js_SaveAndClearRegExpStatics(JSContext *cx, JSRegExpStatics *statics,
JS_FRIEND_API(void) JS_FRIEND_API(void)
js_RestoreRegExpStatics(JSContext *cx, JSRegExpStatics *statics, js_RestoreRegExpStatics(JSContext *cx, JSRegExpStatics *statics,
AutoValueRooter *tvr) JSTempValueRooter *tvr)
{ {
/* Clear/free any new JSRegExpStatics data before clobbering. */ /* Clear/free any new JSRegExpStatics data before clobbering. */
JS_ClearRegExpStatics(cx); JS_ClearRegExpStatics(cx);
cx->regExpStatics = *statics; cx->regExpStatics = *statics;
JS_POP_TEMP_ROOT(cx, tvr);
} }
void void
@ -5838,7 +5839,7 @@ js_NewRegExpObject(JSContext *cx, TokenStream *ts,
str = js_NewStringCopyN(cx, chars, length); str = js_NewStringCopyN(cx, chars, length);
if (!str) if (!str)
return NULL; return NULL;
AutoValueRooter tvr(cx, str); JSAutoTempValueRooter tvr(cx, str);
re = js_NewRegExp(cx, ts, str, flags, JS_FALSE); re = js_NewRegExp(cx, ts, str, flags, JS_FALSE);
if (!re) if (!re)
return NULL; return NULL;

View File

@ -65,15 +65,13 @@ struct JSRegExpStatics {
JSSubString rightContext; /* input to right of last match (perl $') */ JSSubString rightContext; /* input to right of last match (perl $') */
}; };
namespace js { class AutoValueRooter; }
extern JS_FRIEND_API(void) extern JS_FRIEND_API(void)
js_SaveAndClearRegExpStatics(JSContext *cx, JSRegExpStatics *statics, js_SaveAndClearRegExpStatics(JSContext *cx, JSRegExpStatics *statics,
js::AutoValueRooter *tvr); JSTempValueRooter *tvr);
extern JS_FRIEND_API(void) extern JS_FRIEND_API(void)
js_RestoreRegExpStatics(JSContext *cx, JSRegExpStatics *statics, js_RestoreRegExpStatics(JSContext *cx, JSRegExpStatics *statics,
js::AutoValueRooter *tvr); JSTempValueRooter *tvr);
/* /*
* This struct holds a bitmap representation of a class from a regexp. * This struct holds a bitmap representation of a class from a regexp.

View File

@ -478,7 +478,7 @@ XPC_SJOW_DelProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
NS_STACK_CLASS class SafeCallGuard { NS_STACK_CLASS class SafeCallGuard {
public: public:
SafeCallGuard(JSContext *cx, nsIPrincipal *principal) SafeCallGuard(JSContext *cx, nsIPrincipal *principal)
: cx(cx), tvr(cx) { : cx(cx) {
nsIScriptSecurityManager *ssm = XPCWrapper::GetSecurityManager(); nsIScriptSecurityManager *ssm = XPCWrapper::GetSecurityManager();
if (ssm) { if (ssm) {
// Note: We pass null as the target frame pointer because we know that // Note: We pass null as the target frame pointer because we know that
@ -517,7 +517,7 @@ public:
private: private:
JSContext *cx; JSContext *cx;
JSRegExpStatics statics; JSRegExpStatics statics;
js::AutoValueRooter tvr; JSTempValueRooter tvr;
uint32 options; uint32 options;
JSStackFrame *fp; JSStackFrame *fp;
}; };
@ -957,7 +957,7 @@ XPC_SJOW_Iterator(JSContext *cx, JSObject *obj, JSBool keysonly)
return nsnull; return nsnull;
} }
js::AutoValueRooter tvr(cx, OBJECT_TO_JSVAL(wrapperIter)); JSAutoTempValueRooter tvr(cx, OBJECT_TO_JSVAL(wrapperIter));
// Initialize the wrapper. // Initialize the wrapper.
return XPCWrapper::CreateIteratorObj(cx, wrapperIter, obj, unsafeObj, return XPCWrapper::CreateIteratorObj(cx, wrapperIter, obj, unsafeObj,