Bug 339754: Threadsafety asserts from chrome registry when installing

extensions. r+sr=dveditz, a=ted.mielczarek
This commit is contained in:
dtownsend%oxymoronical.com 2007-10-11 16:19:19 +00:00
Родитель a2c86bb2c7
Коммит 62179f75ba
4 изменённых файлов: 21 добавлений и 9 удалений

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

@ -65,10 +65,10 @@
#define XPI_NO_NEW_THREAD 0x1000 #define XPI_NO_NEW_THREAD 0x1000
#define NS_ISOFTWAREUPDATE_IID \ #define NS_ISOFTWAREUPDATE_IID \
{ 0x18c2f992, \ { 0xfc7c086f, \
0xb09f, \ 0xdae0, \
0x11d2, \ 0x45e0, \
{0xbc, 0xde, 0x00, 0x80, 0x5f, 0x0e, 0x13, 0x53}\ {0x99, 0x10, 0xd5, 0xda, 0x91, 0xc8, 0x27, 0x46}\
} }
class nsIPrincipal; class nsIPrincipal;
@ -95,7 +95,7 @@ class nsISoftwareUpdate : public nsISupports
NS_IMETHOD RegisterListener(nsIXPIListener *aListener) = 0; NS_IMETHOD RegisterListener(nsIXPIListener *aListener) = 0;
/* FIX: these should be in a private interface */ /* FIX: these should be in a private interface */
NS_IMETHOD InstallJarCallBack() = 0; NS_IMETHOD_(void) InstallJarCallBack() = 0;
NS_IMETHOD GetMasterListener(nsIXPIListener **aListener) = 0; NS_IMETHOD GetMasterListener(nsIXPIListener **aListener) = 0;
NS_IMETHOD SetActiveListener(nsIXPIListener *aListener) = 0; NS_IMETHOD SetActiveListener(nsIXPIListener *aListener) = 0;
}; };

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

@ -358,7 +358,7 @@ nsSoftwareUpdate::InstallChrome( PRUint32 aType,
} }
NS_IMETHODIMP NS_IMETHODIMP_(void)
nsSoftwareUpdate::InstallJarCallBack() nsSoftwareUpdate::InstallJarCallBack()
{ {
PR_Lock(mLock); PR_Lock(mLock);
@ -375,7 +375,7 @@ nsSoftwareUpdate::InstallJarCallBack()
PR_Unlock(mLock); PR_Unlock(mLock);
return RunNextInstall(); RunNextInstall();
} }

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

@ -66,7 +66,7 @@ class nsSoftwareUpdate: public nsISoftwareUpdate,
NS_IMETHOD RegisterListener(nsIXPIListener *aListener); NS_IMETHOD RegisterListener(nsIXPIListener *aListener);
NS_IMETHOD InstallJarCallBack(); NS_IMETHOD_(void) InstallJarCallBack();
NS_IMETHOD GetMasterListener(nsIXPIListener **aListener); NS_IMETHOD GetMasterListener(nsIXPIListener **aListener);
NS_IMETHOD SetActiveListener(nsIXPIListener *aListener); NS_IMETHOD SetActiveListener(nsIXPIListener *aListener);

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

@ -582,7 +582,19 @@ extern "C" void PR_CALLBACK RunInstallOnThread(void *data)
if (scriptBuffer) delete [] scriptBuffer; if (scriptBuffer) delete [] scriptBuffer;
softwareUpdate->SetActiveListener(0); softwareUpdate->SetActiveListener(0);
softwareUpdate->InstallJarCallBack();
if (installInfo->GetFlags() & XPI_NO_NEW_THREAD)
{
softwareUpdate->InstallJarCallBack();
}
else
{
// Proxy the callback to the main thread
nsCOMPtr<nsIRunnable> callback = NS_NEW_RUNNABLE_METHOD(nsISoftwareUpdate,
softwareUpdate,
InstallJarCallBack);
NS_DispatchToMainThread(callback);
}
} }