Back to index

lightning-sunbird  0.9+nobinonly
Public Types | Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | Friends
nsInstall Class Reference

#include <nsInstall.h>

Collaboration diagram for nsInstall:
Collaboration graph
[legend]

List of all members.

Public Types

enum  {
  BAD_PACKAGE_NAME = -200, UNEXPECTED_ERROR = -201, ACCESS_DENIED = -202, EXECUTION_ERROR = -203,
  NO_INSTALL_SCRIPT = -204, NO_CERTIFICATE = -205, NO_MATCHING_CERTIFICATE = -206, CANT_READ_ARCHIVE = -207,
  INVALID_ARGUMENTS = -208, ILLEGAL_RELATIVE_PATH = -209, USER_CANCELLED = -210, INSTALL_NOT_STARTED = -211,
  SILENT_MODE_DENIED = -212, NO_SUCH_COMPONENT = -213, DOES_NOT_EXIST = -214, READ_ONLY = -215,
  IS_DIRECTORY = -216, NETWORK_FILE_IS_IN_USE = -217, APPLE_SINGLE_ERR = -218, INVALID_PATH_ERR = -219,
  PATCH_BAD_DIFF = -220, PATCH_BAD_CHECKSUM_TARGET = -221, PATCH_BAD_CHECKSUM_RESULT = -222, UNINSTALL_FAILED = -223,
  PACKAGE_FOLDER_NOT_SET = -224, EXTRACTION_FAILED = -225, FILENAME_ALREADY_USED = -226, INSTALL_CANCELLED = -227,
  DOWNLOAD_ERROR = -228, SCRIPT_ERROR = -229, ALREADY_EXISTS = -230, IS_FILE = -231,
  SOURCE_DOES_NOT_EXIST = -232, SOURCE_IS_DIRECTORY = -233, SOURCE_IS_FILE = -234, INSUFFICIENT_DISK_SPACE = -235,
  FILENAME_TOO_LONG = -236, UNABLE_TO_LOCATE_LIB_FUNCTION = -237, UNABLE_TO_LOAD_LIBRARY = -238, CHROME_REGISTRY_ERROR = -239,
  MALFORMED_INSTALL = -240, KEY_ACCESS_DENIED = -241, KEY_DOES_NOT_EXIST = -242, VALUE_DOES_NOT_EXIST = -243,
  INVALID_SIGNATURE = -260, INVALID_HASH = -261, INVALID_HASH_TYPE = -262, OUT_OF_MEMORY = -299,
  GESTALT_UNKNOWN_ERR = -5550, GESTALT_INVALID_ARGUMENT = -5551, SUCCESS = 0, REBOOT_NEEDED = 999
}

Public Member Functions

 nsInstall (nsIZipReader *theJARFile)
virtual ~nsInstall ()
PRInt32 SetScriptObject (void *aScriptObject)
PRInt32 SaveWinRegPrototype (void *aScriptObject)
PRInt32 SaveWinProfilePrototype (void *aScriptObject)
JSObjectRetrieveWinRegPrototype (void)
JSObjectRetrieveWinProfilePrototype (void)
PRInt32 AbortInstall (PRInt32 aErrorNumber)
PRInt32 AddDirectory (const nsString &aRegName, const nsString &aVersion, const nsString &aJarSource, nsInstallFolder *aFolder, const nsString &aSubdir, PRInt32 aMode, PRInt32 *aReturn)
PRInt32 AddDirectory (const nsString &aRegName, const nsString &aVersion, const nsString &aJarSource, nsInstallFolder *aFolder, const nsString &aSubdir, PRInt32 *aReturn)
PRInt32 AddDirectory (const nsString &aRegName, const nsString &aJarSource, nsInstallFolder *aFolder, const nsString &aSubdir, PRInt32 *aReturn)
PRInt32 AddDirectory (const nsString &aJarSource, PRInt32 *aReturn)
PRInt32 AddSubcomponent (const nsString &aRegName, const nsString &aVersion, const nsString &aJarSource, nsInstallFolder *aFolder, const nsString &aTargetName, PRInt32 aMode, PRInt32 *aReturn)
PRInt32 AddSubcomponent (const nsString &aRegName, const nsString &aVersion, const nsString &aJarSource, nsInstallFolder *aFolder, const nsString &aTargetName, PRInt32 *aReturn)
PRInt32 AddSubcomponent (const nsString &aRegName, const nsString &aJarSource, nsInstallFolder *aFolder, const nsString &aTargetName, PRInt32 *aReturn)
PRInt32 AddSubcomponent (const nsString &aJarSource, PRInt32 *aReturn)
PRInt32 DiskSpaceAvailable (const nsString &aFolder, PRInt64 *aReturn)
PRInt32 Execute (const nsString &aJarSource, const nsString &aArgs, PRBool aBlocking, PRInt32 *aReturn)
PRInt32 FinalizeInstall (PRInt32 *aReturn)
PRInt32 Gestalt (const nsString &aSelector, PRInt32 *aReturn)
PRInt32 GetComponentFolder (const nsString &aComponentName, const nsString &aSubdirectory, nsInstallFolder **aFolder)
PRInt32 GetComponentFolder (const nsString &aComponentName, nsInstallFolder **aFolder)
PRInt32 GetFolder (nsInstallFolder &aTargetFolder, const nsString &aSubdirectory, nsInstallFolder **aFolder)
PRInt32 GetFolder (const nsString &aTargetFolder, const nsString &aSubdirectory, nsInstallFolder **aFolder)
PRInt32 GetFolder (const nsString &aTargetFolder, nsInstallFolder **aFolder)
PRInt32 GetLastError (PRInt32 *aReturn)
PRInt32 GetWinProfile (const nsString &aFolder, const nsString &aFile, JSContext *jscontext, JSClass *WinProfileClass, jsval *aReturn)
PRInt32 GetWinRegistry (JSContext *jscontext, JSClass *WinRegClass, jsval *aReturn)
PRInt32 LoadResources (JSContext *cx, const nsString &aBaseName, jsval *aReturn)
PRInt32 Patch (const nsString &aRegName, const nsString &aVersion, const nsString &aJarSource, nsInstallFolder *aFolder, const nsString &aTargetName, PRInt32 *aReturn)
PRInt32 Patch (const nsString &aRegName, const nsString &aJarSource, nsInstallFolder *aFolder, const nsString &aTargetName, PRInt32 *aReturn)
PRInt32 RegisterChrome (nsIFile *chrome, PRUint32 chromeType, const char *path)
PRInt32 RefreshPlugins (PRBool aReloadPages)
PRInt32 ResetError (PRInt32 aError)
PRInt32 SetPackageFolder (nsInstallFolder &aFolder)
PRInt32 StartInstall (const nsString &aUserPackageName, const nsString &aPackageName, const nsString &aVersion, PRInt32 *aReturn)
PRInt32 Uninstall (const nsString &aPackageName, PRInt32 *aReturn)
PRInt32 FileOpDirCreate (nsInstallFolder &aTarget, PRInt32 *aReturn)
PRInt32 FileOpDirGetParent (nsInstallFolder &aTarget, nsInstallFolder **theParentFolder)
PRInt32 FileOpDirRemove (nsInstallFolder &aTarget, PRInt32 aFlags, PRInt32 *aReturn)
PRInt32 FileOpDirRename (nsInstallFolder &aSrc, nsString &aTarget, PRInt32 *aReturn)
PRInt32 FileOpFileCopy (nsInstallFolder &aSrc, nsInstallFolder &aTarget, PRInt32 *aReturn)
PRInt32 FileOpFileDelete (nsInstallFolder &aTarget, PRInt32 aFlags, PRInt32 *aReturn)
PRInt32 FileOpFileExists (nsInstallFolder &aTarget, PRBool *aReturn)
PRInt32 FileOpFileExecute (nsInstallFolder &aTarget, nsString &aParams, PRBool aBlocking, PRInt32 *aReturn)
PRInt32 FileOpFileGetNativeVersion (nsInstallFolder &aTarget, nsString *aReturn)
PRInt32 FileOpFileGetDiskSpaceAvailable (nsInstallFolder &aTarget, PRInt64 *aReturn)
PRInt32 FileOpFileGetModDate (nsInstallFolder &aTarget, double *aReturn)
PRInt32 FileOpFileGetSize (nsInstallFolder &aTarget, PRInt64 *aReturn)
PRInt32 FileOpFileIsDirectory (nsInstallFolder &aTarget, PRBool *aReturn)
PRInt32 FileOpFileIsWritable (nsInstallFolder &aTarget, PRBool *aReturn)
PRInt32 FileOpFileIsFile (nsInstallFolder &aTarget, PRBool *aReturn)
PRInt32 FileOpFileModDateChanged (nsInstallFolder &aTarget, double aOldStamp, PRBool *aReturn)
PRInt32 FileOpFileMove (nsInstallFolder &aSrc, nsInstallFolder &aTarget, PRInt32 *aReturn)
PRInt32 FileOpFileRename (nsInstallFolder &aSrc, nsString &aTarget, PRInt32 *aReturn)
PRInt32 FileOpFileWindowsGetShortName (nsInstallFolder &aTarget, nsString &aShortPathName)
PRInt32 FileOpFileWindowsShortcut (nsIFile *aTarget, nsIFile *aShortcutPath, nsString &aDescription, nsIFile *aWorkingPath, nsString &aParams, nsIFile *aIcon, PRInt32 aIconId, PRInt32 *aReturn)
PRInt32 FileOpFileMacAlias (nsIFile *aSourceFile, nsIFile *aAliasFile, PRInt32 *aReturn)
PRInt32 FileOpFileUnixLink (nsInstallFolder &aTarget, PRInt32 aFlags, PRInt32 *aReturn)
PRInt32 FileOpWinRegisterServer (nsInstallFolder &aTarget, PRInt32 *aReturn)
void LogComment (const nsAString &aComment)
PRInt32 ExtractFileFromJar (const nsString &aJarfile, nsIFile *aSuggestedName, nsIFile **aRealName)
char * GetResourcedString (const nsAString &aResName)
 GetResourcedString.
void AddPatch (nsHashKey *aKey, nsIFile *fileName)
void GetPatch (nsHashKey *aKey, nsIFile **fileName)
nsIFileGetJarFileLocation ()
void SetJarFileLocation (nsIFile *aFile)
void GetInstallArguments (nsString &args)
void SetInstallArguments (const nsString &args)
void GetInstallURL (nsString &url)
void SetInstallURL (const nsString &url)
PRUint32 GetInstallFlags ()
void SetInstallFlags (PRUint32 aFlags)
PRInt32 GetInstallPlatform (nsCString &aPlatform)
CHROMEREG_IFACEGetChromeRegistry ()
void SetChromeRegistry (CHROMEREG_IFACE *reg)
PRUint32 GetFinalStatus ()
PRBool InInstallTransaction (void)
PRInt32 Alert (nsString &string)
PRInt32 ConfirmEx (nsString &aDialogTitle, nsString &aText, PRUint32 aButtonFlags, nsString &aButton0Title, nsString &aButton1Title, nsString &aButton2Title, nsString &aCheckMsg, PRBool *aCheckState, PRInt32 *aReturn)
void InternalAbort (PRInt32 errcode)
PRInt32 ScheduleForInstall (nsInstallObject *ob)
 ScheduleForInstall call this to put an InstallObject on the install queue Do not call installedFiles.addElement directly, because this routine also handles progress messages.
PRInt32 SaveError (PRInt32 errcode)

Private Member Functions

void ParseFlags (int flags)
PRInt32 SanityCheck (void)
 SanityCheck.
void GetTime (nsString &aString)
nsPIXPIProxyGetUIThreadProxy ()
PRInt32 GetQualifiedRegName (const nsString &name, nsString &qualifiedRegName)
 GetQualifiedRegName.
