зеркало из https://github.com/mozilla/pjs.git
Fix the fix to 40406, fixing bustage.
Don't destroy the per-thread safe JS context on cleanup if that context was provided through the setter. r=waterson
This commit is contained in:
Родитель
37f147b0a8
Коммит
c362ca7ae7
|
@ -1371,6 +1371,7 @@ private:
|
|||
nsDeque* mJSContextStack;
|
||||
JSContext* mSafeJSContext;
|
||||
xpcPerThreadData* mNextThread;
|
||||
PRBool mSafeContextIsFromSetter;
|
||||
|
||||
static PRLock* gLock;
|
||||
static xpcPerThreadData* gThreads;
|
||||
|
|
|
@ -198,7 +198,8 @@ xpcPerThreadData::xpcPerThreadData()
|
|||
: mException(nsnull),
|
||||
mJSContextStack(new nsDeque(nsnull)),
|
||||
mSafeJSContext(nsnull),
|
||||
mNextThread(nsnull)
|
||||
mNextThread(nsnull),
|
||||
mSafeContextIsFromSetter(PR_FALSE)
|
||||
{
|
||||
if(gLock)
|
||||
{
|
||||
|
@ -219,7 +220,7 @@ xpcPerThreadData::Cleanup()
|
|||
mJSContextStack = nsnull;
|
||||
}
|
||||
|
||||
if(mSafeJSContext)
|
||||
if(mSafeJSContext && !mSafeContextIsFromSetter)
|
||||
{
|
||||
JS_DestroyContext(mSafeJSContext);
|
||||
mSafeJSContext = nsnull;
|
||||
|
@ -328,8 +329,8 @@ xpcPerThreadData::GetSafeJSContext()
|
|||
nsresult
|
||||
xpcPerThreadData::SetSafeJSContext(JSContext *cx)
|
||||
{
|
||||
NS_ASSERTION(!mSafeJSContext, "SetSafeJSContext called too late!");
|
||||
mSafeJSContext = cx;
|
||||
mSafeContextIsFromSetter = PR_TRUE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче