More diagnostics for bug 626768 - It seems likely that creating a new XPCJSRuntime is failing, but we don't know why or when. Abort in the most obvious failure location to help diagnose the problem. r=bent a=myself

This commit is contained in:
Benjamin Smedberg 2011-02-16 11:52:31 -05:00
Родитель aefebf42e6
Коммит d48741412b
2 изменённых файлов: 22 добавлений и 16 удалений

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

@ -167,22 +167,19 @@ nsXPConnect::GetXPConnect()
if(!gSelf)
return nsnull;
if(!gSelf->mRuntime ||
!gSelf->mInterfaceInfoManager)
{
// ctor failed to create an acceptable instance
delete gSelf;
gSelf = nsnull;
if (!gSelf->mRuntime) {
NS_RUNTIMEABORT("Couldn't create XPCJSRuntime.");
}
else
{
// Initial extra ref to keep the singleton alive
// balanced by explicit call to ReleaseXPConnectSingleton()
NS_ADDREF(gSelf);
if (NS_FAILED(NS_SetGlobalThreadObserver(gSelf))) {
NS_RELEASE(gSelf);
// Fall through to returning null
}
if (!gSelf->mInterfaceInfoManager) {
NS_RUNTIMEABORT("Couldn't get global interface info manager.");
}
// Initial extra ref to keep the singleton alive
// balanced by explicit call to ReleaseXPConnectSingleton()
NS_ADDREF(gSelf);
if (NS_FAILED(NS_SetGlobalThreadObserver(gSelf))) {
NS_RELEASE(gSelf);
// Fall through to returning null
}
}
return gSelf;

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

@ -1354,7 +1354,9 @@ XPCJSRuntime::XPCJSRuntime(nsXPConnect* aXPConnect)
mStrIDs[0] = JSID_VOID;
mJSRuntime = JS_NewRuntime(32L * 1024L * 1024L); // pref ?
if(mJSRuntime)
if (!mJSRuntime)
NS_RUNTIMEABORT("JS_NewRuntime failed.");
{
// Unconstrain the runtime's threshold on nominal heap size, to avoid
// triggering GC too often if operating continuously near an arbitrary
@ -1371,6 +1373,8 @@ XPCJSRuntime::XPCJSRuntime(nsXPConnect* aXPConnect)
xpc::WrapperFactory::Rewrap,
xpc::WrapperFactory::PrepareForWrapping);
mWatchdogWakeup = JS_NEW_CONDVAR(mJSRuntime->gcLock);
if (!mWatchdogWakeup)
NS_RUNTIMEABORT("JS_NEW_CONDVAR failed.");
mJSRuntime->setActivityCallback(ActivityCallback, this);
@ -1400,6 +1404,8 @@ XPCJSRuntime::XPCJSRuntime(nsXPConnect* aXPConnect)
mWatchdogThread = PR_CreateThread(PR_USER_THREAD, WatchdogMain, this,
PR_PRIORITY_NORMAL, PR_LOCAL_THREAD,
PR_UNJOINABLE_THREAD, 0);
if (!mWatchdogThread)
NS_RUNTIMEABORT("PR_CreateThread failed!");
}
}
@ -1427,6 +1433,9 @@ XPCJSRuntime::newXPCJSRuntime(nsXPConnect* aXPConnect)
{
return self;
}
NS_RUNTIMEABORT("new XPCJSRuntime failed to initialize.");
delete self;
return nsnull;
}