Protect against null contexts. bug 340602, r+sr=roc

This commit is contained in:
mrbkap%gmail.com 2006-06-07 17:15:51 +00:00
Родитель 7f74e54994
Коммит 351b267f3b
2 изменённых файлов: 12 добавлений и 3 удалений

Просмотреть файл

@ -2247,6 +2247,10 @@ IsContextOnStack(nsIJSContextStack *aStack, JSContext *aContext)
rv = iterator->Prev(&ctx);
NS_ASSERTION(NS_SUCCEEDED(rv), "Broken iterator implementation");
if (!ctx) {
continue;
}
if (nsJSUtils::GetDynamicScriptContext(ctx) && ctx == aContext)
return PR_TRUE;
}

Просмотреть файл

@ -88,6 +88,11 @@ GetContextFromStack(nsIJSContextStack *aStack, JSContext **aContext)
rv = iterator->Prev(aContext);
NS_ASSERTION(NS_SUCCEEDED(rv), "Broken iterator implementation");
// Consider a null context the end of the line.
if (!*aContext) {
break;
}
if (nsJSUtils::GetDynamicScriptContext(*aContext)) {
return NS_OK;
}