зеркало из https://github.com/mozilla/pjs.git
Added Unix makefiles (that really do not do anything)
Added Arguments and Jarfile variables to the Install object which are now being reflected into js. Fixed how ExtractJarFile in Install was working Hooked up to libjar. ** These changes are not part of the Tinderbox builds **
This commit is contained in:
Родитель
2317e4b478
Коммит
1d2debbaed
|
@ -0,0 +1,31 @@
|
|||
#
|
||||
# The contents of this file are subject to the Netscape Public License
|
||||
# Version 1.0 (the "NPL"); you may not use this file except in
|
||||
# compliance with the NPL. You may obtain a copy of the NPL at
|
||||
# http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
# for the specific language governing rights and limitations under the
|
||||
# NPL.
|
||||
#
|
||||
# The Initial Developer of this code under the NPL is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
# Reserved.
|
||||
#
|
||||
|
||||
DEPTH = ..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
DIRS = public src
|
||||
|
||||
include $(topsrcdir)/config/config.mk
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
#!gmake
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public License
|
||||
# Version 1.0 (the "NPL"); you may not use this file except in
|
||||
# compliance with the NPL. You may obtain a copy of the NPL at
|
||||
# http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
# for the specific language governing rights and limitations under the
|
||||
# NPL.
|
||||
#
|
||||
# The Initial Developer of this code under the NPL is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
# Reserved.
|
||||
|
||||
DEPTH = ../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
MODULE = xpinstall
|
||||
|
||||
EXPORTS = \
|
||||
nsSoftwareUpdateIIDs.h \
|
||||
nsISoftwareUpdate.h \
|
||||
$(NULL)
|
||||
|
||||
EXPORTS := $(addprefix $(srcdir)/, $(EXPORTS))
|
||||
|
||||
include $(topsrcdir)/config/config.mk
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
|
@ -3,48 +3,48 @@ interface Install
|
|||
/* IID: { 0x18c2f988, 0xb09f, 0x11d2, \
|
||||
{0xbc, 0xde, 0x00, 0x80, 0x5f, 0x0e, 0x13, 0x53}} */
|
||||
|
||||
const int SUERR_BAD_PACKAGE_NAME = -200;
|
||||
const int SUERR_UNEXPECTED_ERROR = -201;
|
||||
const int SUERR_ACCESS_DENIED = -202;
|
||||
const int SUERR_TOO_MANY_CERTIFICATES = -203; /* Installer file must have 1 certificate */
|
||||
const int SUERR_NO_INSTALLER_CERTIFICATE = -204; /* Installer file must have a certificate */
|
||||
const int SUERR_NO_CERTIFICATE = -205; /* Extracted file is not signed */
|
||||
const int SUERR_NO_MATCHING_CERTIFICATE = -206; /* Extracted file does not match installer certificate */
|
||||
const int SUERR_UNKNOWN_JAR_FILE = -207; /* JAR file has not been opened */
|
||||
const int SUERR_INVALID_ARGUMENTS = -208; /* Bad arguments to a function */
|
||||
const int SUERR_ILLEGAL_RELATIVE_PATH = -209; /* Illegal relative path */
|
||||
const int SUERR_USER_CANCELLED = -210; /* User cancelled */
|
||||
const int SUERR_INSTALL_NOT_STARTED = -211;
|
||||
const int SUERR_SILENT_MODE_DENIED = -212;
|
||||
const int SUERR_NO_SUCH_COMPONENT = -213; /* no such component in the registry. */
|
||||
const int SUERR_FILE_DOES_NOT_EXIST = -214; /* File cannot be deleted as it does not exist */
|
||||
const int SUERR_FILE_READ_ONLY = -215; /* File cannot be deleted as it is read only. */
|
||||
const int SUERR_FILE_IS_DIRECTORY = -216; /* File cannot be deleted as it is a directory */
|
||||
const int SUERR_NETWORK_FILE_IS_IN_USE = -217; /* File on the network is in-use */
|
||||
const int SUERR_APPLE_SINGLE_ERR = -218; /* error in AppleSingle unpacking */
|
||||
const int SUERR_INVALID_PATH_ERR = -219; /* GetFolder() did not like the folderID */
|
||||
const int SUERR_PATCH_BAD_DIFF = -220; /* error in GDIFF patch */
|
||||
const int SUERR_PATCH_BAD_CHECKSUM_TARGET = -221; /* source file doesn't checksum */
|
||||
const int SUERR_PATCH_BAD_CHECKSUM_RESULT = -222; /* final patched file fails checksum */
|
||||
const int SUERR_UNINSTALL_FAILED = -223; /* error while uninstalling a package */
|
||||
const int SUERR_GESTALT_UNKNOWN_ERR = -5550;
|
||||
const int SUERR_GESTALT_INVALID_ARGUMENT = -5551;
|
||||
const int BAD_PACKAGE_NAME = -200;
|
||||
const int UNEXPECTED_ERROR = -201;
|
||||
const int ACCESS_DENIED = -202;
|
||||
const int TOO_MANY_CERTIFICATES = -203; /* Installer file must have 1 certificate */
|
||||
const int NO_INSTALLER_CERTIFICATE = -204; /* Installer file must have a certificate */
|
||||
const int NO_CERTIFICATE = -205; /* Extracted file is not signed */
|
||||
const int NO_MATCHING_CERTIFICATE = -206; /* Extracted file does not match installer certificate */
|
||||
const int UNKNOWN_JAR_FILE = -207; /* JAR file has not been opened */
|
||||
const int INVALID_ARGUMENTS = -208; /* Bad arguments to a function */
|
||||
const int ILLEGAL_RELATIVE_PATH = -209; /* Illegal relative path */
|
||||
const int USER_CANCELLED = -210; /* User cancelled */
|
||||
const int INSTALL_NOT_STARTED = -211;
|
||||
const int SILENT_MODE_DENIED = -212;
|
||||
const int NO_SUCH_COMPONENT = -213; /* no such component in the registry. */
|
||||
const int FILE_DOES_NOT_EXIST = -214; /* File cannot be deleted as it does not exist */
|
||||
const int FILE_READ_ONLY = -215; /* File cannot be deleted as it is read only. */
|
||||
const int FILE_IS_DIRECTORY = -216; /* File cannot be deleted as it is a directory */
|
||||
const int NETWORK_FILE_IS_IN_USE = -217; /* File on the network is in-use */
|
||||
const int APPLE_SINGLE_ERR = -218; /* error in AppleSingle unpacking */
|
||||
const int INVALID_PATH_ERR = -219; /* GetFolder() did not like the folderID */
|
||||
const int PATCH_BAD_DIFF = -220; /* error in GDIFF patch */
|
||||
const int PATCH_BAD_CHECKSUM_TARGET = -221; /* source file doesn't checksum */
|
||||
const int PATCH_BAD_CHECKSUM_RESULT = -222; /* final patched file fails checksum */
|
||||
const int UNINSTALL_FAILED = -223; /* error while uninstalling a package */
|
||||
const int GESTALT_UNKNOWN_ERR = -5550;
|
||||
const int GESTALT_INVALID_ARGUMENT = -5551;
|
||||
|
||||
const int SU_SUCCESS = 0;
|
||||
const int SU_REBOOT_NEEDED = 999;
|
||||
const int SUCCESS = 0;
|
||||
const int REBOOT_NEEDED = 999;
|
||||
|
||||
/* install types */
|
||||
const int SU_LIMITED_INSTALL = 0;
|
||||
const int SU_FULL_INSTALL = 1;
|
||||
const int SU_NO_STATUS_DLG = 2;
|
||||
const int SU_NO_FINALIZE_DLG = 4;
|
||||
|
||||
const int LIMITED_INSTALL = 0;
|
||||
const int FULL_INSTALL = 1;
|
||||
const int NO_STATUS_DLG = 2;
|
||||
const int NO_FINALIZE_DLG = 4;
|
||||
|
||||
// these should not be public...
|
||||
/* message IDs*/
|
||||
const int SU_INSTALL_FILE_UNEXPECTED_MSG_ID = 0;
|
||||
const int SU_DETAILS_REPLACE_FILE_MSG_ID = 1;
|
||||
const int SU_DETAILS_INSTALL_FILE_MSG_ID = 2;
|
||||
|
||||
//////////////////////////
|
||||
|
||||
readonly attribute wstring UserPackageName;
|
||||
readonly attribute wstring RegPackageName;
|
||||
|
|
|
@ -1,34 +0,0 @@
|
|||
interface InstallVersion
|
||||
{
|
||||
/* IID: { 0x18c2f986, 0xb09f, 0x11d2, \
|
||||
{0xbc, 0xde, 0x00, 0x80, 0x5f, 0x0e, 0x13, 0x53}} */
|
||||
|
||||
const int SU_EQUAL = 0;
|
||||
const int SU_BLD_DIFF = 1;
|
||||
const int SU_BLD_DIFF_MINUS = -1;
|
||||
const int SU_REL_DIFF = 2;
|
||||
const int SU_REL_DIFF_MINUS = -2;
|
||||
const int SU_MINOR_DIFF = 3;
|
||||
const int SU_MINOR_DIFF_MINUS = -3;
|
||||
const int SU_MAJOR_DIFF = 4;
|
||||
const int SU_MAJOR_DIFF_MINUS = -4;
|
||||
|
||||
attribute int major;
|
||||
attribute int minor;
|
||||
attribute int release;
|
||||
attribute int build;
|
||||
|
||||
void InstallVersion();
|
||||
|
||||
void init(in wstring versionString);
|
||||
/*
|
||||
void init(in int major, in int minor, in int release, in int build);
|
||||
*/
|
||||
wstring toString();
|
||||
|
||||
/* int compareTo(in wstring version);
|
||||
int compareTo(in int major, in int minor, in int release, in int build);
|
||||
*/
|
||||
int compareTo(in InstallVersion versionObject);
|
||||
|
||||
};
|
|
@ -34,15 +34,15 @@ class nsIDOMInstallVersion : public nsISupports {
|
|||
public:
|
||||
static const nsIID& IID() { static nsIID iid = NS_IDOMINSTALLVERSION_IID; return iid; }
|
||||
enum {
|
||||
SU_EQUAL = 0,
|
||||
SU_BLD_DIFF = 1,
|
||||
SU_BLD_DIFF_MINUS = -1,
|
||||
SU_REL_DIFF = 2,
|
||||
SU_REL_DIFF_MINUS = -2,
|
||||
SU_MINOR_DIFF = 3,
|
||||
SU_MINOR_DIFF_MINUS = -3,
|
||||
SU_MAJOR_DIFF = 4,
|
||||
SU_MAJOR_DIFF_MINUS = -4
|
||||
EQUAL = 0,
|
||||
BLD_DIFF = 1,
|
||||
BLD_DIFF_MINUS = -1,
|
||||
REL_DIFF = 2,
|
||||
REL_DIFF_MINUS = -2,
|
||||
MINOR_DIFF = 3,
|
||||
MINOR_DIFF_MINUS = -3,
|
||||
MAJOR_DIFF = 4,
|
||||
MAJOR_DIFF_MINUS = -4
|
||||
};
|
||||
|
||||
NS_IMETHOD GetMajor(PRInt32* aMajor)=0;
|
||||
|
|
|
@ -21,6 +21,9 @@
|
|||
|
||||
#include "nsISupports.h"
|
||||
#include "nsIFactory.h"
|
||||
#include "nsString.h"
|
||||
|
||||
|
||||
|
||||
//FIX NEED REAL IID
|
||||
#define NS_ISOFTWAREUPDATE_IID \
|
||||
|
@ -34,6 +37,8 @@ class nsISoftwareUpdate : public nsISupports
|
|||
|
||||
NS_IMETHOD Startup() = 0;
|
||||
NS_IMETHOD Shutdown()= 0;
|
||||
NS_IMETHOD InstallJar(const nsString& jarFile, const nsString& args) = 0;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
#
|
||||
# The contents of this file are subject to the Netscape Public License
|
||||
# Version 1.0 (the "NPL"); you may not use this file except in
|
||||
# compliance with the NPL. You may obtain a copy of the NPL at
|
||||
# http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
# for the specific language governing rights and limitations under the
|
||||
# NPL.
|
||||
#
|
||||
# The Initial Developer of this code under the NPL is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
# Reserved.
|
||||
#
|
||||
|
||||
DEPTH = ../..
|
||||
topsrcdir = @top_srcdir@
|
||||
VPATH = @srcdir@
|
||||
srcdir = @srcdir@
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
|
@ -35,6 +35,7 @@ LINCS= \
|
|||
-I..\base \
|
||||
-I$(XPDIST)\public\xpinstall \
|
||||
-I$(XPDIST)\public\js \
|
||||
-I$(XPDIST)\public\jar \
|
||||
-I$(XPDIST)\public\netlib \
|
||||
-I$(XPDIST)\public\network \
|
||||
-I$(XPDIST)\public\dom \
|
||||
|
@ -47,6 +48,7 @@ LINCS= \
|
|||
$(NULL)
|
||||
|
||||
LLIBS = \
|
||||
$(DIST)\lib\jar50.lib \
|
||||
$(DIST)\lib\libreg32.lib \
|
||||
$(DIST)\lib\netlib.lib \
|
||||
$(DIST)\lib\xpcom32.lib \
|
||||
|
|
|
@ -24,12 +24,14 @@
|
|||
|
||||
#include "nsVector.h"
|
||||
#include "nsHashtable.h"
|
||||
#include "nsFileSpec.h"
|
||||
|
||||
#include "prmem.h"
|
||||
#include "pratom.h"
|
||||
#include "prefapi.h"
|
||||
#include "VerReg.h"
|
||||
|
||||
#include "zipfile.h"
|
||||
|
||||
#include "nsInstall.h"
|
||||
|
||||
|
@ -58,6 +60,8 @@ nsInstall::nsInstall()
|
|||
mScriptObject = nsnull;
|
||||
mVersionInfo = nsnull;
|
||||
|
||||
mJarFileData = nsnull;
|
||||
|
||||
mPackageName = "";
|
||||
mUserPackageName= "";
|
||||
|
||||
|
@ -734,7 +738,6 @@ nsInstall::StartInstall(const nsString& aUserPackageName, const nsString& aPacka
|
|||
*aReturn = nsInstall::SUCCESS;
|
||||
|
||||
ResetError();
|
||||
ParseFlags(aFlags);
|
||||
|
||||
mUserCancelled = PR_FALSE;
|
||||
|
||||
|
@ -779,35 +782,7 @@ nsInstall::StartInstall(const nsString& aUserPackageName, const nsString& aPacka
|
|||
return -1; /* FIX: need real error code */
|
||||
}
|
||||
|
||||
if (mShowProgress)
|
||||
{
|
||||
/* Show our window here */
|
||||
}
|
||||
|
||||
#if 0
|
||||
// set up default package folder, if any
|
||||
int err;
|
||||
char* path = (char*) PR_Malloc(MAXREGPATHLEN);
|
||||
char* packageNameCString = mPackageName.ToNewCString();
|
||||
|
||||
err = VR_GetDefaultDirectory( packageNameCString , MAXREGPATHLEN, path );
|
||||
|
||||
delete [] packageNameCString;
|
||||
|
||||
if (err != REGERR_OK)
|
||||
{
|
||||
PR_FREEIF(path);
|
||||
path = NULL;
|
||||
}
|
||||
|
||||
if ( path != NULL )
|
||||
{
|
||||
mPackageFolder = new nsInstallFolder();
|
||||
mPackageFolder->Init("Installed", nsString(path), mPackageName);
|
||||
|
||||
PR_FREEIF(path);
|
||||
}
|
||||
#endif
|
||||
|
||||
SaveError(*aReturn);
|
||||
|
||||
|
@ -853,20 +828,6 @@ nsInstall::Uninstall(const nsString& aPackageName, PRInt32* aReturn)
|
|||
|
||||
////////////////////////////////////////
|
||||
|
||||
/*
|
||||
|
||||
aJarFile - location inside a jar file
|
||||
|
||||
|
||||
*/
|
||||
|
||||
PRInt32
|
||||
nsInstall::ExtractFileFromJar(const nsString& aJarfile, const nsString& aFinalFile, nsString& aTempFile, PRInt32* error)
|
||||
{
|
||||
*error = SUCCESS;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
nsInstall::AddPatch(nsHashKey *aKey, nsString* fileName)
|
||||
|
@ -933,20 +894,6 @@ nsInstall::ScheduleForInstall(nsInstallObject* ob)
|
|||
|
||||
|
||||
|
||||
void
|
||||
nsInstall::ParseFlags(int flags)
|
||||
{
|
||||
mShowProgress = mShowFinalize = PR_TRUE;
|
||||
if ((flags & NO_STATUS_DLG) == NO_STATUS_DLG)
|
||||
{
|
||||
mShowProgress = PR_FALSE;
|
||||
}
|
||||
if ((flags & NO_FINALIZE_DLG) == NO_FINALIZE_DLG)
|
||||
{
|
||||
mShowFinalize = PR_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* SanityCheck
|
||||
*
|
||||
|
@ -1166,17 +1113,88 @@ nsInstall::CleanUp(void)
|
|||
//CloseProgressDialog();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
nsInstall::GetJarFileLocation(char** aFile)
|
||||
{
|
||||
*aFile = mJarFileLocation;
|
||||
}
|
||||
|
||||
void
|
||||
nsInstall::SetJarFileLocation(char* aFile)
|
||||
{
|
||||
mJarFileLocation = aFile;
|
||||
}
|
||||
|
||||
void
|
||||
nsInstall::GetInstallArguments(char** args)
|
||||
{
|
||||
*args = mInstallArguments;
|
||||
}
|
||||
|
||||
void
|
||||
nsInstall::SetInstallArguments(char* args)
|
||||
{
|
||||
mInstallArguments = args;
|
||||
}
|
||||
|
||||
|
||||
|
||||
PRInt32
|
||||
nsInstall::OpenJARFile(void)
|
||||
{
|
||||
return nsInstall::SUCCESS;
|
||||
|
||||
PRInt32 result = ZIPR_OpenArchive(mJarFileLocation, &mJarFileData);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void
|
||||
nsInstall::CloseJARFile(void)
|
||||
{
|
||||
ZIPR_CloseArchive(&mJarFileData);
|
||||
mJarFileData = nsnull;
|
||||
}
|
||||
|
||||
|
||||
// aJarFile - This is the filepath within the jar file.
|
||||
// aSuggestedName - This is the name that we should try to extract to. If we can, we will create a new temporary file.
|
||||
// aRealName - This is the name that we did extract to. This will be allocated by use and should be disposed by the caller.
|
||||
|
||||
PRInt32
|
||||
nsInstall::ExtractFileFromJar(const nsString& aJarfile, const nsString& aSuggestedName, nsString** aRealName)
|
||||
{
|
||||
PRInt32 result;
|
||||
char* extractFileHere;
|
||||
|
||||
|
||||
nsFileSpec finalFile(aSuggestedName);
|
||||
|
||||
if (aSuggestedName == "" || finalFile.Exists() )
|
||||
{
|
||||
// Create a temporary file to extract to.
|
||||
|
||||
extractFileHere = "c:\\temp\\tempFile.tmp";
|
||||
}
|
||||
else
|
||||
{
|
||||
// extract to the final destination.
|
||||
extractFileHere = aSuggestedName.ToNewCString();
|
||||
}
|
||||
|
||||
*aRealName = new nsString(extractFileHere);
|
||||
|
||||
char* fileInJar = aJarfile.ToNewCString();
|
||||
|
||||
result = ZIPR_ExtractFile( mJarFileData, fileInJar, extractFileHere );
|
||||
|
||||
delete [] fileInJar;
|
||||
//delete [] extractFileHere;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
PRInt32
|
||||
nsInstall::ExtractDirEntries(const nsString& directory, nsVector *paths)
|
||||
{
|
||||
|
|
|
@ -2,21 +2,21 @@
|
|||
#define __NS_INSTALL_H__
|
||||
|
||||
#include "nscore.h"
|
||||
#include "nsString.h"
|
||||
#include "nsISupports.h"
|
||||
|
||||
#include "jsapi.h"
|
||||
|
||||
#include "nsString.h"
|
||||
#include "nsFileSpec.h"
|
||||
#include "nsVector.h"
|
||||
#include "nsHashtable.h"
|
||||
|
||||
#include "nsSoftwareUpdate.h"
|
||||
|
||||
#include "nsInstallObject.h"
|
||||
#include "nsInstallFolder.h"
|
||||
#include "nsInstallVersion.h"
|
||||
|
||||
#include "nsInstallObject.h"
|
||||
|
||||
class nsInstall
|
||||
{
|
||||
public:
|
||||
|
@ -94,16 +94,28 @@ class nsInstall
|
|||
|
||||
|
||||
|
||||
PRInt32 ExtractFileFromJar(const nsString& aJarfile, const nsString& aFinalFile, nsString& aTempFile, PRInt32* aError);
|
||||
PRInt32 ExtractFileFromJar(const nsString& aJarfile, const nsString& aFinalFile, nsString** aTempFile);
|
||||
void AddPatch(nsHashKey *aKey, nsString* fileName);
|
||||
void GetPatch(nsHashKey *aKey, nsString* fileName);
|
||||
|
||||
void GetJarFileLocation(char** aFile);
|
||||
void SetJarFileLocation(char* aFile);
|
||||
|
||||
void GetInstallArguments(char** args);
|
||||
void SetInstallArguments(char* args);
|
||||
|
||||
|
||||
private:
|
||||
JSObject* mScriptObject;
|
||||
|
||||
|
||||
char* mJarFileLocation;
|
||||
void* mJarFileData;
|
||||
|
||||
char* mInstallArguments;
|
||||
|
||||
PRBool mUserCancelled;
|
||||
PRBool mShowProgress;
|
||||
PRBool mShowFinalize;
|
||||
|
||||
PRBool mUninstallPackage;
|
||||
PRBool mRegisterPackage;
|
||||
|
||||
|
|
|
@ -46,29 +46,32 @@ nsInstallExecute:: nsInstallExecute( nsInstall* inInstall,
|
|||
|
||||
mJarLocation = inJarLocation;
|
||||
mArgs = inArgs;
|
||||
mExecutableFile = nsnull;
|
||||
|
||||
}
|
||||
|
||||
|
||||
nsInstallExecute::~nsInstallExecute()
|
||||
{
|
||||
delete mExecutableFile;
|
||||
}
|
||||
|
||||
|
||||
|
||||
PRInt32 nsInstallExecute::Prepare()
|
||||
{
|
||||
if (mInstall == NULL || mExecutableFile == "null" || mJarLocation == "null")
|
||||
if (mInstall == NULL || mJarLocation == "null")
|
||||
return nsInstall::INVALID_ARGUMENTS;
|
||||
|
||||
PRInt32 err;
|
||||
mInstall->ExtractFileFromJar(mJarLocation, "", mExecutableFile, &err);
|
||||
|
||||
return err;
|
||||
return mInstall->ExtractFileFromJar(mJarLocation, "", &mExecutableFile);
|
||||
}
|
||||
|
||||
PRInt32 nsInstallExecute::Complete()
|
||||
{
|
||||
char* tempCString = mExecutableFile.ToNewCString();
|
||||
if (mExecutableFile == nsnull)
|
||||
return nsInstall::INVALID_ARGUMENTS;
|
||||
|
||||
char* tempCString = mExecutableFile->ToNewCString();
|
||||
|
||||
nsFileSpec appPath(tempCString , false);
|
||||
|
||||
|
@ -94,23 +97,23 @@ void nsInstallExecute::Abort()
|
|||
int result;
|
||||
|
||||
/* Get the names */
|
||||
if (mExecutableFile == "")
|
||||
if (mExecutableFile == nsnull)
|
||||
return;
|
||||
currentName = mExecutableFile.ToNewCString();
|
||||
|
||||
currentName = mExecutableFile->ToNewCString();
|
||||
|
||||
result = PR_Delete(currentName);
|
||||
PR_ASSERT(result == 0); /* XXX: need to fe_deletefilelater() or something */
|
||||
PR_ASSERT(result == 0); /* FIX: need to fe_deletefilelater() or something */
|
||||
|
||||
delete currentName;
|
||||
}
|
||||
|
||||
char* nsInstallExecute::toString()
|
||||
{
|
||||
nsString fullPathString;
|
||||
nsString fullPathString(mJarLocation);
|
||||
fullPathString.Append(*mExecutableFile);
|
||||
|
||||
fullPathString = mJarLocation;
|
||||
fullPathString += mExecutableFile;
|
||||
|
||||
if (mExecutableFile == "null")
|
||||
if (mExecutableFile == nsnull)
|
||||
{
|
||||
// FIX!
|
||||
// return nsInstallErrorMessages::GetString(nsInstall::DETAILS_EXECUTE_PROGRESS, fullPathString);
|
||||
|
|
|
@ -53,9 +53,11 @@ class nsInstallExecute : public nsInstallObject
|
|||
private:
|
||||
|
||||
nsString mJarLocation; // Location in the JAR
|
||||
nsString mExecutableFile; // temporary file location
|
||||
nsString mArgs; // command line arguments
|
||||
|
||||
nsString *mExecutableFile; // temporary file location
|
||||
|
||||
|
||||
PRInt32 NativeComplete(void);
|
||||
void NativeAbort(void);
|
||||
|
||||
|
|
|
@ -31,8 +31,9 @@
|
|||
#include "nsInstallFile.h"
|
||||
|
||||
#include "nsInstall.h"
|
||||
#include "nsInstallVersion.h"
|
||||
#include "nsIDOMInstallFolder.h"
|
||||
#include "nsIDOMInstallVersion.h"
|
||||
|
||||
|
||||
#include "nsInstallErrorMessages.h"
|
||||
|
||||
|
@ -80,16 +81,25 @@ nsInstallFile::nsInstallFile(nsInstall* inInstall,
|
|||
return;
|
||||
}
|
||||
|
||||
mVersionRegistryName = new nsString(inVRName);
|
||||
mJarLocation = new nsString(inJarLocation);
|
||||
mVersionInfo = inVInfo; /* XXX: Who owns and who free's this object. Is it nsSoftwareUpdate?? */
|
||||
|
||||
mReplaceFile = DoesFileExist();
|
||||
mForceInstall = forceInstall;
|
||||
|
||||
folderSpec->IsJavaCapable(&mJavaInstall);
|
||||
mVersionRegistryName = new nsString(inVRName);
|
||||
mJarLocation = new nsString(inJarLocation);
|
||||
mVersionInfo = new nsInstallVersion();
|
||||
|
||||
|
||||
//FIX need to delete char* created by .ToNewCString().
|
||||
|
||||
nsString tempString;
|
||||
inVInfo->ToString(tempString);
|
||||
mVersionInfo->Init(tempString.ToNewCString());
|
||||
|
||||
mFinalFile = new nsString();
|
||||
folderSpec->MakeFullPath(inPartialPath, *mFinalFile);
|
||||
|
||||
mReplaceFile = DoesFileExist();
|
||||
|
||||
|
||||
|
||||
nsString regPackageName;
|
||||
|
@ -122,12 +132,20 @@ nsInstallFile::nsInstallFile(nsInstall* inInstall,
|
|||
|
||||
nsInstallFile::~nsInstallFile()
|
||||
{
|
||||
if (mVersionRegistryName)
|
||||
delete mVersionRegistryName;
|
||||
|
||||
if (mJarLocation)
|
||||
delete mJarLocation;
|
||||
|
||||
if (mTempFile)
|
||||
delete mTempFile;
|
||||
|
||||
if (mFinalFile)
|
||||
delete mFinalFile;
|
||||
|
||||
if (mVersionInfo)
|
||||
delete mVersionInfo;
|
||||
}
|
||||
|
||||
/* Prepare
|
||||
|
@ -138,10 +156,7 @@ PRInt32 nsInstallFile::Prepare()
|
|||
if (mInstall == NULL || mFinalFile == NULL || mJarLocation == NULL)
|
||||
return nsInstall::INVALID_ARGUMENTS;
|
||||
|
||||
PRInt32 err;
|
||||
mInstall->ExtractFileFromJar(*mJarLocation, *mFinalFile, *mTempFile, &err);
|
||||
|
||||
return err;
|
||||
return mInstall->ExtractFileFromJar(*mJarLocation, *mFinalFile, &mTempFile);
|
||||
}
|
||||
|
||||
/* Complete
|
||||
|
@ -165,21 +180,8 @@ PRInt32 nsInstallFile::Complete()
|
|||
err = NativeComplete();
|
||||
|
||||
|
||||
char *vr_name = mVersionRegistryName->ToNewCString();
|
||||
char *final_file = mFinalFile->ToNewCString();
|
||||
|
||||
// Add java archives to the classpath. Don't add if we're
|
||||
// replacing an existing file -- it'll already be there.
|
||||
|
||||
if ( mJavaInstall && !mReplaceFile )
|
||||
{
|
||||
PRBool found_zip = endsWith(mFinalFile, ".zip");
|
||||
PRBool found_jar = endsWith(mFinalFile, ".jar");;
|
||||
if (found_zip || found_jar)
|
||||
{
|
||||
AddToClasspath( mFinalFile );
|
||||
}
|
||||
}
|
||||
char *vr_name = mVersionRegistryName->ToNewCString();
|
||||
|
||||
nsString regPackageName;
|
||||
mInstall->GetRegPackageName(regPackageName);
|
||||
|
@ -421,17 +423,6 @@ end:
|
|||
}
|
||||
|
||||
|
||||
|
||||
void nsInstallFile::AddToClasspath(nsString* file)
|
||||
{
|
||||
if ( file != NULL ) {
|
||||
char *final_file = file->ToNewCString();
|
||||
// FIX JVM_AddToClassPath(final_file);
|
||||
delete final_file;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Finds out if the file exists
|
||||
*/
|
||||
PRBool nsInstallFile::DoesFileExist()
|
||||
|
|
|
@ -25,8 +25,9 @@
|
|||
#include "nsInstallObject.h"
|
||||
|
||||
#include "nsInstall.h"
|
||||
#include "nsInstallVersion.h"
|
||||
#include "nsIDOMInstallFolder.h"
|
||||
#include "nsIDOMInstallVersion.h"
|
||||
|
||||
|
||||
|
||||
class nsInstallFile : public nsInstallObject
|
||||
|
@ -66,7 +67,7 @@ class nsInstallFile : public nsInstallObject
|
|||
private:
|
||||
|
||||
/* Private Fields */
|
||||
nsIDOMInstallVersion* mVersionInfo; /* Version info for this file*/
|
||||
nsInstallVersion* mVersionInfo; /* Version info for this file*/
|
||||
|
||||
nsString* mJarLocation; /* Location in the JAR */
|
||||
nsString* mTempFile; /* temporary file location */
|
||||
|
@ -81,7 +82,6 @@ class nsInstallFile : public nsInstallObject
|
|||
|
||||
int NativeComplete();
|
||||
PRBool DoesFileExist();
|
||||
void AddToClasspath(nsString* file);
|
||||
};
|
||||
|
||||
#endif /* nsInstallFile_h__ */
|
||||
|
|
|
@ -51,7 +51,8 @@ nsInstallPatch::nsInstallPatch( nsInstall* inInstall,
|
|||
|
||||
mJarLocation = inJarLocation;
|
||||
|
||||
mPatchFile = "";
|
||||
mPatchFile = nsnull;
|
||||
|
||||
mTargetFile = "";
|
||||
mPatchedFile = "";
|
||||
|
||||
|
@ -97,7 +98,7 @@ nsInstallPatch::nsInstallPatch( nsInstall* inInstall,
|
|||
mVersionInfo = inVInfo; /* Who owns this object? May be we should make a copy of it */
|
||||
mJarLocation = inJarLocation;
|
||||
|
||||
mPatchFile = "";
|
||||
mPatchFile = nsnull;
|
||||
mPatchedFile = "";
|
||||
|
||||
folderSpec->MakeFullPath(inPartialPath, mTargetFile);
|
||||
|
@ -105,6 +106,8 @@ nsInstallPatch::nsInstallPatch( nsInstall* inInstall,
|
|||
|
||||
nsInstallPatch::~nsInstallPatch()
|
||||
{
|
||||
if (mPatchFile != nsnull)
|
||||
delete mPatchFile;
|
||||
}
|
||||
|
||||
|
||||
|
@ -138,7 +141,7 @@ PRInt32 nsInstallPatch::Prepare()
|
|||
return err;
|
||||
}
|
||||
|
||||
mInstall->ExtractFileFromJar(mJarLocation, mTargetFile, mPatchFile, &err);
|
||||
err = mInstall->ExtractFileFromJar(mJarLocation, mTargetFile, &mPatchFile);
|
||||
|
||||
|
||||
nsString *fileName = nsnull;
|
||||
|
@ -156,7 +159,7 @@ PRInt32 nsInstallPatch::Prepare()
|
|||
deleteOldSrc = PR_FALSE;
|
||||
}
|
||||
|
||||
err = NativePatch( *fileName, mPatchFile, mPatchedFile);
|
||||
err = NativePatch( *fileName, *mPatchFile, mPatchedFile);
|
||||
|
||||
if (err != nsInstall::SUCCESS)
|
||||
{
|
||||
|
|
|
@ -64,7 +64,9 @@ class nsInstallPatch : public nsInstallObject
|
|||
nsIDOMInstallVersion* mVersionInfo;
|
||||
|
||||
nsString mJarLocation;
|
||||
nsString mPatchFile;
|
||||
|
||||
nsString *mPatchFile;
|
||||
|
||||
nsString mTargetFile;
|
||||
nsString mPatchedFile;
|
||||
|
||||
|
|
|
@ -85,6 +85,22 @@ GetInstallProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
}
|
||||
break;
|
||||
}
|
||||
case INSTALL_JARFILE:
|
||||
{
|
||||
char* prop;
|
||||
a->GetJarFileLocation(&prop);
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
break;
|
||||
}
|
||||
|
||||
case INSTALL_ARGUMENTS:
|
||||
{
|
||||
char* prop;
|
||||
a->GetInstallArguments(&prop);
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
@ -1065,7 +1081,7 @@ Install(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
|||
// Install class initialization
|
||||
//
|
||||
|
||||
PRInt32 InitXPInstallObjects(nsIScriptContext *aContext, nsFileSpec* jarfile, PRInt32 flags, char* argc, PRInt32 argv)
|
||||
PRInt32 InitXPInstallObjects(nsIScriptContext *aContext, char* jarfile, char* args)
|
||||
{
|
||||
JSContext *jscontext = (JSContext *)aContext->GetNativeContext();
|
||||
JSObject *global = JS_GetGlobalObject(jscontext);
|
||||
|
@ -1094,6 +1110,8 @@ PRInt32 InitXPInstallObjects(nsIScriptContext *aContext, nsFileSpec* jarfile, PR
|
|||
|
||||
nativeInstallObject = new nsInstall();
|
||||
|
||||
nativeInstallObject->SetJarFileLocation(jarfile);
|
||||
nativeInstallObject->SetInstallArguments(args);
|
||||
|
||||
JS_SetPrivate(jscontext, installObject, nativeInstallObject);
|
||||
nativeInstallObject->SetScriptObject(installObject);
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
|
||||
#include "VerReg.h"
|
||||
|
||||
|
||||
#include "nsIScriptObjectOwner.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
|
||||
|
@ -164,7 +165,7 @@ nsSoftwareUpdate::Startup()
|
|||
/* Stupid Hack to test js env*/
|
||||
/***************************************/
|
||||
|
||||
RunInstallJS("c:\\temp\\test.js");
|
||||
InstallJar(nsString("c:\\temp\\test.jar"), "");
|
||||
|
||||
DeleteScheduledNodes();
|
||||
|
||||
|
@ -179,6 +180,23 @@ nsSoftwareUpdate::Shutdown()
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
// We will need to have a overloaded function for multiple jarfile triggers.
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSoftwareUpdate::InstallJar(const nsString& jarFile, const nsString& args)
|
||||
{
|
||||
// FIX: Display some UI indicating that we are going to start an install.
|
||||
|
||||
|
||||
char* tempJarFileName = jarFile.ToNewCString();
|
||||
|
||||
PRInt32 result = Install(tempJarFileName, nsnull);
|
||||
|
||||
delete [] tempJarFileName;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
nsresult
|
||||
nsSoftwareUpdate::DeleteScheduledNodes()
|
||||
|
@ -334,13 +352,6 @@ nsSoftwareUpdateNameSet::AddNameSet(nsIScriptContext* aScriptContext)
|
|||
result = aScriptContext->GetNameSpaceManager(&manager);
|
||||
if (NS_OK == result)
|
||||
{
|
||||
/*
|
||||
result = manager->RegisterGlobalName("Install",
|
||||
kInstall_CID,
|
||||
PR_TRUE);
|
||||
|
||||
if (result != NS_OK) return result;
|
||||
*/
|
||||
result = manager->RegisterGlobalName("InstallVersion",
|
||||
kInstallVersion_CID,
|
||||
PR_TRUE);
|
||||
|
@ -374,24 +385,28 @@ nsSoftwareUpdateNameSet::AddNameSet(nsIScriptContext* aScriptContext)
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
extern "C" NS_EXPORT PRBool
|
||||
NSCanUnload(void)
|
||||
NSCanUnload(nsISupports* serviceMgr)
|
||||
{
|
||||
return PRBool (gInstanceCnt == 0 && gLockCnt == 0);
|
||||
}
|
||||
|
||||
extern "C" NS_EXPORT nsresult
|
||||
NSRegisterSelf(const char *path)
|
||||
NSRegisterSelf(nsISupports* serviceMgr, const char *path)
|
||||
{
|
||||
nsRepository::RegisterFactory(kSoftwareUpdate_CID, path, PR_TRUE, PR_TRUE);
|
||||
nsRepository::RegisterFactory(kInstallTrigger_CID, path, PR_TRUE, PR_TRUE);
|
||||
nsRepository::RegisterFactory(kInstallVersion_CID, path, PR_TRUE, PR_TRUE);
|
||||
nsRepository::RegisterFactory(kInstallFolder_CID, path, PR_TRUE, PR_TRUE);
|
||||
printf("*** XPInstall is being registered\n");
|
||||
nsRepository::RegisterComponent(kSoftwareUpdate_CID, NULL, NULL, path, PR_TRUE, PR_TRUE);
|
||||
nsRepository::RegisterComponent(kInstallTrigger_CID, NULL, NULL, path, PR_TRUE, PR_TRUE);
|
||||
nsRepository::RegisterComponent(kInstallVersion_CID, NULL, NULL, path, PR_TRUE, PR_TRUE);
|
||||
nsRepository::RegisterComponent(kInstallFolder_CID, NULL, NULL, path, PR_TRUE, PR_TRUE);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
extern "C" NS_EXPORT nsresult
|
||||
NSUnregisterSelf(const char *path)
|
||||
NSUnregisterSelf(nsISupports* serviceMgr, const char *path)
|
||||
{
|
||||
printf("*** XPInstall is being unregistered\n");
|
||||
|
||||
nsRepository::UnregisterFactory(kSoftwareUpdate_CID, path);
|
||||
nsRepository::UnregisterFactory(kInstallTrigger_CID, path);
|
||||
nsRepository::UnregisterFactory(kInstallVersion_CID, path);
|
||||
|
@ -403,7 +418,11 @@ NSUnregisterSelf(const char *path)
|
|||
|
||||
|
||||
extern "C" NS_EXPORT nsresult
|
||||
NSGetFactory(const nsCID &aClass, nsISupports* serviceMgr, nsIFactory **aFactory)
|
||||
NSGetFactory(nsISupports* serviceMgr,
|
||||
const nsCID &aClass,
|
||||
const char *aClassName,
|
||||
const char *aProgID,
|
||||
nsIFactory **aFactory)
|
||||
{
|
||||
|
||||
if (aFactory == NULL)
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#include "nscore.h"
|
||||
#include "nsIFactory.h"
|
||||
#include "nsISupports.h"
|
||||
#include "nsString.h"
|
||||
|
||||
#include "nsIScriptExternalNameSet.h"
|
||||
|
||||
|
@ -23,6 +24,7 @@ class nsSoftwareUpdate: public nsISoftwareUpdate
|
|||
|
||||
NS_IMETHOD Startup();
|
||||
NS_IMETHOD Shutdown();
|
||||
NS_IMETHOD InstallJar(const nsString& jarFile, const nsString& args);
|
||||
|
||||
private:
|
||||
nsresult DeleteScheduledNodes();
|
||||
|
@ -40,7 +42,6 @@ class nsSoftwareUpdateNameSet : public nsIScriptExternalNameSet
|
|||
NS_IMETHOD AddNameSet(nsIScriptContext* aScriptContext);
|
||||
};
|
||||
|
||||
|
||||
#define AUTOUPDATE_ENABLE_PREF "autoupdate.enabled"
|
||||
#define AUTOUPDATE_CONFIRM_PREF "autoupdate.confirm_install"
|
||||
#define CHARSET_HEADER "Charset"
|
||||
|
@ -50,12 +51,5 @@ class nsSoftwareUpdateNameSet : public nsIScriptExternalNameSet
|
|||
#define REG_SOFTUPDT_DIR "Netscape/Communicator/SoftwareUpdate/"
|
||||
#define LAST_REGPACK_TIME "LastRegPackTime"
|
||||
|
||||
/* error codes */
|
||||
#define ErrInvalidArgs -1
|
||||
#define ErrUnknownInstaller -2
|
||||
#define ErrInternalError -3
|
||||
#define ErrBadScript -4
|
||||
#define JarError -5
|
||||
#define DiskSpaceError -6
|
||||
|
||||
#endif
|
|
@ -12,8 +12,10 @@
|
|||
#include "nsIScriptContextOwner.h"
|
||||
|
||||
#include "nsInstall.h"
|
||||
#include "zipfile.h"
|
||||
|
||||
extern PRInt32 InitXPInstallObjects(nsIScriptContext *aContext, nsFileSpec* jarfile, PRInt32 flags, char* argc, PRInt32 argv);
|
||||
|
||||
extern PRInt32 InitXPInstallObjects(nsIScriptContext *aContext, char* jarfile, char* args);
|
||||
|
||||
|
||||
static NS_DEFINE_IID(kBrowserWindowCID, NS_BROWSER_WINDOW_CID);
|
||||
|
@ -35,7 +37,7 @@ static short ReadFileIntoBuffer(char * fileName, char** buffer, unsigned long *b
|
|||
|
||||
if ( stat( fileName, &st) != 0 )
|
||||
{
|
||||
result = ErrInternalError;
|
||||
result = -1;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
@ -53,13 +55,13 @@ static short ReadFileIntoBuffer(char * fileName, char** buffer, unsigned long *b
|
|||
|
||||
if ( file == NULL)
|
||||
{
|
||||
result = ErrInternalError;
|
||||
result = -1;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if ( PR_Read(file, *buffer, *bufferSize ) != st.st_size )
|
||||
{
|
||||
result = ErrInternalError;
|
||||
result = -1;
|
||||
PR_Close( file );
|
||||
goto fail;
|
||||
}
|
||||
|
@ -77,12 +79,40 @@ fail:
|
|||
}
|
||||
|
||||
|
||||
|
||||
int RunInstallJS(char* installJSFile)
|
||||
extern "C" NS_EXPORT PRInt32 Install(char* jarFile, char* args)
|
||||
{
|
||||
// Open the jarfile.
|
||||
void* hZip;
|
||||
|
||||
PRInt32 result = ZIPR_OpenArchive(jarFile , &hZip);
|
||||
|
||||
if (result != ZIP_OK)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
// Read manifest file for Install Script filename.
|
||||
//FIX: need to do.
|
||||
|
||||
char* installJSFile = "c:\\temp\\install.js";
|
||||
|
||||
|
||||
remove(installJSFile);
|
||||
|
||||
// Extract the install.js file.
|
||||
result = ZIPR_ExtractFile( hZip, "install.js", installJSFile );
|
||||
if (result != ZIP_OK)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
nsIBrowserWindow *aWindow;
|
||||
nsIWebShell *aWebShell;
|
||||
|
||||
// Create a new window so that we can both run a script in it and display UI.
|
||||
|
||||
nsresult rv = nsRepository::CreateInstance( kBrowserWindowCID,
|
||||
nsnull,
|
||||
kIBrowserWindowIID,
|
||||
|
@ -91,51 +121,37 @@ int RunInstallJS(char* installJSFile)
|
|||
{
|
||||
nsRect rect(0, 0, 275, 300);
|
||||
|
||||
nsAutoString retval;
|
||||
PRBool isUndefined;
|
||||
|
||||
nsIScriptContextOwner* scriptContextOwner;
|
||||
nsIScriptContext* scriptContext;
|
||||
|
||||
rv = aWindow->Init(nsnull, nsnull, rect, PRUint32(0), PR_FALSE);
|
||||
|
||||
if (rv == NS_OK)
|
||||
{
|
||||
rv = aWindow->GetWebShell(aWebShell);
|
||||
|
||||
/* FIX: Display a window here...(ie.OpenURL)
|
||||
|
||||
What about silent/forced installs?
|
||||
/*
|
||||
* FIX: Display a window here...(ie.OpenURL)
|
||||
*/
|
||||
|
||||
|
||||
nsAutoString retval;
|
||||
PRBool isUndefined;
|
||||
nsIScriptContextOwner* scriptContextOwner;
|
||||
|
||||
if (NS_OK == aWebShell->QueryInterface( kIScriptContextOwnerIID,
|
||||
(void**)&scriptContextOwner))
|
||||
if (NS_OK == aWebShell->QueryInterface( kIScriptContextOwnerIID, (void**)&scriptContextOwner))
|
||||
{
|
||||
const char* url = "";
|
||||
nsIScriptContext* scriptContext;
|
||||
rv = scriptContextOwner->GetScriptContext(&scriptContext);
|
||||
|
||||
if (NS_OK == rv)
|
||||
{
|
||||
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
// Init Install Object
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
nsFileSpec jarfile("c:\\temp\\jarfile.jar");
|
||||
PRInt32 flags = 0;
|
||||
char* argc = nsnull;
|
||||
PRInt32 argv = 0;
|
||||
|
||||
InitXPInstallObjects(scriptContext, &jarfile, flags, argc, argv );
|
||||
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
InitXPInstallObjects(scriptContext, jarFile, args );
|
||||
|
||||
char* buffer;
|
||||
unsigned long bufferLength;
|
||||
|
||||
ReadFileIntoBuffer(installJSFile, &buffer, &bufferLength);
|
||||
|
||||
// We expected this to block.
|
||||
scriptContext->EvaluateString(nsString(buffer), nsnull, 0, retval, &isUndefined);
|
||||
|
||||
PR_FREEIF(buffer);
|
||||
|
@ -145,9 +161,16 @@ int RunInstallJS(char* installJSFile)
|
|||
NS_RELEASE(scriptContextOwner);
|
||||
}
|
||||
}
|
||||
|
||||
aWindow->Close();
|
||||
NS_RELEASE(aWindow);
|
||||
}
|
||||
return 0;
|
||||
else
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
ZIPR_CloseArchive(&hZip);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#ifndef __NS_SoftwareUpdateRun_H__
|
||||
#define __NS_SoftwareUpdateRun_H__
|
||||
|
||||
int RunInstallJS(char* filename);
|
||||
extern "C" NS_EXPORT PRInt32 Install(char* jarFile, char* args);
|
||||
|
||||
#endif
|
Загрузка…
Ссылка в новой задаче