bug 426162 - allow calling JS_DestroyContext when cx->thread is null for API compatibility. r=brendan

This commit is contained in:
Igor Bukanov 2009-03-25 16:41:17 +01:00
parent f51ef2ceec
commit 0a955fa410

View File

@ -538,7 +538,14 @@ js_DestroyContext(JSContext *cx, JSDestroyContextMode mode)
JSBool last;
#ifdef JS_THREADSAFE
JS_ASSERT(CURRENT_THREAD_IS_ME(cx->thread));
/*
* For API compatibility we allow to destroy contexts without a thread in
* optimized builds. We assume that the embedding knows that an OOM error
* cannot happen in JS_SetContextThread.
*/
JS_ASSERT(cx->thread && CURRENT_THREAD_IS_ME(cx->thread));
if (!cx->thread)
JS_SetContextThread(cx);
#endif
rt = cx->runtime;