зеркало из https://github.com/mozilla/gecko-dev.git
Bug 12816, move XPInstall initialization closer to the front so we can
clean up after an install *before* the wrong components are loaded.
This commit is contained in:
Родитель
d6d32629ea
Коммит
cbe2026152
|
@ -73,6 +73,7 @@ class nsISoftwareUpdate : public nsISupports
|
|||
NS_IMETHOD InstallJarCallBack() = 0;
|
||||
NS_IMETHOD GetMasterNotifier(nsIXPINotifier **notifier) = 0;
|
||||
NS_IMETHOD SetActiveNotifier(nsIXPINotifier *notifier) = 0;
|
||||
NS_IMETHOD StartupTasks() = 0;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -103,28 +103,12 @@ nsSoftwareUpdate::GetInstance()
|
|||
|
||||
|
||||
nsSoftwareUpdate::nsSoftwareUpdate()
|
||||
: mInstalling(PR_FALSE),
|
||||
mStubLockout(PR_FALSE)
|
||||
{
|
||||
NS_INIT_ISUPPORTS();
|
||||
|
||||
mStubLockout = PR_FALSE;
|
||||
/***************************************/
|
||||
/* Create us a queue */
|
||||
/***************************************/
|
||||
mLock = PR_NewLock();
|
||||
mInstalling = PR_FALSE;
|
||||
mJarInstallQueue = new nsVoidArray();
|
||||
|
||||
/***************************************/
|
||||
/* Add us to the Javascript Name Space */
|
||||
/***************************************/
|
||||
|
||||
RegisterNameset();
|
||||
|
||||
/***************************************/
|
||||
/* Register us with NetLib */
|
||||
/***************************************/
|
||||
// FIX
|
||||
|
||||
|
||||
/***************************************/
|
||||
/* Startup the Version Registry */
|
||||
|
@ -134,30 +118,6 @@ nsSoftwareUpdate::nsSoftwareUpdate()
|
|||
|
||||
nsSpecialSystemDirectory appDir(nsSpecialSystemDirectory::OS_CurrentProcessDirectory);
|
||||
VR_SetRegDirectory( appDir.GetNativePathCString() );
|
||||
|
||||
|
||||
/***************************************/
|
||||
/* Perform Scheduled Tasks */
|
||||
/***************************************/
|
||||
|
||||
/* XXX Temporary workaround: see bugs 8849, 8971 */
|
||||
#ifndef XP_UNIX
|
||||
PR_CreateThread(PR_USER_THREAD,
|
||||
PerformScheduledTasks,
|
||||
nsnull,
|
||||
PR_PRIORITY_NORMAL,
|
||||
PR_GLOBAL_THREAD,
|
||||
PR_UNJOINABLE_THREAD,
|
||||
0);
|
||||
#endif
|
||||
|
||||
|
||||
/***************************************/
|
||||
/* Create a top level observer */
|
||||
/***************************************/
|
||||
|
||||
nsLoggingProgressNotifier *logger = new nsLoggingProgressNotifier();
|
||||
RegisterNotifier(logger);
|
||||
}
|
||||
|
||||
|
||||
|
@ -167,20 +127,17 @@ nsSoftwareUpdate::nsSoftwareUpdate()
|
|||
nsSoftwareUpdate::~nsSoftwareUpdate()
|
||||
{
|
||||
PR_Lock(mLock);
|
||||
if (mJarInstallQueue != nsnull)
|
||||
{
|
||||
nsInstallInfo* element;
|
||||
for (PRInt32 i=0; i < mJarInstallQueue->Count(); i++)
|
||||
{
|
||||
element = (nsInstallInfo*)mJarInstallQueue->ElementAt(i);
|
||||
//FIX: need to add to registry....
|
||||
delete element;
|
||||
}
|
||||
|
||||
mJarInstallQueue->Clear();
|
||||
delete (mJarInstallQueue);
|
||||
mJarInstallQueue = nsnull;
|
||||
nsInstallInfo* element;
|
||||
for (PRInt32 i=0; i < mJarInstallQueue.Count(); i++)
|
||||
{
|
||||
element = (nsInstallInfo*)mJarInstallQueue.ElementAt(i);
|
||||
//FIX: need to add to registry....
|
||||
delete element;
|
||||
}
|
||||
|
||||
mJarInstallQueue.Clear();
|
||||
|
||||
PR_Unlock(mLock);
|
||||
PR_DestroyLock(mLock);
|
||||
|
||||
|
@ -236,16 +193,34 @@ nsSoftwareUpdate::QueryInterface( REFNSIID anIID, void **anInstancePtr )
|
|||
NS_IMETHODIMP
|
||||
nsSoftwareUpdate::Initialize( nsIAppShellService *anAppShell, nsICmdLineService *aCmdLineService )
|
||||
{
|
||||
mStubLockout = PR_TRUE; // prevent use of nsPIXPIStubHook by browser
|
||||
// prevent use of nsPIXPIStubHook by browser
|
||||
mStubLockout = PR_TRUE;
|
||||
|
||||
/***************************************/
|
||||
/* Add us to the Javascript Name Space */
|
||||
/***************************************/
|
||||
|
||||
RegisterNameset();
|
||||
|
||||
/***************************************/
|
||||
/* Register us with NetLib */
|
||||
/***************************************/
|
||||
// FIX
|
||||
|
||||
|
||||
/***************************************/
|
||||
/* Create a top level observer */
|
||||
/***************************************/
|
||||
|
||||
nsLoggingProgressNotifier *logger = new nsLoggingProgressNotifier();
|
||||
RegisterNotifier(logger);
|
||||
|
||||
// rv = nsServiceManager::RegisterService( NS_IXPINSTALLCOMPONENT_PROGID, ( (nsISupports*) (nsISoftwareUpdate*) this ) );
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSoftwareUpdate::Shutdown()
|
||||
{
|
||||
// rv = nsServiceManager::UnregisterService( NS_IXPINSTALLCOMPONENT_PROGID );
|
||||
NS_IF_RELEASE(mInstance);
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -299,7 +274,7 @@ nsSoftwareUpdate::InstallJar( nsIFileSpec* aLocalFile,
|
|||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
PR_Lock(mLock);
|
||||
mJarInstallQueue->AppendElement( info );
|
||||
mJarInstallQueue.AppendElement( info );
|
||||
PR_Unlock(mLock);
|
||||
RunNextInstall();
|
||||
|
||||
|
@ -312,11 +287,11 @@ nsSoftwareUpdate::InstallJarCallBack()
|
|||
{
|
||||
PR_Lock(mLock);
|
||||
|
||||
nsInstallInfo *nextInstall = (nsInstallInfo*)mJarInstallQueue->ElementAt(0);
|
||||
nsInstallInfo *nextInstall = (nsInstallInfo*)mJarInstallQueue.ElementAt(0);
|
||||
if (nextInstall != nsnull)
|
||||
delete nextInstall;
|
||||
|
||||
mJarInstallQueue->RemoveElementAt(0);
|
||||
mJarInstallQueue.RemoveElementAt(0);
|
||||
mInstalling = PR_FALSE;
|
||||
|
||||
PR_Unlock(mLock);
|
||||
|
@ -325,6 +300,14 @@ nsSoftwareUpdate::InstallJarCallBack()
|
|||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSoftwareUpdate::StartupTasks()
|
||||
{
|
||||
PerformScheduledTasks(0);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
nsresult
|
||||
nsSoftwareUpdate::RunNextInstall()
|
||||
{
|
||||
|
@ -334,9 +317,9 @@ nsSoftwareUpdate::RunNextInstall()
|
|||
PR_Lock(mLock);
|
||||
if (!mInstalling)
|
||||
{
|
||||
if ( mJarInstallQueue->Count() > 0 )
|
||||
if ( mJarInstallQueue.Count() > 0 )
|
||||
{
|
||||
info = (nsInstallInfo*)mJarInstallQueue->ElementAt(0);
|
||||
info = (nsInstallInfo*)mJarInstallQueue.ElementAt(0);
|
||||
|
||||
if ( info )
|
||||
mInstalling = PR_TRUE;
|
||||
|
@ -680,7 +663,7 @@ nsSoftwareUpdateModule::RegisterSelf(nsIComponentManager *aCompMgr,
|
|||
nsresult rv = NS_OK;
|
||||
|
||||
#ifdef DEBUG
|
||||
printf("*** XPInstall is being registered\n");
|
||||
printf("*** Registering XPInstall\n");
|
||||
#endif
|
||||
|
||||
Components* cp = gComponents;
|
||||
|
|
|
@ -50,6 +50,7 @@ class nsSoftwareUpdate: public nsIAppShellComponent,
|
|||
NS_IMETHOD InstallJarCallBack();
|
||||
NS_IMETHOD GetMasterNotifier(nsIXPINotifier **notifier);
|
||||
NS_IMETHOD SetActiveNotifier(nsIXPINotifier *notifier);
|
||||
NS_IMETHOD StartupTasks();
|
||||
|
||||
/** SetProgramDirectory() is private for the Install Wizard.
|
||||
* The mStubLockout property makes sure this is only called
|
||||
|
@ -72,7 +73,7 @@ class nsSoftwareUpdate: public nsIAppShellComponent,
|
|||
PRLock* mLock;
|
||||
PRBool mInstalling;
|
||||
PRBool mStubLockout;
|
||||
nsVoidArray* mJarInstallQueue;
|
||||
nsVoidArray mJarInstallQueue;
|
||||
nsTopProgressNotifier mMasterNotifier;
|
||||
};
|
||||
|
||||
|
|
|
@ -43,8 +43,10 @@
|
|||
#include "nsIZipReader.h"
|
||||
#include "nsCOMPtr.h"
|
||||
|
||||
static NS_DEFINE_IID(kSoftwareUpdateCID, NS_SoftwareUpdate_CID);
|
||||
#include "nsIEventQueueService.h"
|
||||
|
||||
static NS_DEFINE_CID(kSoftwareUpdateCID, NS_SoftwareUpdate_CID);
|
||||
static NS_DEFINE_CID(kEventQueueServiceCID, NS_EVENTQUEUESERVICE_CID);
|
||||
|
||||
|
||||
extern JSObject *InitXPInstallObjects(JSContext *jscontext, JSObject *global, const nsFileSpec& jarfile, const PRUnichar* url, const PRUnichar* args);
|
||||
|
@ -306,6 +308,16 @@ extern "C" void RunInstallOnThread(void *data)
|
|||
nsIXPINotifier *notifier;
|
||||
nsresult rv;
|
||||
|
||||
|
||||
// lets set up an eventQ so that our xpcom/proxies will not have to:
|
||||
nsCOMPtr<nsIEventQueue> eventQ;
|
||||
NS_WITH_SERVICE(nsIEventQueueService, eventQService, kEventQueueServiceCID, &rv);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
eventQService->CreateThreadEventQueue();
|
||||
eventQService->GetThreadEventQueue(NS_CURRENT_THREAD, getter_AddRefs(eventQ));
|
||||
}
|
||||
|
||||
NS_WITH_SERVICE(nsISoftwareUpdate, softwareUpdate, kSoftwareUpdateCID, &rv );
|
||||
|
||||
if (!NS_SUCCEEDED(rv))
|
||||
|
|
|
@ -10,8 +10,7 @@
|
|||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is Mozilla Communicator client code,
|
||||
* released March 31, 1998.
|
||||
* The Original Code is Mozilla Communicator
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape Communications
|
||||
* Corporation. Portions created by Netscape are
|
||||
|
|
Загрузка…
Ссылка в новой задаче