Backend plumbin fix for bugs 17505 and 20046 r=dveditz

This commit is contained in:
dbragg%netscape.com 2000-03-22 21:51:26 +00:00
Родитель 76e1e4e8f5
Коммит b5779529a9
5 изменённых файлов: 60 добавлений и 29 удалений

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

@ -285,7 +285,7 @@ nsInstall::AddDirectory(const nsString& aRegName,
const nsString& aJarSource,
nsInstallFolder *aFolder,
const nsString& aSubdir,
PRBool aForceMode,
PRInt32 aMode,
PRInt32* aReturn)
{
nsInstallFile* ie = nsnull;
@ -394,7 +394,7 @@ nsInstall::AddDirectory(const nsString& aRegName,
newJarSource,
aFolder,
newSubDir,
aForceMode,
aMode,
&result);
if (ie == nsnull)
@ -433,7 +433,7 @@ nsInstall::AddDirectory(const nsString& aRegName,
aJarSource,
aFolder,
aSubdir,
PR_FALSE,
INSTALL_NO_COMPARE,
aReturn);
}
@ -449,7 +449,7 @@ nsInstall::AddDirectory(const nsString& aRegName,
aJarSource,
aFolder,
aSubdir,
PR_FALSE,
INSTALL_NO_COMPARE,
aReturn);
}
@ -468,7 +468,7 @@ nsInstall::AddDirectory(const nsString& aJarSource,
aJarSource,
mPackageFolder,
"",
PR_FALSE,
INSTALL_NO_COMPARE,
aReturn);
}
@ -478,7 +478,7 @@ nsInstall::AddSubcomponent(const nsString& aRegName,
const nsString& aJarSource,
nsInstallFolder *aFolder,
const nsString& aTargetName,
PRBool aForceMode,
PRInt32 aMode,
PRInt32* aReturn)
{
nsInstallFile* ie;
@ -538,7 +538,7 @@ nsInstall::AddSubcomponent(const nsString& aRegName,
aJarSource,
aFolder,
tempTargetName,
aForceMode,
aMode,
&errcode );
if (ie == nsnull)
@ -573,7 +573,7 @@ nsInstall::AddSubcomponent(const nsString& aRegName,
aJarSource,
aFolder,
aTargetName,
PR_FALSE,
INSTALL_NO_COMPARE,
aReturn);
}
@ -606,7 +606,7 @@ nsInstall::AddSubcomponent(const nsString& aRegName,
aJarSource,
aFolder,
aTargetName,
PR_FALSE,
INSTALL_NO_COMPARE,
aReturn);
}
@ -641,7 +641,7 @@ nsInstall::AddSubcomponent(const nsString& aJarSource,
aJarSource,
mPackageFolder,
"",
PR_FALSE,
INSTALL_NO_COMPARE,
aReturn);
}

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

@ -57,7 +57,6 @@
#include "nsIEnumerator.h"
#include "nsIZipReader.h"
class nsInstallInfo
{
public:
@ -185,12 +184,12 @@ class nsInstall
PRInt32 AbortInstall(PRInt32 aErrorNumber);
PRInt32 AddDirectory(const nsString& aRegName, const nsString& aVersion, const nsString& aJarSource, nsInstallFolder* aFolder, const nsString& aSubdir, PRBool aForceMode, PRInt32* aReturn);
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, PRBool aForceMode, 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);
@ -267,7 +266,6 @@ class nsInstall
PRInt32 SaveError(PRInt32 errcode);
private:
JSObject* mScriptObject;

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

@ -50,7 +50,7 @@ nsInstallFile::nsInstallFile(nsInstall* inInstall,
const nsString& inJarLocation,
nsInstallFolder *folderSpec,
const nsString& inPartialPath,
PRBool forceInstall,
PRInt32 mode,
PRInt32 *error)
: nsInstallObject(inInstall),
mVersionInfo(nsnull),
@ -58,7 +58,7 @@ nsInstallFile::nsInstallFile(nsInstall* inInstall,
mExtractedFile(nsnull),
mFinalFile(nsnull),
mVersionRegistryName(nsnull),
mForceInstall(forceInstall),
mMode(mode),
mReplaceFile(PR_FALSE),
mChildFile(PR_TRUE),
mUpgradeFile(PR_FALSE),
@ -86,7 +86,8 @@ nsInstallFile::nsInstallFile(nsInstall* inInstall,
// IFF it's not force, AND the new file has a version, AND it's been
// previously installed, THEN we have to do the version comparing foo.
// --------------------------------------------------------------------
if ( (forceInstall == PR_FALSE ) && (inVInfo != "") && ( VR_ValidateComponent( qualifiedRegNameString ) == 0 ) )
if ( !(mode & INSTALL_NO_COMPARE ) && (inVInfo != "") &&
( VR_ValidateComponent( qualifiedRegNameString ) == 0 ) )
{
nsInstallVersion *newVersion = new nsInstallVersion();

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

@ -35,6 +35,13 @@
#include "nsInstall.h"
#include "nsInstallVersion.h"
/* Global defines for file handling mode bitfield values */
#define INSTALL_NO_COMPARE 0x1
#define INSTALL_IF_NEWER 0x2
#define INSTALL_IF_EQUAL_OR_NEWER 0x4
class nsInstallFile : public nsInstallObject
{
public:
@ -55,7 +62,7 @@ class nsInstallFile : public nsInstallObject
const nsString& inJarLocation,
nsInstallFolder *folderSpec,
const nsString& inPartialPath,
PRBool forceInstall,
PRInt32 mode,
PRInt32 *error);
virtual ~nsInstallFile();
@ -86,9 +93,13 @@ class nsInstallFile : public nsInstallObject
PRBool mUpgradeFile; /* whether file is an upgrade */
PRBool mSkipInstall; /* if true don't install this file */
PRInt32 mMode; /* an integer used like a bitfield to control *
* how a file is installed or registered */
PRInt32 CompleteFileMove();
PRInt32 RegisterInVersionRegistry();
};
#endif /* nsInstallFile_h__ */

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

@ -28,6 +28,7 @@
#include "nsString.h"
#include "nsInstall.h"
#include "nsInstallFile.h"
#include "nsIDOMInstallVersion.h"
@ -389,7 +390,7 @@ InstallAddDirectory(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval
nsAutoString b4;
JSObject *jsObj;
nsInstallFolder *folder;
PRBool b5;
PRInt32 b5;
*rval = INT_TO_JSVAL(nsInstall::UNEXPECTED_ERROR);
@ -512,11 +513,21 @@ InstallAddDirectory(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval
return JS_TRUE;
}
if(!ConvertJSValToBool(&b5, cx, argv[5]))
if(JSVAL_IS_BOOLEAN(argv[5])) //Old form of the AddDirectory took a boolean
{
b5 = JSVAL_TO_BOOLEAN(argv[5]);
if( b5 == PR_TRUE )
b5 = INSTALL_NO_COMPARE; //convert to values that mean something in the bit field
else
b5 = INSTALL_IF_NEWER;
}
else
{
if(!(b5 = JSVAL_TO_INT(argv[5]))) //File handling bit field
{
return JS_FALSE;
}
}
folder = (nsInstallFolder*)JS_GetPrivate(cx, jsObj);
@ -552,7 +563,7 @@ InstallAddSubcomponent(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, js
nsAutoString b4;
JSObject* jsObj;
nsInstallFolder* folder;
PRBool b5;
PRInt32 b5;
*rval = INT_TO_JSVAL(nsInstall::UNEXPECTED_ERROR);
@ -590,11 +601,21 @@ InstallAddSubcomponent(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, js
return JS_TRUE;
}
if(!ConvertJSValToBool(&b5, cx, argv[5]))
if(JSVAL_IS_BOOLEAN(argv[5])) //Old form of the AddSubComponent took a boolean
{
b5 = JSVAL_TO_BOOLEAN(argv[5]);
if( b5 == PR_TRUE )
b5 = INSTALL_NO_COMPARE; //convert to values that mean something in the bit field
else
b5 = INSTALL_IF_NEWER;
}
else
{
if(!(b5 = JSVAL_TO_INT(argv[5]))) //File handling bit field
{
return JS_FALSE;
}
}
folder = (nsInstallFolder*)JS_GetPrivate(cx, jsObj);