From 4b48b79408ca1397a7ba4984ef40c269cad1d93a Mon Sep 17 00:00:00 2001 From: "dveditz%netscape.com" Date: Fri, 3 Dec 1999 13:39:18 +0000 Subject: [PATCH] bug 12816 init XPInstall before any components are loaded so they can be replaced --- xpfe/bootstrap/nsAppRunner.cpp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/xpfe/bootstrap/nsAppRunner.cpp b/xpfe/bootstrap/nsAppRunner.cpp index f6cf85a39907..656a6b104dde 100644 --- a/xpfe/bootstrap/nsAppRunner.cpp +++ b/xpfe/bootstrap/nsAppRunner.cpp @@ -51,7 +51,12 @@ #include "nsIWindowMediator.h" #include "nsIDOMWindow.h" #include "nsIClipboard.h" +#ifndef XP_MAC +#include "nsISoftwareUpdate.h" +#include "nsSoftwareUpdateIIDs.h" +static NS_DEFINE_CID(kSoftUpdateCID, NS_SoftwareUpdate_CID); +#endif static NS_DEFINE_IID(kIWindowMediatorIID,NS_IWINDOWMEDIATOR_IID); static NS_DEFINE_CID(kWindowMediatorCID, NS_WINDOWMEDIATOR_CID); static NS_DEFINE_IID(kWalletServiceCID, NS_WALLETSERVICE_CID); @@ -656,8 +661,28 @@ int main(int argc, char* argv[]) rv = NS_InitXPCOM(NULL, NULL, NULL); NS_ASSERTION( NS_SUCCEEDED(rv), "NS_InitXPCOM failed" ); +#ifndef XP_MAC + { + //---------------------------------------------------------------- + // XPInstall needs to clean up after any updates that couldn't + // be completed because components were in use. This must be done + // **BEFORE** any other components are loaded! + // + // Will also check to see if AutoReg is required due to version + // change or installation of new components + // + // (scoped in a block to force release of COMPtr) + //---------------------------------------------------------------- + nsCOMPtr su = do_GetService(kSoftUpdateCID,&rv); + if (NS_SUCCEEDED(rv)) + su->StartupTasks(); + } +#endif + + nsresult result = main1( argc, argv ); + { // Scoping this in a block to force the pref service to be // released.