зеркало из https://github.com/mozilla/pjs.git
Bug 23941 speed up install on Mac, r=cathleen, a=jar;
Bug 12817 no Autoreg (in optimized builds) unless xpinstall detects flag indicating install has happened or build number changed, r=dp, a=jar; Bug 23859 add wstring API to nsIRegistry for profile manager/i18n, r=gayatrib, a=jar;
This commit is contained in:
Родитель
1b85c3659c
Коммит
74d0f231ed
|
@ -308,7 +308,7 @@ void nsCharsetConverterManager::FillInfoArrays()
|
|||
res = base->QueryInterface(kRegistryNodeIID, (void**)&node);
|
||||
if (NS_FAILED(res)) goto done1;
|
||||
|
||||
res = node->GetName(&name);
|
||||
res = node->GetNameUTF8(&name);
|
||||
if (NS_FAILED(res)) goto done1;
|
||||
|
||||
ci = new nsConverterInfo();
|
||||
|
@ -487,7 +487,7 @@ nsresult nsCharsetConverterManager::GetRegistryEnumeration(
|
|||
res = base->QueryInterface(kRegistryNodeIID, (void**)&node);
|
||||
if (NS_FAILED(res)) goto done1;
|
||||
|
||||
res = node->GetName(&name);
|
||||
res = node->GetNameUTF8(&name);
|
||||
if (NS_FAILED(res)) goto done1;
|
||||
|
||||
s = new nsString("charsetDetector.");
|
||||
|
|
|
@ -188,7 +188,7 @@ nsMimeXULEmitter::BuildListOfStatusProviders()
|
|||
return rv;
|
||||
|
||||
nsXPIDLCString name;
|
||||
rv = node->GetName(getter_Copies(name));
|
||||
rv = node->GetNameUTF8(getter_Copies(name));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
|
|
|
@ -85,14 +85,16 @@ interface nsIRegistry : nsISupports
|
|||
[scriptable, uuid(D1B54831-AC07-11d2-805E-00600811A9C3)]
|
||||
interface nsIRegistryNode : nsISupports
|
||||
{
|
||||
readonly attribute string name;
|
||||
readonly attribute string nameUTF8;
|
||||
readonly attribute wstring name;
|
||||
readonly attribute nsRegistryKey key;
|
||||
};
|
||||
|
||||
[scriptable,uuid(5316C380-B2F8-11d2-A374-0080C6F80E4B)]
|
||||
interface nsIRegistryValue : nsISupports
|
||||
{
|
||||
readonly attribute string name;
|
||||
readonly attribute wstring name;
|
||||
readonly attribute string nameUTF8;
|
||||
readonly attribute unsigned long type;
|
||||
readonly attribute PRUint32 length;
|
||||
};
|
||||
|
|
|
@ -42,6 +42,8 @@
|
|||
#define PR_Unlock(x) (void)0
|
||||
#endif
|
||||
|
||||
PRUnichar widestrFormat[] = { PRUnichar('%'),PRUnichar('s'),PRUnichar(0)};
|
||||
|
||||
/*-------------------------------- nsRegistry ----------------------------------
|
||||
| This class implements the nsIRegistry interface using the functions |
|
||||
| provided by libreg (as declared in mozilla/modules/libreg/include/NSReg.h). |
|
||||
|
@ -614,8 +616,7 @@ NS_IMETHODIMP nsRegistry::GetString(nsRegistryKey baseKey, const PRUnichar *valn
|
|||
rv = GetStringUTF8( baseKey, utf8name, &tmpstr );
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
nsString tmpfmt("%s");
|
||||
*_retval = nsTextFormatter::smprintf( tmpfmt.GetUnicode(), tmpstr );
|
||||
*_retval = nsTextFormatter::smprintf( widestrFormat, tmpstr );
|
||||
nsCRT::free(tmpstr);
|
||||
if ( *_retval == nsnull )
|
||||
rv = NS_ERROR_OUT_OF_MEMORY;
|
||||
|
@ -1396,7 +1397,19 @@ nsRegistryNode::~nsRegistryNode()
|
|||
| If we haven't fetched it yet, get the name of the corresponding subkey now, |
|
||||
| using NR_RegEnumSubkeys. |
|
||||
------------------------------------------------------------------------------*/
|
||||
NS_IMETHODIMP nsRegistryNode::GetName( char **result ) {
|
||||
NS_IMETHODIMP nsRegistryNode::GetName( PRUnichar **result ) {
|
||||
if (result == nsnull) return NS_ERROR_NULL_POINTER;
|
||||
// Make sure there is a place to put the result.
|
||||
*result = nsTextFormatter::smprintf( widestrFormat, mName );
|
||||
if ( !*result ) return NS_ERROR_OUT_OF_MEMORY;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/*-------------------------- nsRegistryNode::GetNameUTF8 -----------------------
|
||||
| If we haven't fetched it yet, get the name of the corresponding subkey now, |
|
||||
| using NR_RegEnumSubkeys. |
|
||||
------------------------------------------------------------------------------*/
|
||||
NS_IMETHODIMP nsRegistryNode::GetNameUTF8( char **result ) {
|
||||
if (result == nsnull) return NS_ERROR_NULL_POINTER;
|
||||
// Make sure there is a place to put the result.
|
||||
*result = nsCRT::strdup( mName );
|
||||
|
@ -1441,7 +1454,31 @@ nsRegistryValue::~nsRegistryValue()
|
|||
/*------------------------- nsRegistryValue::GetName ---------------------------
|
||||
| See nsRegistryNode::GetName; we use NR_RegEnumEntries in this case. |
|
||||
------------------------------------------------------------------------------*/
|
||||
NS_IMETHODIMP nsRegistryValue::GetName( char **result ) {
|
||||
NS_IMETHODIMP nsRegistryValue::GetName( PRUnichar **result ) {
|
||||
nsresult rv = NS_OK;
|
||||
// Make sure we have a place to put the result.
|
||||
if( result ) {
|
||||
// Ensure we've got the info we need.
|
||||
rv = getInfo();
|
||||
if( rv == NS_OK || rv == NS_ERROR_REG_NO_MORE ) {
|
||||
// worked, return actual result.
|
||||
*result = nsTextFormatter::smprintf( widestrFormat, mName );
|
||||
if ( *result ) {
|
||||
rv = NS_OK;
|
||||
} else {
|
||||
rv = NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
rv = NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
/*------------------------- nsRegistryValue::GetNameUTF8 -----------------------
|
||||
| See nsRegistryNode::GetName; we use NR_RegEnumEntries in this case. |
|
||||
------------------------------------------------------------------------------*/
|
||||
NS_IMETHODIMP nsRegistryValue::GetNameUTF8( char **result ) {
|
||||
nsresult rv = NS_OK;
|
||||
// Make sure we have a place to put the result.
|
||||
if( result ) {
|
||||
|
|
|
@ -132,7 +132,7 @@ nsStreamConverterService::BuildGraph() {
|
|||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
char *name = nsnull;
|
||||
rv = node->GetName(&name);
|
||||
rv = node->GetNameUTF8(&name);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCString actualProgID(NS_ISTREAMCONVERTER_KEY);
|
||||
|
|
|
@ -373,7 +373,7 @@ nsProfileAccess::FillProfileInfo()
|
|||
nsXPIDLCString NCHavePregInfo;
|
||||
char* directory = nsnull;
|
||||
|
||||
rv = node->GetName( getter_Copies(profile) );
|
||||
rv = node->GetNameUTF8( getter_Copies(profile) );
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
if (profile)
|
||||
|
@ -689,7 +689,7 @@ nsProfileAccess::UpdateRegistry()
|
|||
nsXPIDLCString isMigrated;
|
||||
nsXPIDLCString directory;
|
||||
|
||||
rv = node->GetName( getter_Copies(profile) );
|
||||
rv = node->GetNameUTF8( getter_Copies(profile) );
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
PRInt32 index = 0;
|
||||
|
@ -848,7 +848,7 @@ nsProfileAccess::Get4xProfileInfo(const char *registryName)
|
|||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
char *profile = nsnull;
|
||||
rv = node->GetName(&profile);
|
||||
rv = node->GetNameUTF8(&profile);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
PRBool exists = PR_FALSE;;
|
||||
|
|
|
@ -196,7 +196,7 @@ nsCategoryManager::initialize()
|
|||
keys->CurrentItem(getter_AddRefs(supportsNode));
|
||||
|
||||
nsCOMPtr<nsIRegistryNode> registryNode = do_QueryInterface(supportsNode);
|
||||
registryNode->GetName(getter_Copies(categoryName));
|
||||
registryNode->GetNameUTF8(getter_Copies(categoryName));
|
||||
registryNode->GetKey(&categoryKey);
|
||||
}
|
||||
|
||||
|
@ -211,7 +211,7 @@ nsCategoryManager::initialize()
|
|||
values->CurrentItem(getter_AddRefs(supportsValue));
|
||||
|
||||
nsCOMPtr<nsIRegistryValue> registryValue = do_QueryInterface(supportsValue);
|
||||
registryValue->GetName(getter_Copies(entryName));
|
||||
registryValue->GetNameUTF8(getter_Copies(entryName));
|
||||
}
|
||||
|
||||
nsXPIDLCString value;
|
||||
|
|
|
@ -67,14 +67,14 @@ PRLogModuleInfo* nsComponentManagerLog = NULL;
|
|||
|
||||
// Common Key Names
|
||||
const char xpcomKeyName[]="software/mozilla/XPCOM";
|
||||
const char classesKeyName[]="classes";
|
||||
const char classIDKeyName[]="CLSID";
|
||||
const char classesKeyName[]="progID";
|
||||
const char classIDKeyName[]="classID";
|
||||
const char componentsKeyName[]="components";
|
||||
const char componentLoadersKeyName[]="componentLoaders";
|
||||
const char xpcomComponentsKeyName[]="software/mozilla/XPCOM/components";
|
||||
|
||||
// Common Value Names
|
||||
const char classIDValueName[]="CLSID";
|
||||
const char classIDValueName[]="ClassID";
|
||||
const char versionValueName[]="VersionString";
|
||||
const char lastModValueName[]="LastModTimeStamp";
|
||||
const char fileSizeValueName[]="FileSize";
|
||||
|
@ -800,7 +800,7 @@ nsresult nsComponentManagerImpl::PlatformPrePopulateRegistry()
|
|||
|
||||
// Get library name
|
||||
nsXPIDLCString cidString;
|
||||
rv = node->GetName(getter_Copies(cidString));
|
||||
rv = node->GetNameUTF8(getter_Copies(cidString));
|
||||
if (NS_FAILED(rv)) continue;
|
||||
|
||||
// Get key associated with library
|
||||
|
@ -854,7 +854,7 @@ nsresult nsComponentManagerImpl::PlatformPrePopulateRegistry()
|
|||
|
||||
// Get the progid string
|
||||
nsXPIDLCString progidString;
|
||||
rv = node->GetName(getter_Copies(progidString));
|
||||
rv = node->GetNameUTF8(getter_Copies(progidString));
|
||||
if (NS_FAILED(rv)) continue;
|
||||
|
||||
// Get cid string
|
||||
|
@ -2074,7 +2074,7 @@ nsComponentManagerImpl::AutoRegister(PRInt32 when, nsIFile *inDirSpec)
|
|||
continue;
|
||||
|
||||
nsXPIDLCString type;
|
||||
rv = node->GetName(getter_Copies(type));
|
||||
rv = node->GetNameUTF8(getter_Copies(type));
|
||||
if (NS_FAILED(rv))
|
||||
continue;
|
||||
|
||||
|
|
|
@ -169,9 +169,9 @@ protected:
|
|||
* alpha0.60 : xpcom 2.0 landing
|
||||
* alpha0.70 : using nsIFileSpec. PRTime -> PRUint32
|
||||
* alpha0.90 : using nsIComponentLoader, abs:/rel:/lib:, shaver-cleanup
|
||||
* alpha0.91 : restructured registry keys
|
||||
* alpha0.92 : restructured registry keys
|
||||
*/
|
||||
#define NS_XPCOM_COMPONENT_MANAGER_VERSION_STRING "alpha0.91"
|
||||
#define NS_XPCOM_COMPONENT_MANAGER_VERSION_STRING "alpha0.92"
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/**
|
||||
|
|
|
@ -85,14 +85,16 @@ interface nsIRegistry : nsISupports
|
|||
[scriptable, uuid(D1B54831-AC07-11d2-805E-00600811A9C3)]
|
||||
interface nsIRegistryNode : nsISupports
|
||||
{
|
||||
readonly attribute string name;
|
||||
readonly attribute string nameUTF8;
|
||||
readonly attribute wstring name;
|
||||
readonly attribute nsRegistryKey key;
|
||||
};
|
||||
|
||||
[scriptable,uuid(5316C380-B2F8-11d2-A374-0080C6F80E4B)]
|
||||
interface nsIRegistryValue : nsISupports
|
||||
{
|
||||
readonly attribute string name;
|
||||
readonly attribute wstring name;
|
||||
readonly attribute string nameUTF8;
|
||||
readonly attribute unsigned long type;
|
||||
readonly attribute PRUint32 length;
|
||||
};
|
||||
|
|
|
@ -194,7 +194,7 @@ nsNativeComponentLoader::Init(nsIComponentManager *aCompMgr, nsISupports *aReg)
|
|||
|
||||
// Get library name
|
||||
nsXPIDLCString library;
|
||||
rv = node->GetName(getter_Copies(library));
|
||||
rv = node->GetNameUTF8(getter_Copies(library));
|
||||
if (NS_FAILED(rv)) continue;
|
||||
|
||||
// Get key associated with library
|
||||
|
|
|
@ -42,6 +42,8 @@
|
|||
#define PR_Unlock(x) (void)0
|
||||
#endif
|
||||
|
||||
PRUnichar widestrFormat[] = { PRUnichar('%'),PRUnichar('s'),PRUnichar(0)};
|
||||
|
||||
/*-------------------------------- nsRegistry ----------------------------------
|
||||
| This class implements the nsIRegistry interface using the functions |
|
||||
| provided by libreg (as declared in mozilla/modules/libreg/include/NSReg.h). |
|
||||
|
@ -614,8 +616,7 @@ NS_IMETHODIMP nsRegistry::GetString(nsRegistryKey baseKey, const PRUnichar *valn
|
|||
rv = GetStringUTF8( baseKey, utf8name, &tmpstr );
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
nsString tmpfmt("%s");
|
||||
*_retval = nsTextFormatter::smprintf( tmpfmt.GetUnicode(), tmpstr );
|
||||
*_retval = nsTextFormatter::smprintf( widestrFormat, tmpstr );
|
||||
nsCRT::free(tmpstr);
|
||||
if ( *_retval == nsnull )
|
||||
rv = NS_ERROR_OUT_OF_MEMORY;
|
||||
|
@ -1396,7 +1397,19 @@ nsRegistryNode::~nsRegistryNode()
|
|||
| If we haven't fetched it yet, get the name of the corresponding subkey now, |
|
||||
| using NR_RegEnumSubkeys. |
|
||||
------------------------------------------------------------------------------*/
|
||||
NS_IMETHODIMP nsRegistryNode::GetName( char **result ) {
|
||||
NS_IMETHODIMP nsRegistryNode::GetName( PRUnichar **result ) {
|
||||
if (result == nsnull) return NS_ERROR_NULL_POINTER;
|
||||
// Make sure there is a place to put the result.
|
||||
*result = nsTextFormatter::smprintf( widestrFormat, mName );
|
||||
if ( !*result ) return NS_ERROR_OUT_OF_MEMORY;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/*-------------------------- nsRegistryNode::GetNameUTF8 -----------------------
|
||||
| If we haven't fetched it yet, get the name of the corresponding subkey now, |
|
||||
| using NR_RegEnumSubkeys. |
|
||||
------------------------------------------------------------------------------*/
|
||||
NS_IMETHODIMP nsRegistryNode::GetNameUTF8( char **result ) {
|
||||
if (result == nsnull) return NS_ERROR_NULL_POINTER;
|
||||
// Make sure there is a place to put the result.
|
||||
*result = nsCRT::strdup( mName );
|
||||
|
@ -1441,7 +1454,31 @@ nsRegistryValue::~nsRegistryValue()
|
|||
/*------------------------- nsRegistryValue::GetName ---------------------------
|
||||
| See nsRegistryNode::GetName; we use NR_RegEnumEntries in this case. |
|
||||
------------------------------------------------------------------------------*/
|
||||
NS_IMETHODIMP nsRegistryValue::GetName( char **result ) {
|
||||
NS_IMETHODIMP nsRegistryValue::GetName( PRUnichar **result ) {
|
||||
nsresult rv = NS_OK;
|
||||
// Make sure we have a place to put the result.
|
||||
if( result ) {
|
||||
// Ensure we've got the info we need.
|
||||
rv = getInfo();
|
||||
if( rv == NS_OK || rv == NS_ERROR_REG_NO_MORE ) {
|
||||
// worked, return actual result.
|
||||
*result = nsTextFormatter::smprintf( widestrFormat, mName );
|
||||
if ( *result ) {
|
||||
rv = NS_OK;
|
||||
} else {
|
||||
rv = NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
rv = NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
/*------------------------- nsRegistryValue::GetNameUTF8 -----------------------
|
||||
| See nsRegistryNode::GetName; we use NR_RegEnumEntries in this case. |
|
||||
------------------------------------------------------------------------------*/
|
||||
NS_IMETHODIMP nsRegistryValue::GetNameUTF8( char **result ) {
|
||||
nsresult rv = NS_OK;
|
||||
// Make sure we have a place to put the result.
|
||||
if( result ) {
|
||||
|
|
|
@ -165,7 +165,7 @@ void display( nsIRegistry *reg, nsRegistryKey root, const char *rootName ) {
|
|||
if ( rv == NS_OK ) {
|
||||
// Get node name.
|
||||
char *name;
|
||||
rv = node->GetName( &name );
|
||||
rv = node->GetNameUTF8( &name );
|
||||
// Test result.
|
||||
if ( rv == NS_OK ) {
|
||||
// Build complete name.
|
||||
|
@ -238,7 +238,7 @@ static void displayValues( nsIRegistry *reg, nsRegistryKey root ) {
|
|||
if ( rv == NS_OK ) {
|
||||
// Get node name.
|
||||
char *name;
|
||||
rv = value->GetName( &name );
|
||||
rv = value->GetNameUTF8( &name );
|
||||
// Test result.
|
||||
if ( rv == NS_OK ) {
|
||||
// Print name:
|
||||
|
|
|
@ -282,7 +282,7 @@ nsAppShellService::EnumerateComponents( EnumeratorMemberFunction function ) {
|
|||
if ( NS_SUCCEEDED( rv ) ) {
|
||||
// Get node name.
|
||||
char *name;
|
||||
rv = node->GetName( &name );
|
||||
rv = node->GetNameUTF8( &name );
|
||||
if ( NS_SUCCEEDED( rv ) ) {
|
||||
// If this is a CID of a component; apply function to it.
|
||||
nsCID cid;
|
||||
|
|
|
@ -97,9 +97,10 @@ nsresult NS_AutoregisterComponents()
|
|||
#endif
|
||||
|
||||
extern "C" void
|
||||
NS_SetupRegistry_1()
|
||||
NS_SetupRegistry_1( PRBool needAutoreg )
|
||||
{
|
||||
NS_AutoregisterComponents();
|
||||
if ( needAutoreg )
|
||||
NS_AutoregisterComponents();
|
||||
|
||||
/*
|
||||
* Call the standard NS_SetupRegistry() implemented in
|
||||
|
|
|
@ -639,7 +639,7 @@ nsRegistryDataSource::ArcLabelsOut(nsIRDFResource *aSource, nsISimpleEnumerator
|
|||
return NS_ERROR_UNEXPECTED;
|
||||
|
||||
nsXPIDLCString valueStr;
|
||||
rv = value->GetName(getter_Copies(valueStr));
|
||||
rv = value->GetNameUTF8(getter_Copies(valueStr));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCAutoString propertyStr(kValuePrefix);
|
||||
|
@ -771,7 +771,7 @@ nsRegistryDataSource::SubkeyEnumerator::ConvertRegistryNodeToResource(nsISupport
|
|||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsXPIDLCString path;
|
||||
rv = node->GetName(getter_Copies(path));
|
||||
rv = node->GetNameUTF8(getter_Copies(path));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCAutoString newURI(rootURI);
|
||||
|
|
|
@ -838,22 +838,37 @@ nsInstall::FinalizeInstall(PRInt32* aReturn)
|
|||
}
|
||||
}
|
||||
|
||||
if ( result != SUCCESS )
|
||||
if ( result == SUCCESS )
|
||||
{
|
||||
if ( rebootNeeded )
|
||||
*aReturn = SaveError( REBOOT_NEEDED );
|
||||
|
||||
// XXX for now all successful installs will trigger an Autoreg.
|
||||
// We eventually want to do this only when flagged.
|
||||
HREG reg;
|
||||
if ( REGERR_OK == NR_RegOpen("", ®) )
|
||||
{
|
||||
RKEY xpiRoot;
|
||||
REGERR err;
|
||||
err = NR_RegAddKey(reg,ROOTKEY_COMMON,XPI_ROOT_KEY,&xpiRoot);
|
||||
if ( err == REGERR_OK )
|
||||
NR_RegSetEntryString(reg, xpiRoot, XPI_AUTOREG_VAL, "no");
|
||||
}
|
||||
}
|
||||
else
|
||||
*aReturn = SaveError( result );
|
||||
else if ( rebootNeeded )
|
||||
*aReturn = SaveError( REBOOT_NEEDED );
|
||||
|
||||
if (mNotifier)
|
||||
{
|
||||
mNotifier->FinalStatus(mInstallURL.GetUnicode(), *aReturn);
|
||||
mStatusSent = PR_TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// no actions queued: don't register the package version
|
||||
// and no need for user confirmation
|
||||
|
||||
|
||||
if (mNotifier)
|
||||
{
|
||||
mNotifier->FinalStatus(mInstallURL.GetUnicode(), *aReturn);
|
||||
|
@ -861,8 +876,7 @@ nsInstall::FinalizeInstall(PRInt32* aReturn)
|
|||
}
|
||||
}
|
||||
|
||||
if((result == nsInstall::SUCCESS) || (result == REBOOT_NEEDED))
|
||||
CleanUp();
|
||||
CleanUp();
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -75,6 +75,7 @@ nsInstallFile::nsInstallFile(nsInstall* inInstall,
|
|||
*error = nsInstall::SUCCESS;
|
||||
|
||||
/* Check for existence of the newer version */
|
||||
#if 0 // XXX need to re-implement force mode in the opposite sense
|
||||
|
||||
char* qualifiedRegNameString = inComponentName.ToNewCString();
|
||||
|
||||
|
@ -132,6 +133,7 @@ nsInstallFile::nsInstallFile(nsInstall* inInstall,
|
|||
}
|
||||
|
||||
Recycle(qualifiedRegNameString);
|
||||
#endif
|
||||
|
||||
nsFileSpec* tmp = folderSpec->GetFileSpec();
|
||||
if (!tmp)
|
||||
|
@ -266,7 +268,10 @@ PRInt32 nsInstallFile::Complete()
|
|||
|
||||
if ( 0 == err || nsInstall::REBOOT_NEEDED == err )
|
||||
{
|
||||
RegisterInVersionRegistry();
|
||||
// XXX Don't register individual files for now -- crucial performance
|
||||
// speed up on the Mac, and we'll switch uninstall schemes after beta
|
||||
|
||||
// RegisterInVersionRegistry();
|
||||
}
|
||||
|
||||
return err;
|
||||
|
|
|
@ -59,7 +59,11 @@ NS_IMETHODIMP
|
|||
nsLoggingProgressNotifier::BeforeJavascriptEvaluation(const PRUnichar *URL)
|
||||
{
|
||||
nsSpecialSystemDirectory logFile(nsSpecialSystemDirectory::OS_CurrentProcessDirectory);
|
||||
#ifdef XP_MAC
|
||||
logFile += "Install Log";
|
||||
#else
|
||||
logFile += "install.log";
|
||||
#endif
|
||||
|
||||
mLogStream = new nsOutputFileStream(logFile, PR_WRONLY | PR_CREATE_FILE | PR_APPEND, 0744 );
|
||||
if (!mLogStream)
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
|
||||
#include "nspr.h"
|
||||
#include "prlock.h"
|
||||
#include "NSReg.h"
|
||||
#include "VerReg.h"
|
||||
#include "nsSpecialSystemDirectory.h"
|
||||
|
||||
|
@ -49,6 +50,7 @@
|
|||
|
||||
#include "nsIAppShellComponent.h"
|
||||
#include "nsIRegistry.h"
|
||||
#include "nsBuildID.h"
|
||||
|
||||
/* For Javascript Namespace Access */
|
||||
#include "nsDOMCID.h"
|
||||
|
@ -74,16 +76,18 @@ static NS_DEFINE_IID(kIScriptObjectOwnerIID, NS_ISCRIPTOBJECTOWNER_IID);
|
|||
static NS_DEFINE_CID(kComponentManagerCID, NS_COMPONENTMANAGER_CID);
|
||||
|
||||
static NS_DEFINE_IID(kIScriptNameSetRegistryIID, NS_ISCRIPTNAMESETREGISTRY_IID);
|
||||
static NS_DEFINE_IID(kCScriptNameSetRegistryCID, NS_SCRIPT_NAMESET_REGISTRY_CID);
|
||||
static NS_DEFINE_CID(kCScriptNameSetRegistryCID, NS_SCRIPT_NAMESET_REGISTRY_CID);
|
||||
static NS_DEFINE_IID(kIScriptExternalNameSetIID, NS_ISCRIPTEXTERNALNAMESET_IID);
|
||||
|
||||
static NS_DEFINE_IID(kISoftwareUpdate_IID, NS_ISOFTWAREUPDATE_IID);
|
||||
|
||||
static NS_DEFINE_IID(kIInstallTrigger_IID, NS_IDOMINSTALLTRIGGERGLOBAL_IID);
|
||||
static NS_DEFINE_IID(kInstallTrigger_CID, NS_SoftwareUpdateInstallTrigger_CID);
|
||||
static NS_DEFINE_CID(kInstallTrigger_CID, NS_SoftwareUpdateInstallTrigger_CID);
|
||||
|
||||
static NS_DEFINE_IID(kIInstallVersion_IID, NS_IDOMINSTALLVERSION_IID);
|
||||
static NS_DEFINE_IID(kInstallVersion_CID, NS_SoftwareUpdateInstallVersion_CID);
|
||||
static NS_DEFINE_CID(kInstallVersion_CID, NS_SoftwareUpdateInstallVersion_CID);
|
||||
|
||||
static NS_DEFINE_CID(knsRegistryCID, NS_REGISTRY_CID);
|
||||
|
||||
|
||||
nsSoftwareUpdate* nsSoftwareUpdate::mInstance = nsnull;
|
||||
|
@ -309,18 +313,84 @@ nsSoftwareUpdate::InstallJarCallBack()
|
|||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSoftwareUpdate::StartupTasks( PRBool* outAutoreg )
|
||||
nsSoftwareUpdate::StartupTasks( PRBool *needAutoreg )
|
||||
{
|
||||
if (outAutoreg) *outAutoreg = PR_FALSE;
|
||||
PRBool autoReg = PR_FALSE;
|
||||
RKEY xpiRoot;
|
||||
REGERR err;
|
||||
|
||||
*needAutoreg = PR_TRUE;
|
||||
|
||||
// First do any left-over file replacements and deletes
|
||||
|
||||
// NOTE: we leave the registry open until later to prevent
|
||||
// having to load and unload it many times at startup
|
||||
|
||||
if ( REGERR_OK == NR_RegOpen("", &mReg) )
|
||||
{
|
||||
// XXX get a return val and if not all replaced autoreg again later
|
||||
PerformScheduledTasks(mReg);
|
||||
|
||||
// now look for an autoreg flag left behind by XPInstall
|
||||
err = NR_RegGetKey( mReg, ROOTKEY_COMMON, XPI_ROOT_KEY, &xpiRoot);
|
||||
if ( err == REGERR_OK )
|
||||
{
|
||||
char buf[8];
|
||||
err = NR_RegGetEntryString( mReg, xpiRoot, XPI_AUTOREG_VAL,
|
||||
buf, sizeof(buf) );
|
||||
|
||||
if ( err == REGERR_OK && !strcmp( buf, "yes" ) )
|
||||
autoReg = PR_TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
// Also check for build number changes
|
||||
nsresult rv;
|
||||
PRInt32 buildID = 0;
|
||||
nsRegistryKey idKey = 0;
|
||||
nsCOMPtr<nsIRegistry> reg = do_GetService(knsRegistryCID,&rv);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
rv = reg->OpenWellKnownRegistry(nsIRegistry::ApplicationComponentRegistry);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
rv = reg->GetSubtree(nsIRegistry::Common,XPCOM_KEY,&idKey);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
rv = reg->GetInt( idKey, XPI_AUTOREG_VAL, &buildID );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
// Autoregister if we found the XPInstall flag, the stored BuildID
|
||||
// is not the actual BuildID, or if we couldn't get the BuildID
|
||||
if ( autoReg || NS_FAILED(rv) || buildID != NS_BUILD_ID )
|
||||
{
|
||||
rv = nsComponentManager::AutoRegister(nsIComponentManager::NS_Startup,0);
|
||||
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
*needAutoreg = PR_FALSE;
|
||||
|
||||
// Now store back into the registries so we don't do this again
|
||||
if ( autoReg )
|
||||
NR_RegSetEntryString( mReg, xpiRoot, XPI_AUTOREG_VAL, "no" );
|
||||
|
||||
if ( buildID != NS_BUILD_ID && idKey != 0 )
|
||||
reg->SetInt( idKey, XPI_AUTOREG_VAL, NS_BUILD_ID );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//We don't need to autoreg, we're up to date
|
||||
*needAutoreg = PR_FALSE;
|
||||
#ifdef DEBUG
|
||||
// debug (developer) builds should always autoreg
|
||||
*needAutoreg = PR_TRUE;
|
||||
#endif
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
|
@ -396,6 +466,11 @@ nsSoftwareUpdate::StubInitialize(nsIFileSpec *aDir)
|
|||
mProgramDir = aDir;
|
||||
NS_ADDREF(mProgramDir);
|
||||
|
||||
// make sure registry updates go to the right place
|
||||
nsFileSpec instDir;
|
||||
if (NS_SUCCEEDED( aDir->GetFileSpec( &instDir ) ) )
|
||||
VR_SetRegDirectory( instDir.GetNativePathCString() );
|
||||
|
||||
// Create the logfile observer
|
||||
nsLoggingProgressNotifier *logger = new nsLoggingProgressNotifier();
|
||||
RegisterNotifier(logger);
|
||||
|
|
|
@ -22,6 +22,10 @@ class nsInstallInfo;
|
|||
#include "nsPIXPIStubHook.h"
|
||||
#include "nsTopProgressNotifier.h"
|
||||
|
||||
#define XPI_ROOT_KEY "software/mozilla/xpinstall"
|
||||
#define XPI_AUTOREG_VAL "Autoreg"
|
||||
#define XPCOM_KEY "software/mozilla/XPCOM"
|
||||
|
||||
class nsSoftwareUpdate: public nsIAppShellComponent,
|
||||
public nsISoftwareUpdate,
|
||||
public nsPIXPIStubHook
|
||||
|
@ -52,7 +56,7 @@ class nsSoftwareUpdate: public nsIAppShellComponent,
|
|||
NS_IMETHOD InstallJarCallBack();
|
||||
NS_IMETHOD GetMasterNotifier(nsIXPINotifier **notifier);
|
||||
NS_IMETHOD SetActiveNotifier(nsIXPINotifier *notifier);
|
||||
NS_IMETHOD StartupTasks( PRBool* outAutoreg );
|
||||
NS_IMETHOD StartupTasks( PRBool* needAutoreg );
|
||||
|
||||
/** StubInitialize() is private for the Install Wizard.
|
||||
* The mStubLockout property makes sure this is only called
|
||||
|
|
Загрузка…
Ссылка в новой задаче