PRInt32 GetQualifiedPackageName (const nsString &name, nsString &qualifiedName)
 GetQualifiedPackageName.
void CurrentUserNode (nsString &userRegNode)
PRBool BadRegName (const nsString &regName)
void CleanUp ()
PRInt32 ExtractDirEntries (const nsString &directory, nsVoidArray *paths)

Static Private Member Functions

static void DeleteVector (nsVoidArray *vector)

Private Attributes

JSObjectmScriptObject
JSObjectmWinRegObject
JSObjectmWinProfileObject
nsCOMPtr< nsIFilemJarFileLocation
nsIZipReadermJarFileData
nsString mInstallArguments
nsString mInstallURL
PRUint32 mInstallFlags
nsCString mInstallPlatform
CHROMEREG_IFACEmChromeRegistry
nsInstallFoldermPackageFolder
PRBool mUserCancelled
PRUint32 mFinalStatus
PRBool mUninstallPackage
PRBool mRegisterPackage
PRBool mStartInstallCompleted
nsString mRegistryPackageName
nsString mUIName
nsInstallVersionmVersionInfo
nsVoidArraymInstalledFiles
nsHashtable * mPatchList
nsCOMPtr< nsIXPIListenermListener
nsCOMPtr< nsPIXPIProxymUIThreadProxy
nsCOMPtr< nsIStringBundlemStringBundle
PRInt32 mLastError

Friends

class nsWinReg
class nsWinProfile

Detailed Description

Definition at line 165 of file nsInstall.h.


Member Enumeration Documentation

anonymous enum
Enumerator:
BAD_PACKAGE_NAME 
UNEXPECTED_ERROR 
ACCESS_DENIED 
EXECUTION_ERROR 
NO_INSTALL_SCRIPT 
NO_CERTIFICATE 
NO_MATCHING_CERTIFICATE 
CANT_READ_ARCHIVE 
INVALID_ARGUMENTS 
ILLEGAL_RELATIVE_PATH 
USER_CANCELLED 
INSTALL_NOT_STARTED 
SILENT_MODE_DENIED 
NO_SUCH_COMPONENT 
DOES_NOT_EXIST 
READ_ONLY 
IS_DIRECTORY 
NETWORK_FILE_IS_IN_USE 
APPLE_SINGLE_ERR 
INVALID_PATH_ERR 
PATCH_BAD_DIFF 
PATCH_BAD_CHECKSUM_TARGET 
PATCH_BAD_CHECKSUM_RESULT 
UNINSTALL_FAILED 
PACKAGE_FOLDER_NOT_SET 
EXTRACTION_FAILED 
FILENAME_ALREADY_USED 
INSTALL_CANCELLED 
DOWNLOAD_ERROR 
SCRIPT_ERROR 
ALREADY_EXISTS 
IS_FILE 
SOURCE_DOES_NOT_EXIST 
SOURCE_IS_DIRECTORY 
SOURCE_IS_FILE 
INSUFFICIENT_DISK_SPACE 
FILENAME_TOO_LONG 
UNABLE_TO_LOCATE_LIB_FUNCTION 
UNABLE_TO_LOAD_LIBRARY 
CHROME_REGISTRY_ERROR 
MALFORMED_INSTALL 
KEY_ACCESS_DENIED 
KEY_DOES_NOT_EXIST 
VALUE_DOES_NOT_EXIST 
INVALID_SIGNATURE 
INVALID_HASH 
INVALID_HASH_TYPE 
OUT_OF_MEMORY 
GESTALT_UNKNOWN_ERR 
GESTALT_INVALID_ARGUMENT 
SUCCESS 
REBOOT_NEEDED 

Definition at line 172 of file nsInstall.h.


Constructor & Destructor Documentation

Definition at line 236 of file nsInstall.cpp.

{
    MOZ_COUNT_CTOR(nsInstall);

    mScriptObject           = nsnull;           // this is the jsobject for our context
    mVersionInfo            = nsnull;           // this is the version information passed to us in StartInstall()
    mInstalledFiles         = nsnull;           // the list of installed objects
//  mRegistryPackageName    = "";               // this is the name that we will add into the registry for the component we are installing
//  mUIName                 = "";               // this is the name that will be displayed in UI.
    mPatchList              = nsnull;
    mUninstallPackage       = PR_FALSE;
    mRegisterPackage        = PR_FALSE;
    mFinalStatus            = SUCCESS;
    mStartInstallCompleted  = PR_FALSE;
    mJarFileLocation        = nsnull;
    //mInstallArguments       = "";
    mPackageFolder          = nsnull;

    // mJarFileData is an opaque handle to the jarfile.
    mJarFileData = theJARFile;

    nsISoftwareUpdate *su;
    nsresult rv = CallGetService(kSoftwareUpdateCID, &su);

    if (NS_SUCCEEDED(rv))
    {
        su->GetMasterListener( getter_AddRefs(mListener) );
    }

    su->Release();

    // get the resourced xpinstall string bundle
    mStringBundle = nsnull;
    NS_WITH_PROXIED_SERVICE( nsIStringBundleService,
                             service,
                             kStringBundleServiceCID,
                             NS_UI_THREAD_EVENTQ,
                             &rv );

    if (NS_SUCCEEDED(rv) && service)
    {
        rv = service->CreateBundle( XPINSTALL_BUNDLE_URL,
                                    getter_AddRefs(mStringBundle) );
    }
}

Here is the call graph for this function:

nsInstall::~nsInstall ( ) [virtual]

Definition at line 282 of file nsInstall.cpp.


Member Function Documentation

Definition at line 434 of file nsInstall.cpp.

{
    InternalAbort(aErrorNumber);
    return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

PRInt32 nsInstall::AddDirectory ( const nsString aRegName,
const nsString aVersion,
const nsString aJarSource,
nsInstallFolder aFolder,
const nsString aSubdir,
PRInt32  aMode,
PRInt32 aReturn 
)

Definition at line 441 of file nsInstall.cpp.

{
    nsInstallFile* ie = nsnull;
    PRInt32 result;

    if ( aJarSource.IsEmpty() || aFolder == nsnull )
    {
        *aReturn = SaveError(nsInstall::INVALID_ARGUMENTS);
        return NS_OK;
    }

    result = SanityCheck();

    if (result != nsInstall::SUCCESS)
    {
        *aReturn = SaveError( result );
        return NS_OK;
    }

    nsString qualifiedRegName;

    if ( aRegName.IsEmpty())
    {
        // Default subName = location in jar file
        *aReturn = GetQualifiedRegName( aJarSource, qualifiedRegName);
    }
    else
    {
        *aReturn = GetQualifiedRegName( aRegName, qualifiedRegName );
    }

    if (*aReturn != SUCCESS)
    {
        return NS_OK;
    }

    nsString qualifiedVersion = aVersion;
    if (qualifiedVersion.IsEmpty())
    {
        // assume package version for overriden forms that don't take version info
        *aReturn = mVersionInfo->ToString(qualifiedVersion);

        if (NS_FAILED(*aReturn))
        {
            SaveError( nsInstall::UNEXPECTED_ERROR );
            return NS_OK;
        }
    }

    nsString subdirectory(aSubdir);

    if (!subdirectory.IsEmpty())
    {
        subdirectory.AppendLiteral("/");
    }


    nsVoidArray *paths = new nsVoidArray();

    if (paths == nsnull)
    {
        *aReturn = SaveError(nsInstall::OUT_OF_MEMORY);
        return NS_OK;
    }

    PRInt32 count = 0;
    result = ExtractDirEntries(aJarSource, paths);
    if (result == nsInstall::SUCCESS)
    {
        count = paths->Count();
        if (count == 0)
            result = nsInstall::DOES_NOT_EXIST;
    }

    for (PRInt32 i=0; i < count && result == nsInstall::SUCCESS; i++)
    {
        nsString *thisPath = (nsString *)paths->ElementAt(i);

        nsString newJarSource = aJarSource;
        newJarSource.AppendLiteral("/");
        newJarSource += *thisPath;

        nsString newSubDir;

        if (!subdirectory.IsEmpty())
        {
            newSubDir = subdirectory;
        }

        newSubDir += *thisPath;

        ie = new nsInstallFile( this,
                                qualifiedRegName,
                                qualifiedVersion,
                                newJarSource,
                                aFolder,
                                newSubDir,
                                aMode,
                                (i == 0), // register the first one only
                                &result);

        if (ie == nsnull)
        {
            result = nsInstall::OUT_OF_MEMORY;
        }
        else if (result != nsInstall::SUCCESS)
        {
            delete ie;
        }
        else
        {
            result = ScheduleForInstall( ie );
        }
    }

    DeleteVector(paths);

    *aReturn = SaveError( result );
    return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

PRInt32 nsInstall::AddDirectory ( const nsString aRegName,
const nsString aVersion,
const nsString aJarSource,
nsInstallFolder aFolder,
const nsString aSubdir,
PRInt32 aReturn 
)

Definition at line 569 of file nsInstall.cpp.

{
    return AddDirectory(aRegName,
                        aVersion,
                        aJarSource,
                        aFolder,
                        aSubdir,
                        INSTALL_NO_COMPARE,
                        aReturn);
}

Here is the call graph for this function:

PRInt32 nsInstall::AddDirectory ( const nsString aRegName,
const nsString aJarSource,
nsInstallFolder aFolder,
const nsString aSubdir,
PRInt32 aReturn 
)

Definition at line 586 of file nsInstall.cpp.

{
    return AddDirectory(aRegName,
                        EmptyString(),
                        aJarSource,
                        aFolder,
                        aSubdir,
                        INSTALL_NO_COMPARE,
                        aReturn);
}

Here is the call graph for this function:

PRInt32 nsInstall::AddDirectory ( const nsString aJarSource,
PRInt32 aReturn 
)

Definition at line 602 of file nsInstall.cpp.

Here is the call graph for this function:

void nsInstall::AddPatch ( nsHashKey *  aKey,
nsIFile fileName 
)

Definition at line 1600 of file nsInstall.cpp.

{
    if (mPatchList != nsnull)
    {
        mPatchList->Put(aKey, fileName);
    }
}

Here is the caller graph for this function:

PRInt32 nsInstall::AddSubcomponent ( const nsString aRegName,
const nsString aVersion,
const nsString aJarSource,
nsInstallFolder aFolder,
const nsString aTargetName,
PRInt32  aMode,
PRInt32 aReturn 
)

Definition at line 621 of file nsInstall.cpp.

{
    nsInstallFile*  ie;
    nsString        qualifiedRegName;
    nsString        qualifiedVersion = aVersion;
    nsString        tempTargetName   = aTargetName;

    PRInt32         errcode = nsInstall::SUCCESS;


    if(aJarSource.IsEmpty() || aFolder == nsnull )
    {
        *aReturn = SaveError( nsInstall::INVALID_ARGUMENTS );
        return NS_OK;
    }

    PRInt32 result = SanityCheck();

    if (result != nsInstall::SUCCESS)
    {
        *aReturn = SaveError( result );
        return NS_OK;
    }

    if( aTargetName.IsEmpty() )
    {
        PRInt32 pos = aJarSource.RFindChar('/');

        if ( pos == kNotFound )
            tempTargetName = aJarSource;
        else
            aJarSource.Right(tempTargetName, aJarSource.Length() - (pos+1));
    }

    if (qualifiedVersion.IsEmpty())
        qualifiedVersion.AssignLiteral("0.0.0.0");


    if ( aRegName.IsEmpty() )
    {
        // Default subName = location in jar file
        *aReturn = GetQualifiedRegName( aJarSource, qualifiedRegName);
    }
    else
    {
        *aReturn = GetQualifiedRegName( aRegName, qualifiedRegName );
    }

    if (*aReturn != SUCCESS)
    {
        return NS_OK;
    }


    ie = new nsInstallFile( this,
                            qualifiedRegName,
                            qualifiedVersion,
                            aJarSource,
                            aFolder,
                            tempTargetName,
                            aMode,
                            PR_TRUE,
                            &errcode );

    if (ie == nsnull)
    {
        *aReturn = SaveError(nsInstall::OUT_OF_MEMORY);
            return NS_OK;
    }

    if (errcode == nsInstall::SUCCESS)
    {
        errcode = ScheduleForInstall( ie );
    }
    else
    {
        delete ie;
    }

    *aReturn = SaveError( errcode );
    return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

PRInt32 nsInstall::AddSubcomponent ( const nsString aRegName,
const nsString aVersion,
const nsString aJarSource,
nsInstallFolder aFolder,
const nsString aTargetName,
PRInt32 aReturn 
)

Definition at line 711 of file nsInstall.cpp.

{
    return AddSubcomponent(aRegName,
                           aVersion,
                           aJarSource,
                           aFolder,
                           aTargetName,
                           INSTALL_NO_COMPARE,
                           aReturn);
}

Here is the call graph for this function:

PRInt32 nsInstall::AddSubcomponent ( const nsString aRegName,
const nsString aJarSource,
nsInstallFolder aFolder,
const nsString aTargetName,
PRInt32 aReturn 
)

Definition at line 728 of file nsInstall.cpp.

{
    PRInt32 result = SanityCheck();

    if (result != nsInstall::SUCCESS)
    {
        *aReturn = SaveError( result );
        return NS_OK;
    }

    nsString version;
    *aReturn = mVersionInfo->ToString(version);

    if (NS_FAILED(*aReturn))
    {
        SaveError( nsInstall::UNEXPECTED_ERROR );
        return NS_OK;
    }

    return AddSubcomponent(aRegName,
                           version,
                           aJarSource,
                           aFolder,
                           aTargetName,
                           INSTALL_NO_COMPARE,
                           aReturn);
}

Here is the call graph for this function:

PRInt32 nsInstall::AddSubcomponent ( const nsString aJarSource,
PRInt32 aReturn 
)

Definition at line 761 of file nsInstall.cpp.

{
    if(mPackageFolder == nsnull)
    {
        *aReturn = SaveError( nsInstall::PACKAGE_FOLDER_NOT_SET );
        return NS_OK;
    }
    PRInt32 result = SanityCheck();

    if (result != nsInstall::SUCCESS)
    {
        *aReturn = SaveError( result );
        return NS_OK;
    }

    nsString version;
    *aReturn = mVersionInfo->ToString(version);

    if (NS_FAILED(*aReturn))
    {
        SaveError( nsInstall::UNEXPECTED_ERROR );
        return NS_OK;
    }

    return AddSubcomponent(EmptyString(),
                           version,
                           aJarSource,
                           mPackageFolder,
                           EmptyString(),
                           INSTALL_NO_COMPARE,
                           aReturn);
}

Here is the call graph for this function:

Definition at line 2598 of file nsInstall.cpp.

{
    nsPIXPIProxy *ui = GetUIThreadProxy();
    if (!ui)
        return UNEXPECTED_ERROR;

    nsAutoString title;
    title.AssignLiteral("Alert");
    if (!mUIName.IsEmpty())
    {
        title = mUIName;
    }
    else
    {
        PRUnichar *t = GetTranslatedString(title.get());
        if (t)
            title.Adopt(t);
    }
    return ui->Alert( title.get(), string.get());
}

Here is the call graph for this function:

Here is the caller graph for this function:

PRBool nsInstall::BadRegName ( const nsString regName) [private]

Definition at line 2481 of file nsInstall.cpp.

{
    if ( regName.IsEmpty() )
        return PR_TRUE;

    if ((regName.First() == ' ' ) || (regName.Last() == ' ' ))
        return PR_TRUE;

    if ( regName.Find("//") != -1 )
        return PR_TRUE;

    if ( regName.Find(" /") != -1 )
        return PR_TRUE;

    if ( regName.Find("/ ") != -1  )
        return PR_TRUE;

    return PR_FALSE;
}

Here is the caller graph for this function:

void nsInstall::CleanUp ( void  ) [private]

Definition at line 2517 of file nsInstall.cpp.

{
    nsInstallObject* ie;

    if ( mInstalledFiles != nsnull )
    {
        for (PRInt32 i=0; i < mInstalledFiles->Count(); i++)
        {
            ie = (nsInstallObject*)mInstalledFiles->ElementAt(i);
            if (ie)
                delete ie;
        }

        mInstalledFiles->Clear();
        delete (mInstalledFiles);
        mInstalledFiles = nsnull;
    }

    if (mPatchList != nsnull)
    {
        mPatchList->Reset();
        delete mPatchList;
        mPatchList = nsnull;
    }

    if (mPackageFolder != nsnull)
    {
      delete (mPackageFolder);
      mPackageFolder = nsnull;
    }

    mRegistryPackageName.SetLength(0); // used to see if StartInstall() has been called
    mStartInstallCompleted = PR_FALSE;
}

Here is the caller graph for this function:

PRInt32 nsInstall::ConfirmEx ( nsString aDialogTitle,
nsString aText,
PRUint32  aButtonFlags,
nsString aButton0Title,
nsString aButton1Title,
nsString aButton2Title,
nsString aCheckMsg,
PRBool aCheckState,
PRInt32 aReturn 
)

Definition at line 2620 of file nsInstall.cpp.

{
    *aReturn = -1; /* default value */

    nsPIXPIProxy *ui = GetUIThreadProxy();
    if (!ui)
        return UNEXPECTED_ERROR;

    nsAutoString title;
    title.AssignLiteral("Confirm");
    if (!aDialogTitle.IsEmpty())
    {
        title = aDialogTitle;
    }
    else if (!mUIName.IsEmpty())
    {
        title = mUIName;
    }
    else
    {
        PRUnichar *t = GetTranslatedString(title.get());
        if (t)
            title.Adopt(t);
    }
    return ui->ConfirmEx( title.get(),
                          aText.get(),
                          aButtonFlags,
                          aButton0Title.get(),
                          aButton1Title.get(),
                          aButton2Title.get(),
                          aCheckMsg.get(),
                          aCheckState,
                          aReturn);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsInstall::CurrentUserNode ( nsString userRegNode) [private]

Definition at line 2460 of file nsInstall.cpp.

{
    nsXPIDLCString profname;
    nsCOMPtr<nsIPrefBranch> prefBranch = do_GetService(NS_PREFSERVICE_CONTRACTID);

    if ( prefBranch )
    {
        prefBranch->GetCharPref("profile.name", getter_Copies(profname));
    }

    userRegNode.AssignLiteral("/Netscape/Users/");
    if ( !profname.IsEmpty() )
    {
        userRegNode.AppendWithConversion(profname);
        userRegNode.AppendLiteral("/");
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsInstall::DeleteVector ( nsVoidArray vector) [static, private]

Definition at line 2873 of file nsInstall.cpp.

{
    if (vector != nsnull)
    {
        for (PRInt32 i=0; i < vector->Count(); i++)
        {
            nsString* element = (nsString*)vector->ElementAt(i);
            if (element != nsnull)
                delete element;
        }

        vector->Clear();
        delete (vector);
        vector = nsnull;
    }
}

Here is the caller graph for this function:

Definition at line 797 of file nsInstall.cpp.

{
    PRInt32 result = SanityCheck();

    if (result != nsInstall::SUCCESS)
    {
        double d = SaveError( result );
        LL_L2D(d, *aReturn);
        return NS_OK;
    }
    nsCOMPtr<nsILocalFile> folder;
    NS_NewLocalFile(aFolder, PR_TRUE, getter_AddRefs(folder));

    result = folder->GetDiskSpaceAvailable(aReturn);
    return NS_OK;
}

Here is the call graph for this function:

PRInt32 nsInstall::Execute ( const nsString aJarSource,
const nsString aArgs,
PRBool  aBlocking,
PRInt32 aReturn 
)

Definition at line 815 of file nsInstall.cpp.

{
    PRInt32 result = SanityCheck();

    if (result != nsInstall::SUCCESS)
    {
        *aReturn = SaveError( result );
        return NS_OK;
    }

    nsInstallExecute* ie = new nsInstallExecute(this, aJarSource, aArgs, aBlocking, &result);

    if (ie == nsnull)
    {
        *aReturn = SaveError(nsInstall::OUT_OF_MEMORY);
        return NS_OK;
    }

    if (result == nsInstall::SUCCESS)
    {
        result = ScheduleForInstall( ie );
    }

    *aReturn = SaveError(result);
    return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

PRInt32 nsInstall::ExtractDirEntries ( const nsString directory,
nsVoidArray paths 
) [private]

Definition at line 2815 of file nsInstall.cpp.

{
    char                *buf;
    nsISimpleEnumerator *jarEnum = nsnull;
    nsIZipEntry         *currZipEntry = nsnull;

    if ( paths )
    {
        nsString pattern(directory + NS_LITERAL_STRING("/*"));
        PRInt32 prefix_length = directory.Length()+1; // account for slash

        nsresult rv = mJarFileData->FindEntries(
                          NS_LossyConvertUCS2toASCII(pattern).get(),
                          &jarEnum );
        if (NS_FAILED(rv) || !jarEnum)
            goto handle_err;

        PRBool bMore;
        rv = jarEnum->HasMoreElements(&bMore);
        while (bMore && NS_SUCCEEDED(rv))
        {
            rv = jarEnum->GetNext( (nsISupports**) &currZipEntry );
            if (currZipEntry)
            {
                // expensive 'buf' callee malloc per iteration!
                rv = currZipEntry->GetName(&buf);
                if (NS_FAILED(rv))
                    goto handle_err;
                if (buf)
                {
                    PRInt32 namelen = PL_strlen(buf);
                    NS_ASSERTION( prefix_length <= namelen, "Match must be longer than pattern!" );

                    if ( buf[namelen-1] != '/' )
                    {
                        // XXX manipulation should be in caller
                        nsString* tempString = new nsString; tempString->AssignWithConversion(buf+prefix_length);
                        paths->AppendElement(tempString);
                    }

                    PR_FREEIF( buf );
                }
                NS_IF_RELEASE(currZipEntry);
            }
            rv = jarEnum->HasMoreElements(&bMore);
        }
    }

    NS_IF_RELEASE(jarEnum);
    return SUCCESS;

handle_err:
    NS_IF_RELEASE(jarEnum);
    NS_IF_RELEASE(currZipEntry);
    return EXTRACTION_FAILED;
}

Here is the call graph for this function:

Here is the caller graph for this function:

PRInt32 nsInstall::ExtractFileFromJar ( const nsString aJarfile,
nsIFile aSuggestedName,
nsIFile **  aRealName 
)

Definition at line 2661 of file nsInstall.cpp.

{
    PRInt32 extpos = 0;
    nsCOMPtr<nsIFile> extractHereSpec;
    nsCOMPtr<nsILocalFile> tempFile;
    nsresult rv;

    if (aSuggestedName == nsnull)
    {
        nsCOMPtr<nsIProperties> directoryService =
                 do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID, &rv);

        directoryService->Get(NS_OS_TEMP_DIR, NS_GET_IID(nsIFile), getter_AddRefs(tempFile));

        nsAutoString tempFileName(NS_LITERAL_STRING("xpinstall"));

        // Get the extension of the file in the JAR
        extpos = aJarfile.RFindChar('.');
        if (extpos != -1)
        {
            // We found the extension; add it to the tempFileName string
            nsString extension;
            aJarfile.Right(extension, (aJarfile.Length() - extpos) );
            tempFileName += extension;
        }
        tempFile->Append(tempFileName);
        tempFile->CreateUnique(nsIFile::NORMAL_FILE_TYPE, 0664);
        tempFile->Clone(getter_AddRefs(extractHereSpec));

        if (extractHereSpec == nsnull)
            return nsInstall::OUT_OF_MEMORY;
    }
    else
    {
        nsCOMPtr<nsIFile> temp;
        aSuggestedName->Clone(getter_AddRefs(temp));

        PRBool exists;
        temp->Exists(&exists);
        if (exists)
        {
            PRBool writable;
            temp->IsWritable(&writable);
            if (!writable) // Can't extract. Target is readonly.
                return nsInstall::READ_ONLY;

            tempFile = do_QueryInterface(temp, &rv); //convert to an nsILocalFile
            if (tempFile == nsnull)
                return nsInstall::OUT_OF_MEMORY;

            //get the leafname so we can convert its extension to .new
            nsAutoString newLeafName;
            tempFile->GetLeafName(newLeafName);

            PRInt32 extpos = newLeafName.RFindChar('.');
            if (extpos != -1)
            {
                // We found the extension;
                newLeafName.Truncate(extpos + 1); //strip off the old extension
            }
            newLeafName.AppendLiteral("new");

            //Now reset the leafname
            tempFile->SetLeafName(newLeafName);
            tempFile->CreateUnique(nsIFile::NORMAL_FILE_TYPE, 0644);
            extractHereSpec = tempFile;
        }
        extractHereSpec = temp;
    }

    rv = mJarFileData->Extract(NS_LossyConvertUCS2toASCII(aJarfile).get(),
                               extractHereSpec);
    if (NS_FAILED(rv))
    {
        switch (rv) {
          case NS_ERROR_FILE_ACCESS_DENIED:         return ACCESS_DENIED;
          case NS_ERROR_FILE_DISK_FULL:             return INSUFFICIENT_DISK_SPACE;
          case NS_ERROR_FILE_TARGET_DOES_NOT_EXIST: return DOES_NOT_EXIST;
          default:                                  return EXTRACTION_FAILED;
        }
    }

#if defined(XP_MAC) || defined(XP_MACOSX)
    FSRef finalRef, extractedRef;

    nsCOMPtr<nsILocalFileMac> tempExtractHereSpec;
    tempExtractHereSpec = do_QueryInterface(extractHereSpec, &rv);
    tempExtractHereSpec->GetFSRef(&extractedRef);

    if ( nsAppleSingleDecoder::IsAppleSingleFile(&extractedRef) )
    {
        nsAppleSingleDecoder *asd = 
          new nsAppleSingleDecoder(&extractedRef, &finalRef);
        OSErr decodeErr = fnfErr;

        if (asd)
            decodeErr = asd->Decode();

        if (decodeErr != noErr)
        {
            if (asd)
                delete asd;
            return EXTRACTION_FAILED;
        }

        if (noErr != FSCompareFSRefs(&extractedRef, &finalRef))
        {
            // delete the unique extracted file that got renamed in AS decoding
            FSDeleteObject(&extractedRef);

            // "real name" in AppleSingle entry may cause file rename
            tempExtractHereSpec->InitWithFSRef(&finalRef);
            extractHereSpec = do_QueryInterface(tempExtractHereSpec, &rv);
        }
    }
#endif /* XP_MAC || XP_MACOSX */

    extractHereSpec->Clone(aRealName);
    
    return nsInstall::SUCCESS;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1623 of file nsInstall.cpp.

{
  nsCOMPtr<nsIFile> localFile = aTarget.GetFileSpec();
  if (localFile == nsnull)
  {
     *aReturn = SaveError(nsInstall::OUT_OF_MEMORY);
     return NS_OK;
  }

  nsInstallFileOpItem* ifop = new nsInstallFileOpItem(this, NS_FOP_DIR_CREATE, localFile, aReturn);
  if (ifop == nsnull)
  {
      *aReturn = SaveError(nsInstall::OUT_OF_MEMORY);
      return NS_OK;
  }

  PRInt32 result = SanityCheck();
  if (result != nsInstall::SUCCESS)
  {
      delete ifop;
      *aReturn = SaveError( result );
      return NS_OK;
  }

  if (*aReturn == nsInstall::SUCCESS)
  {
      *aReturn = ScheduleForInstall( ifop );
  }

  SaveError(*aReturn);

  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

PRInt32 nsInstall::FileOpDirGetParent ( nsInstallFolder aTarget,
nsInstallFolder **  theParentFolder 
)

Definition at line 1658 of file nsInstall.cpp.

{
  nsCOMPtr<nsIFile> parent;
  nsCOMPtr<nsIFile> localFile = aTarget.GetFileSpec();

  nsresult rv = localFile->GetParent(getter_AddRefs(parent));
  if (NS_SUCCEEDED(rv) && parent)
  {
    nsInstallFolder* folder = new nsInstallFolder();
    if (folder == nsnull)
    {
        return NS_ERROR_OUT_OF_MEMORY;
    }
      folder->Init(parent, EmptyString());
      *theParentFolder = folder;
  }
  else
      theParentFolder = nsnull;

  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

PRInt32 nsInstall::FileOpDirRemove ( nsInstallFolder aTarget,
PRInt32  aFlags,
PRInt32 aReturn 
)

Definition at line 1681 of file nsInstall.cpp.

{
  nsCOMPtr<nsIFile> localFile = aTarget.GetFileSpec();
  if (localFile == nsnull)
  {
     *aReturn = SaveError(nsInstall::OUT_OF_MEMORY);
     return NS_OK;
  }

  nsInstallFileOpItem* ifop = new nsInstallFileOpItem(this, NS_FOP_DIR_REMOVE, localFile, aFlags, aReturn);
  if (ifop == nsnull)
  {
      *aReturn = SaveError(nsInstall::OUT_OF_MEMORY);
      return NS_OK;
  }

  PRInt32 result = SanityCheck();
  if (result != nsInstall::SUCCESS)
  {
      delete ifop;
      *aReturn = SaveError( result );
      return NS_OK;
  }

  if (*aReturn == nsInstall::SUCCESS)
  {
      *aReturn = ScheduleForInstall( ifop );
  }

  SaveError(*aReturn);

  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

PRInt32 nsInstall::FileOpDirRename ( nsInstallFolder aSrc,
nsString aTarget,
PRInt32 aReturn 
)

Definition at line 1716 of file nsInstall.cpp.

{
  nsCOMPtr<nsIFile> localFile = aSrc.GetFileSpec();
  if (localFile == nsnull)
  {
     *aReturn = SaveError(nsInstall::OUT_OF_MEMORY);
     return NS_OK;
  }

  nsInstallFileOpItem* ifop = new nsInstallFileOpItem(this, NS_FOP_DIR_RENAME, localFile, aTarget, PR_FALSE, aReturn);
  if (ifop == nsnull)
  {
      *aReturn = SaveError(nsInstall::OUT_OF_MEMORY);
      return NS_OK;
  }

  PRInt32 result = SanityCheck();
  if (result != nsInstall::SUCCESS)
  {
      delete ifop;
      *aReturn = SaveError( result );
      return NS_OK;
  }

  if (*aReturn == nsInstall::SUCCESS)
  {
      *aReturn = ScheduleForInstall( ifop );
  }

  SaveError(*aReturn);

  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

PRInt32 nsInstall::FileOpFileCopy ( nsInstallFolder aSrc,
nsInstallFolder aTarget,
PRInt32 aReturn 
)

Definition at line 1751 of file nsInstall.cpp.

{
  nsCOMPtr<nsIFile> localSrcFile = aSrc.GetFileSpec();
  if (localSrcFile == nsnull)
  {
     *aReturn = SaveError(nsInstall::OUT_OF_MEMORY);
     return NS_OK;
  }

  nsCOMPtr<nsIFile>localTargetFile = aTarget.GetFileSpec();
  if (localTargetFile == nsnull)
  {
     *aReturn = SaveError(nsInstall::OUT_OF_MEMORY);
     return NS_OK;
  }

  nsInstallFileOpItem* ifop = new nsInstallFileOpItem(this, NS_FOP_FILE_COPY, localSrcFile, localTargetFile, aReturn);
  if (ifop == nsnull)
  {
      *aReturn = SaveError(nsInstall::OUT_OF_MEMORY);
      return NS_OK;
  }

  PRInt32 result = SanityCheck();
  if (result != nsInstall::SUCCESS)
  {
      delete ifop;
      *aReturn = SaveError( result );
      return NS_OK;
  }

  if (*aReturn == nsInstall::SUCCESS)
  {
      *aReturn = ScheduleForInstall( ifop );
  }

  SaveError(*aReturn);

  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

PRInt32 nsInstall::FileOpFileDelete ( nsInstallFolder aTarget,
PRInt32  aFlags,
PRInt32 aReturn 
)

Definition at line 1793 of file nsInstall.cpp.

{
  nsCOMPtr<nsIFile> localFile = aTarget.GetFileSpec();
  if (localFile == nsnull)
  {
     *aReturn = SaveError(nsInstall::OUT_OF_MEMORY);
     return NS_OK;
  }

  nsInstallFileOpItem* ifop = new nsInstallFileOpItem(this, NS_FOP_FILE_DELETE, localFile, aFlags, aReturn);
  if (ifop == nsnull)
  {
      *aReturn = SaveError(nsInstall::OUT_OF_MEMORY);
      return NS_OK;
  }

  PRInt32 result = SanityCheck();
  if (result != nsInstall::SUCCESS)
  {
      delete ifop;
      *aReturn = SaveError( result );
      return NS_OK;
  }

  if (*aReturn == nsInstall::SUCCESS)
  {
      *aReturn = ScheduleForInstall( ifop );
  }

  SaveError(*aReturn);

  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

PRInt32 nsInstall::FileOpFileExecute ( nsInstallFolder aTarget,
nsString aParams,
PRBool  aBlocking,
PRInt32 aReturn 
)

Definition at line 1828 of file nsInstall.cpp.

{
  nsCOMPtr<nsIFile> localFile = aTarget.GetFileSpec();
  if (localFile == nsnull)
  {
     *aReturn = SaveError(nsInstall::OUT_OF_MEMORY);
     return NS_OK;
  }

  nsInstallFileOpItem* ifop = new nsInstallFileOpItem(this, NS_FOP_FILE_EXECUTE, localFile, aParams, aBlocking, aReturn);
  if (ifop == nsnull)
  {
      *aReturn = SaveError(nsInstall::OUT_OF_MEMORY);
      return NS_OK;
  }

  PRInt32 result = SanityCheck();
  if (result != nsInstall::SUCCESS)
  {
      delete ifop;
      *aReturn = SaveError( result );
      return NS_OK;
  }

  if (*aReturn == nsInstall::SUCCESS)
  {
      *aReturn = ScheduleForInstall( ifop );
  }

  SaveError(*aReturn);

  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1863 of file nsInstall.cpp.

{
  nsCOMPtr<nsIFile> localFile = aTarget.GetFileSpec();

  localFile->Exists(aReturn);
  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1943 of file nsInstall.cpp.

{
  nsresult rv;
  nsCOMPtr<nsIFile> file = aTarget.GetFileSpec();
  nsCOMPtr<nsILocalFile> localFile = do_QueryInterface(file, &rv);

  localFile->GetDiskSpaceAvailable(aReturn);  //nsIFileXXX: need to figure out how to call GetDiskSpaceAvailable
  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

PRInt32 nsInstall::FileOpFileGetModDate ( nsInstallFolder aTarget,
double *  aReturn 
)

Definition at line 1955 of file nsInstall.cpp.

{
    * aReturn = 0;

    nsCOMPtr<nsIFile> localFile = aTarget.GetFileSpec();

    if (localFile)
    {
        double newStamp;
        PRInt64 lastModDate = LL_ZERO;
        localFile->GetLastModifiedTime(&lastModDate);

        LL_L2D(newStamp, lastModDate);

        *aReturn = newStamp;
    }

  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1876 of file nsInstall.cpp.

{
  PRInt32           rv = NS_OK;

#ifdef XP_WIN
  PRBool            flagExists;
  nsCOMPtr<nsILocalFile> localTarget(do_QueryInterface(aTarget.GetFileSpec()));
  UINT              uLen;
  UINT              dwLen;
  DWORD             dwHandle;
  LPVOID            lpData;
  LPVOID            lpBuffer;
  VS_FIXEDFILEINFO  *lpBuffer2;
  DWORD             dwMajor   = 0;
  DWORD             dwMinor   = 0;
  DWORD             dwRelease = 0;
  DWORD             dwBuild   = 0;
  nsCAutoString     nativeTargetPath;
  char              *nativeVersionString = nsnull;

  if(localTarget == nsnull)
    return(rv);

  flagExists = PR_FALSE;
  localTarget->Exists(&flagExists);
  if(flagExists)
  {
    localTarget->GetNativePath(nativeTargetPath);
    uLen   = 0;
    /* GetFileVersionInfoSize() requires a char *, but the api doesn't
     * indicate that it will modify it */
    dwLen  = GetFileVersionInfoSize((char *)nativeTargetPath.get(), &dwHandle);
    lpData = (LPVOID)PR_Malloc(sizeof(long)*dwLen);
    if(!lpData)
      return(nsInstall::OUT_OF_MEMORY);

    /* GetFileVersionInfo() requires a char *, but the api doesn't
     * indicate that it will modify it */
    if(GetFileVersionInfo((char *)nativeTargetPath.get(), dwHandle, dwLen, lpData) != 0)
    {
      if(VerQueryValue(lpData, "\\", &lpBuffer, &uLen) != 0)
      {
        lpBuffer2 = (VS_FIXEDFILEINFO *)lpBuffer;
        dwMajor   = HIWORD(lpBuffer2->dwFileVersionMS);
        dwMinor   = LOWORD(lpBuffer2->dwFileVersionMS);
        dwRelease = HIWORD(lpBuffer2->dwFileVersionLS);
        dwBuild   = LOWORD(lpBuffer2->dwFileVersionLS);
      }
    }

    nativeVersionString = PR_smprintf("%d.%d.%d.%d", dwMajor, dwMinor, dwRelease, dwBuild);
    if(!nativeVersionString)
      rv = nsInstall::OUT_OF_MEMORY;
    else
    {
      aReturn->AssignASCII(nativeVersionString);
      PR_smprintf_free(nativeVersionString);
    }

    PR_FREEIF(lpData);
  }
#endif

  return(rv);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1976 of file nsInstall.cpp.

{
  nsCOMPtr<nsIFile> localFile = aTarget.GetFileSpec();

  localFile->GetFileSize(aReturn);
  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1985 of file nsInstall.cpp.

{
  nsCOMPtr<nsIFile> localFile = aTarget.GetFileSpec();

  localFile->IsDirectory(aReturn);
  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 2003 of file nsInstall.cpp.

{
  nsCOMPtr<nsIFile> localFile = aTarget.GetFileSpec();

  localFile->IsFile(aReturn);
  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1994 of file nsInstall.cpp.

{
  nsCOMPtr<nsIFile> localFile = aTarget.GetFileSpec();

  localFile->IsWritable(aReturn);
  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

PRInt32 nsInstall::FileOpFileMacAlias ( nsIFile aSourceFile,
nsIFile aAliasFile,
PRInt32 aReturn 
)

Definition at line 2204 of file nsInstall.cpp.

{

  *aReturn = nsInstall::SUCCESS;

#if defined(XP_MAC) || defined(XP_MACOSX)

  nsInstallFileOpItem* ifop = new nsInstallFileOpItem(this, NS_FOP_MAC_ALIAS, aSourceFile, aAliasFile, aReturn);
  if (!ifop)
  {
      *aReturn = SaveError(nsInstall::OUT_OF_MEMORY);
      return NS_OK;
  }

  PRInt32 result = SanityCheck();
  if (result != nsInstall::SUCCESS)
  {
      *aReturn = SaveError( result );
      return NS_OK;
  }

  if (ifop == nsnull)
  {
      *aReturn = SaveError(nsInstall::OUT_OF_MEMORY);
      return NS_OK;
  }

  if (*aReturn == nsInstall::SUCCESS)
  {
      *aReturn = ScheduleForInstall( ifop );
  }

  SaveError(*aReturn);

#endif /* XP_MAC || XP_MACOSX */

  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

PRInt32 nsInstall::FileOpFileModDateChanged ( nsInstallFolder aTarget,
double  aOldStamp,
PRBool aReturn 
)

Definition at line 2013 of file nsInstall.cpp.

{
    *aReturn = PR_TRUE;

    nsCOMPtr<nsIFile> localFile = aTarget.GetFileSpec();
    if (localFile)
    {
        double newStamp;
        PRInt64 lastModDate = LL_ZERO;
        localFile->GetLastModifiedTime(&lastModDate);

        LL_L2D(newStamp, lastModDate);

        *aReturn = !(newStamp == aOldStamp);
    }
    return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

PRInt32 nsInstall::FileOpFileMove ( nsInstallFolder aSrc,
nsInstallFolder aTarget,
PRInt32 aReturn 
)

Definition at line 2032 of file nsInstall.cpp.

{
  nsCOMPtr<nsIFile> localSrcFile = aSrc.GetFileSpec();
  if (localSrcFile == nsnull)
  {
     *aReturn = SaveError(nsInstall::OUT_OF_MEMORY);
     return NS_OK;
  }
  nsCOMPtr<nsIFile> localTargetFile = aTarget.GetFileSpec();
  if (localTargetFile == nsnull)
  {
     *aReturn = SaveError(nsInstall::OUT_OF_MEMORY);
     return NS_OK;
  }

  nsInstallFileOpItem* ifop = new nsInstallFileOpItem(this, NS_FOP_FILE_MOVE, localSrcFile, localTargetFile, aReturn);
  if (ifop == nsnull)
  {
      *aReturn = SaveError(nsInstall::OUT_OF_MEMORY);
      return NS_OK;
  }

  PRInt32 result = SanityCheck();
  if (result != nsInstall::SUCCESS)
  {
      delete ifop;
      *aReturn = SaveError( result );
      return NS_OK;
  }

  if (*aReturn == nsInstall::SUCCESS)
  {
      *aReturn = ScheduleForInstall( ifop );
  }

  SaveError(*aReturn);

  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

PRInt32 nsInstall::FileOpFileRename ( nsInstallFolder aSrc,
nsString aTarget,
PRInt32 aReturn 
)

Definition at line 2073 of file nsInstall.cpp.

{
  nsCOMPtr<nsIFile> localFile = aSrc.GetFileSpec();
  if (localFile == nsnull)
  {
     *aReturn = SaveError(nsInstall::OUT_OF_MEMORY);
     return NS_OK;
  }

  nsInstallFileOpItem* ifop = new nsInstallFileOpItem(this, NS_FOP_FILE_RENAME, localFile, aTarget, PR_FALSE, aReturn);
  if (ifop == nsnull)
  {
      *aReturn = SaveError(nsInstall::OUT_OF_MEMORY);
      return NS_OK;
  }

  PRInt32 result = SanityCheck();
  if (result != nsInstall::SUCCESS)
  {
      delete ifop;
      *aReturn = SaveError( result );
      return NS_OK;
  }

  if (*aReturn == nsInstall::SUCCESS)
  {
      *aReturn = ScheduleForInstall( ifop );
  }

  SaveError(*aReturn);

  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

PRInt32 nsInstall::FileOpFileUnixLink ( nsInstallFolder aTarget,
PRInt32  aFlags,
PRInt32 aReturn 
)

Definition at line 2244 of file nsInstall.cpp.

{
  return NS_OK;
}

Here is the caller graph for this function:

Definition at line 2113 of file nsInstall.cpp.

{
#ifdef _WINDOWS

  PRInt32             err;
  PRBool              flagExists;
  nsString            tmpNsString;
  nsCAutoString       nativeTargetPath;
  nsAutoString        unicodePath;
  char                nativeShortPathName[MAX_PATH];
  nsCOMPtr<nsIFile>   localTarget(aTarget.GetFileSpec());

  if(localTarget == nsnull)
    return NS_OK;

  localTarget->Exists(&flagExists);
  if(flagExists)
  {
    memset(nativeShortPathName, 0, MAX_PATH);
    localTarget->GetNativePath(nativeTargetPath);

    err = GetShortPathName(nativeTargetPath.get(), nativeShortPathName, MAX_PATH);
    if((err > 0) && (*nativeShortPathName == '\0'))
    {
      // NativeShortPathName buffer not big enough.
      // Reallocate and try again.
      // err will have the required size.
      char *nativeShortPathNameTmp = new char[err + 1];
      if(nativeShortPathNameTmp == nsnull)
        return NS_OK;

      err = GetShortPathName(nativeTargetPath.get(), nativeShortPathNameTmp, err + 1);
      // It is safe to assume that the second time around the buffer is big
      // enough and not to worry about it unless it's a different problem.  If
      // it failed the first time because of buffer size being too small, err
      // will be the buffer size required.  If it's any other error, err will
      // be 0 and GetLastError() will have the actual error.
      if(err != 0)
      {
        // if err is 0, it's not a buffer size problem.  It's something else unexpected.
        NS_CopyNativeToUnicode(nsDependentCString(nativeShortPathNameTmp), unicodePath);
      }

      if(nativeShortPathNameTmp)
        delete [] nativeShortPathNameTmp;
    }
    else if(err != 0)
    {
      // if err is 0, it's not a buffer size problem.  It's something else unexpected.
      NS_CopyNativeToUnicode(nsDependentCString(nativeShortPathName), unicodePath);
    }
  }

  if (!unicodePath.IsEmpty())
    aShortPathName = unicodePath;

#endif

  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

PRInt32 nsInstall::FileOpFileWindowsShortcut ( nsIFile aTarget,
nsIFile aShortcutPath,
nsString aDescription,
nsIFile aWorkingPath,
nsString aParams,
nsIFile aIcon,
PRInt32  aIconId,
PRInt32 aReturn 
)

Definition at line 2175 of file nsInstall.cpp.

{

  nsInstallFileOpItem* ifop = new nsInstallFileOpItem(this, NS_FOP_WIN_SHORTCUT, aTarget, aShortcutPath, aDescription, aWorkingPath, aParams, aIcon, aIconId, aReturn);
  if (ifop == nsnull)
  {
      *aReturn = SaveError(nsInstall::OUT_OF_MEMORY);
      return NS_OK;
  }

  PRInt32 result = SanityCheck();
  if (result != nsInstall::SUCCESS)
  {
      delete ifop;
      *aReturn = SaveError( result );
      return NS_OK;
  }

  if (*aReturn == nsInstall::SUCCESS)
  {
      *aReturn = ScheduleForInstall( ifop );
  }

  SaveError(*aReturn);

  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 2250 of file nsInstall.cpp.

{
  nsCOMPtr<nsIFile> localFile = aTarget.GetFileSpec();
  if (localFile == nsnull)
  {
     *aReturn = SaveError(nsInstall::OUT_OF_MEMORY);
     return NS_OK;
  }

  nsInstallFileOpItem* ifop = new nsInstallFileOpItem(this, NS_FOP_WIN_REGISTER_SERVER, localFile, aReturn);
  if (ifop == nsnull)
  {
      *aReturn = SaveError(nsInstall::OUT_OF_MEMORY);
      return NS_OK;
  }

  PRInt32 result = SanityCheck();
  if (result != nsInstall::SUCCESS)
  {
      delete ifop;
      *aReturn = SaveError( result );
      return NS_OK;
  }

  if (*aReturn == nsInstall::SUCCESS)
  {
      *aReturn = ScheduleForInstall( ifop );
  }

  SaveError(*aReturn);

  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 844 of file nsInstall.cpp.

{
    PRInt32 result = SUCCESS;
    PRBool  rebootNeeded = PR_FALSE;

    *aReturn = SanityCheck();

    if (*aReturn != nsInstall::SUCCESS)
    {
        SaveError( *aReturn );
        mFinalStatus = *aReturn;
        return NS_OK;
    }


    if ( mInstalledFiles->Count() > 0 )
    {
        if ( mUninstallPackage )
        {
            VR_UninstallCreateNode( NS_CONST_CAST(char *, NS_ConvertUCS2toUTF8(mRegistryPackageName).get()),
                                    NS_CONST_CAST(char *, NS_ConvertUCS2toUTF8(mUIName).get()));
        }

        // Install the Component into the Version Registry.
        if (mVersionInfo)
        {
            nsString versionString;
            nsCString path;

            mVersionInfo->ToString(versionString);
            nsCAutoString versionCString;
            versionCString.AssignWithConversion(versionString);

            if (mPackageFolder)
                mPackageFolder->GetDirectoryPath(path);

            VR_Install( NS_CONST_CAST(char *, NS_ConvertUCS2toUTF8(mRegistryPackageName).get()),
                        NS_CONST_CAST(char *, path.get()),
                        NS_CONST_CAST(char *, versionCString.get()),
                        PR_TRUE );
        }

        nsInstallObject* ie = nsnull;

        for (PRInt32 i=0; i < mInstalledFiles->Count(); i++)
        {
            ie = (nsInstallObject*)mInstalledFiles->ElementAt(i);
            NS_ASSERTION(ie, "NULL object in install queue!");
            if (ie == NULL)
                continue;

            if (mListener)
            {
                char *objString = ie->toString();
                if (objString)
                {
                    mListener->OnFinalizeProgress(
                                    NS_ConvertASCIItoUCS2(objString).get(),
                                    (i+1), mInstalledFiles->Count());
                    delete [] objString;
                }
            }

            result = ie->Complete();

            if (result != nsInstall::SUCCESS)
            {
                if ( result == REBOOT_NEEDED )
                {
                    rebootNeeded = PR_TRUE;
                    result = SUCCESS;
                }
                else
                {
                    InternalAbort( result );
                    break;
                }
            }
        }

        if ( result == SUCCESS )
        {
            if ( rebootNeeded )
                *aReturn = SaveError( REBOOT_NEEDED );

            if ( nsSoftwareUpdate::mNeedCleanup )
            {
                // Broadcast the fact that we have an incomplete install so
                // parts of Mozilla can take defensive action if necessary.
                //
                // This notification turns off turbo/server mode, for example
                nsPIXPIProxy* proxy = GetUIThreadProxy();
                if (proxy)
                    proxy->NotifyRestartNeeded();
            }

            // XXX for now all successful installs will trigger an Autoreg.
            // We eventually want to do this only when flagged.
            NS_SoftwareUpdateRequestAutoReg();
        }
        else
            *aReturn = SaveError( result );

        mFinalStatus = *aReturn;
    }
    else
    {
        // no actions queued: don't register the package version
        // and no need for user confirmation

        mFinalStatus = *aReturn;
    }

    CleanUp();

    return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

PRInt32 nsInstall::Gestalt ( const nsString aSelector,
PRInt32 aReturn 
)

Definition at line 970 of file nsInstall.cpp.

{
    *aReturn = nsnull;

    PRInt32 result = SanityCheck();

    if (result != nsInstall::SUCCESS)
    {
        *aReturn = SaveError( result );
        return NS_OK;
    }
#if defined(XP_MAC) || defined(XP_MACOSX)

    long    response = 0;
    char    selectorChars[4];
    int     i;
    OSErr   err = noErr;
    OSType  selector;

    if (aSelector.IsEmpty())
    {
        return NS_OK;
    }

    for (i=0; i<4; i++)
        selectorChars[i] = aSelector.CharAt(i);
    selector = GESTALT_CHAR_CODE(selectorChars);

    err = ::Gestalt(selector, &response);

    if (err != noErr)
        *aReturn = err;
    else
        *aReturn = response;

#endif /* XP_MAC || XP_MACOSX */
    return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 331 of file nsInstall.h.

{ return mChromeRegistry; }

Here is the caller graph for this function:

PRInt32 nsInstall::GetComponentFolder ( const nsString aComponentName,
const nsString aSubdirectory,
nsInstallFolder **  aFolder 
)

Definition at line 1010 of file nsInstall.cpp.

{
    long        err;
    char        dir[MAXREGPATHLEN];
    nsresult    res = NS_OK;

    if(!aNewFolder)
        return INVALID_ARGUMENTS;

    *aNewFolder = nsnull;


    nsString tempString;

    if ( GetQualifiedPackageName(aComponentName, tempString) != SUCCESS )
    {
        return NS_OK;
    }

    NS_ConvertUCS2toUTF8 componentCString(tempString);

    if((err = VR_GetDefaultDirectory( NS_CONST_CAST(char *, componentCString.get()), sizeof(dir), dir )) != REGERR_OK)
    {
        // if there's not a default directory, try to see if the component
        // // is registered as a file and then strip the filename off the path
        if((err = VR_GetPath( NS_CONST_CAST(char *, componentCString.get()), sizeof(dir), dir )) != REGERR_OK)
        {
          // no path, either
          *dir = '\0';
        }
    }

    nsCOMPtr<nsILocalFile> componentDir;
    nsCOMPtr<nsIFile> componentIFile;
    if(*dir != '\0')
        NS_NewNativeLocalFile( nsDependentCString(dir), PR_FALSE, getter_AddRefs(componentDir) );

    if ( componentDir )
    {
        PRBool isFile;

        res = componentDir->IsFile(&isFile);
        if (NS_SUCCEEDED(res) && isFile)
            componentDir->GetParent(getter_AddRefs(componentIFile));
        else
            componentIFile = do_QueryInterface(componentDir);

        nsInstallFolder * folder = new nsInstallFolder();
        if (!folder)
            return NS_ERROR_OUT_OF_MEMORY;

        res = folder->Init(componentIFile, aSubdirectory);
        if (NS_FAILED(res))
        {
            delete folder;
        }
        else
        {
            *aNewFolder = folder;
        }
    }

    return res;
}

Here is the call graph for this function:

Here is the caller graph for this function:

PRInt32 nsInstall::GetComponentFolder ( const nsString aComponentName,
nsInstallFolder **  aFolder 
)

Definition at line 1076 of file nsInstall.cpp.

{
    return GetComponentFolder(aComponentName, EmptyString(), aNewFolder);
}

Here is the call graph for this function:

Definition at line 335 of file nsInstall.h.

{ return mFinalStatus; }

Here is the caller graph for this function:

PRInt32 nsInstall::GetFolder ( nsInstallFolder aTargetFolder,
const nsString aSubdirectory,
nsInstallFolder **  aFolder 
)

Definition at line 1114 of file nsInstall.cpp.

{
    /* This version of GetFolder takes an nsString object as the first param */
    if (!aNewFolder)
        return INVALID_ARGUMENTS;

    * aNewFolder = nsnull;

    nsInstallFolder* folder = new nsInstallFolder();
    if (folder == nsnull)
    {
        return NS_ERROR_OUT_OF_MEMORY;
    }
    nsresult res = folder->Init(aTargetFolderObj, aSubdirectory);

    if (NS_FAILED(res))
    {
        delete folder;
        return res;
    }
    *aNewFolder = folder;
    return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

PRInt32 nsInstall::GetFolder ( const nsString aTargetFolder,
const nsString aSubdirectory,
nsInstallFolder **  aFolder 
)

Definition at line 1082 of file nsInstall.cpp.

{
    /* This version of GetFolder takes an nsString object as the first param */
    if (!aNewFolder)
        return INVALID_ARGUMENTS;

    * aNewFolder = nsnull;

    nsInstallFolder* folder = new nsInstallFolder();
    if (folder == nsnull)
    {
        return NS_ERROR_OUT_OF_MEMORY;
    }
    nsresult res = folder->Init(targetFolder, aSubdirectory);

    if (NS_FAILED(res))
    {
        delete folder;
        return res;
    }
    *aNewFolder = folder;
    return NS_OK;
}

Here is the call graph for this function:

PRInt32 nsInstall::GetFolder ( const nsString aTargetFolder,
nsInstallFolder **  aFolder 
)

Definition at line 1107 of file nsInstall.cpp.

{
    /* This version of GetFolder takes an nsString object as the only param */
    return GetFolder(targetFolder, EmptyString(), aNewFolder);
}

Here is the call graph for this function:

Definition at line 2560 of file nsInstall.cpp.

{
    args = mInstallArguments;
}

Here is the caller graph for this function:

Definition at line 326 of file nsInstall.h.

{ return mInstallFlags; }

Here is the caller graph for this function:

Definition at line 329 of file nsInstall.cpp.

{
  if (mInstallPlatform.IsEmpty())
  {
    // Duplicated from mozilla/netwerk/protocol/http/src/nsHTTPHandler.cpp
    // which is not yet available in a wizard install

    // Gather platform.
#if defined(XP_WIN)
    mInstallPlatform = "Windows";
#elif defined(XP_MAC) || defined(XP_MACOSX)
    mInstallPlatform = "Macintosh";
#elif defined (XP_UNIX)
    mInstallPlatform = "X11";
#elif defined(XP_BEOS)
    mInstallPlatform = "BeOS";
#elif defined(XP_OS2)
    mInstallPlatform = "OS/2";
#endif

    mInstallPlatform += "; ";

    // Gather OS/CPU.
#if defined(XP_WIN)
    OSVERSIONINFO info = { sizeof(OSVERSIONINFO) };
    if (GetVersionEx(&info)) {
        if ( info.dwPlatformId == VER_PLATFORM_WIN32_NT ) {
            if (info.dwMajorVersion      == 3) {
                mInstallPlatform += "WinNT3.51";
            }
            else if (info.dwMajorVersion == 4) {
                mInstallPlatform += "WinNT4.0";
            }
            else if (info.dwMajorVersion == 5) {
                mInstallPlatform += "Windows NT 5.0";
            }
            else {
                mInstallPlatform += "WinNT";
            }
        } else if (info.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS) {
            if (info.dwMinorVersion == 90)
                mInstallPlatform += "Win 9x 4.90";
            else if (info.dwMinorVersion > 0)
                mInstallPlatform += "Win98";
            else
                mInstallPlatform += "Win95";
        }
    }
#elif defined (XP_UNIX) || defined (XP_BEOS)
    struct utsname name;

    int ret = uname(&name);
    if (ret >= 0) {
       mInstallPlatform +=  (char*)name.sysname;
       mInstallPlatform += ' ';
       mInstallPlatform += (char*)name.release;
       mInstallPlatform += ' ';
       mInstallPlatform += (char*)name.machine;
    }
#elif defined (XP_MAC) || defined (XP_MACOSX)
    mInstallPlatform += "PPC";
#elif defined(XP_OS2)
    ULONG os2ver = 0;
    DosQuerySysInfo(QSV_VERSION_MINOR, QSV_VERSION_MINOR,
                    &os2ver, sizeof(os2ver));
    if (os2ver == 11)
        mInstallPlatform += "2.11";
    else if (os2ver == 30)
        mInstallPlatform += "Warp 3";
    else if (os2ver == 40)
        mInstallPlatform += "Warp 4";
    else if (os2ver == 45)
        mInstallPlatform += "Warp 4.5";
    else
        mInstallPlatform += "Warp ???";
#endif
  }

  aPlatform = mInstallPlatform;
  return NS_OK;
}

Here is the caller graph for this function:

Definition at line 2572 of file nsInstall.cpp.

{ url = mInstallURL; }

Here is the caller graph for this function:

Definition at line 317 of file nsInstall.h.

{ return mJarFileLocation; }

Here is the caller graph for this function:

Definition at line 1142 of file nsInstall.cpp.

{
    *aReturn = mLastError;
    return NS_OK;
}

Here is the caller graph for this function:

void nsInstall::GetPatch ( nsHashKey *  aKey,
nsIFile **  fileName 
)

Definition at line 1609 of file nsInstall.cpp.

{
    if (!fileName)
        return;
    else
        *fileName = nsnull;

    if (mPatchList)
    {
        NS_IF_ADDREF(*fileName = (nsIFile*) mPatchList->Get(aKey));
    }
}

Here is the caller graph for this function:

PRInt32 nsInstall::GetQualifiedPackageName ( const nsString name,
nsString qualifiedName 
) [private]

GetQualifiedPackageName.

This routine converts a package-relative component registry name into a full name that can be used in calls to the version registry.

Definition at line 2389 of file nsInstall.cpp.

{
    nsString startOfName;
    name.Left(startOfName, 7);

    if ( startOfName.EqualsLiteral("=USER=/") )
    {
        CurrentUserNode(qualifiedName);
        qualifiedName += name;
    }
    else
    {
        qualifiedName = name;
    }

    if (BadRegName(qualifiedName))
    {
        return BAD_PACKAGE_NAME;
    }


    /* Check to see if the PackageName ends in a '/'.  If it does nuke it. */

    if (qualifiedName.Last() == '/')
    {
        PRInt32 index = qualifiedName.Length();
        qualifiedName.Truncate(--index);
    }

    return SUCCESS;
}

Here is the call graph for this function:

Here is the caller graph for this function:

PRInt32 nsInstall::GetQualifiedRegName ( const nsString name,
nsString qualifiedRegName 
) [private]

GetQualifiedRegName.

This routine converts a package-relative component registry name into a full name that can be used in calls to the version registry.

Definition at line 2429 of file nsInstall.cpp.

{
    nsString startOfName;
    name.Left(startOfName, 7);

    if ( startOfName.EqualsLiteral("=COMM=/") || startOfName.EqualsLiteral("=USER=/"))
    {
        qualifiedRegName = startOfName;
    }
    else if (name.CharAt(0) != '/' &&
             !mRegistryPackageName.IsEmpty())
    {
        qualifiedRegName = mRegistryPackageName
                         + NS_LITERAL_STRING("/")
                         + name;
    }
    else
    {
        qualifiedRegName = name;
    }

    if (BadRegName(qualifiedRegName))
    {
        return BAD_PACKAGE_NAME;
    }

    return SUCCESS;
}

Here is the call graph for this function:

Here is the caller graph for this function:

char * nsInstall::GetResourcedString ( const nsAString &  aResName)

GetResourcedString.

Obtains the string resource for actions and messages that are displayed in user interface confirmation and progress dialogs.

Parameters:
aResName- property name/identifier of string resource
Returns:
rscdStr - corresponding resourced value in the string bundle

Definition at line 2793 of file nsInstall.cpp.

{
    if (mStringBundle)
    {
        nsXPIDLString ucRscdStr;
        nsresult rv = mStringBundle->GetStringFromName(PromiseFlatString(aResName).get(),
                                                     getter_Copies(ucRscdStr));
        if (NS_SUCCEEDED(rv))
            return ToNewCString(ucRscdStr);
    }

    /*
    ** We don't have a string bundle, the necessary libs, or something went wrong
    ** so we failover to hardcoded english strings so we log something rather
    ** than nothing due to failure above: always the case for the Install Wizards.
    */
    return nsCRT::strdup(nsInstallResources::GetDefaultVal(
                    NS_LossyConvertUCS2toASCII(aResName).get()));
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsInstall::GetTime ( nsString aString) [private]

Definition at line 1404 of file nsInstall.cpp.

{
    if (!mUIThreadProxy)
    {
        nsresult rv;
        nsCOMPtr<nsIProxyObjectManager> pmgr =
                 do_GetService(kProxyObjectManagerCID, &rv);
        if (NS_SUCCEEDED(rv))
        {
            nsCOMPtr<nsPIXPIProxy> tmp(do_QueryInterface(new nsXPIProxy()));
            rv = pmgr->GetProxyForObject( NS_UI_THREAD_EVENTQ, NS_GET_IID(nsPIXPIProxy),
                    tmp, PROXY_SYNC | PROXY_ALWAYS, getter_AddRefs(mUIThreadProxy) );
        }
    }

    return mUIThreadProxy;
}

Here is the call graph for this function:

Here is the caller graph for this function:

PRInt32 nsInstall::GetWinProfile ( const nsString aFolder,
const nsString aFile,
JSContext jscontext,
JSClass WinProfileClass,
jsval aReturn 
)

Definition at line 1149 of file nsInstall.cpp.

{
    *aReturn = JSVAL_NULL;

    if (SanityCheck() != nsInstall::SUCCESS)
    {
        return NS_OK;
    }

#ifdef _WINDOWS
    JSObject*     winProfileObject;
    nsWinProfile* nativeWinProfileObject = new nsWinProfile(this, aFolder, aFile);

    if (nativeWinProfileObject == nsnull)
        return NS_OK;

    JSObject*     winProfilePrototype    = this->RetrieveWinProfilePrototype();

    winProfileObject = JS_NewObject(jscontext, WinProfileClass, winProfilePrototype, NULL);
    if(winProfileObject == NULL)
        return NS_OK;

    JS_SetPrivate(jscontext, winProfileObject, nativeWinProfileObject);

    *aReturn = OBJECT_TO_JSVAL(winProfileObject);
#endif /* _WINDOWS */

    return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

PRInt32 nsInstall::GetWinRegistry ( JSContext jscontext,
JSClass WinRegClass,
jsval aReturn 
)

Definition at line 1180 of file nsInstall.cpp.

{
    *aReturn = JSVAL_NULL;

    if (SanityCheck() != nsInstall::SUCCESS)
    {
        return NS_OK;
    }

#ifdef _WINDOWS
    JSObject* winRegObject;
    nsWinReg* nativeWinRegObject = new nsWinReg(this);

    if (nativeWinRegObject == nsnull)
        return NS_OK;

    JSObject* winRegPrototype    = this->RetrieveWinRegPrototype();

    winRegObject = JS_NewObject(jscontext, WinRegClass, winRegPrototype, NULL);
    if(winRegObject == NULL)
        return NS_OK;

    JS_SetPrivate(jscontext, winRegObject, nativeWinRegObject);

    *aReturn = OBJECT_TO_JSVAL(winRegObject);
#endif /* _WINDOWS */

    return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 336 of file nsInstall.h.

{ return mInstalledFiles != nsnull; }

Here is the caller graph for this function:

Definition at line 413 of file nsInstall.cpp.

{
    mFinalStatus = errcode;

    nsInstallObject* ie;
    if (mInstalledFiles != nsnull)
    {
        // abort must work backwards through the list so cleanup can
        // happen in the correct order
        for (PRInt32 i = mInstalledFiles->Count()-1; i >= 0; i--)
        {
            ie = (nsInstallObject *)mInstalledFiles->ElementAt(i);
            if (ie)
                ie->Abort();
        }
    }

    CleanUp();
}

Here is the call graph for this function:

Here is the caller graph for this function:

PRInt32 nsInstall::LoadResources ( JSContext cx,
const nsString aBaseName,
jsval aReturn 
)

Definition at line 1211 of file nsInstall.cpp.

{
    *aReturn = JSVAL_NULL;
 
    if (SanityCheck() != nsInstall::SUCCESS)
    {
        return NS_OK;
    }
    nsresult ret;
    nsCOMPtr<nsIFile> resFile;
    nsIURI *url = nsnull;
    nsIStringBundleService* service = nsnull;
    nsIEventQueueService* pEventQueueService = nsnull;
    nsIStringBundle* bundle = nsnull;
    nsCOMPtr<nsISimpleEnumerator> propEnum;
    jsval v = JSVAL_NULL;

    // set up JSObject to return
    JS_GetProperty( cx, JS_GetGlobalObject( cx ), "Object", &v );
    if (!v)
    {
        return NS_ERROR_NULL_POINTER;
    }
    JSClass *objclass = JS_GetClass( cx, JSVAL_TO_OBJECT(v) );
    JSObject *res = JS_NewObject( cx, objclass, JSVAL_TO_OBJECT(v), 0 );

    // extract properties file
    // XXX append locale info: lang code, country code, .properties suffix to aBaseName
    PRInt32 err = ExtractFileFromJar(aBaseName, nsnull, getter_AddRefs(resFile));
    if ( (!resFile) || (err != nsInstall::SUCCESS)  )
    {
        SaveError( err );
        return NS_OK;
    }

    // initialize string bundle and related services
    ret = CallGetService(kStringBundleServiceCID, &service);
    if (NS_FAILED(ret))
        goto cleanup;
    ret = CallGetService(kEventQueueServiceCID, &pEventQueueService);
    if (NS_FAILED(ret))
        goto cleanup;
    ret = pEventQueueService->CreateThreadEventQueue();
    NS_RELEASE(pEventQueueService);
    if (NS_FAILED(ret))
        goto cleanup;

    // get the string bundle using the extracted properties file
#if 1
    {
      nsCAutoString spec;
      ret = NS_GetURLSpecFromFile(resFile, spec);
      if (NS_FAILED(ret)) {
        NS_WARNING("cannot get url spec\n");
        NS_RELEASE(service);
        return ret;
      }
      ret = service->CreateBundle(spec.get(), &bundle);
    }
#else
    ret = service->CreateBundle(url, &bundle);
#endif
    if (NS_FAILED(ret))
        goto cleanup;
    ret = bundle->GetSimpleEnumeration(getter_AddRefs(propEnum));
    if (NS_FAILED(ret))
        goto cleanup;

    // set the variables of the JSObject to return using the StringBundle's
    // enumeration service
    PRBool hasMore;
    while (NS_SUCCEEDED(propEnum->HasMoreElements(&hasMore)) && hasMore)
    {
        nsCOMPtr<nsISupports> nextProp;
        ret = propEnum->GetNext(getter_AddRefs(nextProp));
        if (NS_FAILED(ret))
            goto cleanup;

        nsCOMPtr<nsIPropertyElement> propElem =
            do_QueryInterface(nextProp);
        if (!propElem)
            continue;

        nsAutoString pVal;
        nsCAutoString pKey;
        ret = propElem->GetKey(pKey);
        if (NS_FAILED(ret))
            goto cleanup;
        ret = propElem->GetValue(pVal);
        if (NS_FAILED(ret))
            goto cleanup;

        if (!pKey.IsEmpty() && !pVal.IsEmpty())
        {
            JSString* propValJSStr = JS_NewUCStringCopyZ(cx, NS_REINTERPRET_CAST(const jschar*, pVal.get()));
            jsval propValJSVal = STRING_TO_JSVAL(propValJSStr);
            NS_ConvertUTF8toUTF16 UCKey(pKey);
            JS_SetUCProperty(cx, res, (jschar*)UCKey.get(), UCKey.Length(), &propValJSVal);
        }
    }

    *aReturn = OBJECT_TO_JSVAL(res);
    ret = nsInstall::SUCCESS;

cleanup:
    SaveError( ret );

    // release services
    NS_IF_RELEASE( service );

    // release file, URL, StringBundle, Enumerator
    NS_IF_RELEASE( url );
    NS_IF_RELEASE( bundle );

    return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsInstall::LogComment ( const nsAString &  aComment)

Definition at line 2285 of file nsInstall.cpp.

{
  if(mListener)
    mListener->OnLogComment(PromiseFlatString(aComment).get());
}

Here is the caller graph for this function:

void nsInstall::ParseFlags ( int  flags) [private]
PRInt32 nsInstall::Patch ( const nsString aRegName,
const nsString aVersion,
const nsString aJarSource,
nsInstallFolder aFolder,
const nsString aTargetName,
PRInt32 aReturn 
)

Definition at line 1329 of file nsInstall.cpp.

{
    PRInt32 result = SanityCheck();

    if (result != nsInstall::SUCCESS)
    {
        *aReturn = SaveError( result );
        return NS_OK;
    }

    nsString qualifiedRegName;

    *aReturn = GetQualifiedRegName( aRegName, qualifiedRegName);

    if (*aReturn != SUCCESS)
    {
        return NS_OK;
    }

    if (!mPatchList)
    {
        mPatchList = new nsHashtable();
        if (mPatchList == nsnull)
        {
            *aReturn = SaveError(nsInstall::OUT_OF_MEMORY);
            return NS_OK;
        }
    }

    nsInstallPatch* ip = new nsInstallPatch( this,
                                             qualifiedRegName,
                                             aVersion,
                                             aJarSource,
                                             aFolder,
                                             aTargetName,
                                             &result);

    if (ip == nsnull)
    {
        *aReturn = SaveError(nsInstall::OUT_OF_MEMORY);
        return NS_OK;
    }

    if (result == nsInstall::SUCCESS)
    {
        result = ScheduleForInstall( ip );
    }

    *aReturn = SaveError(result);
    return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

PRInt32 nsInstall::Patch ( const nsString aRegName,
const nsString aJarSource,
nsInstallFolder aFolder,
const nsString aTargetName,
PRInt32 aReturn 
)

Definition at line 1382 of file nsInstall.cpp.

{
    return Patch(aRegName, EmptyString(), aJarSource, aFolder, aTargetName, aReturn);
}

Here is the call graph for this function:

Definition at line 1423 of file nsInstall.cpp.

{
    nsPIXPIProxy* proxy = GetUIThreadProxy();
    if (!proxy)
        return UNEXPECTED_ERROR;

    return proxy->RefreshPlugins(aReloadPages);
}

Here is the call graph for this function:

Here is the caller graph for this function:

PRInt32 nsInstall::RegisterChrome ( nsIFile chrome,
PRUint32  chromeType,
const char *  path 
)

Definition at line 1388 of file nsInstall.cpp.

{
    PRInt32 result = SanityCheck();
    if (result != SUCCESS)
        return SaveError( result );

    if (!chrome || !chromeType)
        return SaveError( INVALID_ARGUMENTS );

    nsRegisterItem* ri = new nsRegisterItem(this, chrome, chromeType, path);
    if (ri == nsnull)
        return SaveError(OUT_OF_MEMORY);
    else
        return SaveError(ScheduleForInstall( ri ));
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1434 of file nsInstall.cpp.

{
    mLastError = aError;
    return SUCCESS;
}

Here is the caller graph for this function:

Here is the caller graph for this function:

Here is the caller graph for this function:

SanityCheck.

This routine checks if the packageName is null. It also checks the flag if the user cancels the install progress dialog is set and acccordingly aborts the install.

Definition at line 2365 of file nsInstall.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 2502 of file nsInstall.cpp.

{
  if ( errcode != nsInstall::SUCCESS )
    mLastError = errcode;

  return errcode;
}

Here is the caller graph for this function:

Here is the caller graph for this function:

Here is the caller graph for this function:

ScheduleForInstall call this to put an InstallObject on the install queue Do not call installedFiles.addElement directly, because this routine also handles progress messages.

Definition at line 2302 of file nsInstall.cpp.

{
    PRInt32 error = nsInstall::SUCCESS;

    char *objString = ob->toString();

    // flash current item

    if (mListener)
        mListener->OnItemScheduled(NS_ConvertASCIItoUCS2(objString).get());


    // do any unpacking or other set-up
    error = ob->Prepare();

    if (error == nsInstall::SUCCESS)
    {
        // Add to installation list
        mInstalledFiles->AppendElement( ob );

        // turn on flags for creating the uninstall node and
        // the package node for each InstallObject

        if (ob->CanUninstall())
            mUninstallPackage = PR_TRUE;

        if (ob->RegisterPackageNode())
            mRegisterPackage = PR_TRUE;
    }
    else if ( mListener )
    {
        // error in preparation step -- log it
        char* errRsrc = GetResourcedString(NS_LITERAL_STRING("ERROR"));
        if (errRsrc)
        {
            char* errprefix = PR_smprintf("%s (%d): ", errRsrc, error);
            nsString errstr; errstr.AssignWithConversion(errprefix);
            errstr.AppendWithConversion(objString);

            mListener->OnLogComment( errstr.get() );

            PR_smprintf_free(errprefix);
            nsCRT::free(errRsrc);
        }
    }

    if (error != SUCCESS)
        SaveError(error);

    if (objString)
        delete [] objString;

    return error;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 332 of file nsInstall.h.

                                { mChromeRegistry = reg; }

Here is the caller graph for this function:

Definition at line 2566 of file nsInstall.cpp.

Here is the caller graph for this function:

Definition at line 327 of file nsInstall.h.

Here is the caller graph for this function:

Definition at line 2573 of file nsInstall.cpp.

Here is the caller graph for this function:

Definition at line 2554 of file nsInstall.cpp.

{
    mJarFileLocation = aFile;
}

Here is the caller graph for this function:

Definition at line 1441 of file nsInstall.cpp.

{
    if (mPackageFolder)
        delete mPackageFolder;

    nsInstallFolder* folder = new nsInstallFolder();
    if (folder == nsnull)
    {
        return OUT_OF_MEMORY;
    }
    nsresult res = folder->Init(aFolder, EmptyString());

    if (NS_FAILED(res))
    {
        delete folder;
        return UNEXPECTED_ERROR;
    }
    mPackageFolder = folder;
    return SUCCESS;
}

Here is the call graph for this function:

Here is the caller graph for this function:

PRInt32 nsInstall::SetScriptObject ( void aScriptObject)

Definition at line 294 of file nsInstall.cpp.

{
  mScriptObject = (JSObject*) aScriptObject;
  return NS_OK;
}

Here is the caller graph for this function:

PRInt32 nsInstall::StartInstall ( const nsString aUserPackageName,
const nsString aPackageName,
const nsString aVersion,
PRInt32 aReturn 
)

Definition at line 1464 of file nsInstall.cpp.

{
    if ( aUserPackageName.IsEmpty() )
    {
        // There must be some pretty name for the UI and the uninstall list
        *aReturn = SaveError(INVALID_ARGUMENTS);
        return NS_OK;
    }

    char szRegPackagePath[MAXREGPATHLEN];

    *szRegPackagePath = '0';
    *aReturn   = nsInstall::SUCCESS;

    ResetError(nsInstall::SUCCESS);

    mUserCancelled = PR_FALSE;

    mUIName = aUserPackageName;

    *aReturn = GetQualifiedPackageName( aRegistryPackageName, mRegistryPackageName );

    if (*aReturn != nsInstall::SUCCESS)
    {
        SaveError( *aReturn );
        return NS_OK;
    }

    // initialize default version
    if (mVersionInfo != nsnull)
        delete mVersionInfo;

    mVersionInfo    = new nsInstallVersion();
    if (mVersionInfo == nsnull)
    {
        *aReturn = SaveError(nsInstall::OUT_OF_MEMORY);
        return NS_OK;
    }
    mVersionInfo->Init(aVersion);

    // initialize item queue
    mInstalledFiles = new nsVoidArray();

    if (mInstalledFiles == nsnull)
    {
        *aReturn = SaveError(nsInstall::OUT_OF_MEMORY);
        return NS_OK;
    }

    // initialize default folder if any (errors are OK)
    if (mPackageFolder != nsnull)
        delete mPackageFolder;

    mPackageFolder = nsnull;
    if(REGERR_OK == VR_GetDefaultDirectory(
                        NS_CONST_CAST(char *, NS_ConvertUCS2toUTF8(mRegistryPackageName).get()),
                        sizeof(szRegPackagePath), szRegPackagePath))
    {
        // found one saved in the registry
        mPackageFolder = new nsInstallFolder();
        nsCOMPtr<nsILocalFile> packageDir;
        NS_NewNativeLocalFile(
                            nsDependentCString(szRegPackagePath), // native path
                            PR_FALSE, getter_AddRefs(packageDir) );

        if (mPackageFolder && packageDir)
        {
            if (NS_FAILED( mPackageFolder->Init(packageDir, EmptyString()) ))
            {
                delete mPackageFolder;
                mPackageFolder = nsnull;
            }
        }
    }

    // We've correctly initialized an install transaction
    // - note that for commands that are only valid within one
    // - save error in case script doesn't call performInstall or cancelInstall
    // - broadcast to listeners
    mStartInstallCompleted = PR_TRUE;
    mFinalStatus = MALFORMED_INSTALL;
    if (mListener)
        mListener->OnPackageNameSet(mInstallURL.get(), mUIName.get(), aVersion.get());

    return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

PRInt32 nsInstall::Uninstall ( const nsString aPackageName,
PRInt32 aReturn 
)

Definition at line 1553 of file nsInstall.cpp.

{
    PRInt32 result = SanityCheck();

    if (result != nsInstall::SUCCESS)
    {
        *aReturn = SaveError( result );
        return NS_OK;
    }

    nsString qualifiedPackageName;

    *aReturn = GetQualifiedPackageName( aRegistryPackageName, qualifiedPackageName );

    if (*aReturn != SUCCESS)
    {
        return NS_OK;
    }

    nsInstallUninstall *ie = new nsInstallUninstall( this,
                                                     qualifiedPackageName,
                                                     &result );

    if (ie == nsnull)
    {
        *aReturn = SaveError(nsInstall::OUT_OF_MEMORY);
        return NS_OK;
    }

    if (result == nsInstall::SUCCESS)
    {
        result = ScheduleForInstall( ie );
    }
    else
    {
        delete ie;
    }

    *aReturn = SaveError(result);

    return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:


Friends And Related Function Documentation

friend class nsWinProfile [friend]

Definition at line 168 of file nsInstall.h.

friend class nsWinReg [friend]

Definition at line 167 of file nsInstall.h.


Member Data Documentation

Definition at line 360 of file nsInstall.h.

Definition at line 364 of file nsInstall.h.

Definition at line 356 of file nsInstall.h.

Definition at line 374 of file nsInstall.h.

Definition at line 358 of file nsInstall.h.

Definition at line 359 of file nsInstall.h.

Definition at line 357 of file nsInstall.h.

Definition at line 354 of file nsInstall.h.

Definition at line 353 of file nsInstall.h.

Definition at line 383 of file nsInstall.h.

Definition at line 378 of file nsInstall.h.

Definition at line 361 of file nsInstall.h.

nsHashtable* nsInstall::mPatchList [private]

Definition at line 376 of file nsInstall.h.

Definition at line 367 of file nsInstall.h.

Definition at line 370 of file nsInstall.h.

Definition at line 347 of file nsInstall.h.

Definition at line 368 of file nsInstall.h.

Definition at line 381 of file nsInstall.h.

Definition at line 371 of file nsInstall.h.

Definition at line 379 of file nsInstall.h.

Definition at line 366 of file nsInstall.h.

Definition at line 363 of file nsInstall.h.

Definition at line 372 of file nsInstall.h.

Definition at line 350 of file nsInstall.h.

Definition at line 349 of file nsInstall.h.


The documentation for this class was generated from the following files: