зеркало из https://github.com/mozilla/gecko-dev.git
bug 552266 - - asserting that autorooters are used only under a request. r=mrbkap
This commit is contained in:
Родитель
9ae6a6411c
Коммит
d7a21deef3
|
@ -2172,6 +2172,8 @@ nsJSContext::CallEventHandler(nsISupports* aTarget, void *aScope, void *aHandler
|
|||
NS_TIME_FUNCTION_FMT(1.0, "%s (line %d) (function: %s)", MOZ_FUNCTION_NAME,
|
||||
__LINE__, JS_GetFunctionName(static_cast<JSFunction *>(JS_GetPrivate(mContext, static_cast<JSObject *>(aHandler)))));
|
||||
|
||||
|
||||
JSAutoRequest ar(mContext);
|
||||
JSObject* target = nsnull;
|
||||
nsresult rv = JSObjectFromInterface(aTarget, aScope, &target);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
@ -2215,7 +2217,6 @@ nsJSContext::CallEventHandler(nsISupports* aTarget, void *aScope, void *aHandler
|
|||
}
|
||||
|
||||
jsval funval = OBJECT_TO_JSVAL(static_cast<JSObject *>(aHandler));
|
||||
JSAutoRequest ar(mContext);
|
||||
JSAutoCrossCompartmentCall accc;
|
||||
if (!accc.enter(mContext, target)) {
|
||||
stack->Pop(nsnull);
|
||||
|
@ -2247,7 +2248,6 @@ nsJSContext::CallEventHandler(nsISupports* aTarget, void *aScope, void *aHandler
|
|||
|
||||
// Convert to variant before calling ScriptEvaluated, as it may GC, meaning
|
||||
// we would need to root rval.
|
||||
JSAutoRequest ar(mContext);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
if (rval == JSVAL_NULL)
|
||||
*arv = nsnull;
|
||||
|
|
|
@ -2224,11 +2224,17 @@ class AutoGCRooter {
|
|||
: down(cx->autoGCRooters), tag(tag), context(cx)
|
||||
{
|
||||
JS_ASSERT(this != cx->autoGCRooters);
|
||||
#ifdef JS_THREADSAFE
|
||||
JS_ASSERT(cx->requestDepth != 0);
|
||||
#endif
|
||||
cx->autoGCRooters = this;
|
||||
}
|
||||
|
||||
~AutoGCRooter() {
|
||||
JS_ASSERT(this == context->autoGCRooters);
|
||||
#ifdef JS_THREADSAFE
|
||||
JS_ASSERT(context->requestDepth != 0);
|
||||
#endif
|
||||
context->autoGCRooters = down;
|
||||
}
|
||||
|
||||
|
|
|
@ -1560,6 +1560,8 @@ _evaluate(NPP npp, NPObject* npobj, NPString *script, NPVariant *result)
|
|||
JSContext *cx = GetJSContextFromDoc(doc);
|
||||
NS_ENSURE_TRUE(cx, false);
|
||||
|
||||
JSAutoRequest req(cx);
|
||||
|
||||
nsCOMPtr<nsIScriptContext> scx = GetScriptContextFromJSContext(cx);
|
||||
NS_ENSURE_TRUE(scx, false);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче