зеркало из https://github.com/mozilla/gecko-dev.git
Bug 327168 - test holds COMPtrs past XPCOM shutdown, r=darin
This commit is contained in:
Родитель
bd97a372fa
Коммит
d58e68beb2
|
@ -166,14 +166,33 @@ InitPrefs(nsIPrefBranch *aPrefBranch)
|
|||
aPrefBranch->SetBoolPref(kCookiesAskPermission, PR_FALSE);
|
||||
}
|
||||
|
||||
class ScopedXPCOM
|
||||
{
|
||||
public:
|
||||
ScopedXPCOM() : rv(NS_InitXPCOM2(nsnull, nsnull, nsnull)) { }
|
||||
~ScopedXPCOM()
|
||||
{
|
||||
if (NS_SUCCEEDED(rv))
|
||||
NS_ShutdownXPCOM(nsnull);
|
||||
}
|
||||
|
||||
nsresult rv;
|
||||
};
|
||||
|
||||
int
|
||||
main(PRInt32 argc, char *argv[])
|
||||
{
|
||||
if (test_common_init(&argc, &argv) != 0)
|
||||
return -1;
|
||||
|
||||
nsresult rv0 = NS_InitXPCOM2(nsnull, nsnull, nsnull);
|
||||
if (NS_FAILED(rv0)) return -1;
|
||||
PRBool allTestsPassed = PR_TRUE;
|
||||
|
||||
ScopedXPCOM xpcom;
|
||||
if (NS_FAILED(xpcom.rv))
|
||||
return -1;
|
||||
|
||||
{
|
||||
nsresult rv0;
|
||||
|
||||
nsCOMPtr<nsICookieService> cookieService =
|
||||
do_GetService(kCookieServiceCID, &rv0);
|
||||
|
@ -185,7 +204,6 @@ main(PRInt32 argc, char *argv[])
|
|||
|
||||
InitPrefs(prefBranch);
|
||||
|
||||
PRBool allTestsPassed = PR_TRUE;
|
||||
PRBool rv[20];
|
||||
nsCString cookie;
|
||||
|
||||
|
@ -563,7 +581,7 @@ main(PRInt32 argc, char *argv[])
|
|||
|
||||
printf("\n*** Result: %s!\n\n", allTestsPassed ? "all tests passed" : "TEST(S) FAILED");
|
||||
|
||||
NS_ShutdownXPCOM(nsnull);
|
||||
}
|
||||
|
||||
return allTestsPassed ? 0 : 1;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче