mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 22:01:30 +00:00
Moved javascript execution onto a new nspr thread.
added delete and replace later got rid of unneeded IIDs in public header Added the correct license to all files.
This commit is contained in:
parent
c5ee58a5d6
commit
bee3384169
@ -1,19 +1,27 @@
|
||||
#!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
|
||||
# Version 1.0 (the "License"); you may not use this file except in
|
||||
# compliance with the License. You may obtain a copy of the License 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
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# NPL.
|
||||
# License.
|
||||
#
|
||||
# The Initial Developer of this code under the NPL is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# The Original Code is Mozilla Communicator client code,
|
||||
# released March 31, 1998.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape Communications
|
||||
# Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
# Reserved.
|
||||
#
|
||||
# Contributors:
|
||||
# Daniel Veditz <dveditz@netscape.com>
|
||||
# Douglas Turner <dougt@netscape.com>
|
||||
|
||||
|
||||
DEPTH = ..
|
||||
topsrcdir = @top_srcdir@
|
||||
|
@ -1,19 +1,27 @@
|
||||
#!nmake
|
||||
#
|
||||
# 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
|
||||
# Version 1.0 (the "License"); you may not use this file except in
|
||||
# compliance with the License. You may obtain a copy of the License 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
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# NPL.
|
||||
# License.
|
||||
#
|
||||
# The Initial Developer of this code under the NPL is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# The Original Code is Mozilla Communicator client code,
|
||||
# released March 31, 1998.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape Communications
|
||||
# Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
# Reserved.
|
||||
#
|
||||
# Contributors:
|
||||
# Daniel Veditz <dveditz@netscape.com>
|
||||
# Douglas Turner <dougt@netscape.com>
|
||||
|
||||
|
||||
DEPTH=..
|
||||
|
||||
|
@ -1,19 +1,26 @@
|
||||
#!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
|
||||
# Version 1.0 (the "License"); you may not use this file except in
|
||||
# compliance with the License. You may obtain a copy of the License 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
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# NPL.
|
||||
# License.
|
||||
#
|
||||
# The Initial Developer of this code under the NPL is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# The Original Code is Mozilla Communicator client code,
|
||||
# released March 31, 1998.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape Communications
|
||||
# Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
# Reserved.
|
||||
#
|
||||
# Contributors:
|
||||
# Daniel Veditz <dveditz@netscape.com>
|
||||
# Douglas Turner <dougt@netscape.com>
|
||||
|
||||
DEPTH = ../..
|
||||
topsrcdir = @top_srcdir@
|
||||
|
@ -1,19 +1,26 @@
|
||||
#!nmake
|
||||
#
|
||||
# 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
|
||||
# Version 1.0 (the "License"); you may not use this file except in
|
||||
# compliance with the License. You may obtain a copy of the License 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
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# NPL.
|
||||
# License.
|
||||
#
|
||||
# The Initial Developer of this code under the NPL is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# The Original Code is Mozilla Communicator client code,
|
||||
# released March 31, 1998.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape Communications
|
||||
# Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
# Reserved.
|
||||
#
|
||||
# Contributors:
|
||||
# Daniel Veditz <dveditz@netscape.com>
|
||||
# Douglas Turner <dougt@netscape.com>
|
||||
|
||||
DEPTH=..\..
|
||||
|
||||
|
@ -1,19 +1,26 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/*
|
||||
* 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
|
||||
* Version 1.0 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License 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
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
* License.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* The Original Code is Mozilla Communicator client code,
|
||||
* released March 31, 1998.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape Communications
|
||||
* Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*
|
||||
* Contributors:
|
||||
* Daniel Veditz <dveditz@netscape.com>
|
||||
* Douglas Turner <dougt@netscape.com>
|
||||
*/
|
||||
|
||||
#ifndef nsISoftwareUpdate_h__
|
||||
@ -41,6 +48,10 @@ class nsISoftwareUpdate : public nsISupports
|
||||
const nsString& flags,
|
||||
const nsString& args) = 0;
|
||||
|
||||
// these should be in a private interface:
|
||||
NS_IMETHOD RunNextInstall() = 0;
|
||||
NS_IMETHOD InstallJarCallBack() = 0;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
@ -1,3 +1,28 @@
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Mozilla Communicator client code,
|
||||
* released March 31, 1998.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape Communications
|
||||
* Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*
|
||||
* Contributors:
|
||||
* Daniel Veditz <dveditz@netscape.com>
|
||||
* Douglas Turner <dougt@netscape.com>
|
||||
*/
|
||||
|
||||
#ifndef nsSoftwareUpdateIIDs_h___
|
||||
#define nsSoftwareUpdateIIDs_h___
|
||||
|
||||
@ -65,6 +90,7 @@
|
||||
{0xbc, 0xde, 0x00, 0x80, 0x5f, 0x0e, 0x13, 0x53} \
|
||||
}
|
||||
|
||||
#if 0
|
||||
#define NS_SoftwareUpdateInstallFolder_CID \
|
||||
{ /* 18c2f991-b09f-11d2-bcde-00805f0e1353 */ \
|
||||
0x18c2f991, \
|
||||
@ -80,5 +106,6 @@
|
||||
0x11d2, \
|
||||
{0xbc, 0xde, 0x00, 0x80, 0x5f, 0x0e, 0x13, 0x53} \
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* nsSoftwareUpdateIIDs_h___ */
|
@ -1,19 +1,26 @@
|
||||
#!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
|
||||
# Version 1.0 (the "License"); you may not use this file except in
|
||||
# compliance with the License. You may obtain a copy of the License 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
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# NPL.
|
||||
# License.
|
||||
#
|
||||
# The Initial Developer of this code under the NPL is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# The Original Code is Mozilla Communicator client code,
|
||||
# released March 31, 1998.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape Communications
|
||||
# Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
# Reserved.
|
||||
#
|
||||
# Contributors:
|
||||
# Daniel Veditz <dveditz@netscape.com>
|
||||
# Douglas Turner <dougt@netscape.com>
|
||||
|
||||
DEPTH = ../..
|
||||
topsrcdir = @top_srcdir@
|
||||
@ -40,6 +47,7 @@ CPPSRCS = \
|
||||
nsJSInstallTriggerGlobal.cpp\
|
||||
nsSoftwareUpdateRun.cpp \
|
||||
nsSoftwareUpdateStream.cpp \
|
||||
ScheduledTasks.cpp \
|
||||
$(NULL)
|
||||
|
||||
|
||||
|
@ -1,92 +1,94 @@
|
||||
#!gmake
|
||||
#!nmake
|
||||
#
|
||||
# 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
|
||||
# Version 1.0 (the "License"); you may not use this file except in
|
||||
# compliance with the License. You may obtain a copy of the License 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
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# NPL.
|
||||
# License.
|
||||
#
|
||||
# The Initial Developer of this code under the NPL is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# The Original Code is Mozilla Communicator client code,
|
||||
# released March 31, 1998.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape Communications
|
||||
# Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
# Reserved.
|
||||
#
|
||||
# Contributors:
|
||||
# Daniel Veditz <dveditz@netscape.com>
|
||||
# Douglas Turner <dougt@netscape.com>
|
||||
|
||||
|
||||
DEPTH=..\..
|
||||
IGNORE_MANIFEST=1
|
||||
|
||||
|
||||
MAKE_OBJ_TYPE = DLL
|
||||
MODULE=xpinstall
|
||||
|
||||
DLL=.\$(OBJDIR)\$(MODULE).dll
|
||||
|
||||
DEFINES=-D_IMPL_NS_DOM
|
||||
DEFINES=-D_IMPL_NS_DOM -DWIN32_LEAN_AND_MEAN
|
||||
|
||||
LCFLAGS = \
|
||||
LCFLAGS = \
|
||||
$(LCFLAGS) \
|
||||
$(DEFINES) \
|
||||
$(NULL)
|
||||
|
||||
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 \
|
||||
-I$(XPDIST)\public\xpcom \
|
||||
-I$(XPDIST)\public\util \
|
||||
-I$(XPDIST)\public\nspr2 \
|
||||
-I$(XPDIST)\public\pref \
|
||||
-I$(XPDIST)\public\raptor \
|
||||
-I$(XPDIST)\public\libreg \
|
||||
$(NULL)
|
||||
LINCS= \
|
||||
-I$(XPDIST)\public\xpinstall \
|
||||
-I$(XPDIST)\public\jar \
|
||||
-I$(XPDIST)\public\libreg \
|
||||
-I$(XPDIST)\public\netlib \
|
||||
-I$(XPDIST)\public\xpcom \
|
||||
-I$(XPDIST)\public\pref \
|
||||
-I$(XPDIST)\public\js \
|
||||
-I$(XPDIST)\public\dom \
|
||||
-I$(XPDIST)\public\raptor \
|
||||
-I$(XPDIST)\public\nspr2 \
|
||||
$(NULL)
|
||||
|
||||
LLIBS = \
|
||||
$(DIST)\lib\jar50.lib \
|
||||
$(DIST)\lib\libreg32.lib \
|
||||
$(DIST)\lib\netlib.lib \
|
||||
$(DIST)\lib\xpcom32.lib \
|
||||
$(DIST)\lib\xppref32.lib \
|
||||
$(DIST)\lib\xplib.lib \
|
||||
$(DIST)\lib\js3250.lib \
|
||||
$(DIST)\lib\jsdombase_s.lib \
|
||||
$(DIST)\lib\raptorbase.lib \
|
||||
$(DIST)\lib\raptorgfxwin.lib \
|
||||
$(LIBNSPR) \
|
||||
$(DIST)\lib\libplc21.lib \
|
||||
$(NULL)
|
||||
LLIBS = \
|
||||
$(DIST)\lib\jar50.lib \
|
||||
$(DIST)\lib\libreg32.lib \
|
||||
$(DIST)\lib\netlib.lib \
|
||||
$(DIST)\lib\xpcom32.lib \
|
||||
$(DIST)\lib\xppref32.lib \
|
||||
$(DIST)\lib\js3250.lib \
|
||||
$(DIST)\lib\jsdombase_s.lib \
|
||||
$(DIST)\lib\raptorbase.lib \
|
||||
$(LIBNSPR) \
|
||||
$(NULL)
|
||||
|
||||
|
||||
OBJS = \
|
||||
.\$(OBJDIR)\nsInstall.obj \
|
||||
.\$(OBJDIR)\nsInstallTrigger.obj \
|
||||
.\$(OBJDIR)\nsInstallVersion.obj \
|
||||
.\$(OBJDIR)\nsInstallFolder.obj \
|
||||
.\$(OBJDIR)\nsJSInstall.obj \
|
||||
.\$(OBJDIR)\nsJSInstallTriggerGlobal.obj \
|
||||
.\$(OBJDIR)\nsJSInstallVersion.obj \
|
||||
.\$(OBJDIR)\nsSoftwareUpdate.obj \
|
||||
.\$(OBJDIR)\nsSoftwareUpdateRun.obj \
|
||||
.\$(OBJDIR)\nsSoftwareUpdateStream.obj \
|
||||
.\$(OBJDIR)\nsInstallFile.obj \
|
||||
.\$(OBJDIR)\nsInstallDelete.obj \
|
||||
.\$(OBJDIR)\nsInstallExecute.obj \
|
||||
.\$(OBJDIR)\nsInstallPatch.obj \
|
||||
$(NULL)
|
||||
OBJS = \
|
||||
.\$(OBJDIR)\nsInstall.obj \
|
||||
.\$(OBJDIR)\nsInstallTrigger.obj \
|
||||
.\$(OBJDIR)\nsInstallVersion.obj \
|
||||
.\$(OBJDIR)\nsInstallFolder.obj \
|
||||
.\$(OBJDIR)\nsJSInstall.obj \
|
||||
.\$(OBJDIR)\nsJSInstallTriggerGlobal.obj \
|
||||
.\$(OBJDIR)\nsJSInstallVersion.obj \
|
||||
.\$(OBJDIR)\nsSoftwareUpdate.obj \
|
||||
.\$(OBJDIR)\nsSoftwareUpdateRun.obj \
|
||||
.\$(OBJDIR)\nsSoftwareUpdateStream.obj \
|
||||
.\$(OBJDIR)\nsInstallFile.obj \
|
||||
.\$(OBJDIR)\nsInstallDelete.obj \
|
||||
.\$(OBJDIR)\nsInstallExecute.obj \
|
||||
.\$(OBJDIR)\nsInstallPatch.obj \
|
||||
.\$(OBJDIR)\ScheduledTasks.obj \
|
||||
$(NULL)
|
||||
|
||||
include <$(DEPTH)\config\rules.mak>
|
||||
|
||||
install:: $(DLL)
|
||||
$(MAKE_INSTALL) .\$(OBJDIR)\$(MODULE).dll $(DIST)\bin\components
|
||||
$(MAKE_INSTALL) .\$(OBJDIR)\$(MODULE).lib $(DIST)\lib
|
||||
$(MAKE_INSTALL) .\$(OBJDIR)\$(MODULE).dll $(DIST)\bin\components
|
||||
|
||||
clobber::
|
||||
rm -f $(DIST)\lib\$(MODULE).lib
|
||||
rm -f $(DIST)\bin\$(MODULE).dll
|
||||
rm -f $(DIST)\bin\components\$(MODULE).dll
|
||||
|
||||
|
@ -1,23 +1,30 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS"
|
||||
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
|
||||
* the License for the specific language governing rights and limitations
|
||||
* under the License.
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Mozilla Communicator client code.
|
||||
* The Original Code is Mozilla Communicator client code,
|
||||
* released March 31, 1998.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape Communications
|
||||
* Corporation. Portions created by Netscape are Copyright (C) 1998
|
||||
* Netscape Communications Corporation. All Rights Reserved.
|
||||
* The Initial Developer of the Original Code is Netscape Communications
|
||||
* Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*
|
||||
* Contributors:
|
||||
* Daniel Veditz <dveditz@netscape.com>
|
||||
* Douglas Turner <dougt@netscape.com>
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include "nscore.h"
|
||||
#include "nsIFactory.h"
|
||||
#include "nsISupports.h"
|
||||
@ -71,7 +78,9 @@ nsInstallInfo::nsInstallInfo(const nsString& fromURL, const nsString& arguments,
|
||||
mArguments = new nsString(arguments);
|
||||
mFlags = new nsString(flags);
|
||||
mLocalFile = new nsString();
|
||||
|
||||
|
||||
mInstalled = PR_FALSE;
|
||||
|
||||
mMultipleTrigger = PR_FALSE;
|
||||
mFromURLs = nsnull;
|
||||
mLocalFiles = nsnull;
|
||||
@ -88,6 +97,7 @@ nsInstallInfo::nsInstallInfo(nsVector* fromURL, const nsString& arguments, const
|
||||
mArguments = new nsString(arguments);
|
||||
mFlags = new nsString(flags);
|
||||
|
||||
mInstalled = PR_FALSE;
|
||||
mMultipleTrigger = PR_FALSE;
|
||||
|
||||
// The following are not to be used with the Multiple Trigger
|
||||
@ -213,7 +223,6 @@ nsInstallInfo::IsMultipleTrigger()
|
||||
return mMultipleTrigger;
|
||||
}
|
||||
|
||||
|
||||
nsInstall::nsInstall()
|
||||
{
|
||||
mScriptObject = nsnull; // this is the jsobject for our context
|
||||
@ -225,17 +234,14 @@ nsInstall::nsInstall()
|
||||
mUninstallPackage = PR_FALSE;
|
||||
mRegisterPackage = PR_FALSE;
|
||||
|
||||
mJarFileLocation = nsnull;
|
||||
mInstallArguments = nsnull;
|
||||
mJarFileLocation = "";
|
||||
mInstallArguments = "";
|
||||
}
|
||||
|
||||
nsInstall::~nsInstall()
|
||||
{
|
||||
if (mVersionInfo != nsnull)
|
||||
delete mVersionInfo;
|
||||
|
||||
PR_FREEIF( mJarFileLocation );
|
||||
PR_FREEIF( mInstallArguments );
|
||||
}
|
||||
|
||||
|
||||
@ -1263,31 +1269,27 @@ nsInstall::CleanUp(void)
|
||||
|
||||
|
||||
void
|
||||
nsInstall::GetJarFileLocation(char** aFile)
|
||||
nsInstall::GetJarFileLocation(nsString& aFile)
|
||||
{
|
||||
*aFile = mJarFileLocation;
|
||||
aFile.SetString( mJarFileLocation );
|
||||
}
|
||||
|
||||
void
|
||||
nsInstall::SetJarFileLocation(const char* aFile)
|
||||
nsInstall::SetJarFileLocation(const nsString& aFile)
|
||||
{
|
||||
PR_FREEIF(mJarFileLocation);
|
||||
mJarFileLocation = (char*) malloc( strlen(aFile) + 1 );
|
||||
strncpy(mJarFileLocation, aFile, strlen(aFile) + 1 );
|
||||
mJarFileLocation.SetString(aFile);
|
||||
}
|
||||
|
||||
void
|
||||
nsInstall::GetInstallArguments(char** args)
|
||||
nsInstall::GetInstallArguments(nsString& args)
|
||||
{
|
||||
*args = mInstallArguments;
|
||||
args.SetString( mInstallArguments );
|
||||
}
|
||||
|
||||
void
|
||||
nsInstall::SetInstallArguments(const char* args)
|
||||
nsInstall::SetInstallArguments(const nsString& args)
|
||||
{
|
||||
PR_FREEIF(mInstallArguments);
|
||||
mInstallArguments = (char*) malloc( strlen(args) + 1 );
|
||||
strncpy(mInstallArguments, args, strlen(args) + 1);
|
||||
mInstallArguments.SetString(args);
|
||||
}
|
||||
|
||||
|
||||
@ -1296,7 +1298,7 @@ PRInt32
|
||||
nsInstall::OpenJARFile(void)
|
||||
{
|
||||
|
||||
PRInt32 result = ZIP_OpenArchive(mJarFileLocation, &mJarFileData);
|
||||
PRInt32 result = ZIP_OpenArchive(nsAutoCString(mJarFileLocation), &mJarFileData);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
@ -1,3 +1,29 @@
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Mozilla Communicator client code,
|
||||
* released March 31, 1998.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape Communications
|
||||
* Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*
|
||||
* Contributors:
|
||||
* Daniel Veditz <dveditz@netscape.com>
|
||||
* Douglas Turner <dougt@netscape.com>
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __NS_INSTALL_H__
|
||||
#define __NS_INSTALL_H__
|
||||
|
||||
@ -35,7 +61,6 @@ class nsInstallInfo
|
||||
|
||||
PRBool IsMultipleTrigger();
|
||||
|
||||
|
||||
private:
|
||||
DeleteVector(nsVector* vector);
|
||||
MakeTempFile(nsString aURL, nsString& tempFileString);
|
||||
@ -44,7 +69,9 @@ class nsInstallInfo
|
||||
nsString *mFromURL;
|
||||
nsString *mArguments;
|
||||
nsString *mFlags;
|
||||
|
||||
|
||||
PRBool mInstalled;
|
||||
PRBool mMultipleTrigger;
|
||||
|
||||
nsVector *mFromURLs;
|
||||
@ -135,21 +162,20 @@ class nsInstall
|
||||
void AddPatch(nsHashKey *aKey, nsFileSpec* fileName);
|
||||
void GetPatch(nsHashKey *aKey, nsFileSpec* fileName);
|
||||
|
||||
void GetJarFileLocation(char** aFile);
|
||||
void SetJarFileLocation(const char* aFile);
|
||||
void GetJarFileLocation(nsString& aFile);
|
||||
void SetJarFileLocation(const nsString& aFile);
|
||||
|
||||
void GetInstallArguments(char** args);
|
||||
void SetInstallArguments(const char* args);
|
||||
void GetInstallArguments(nsString& args);
|
||||
void SetInstallArguments(const nsString& args);
|
||||
|
||||
|
||||
private:
|
||||
JSObject* mScriptObject;
|
||||
|
||||
|
||||
char* mJarFileLocation;
|
||||
nsString mJarFileLocation;
|
||||
void* mJarFileData;
|
||||
|
||||
char* mInstallArguments;
|
||||
nsString mInstallArguments;
|
||||
|
||||
PRBool mUserCancelled;
|
||||
|
||||
|
@ -1,19 +1,26 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/*
|
||||
* 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
|
||||
* Version 1.0 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License 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
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
* License.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* The Original Code is Mozilla Communicator client code,
|
||||
* released March 31, 1998.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape Communications
|
||||
* Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*
|
||||
* Contributors:
|
||||
* Daniel Veditz <dveditz@netscape.com>
|
||||
* Douglas Turner <dougt@netscape.com>
|
||||
*/
|
||||
|
||||
|
||||
@ -22,6 +29,7 @@
|
||||
#include "nsFileSpec.h"
|
||||
|
||||
#include "VerReg.h"
|
||||
#include "ScheduledTasks.h"
|
||||
#include "nsInstallDelete.h"
|
||||
|
||||
#include "nsInstall.h"
|
||||
@ -206,7 +214,7 @@ PRInt32 nsInstallDelete::NativeComplete()
|
||||
if (mFinalFile->Exists())
|
||||
{
|
||||
// If file still exists, we need to delete it later!
|
||||
// FIX DeleteOldFileLater( (char*)finalFile );
|
||||
DeleteFileLater(mFinalFile->GetCString());
|
||||
return nsInstall::REBOOT_NEEDED;
|
||||
}
|
||||
}
|
||||
|
@ -1,21 +1,29 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/*
|
||||
* 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
|
||||
* Version 1.0 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License 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
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
* License.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* The Original Code is Mozilla Communicator client code,
|
||||
* released March 31, 1998.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape Communications
|
||||
* Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*
|
||||
* Contributors:
|
||||
* Daniel Veditz <dveditz@netscape.com>
|
||||
* Douglas Turner <dougt@netscape.com>
|
||||
*/
|
||||
|
||||
|
||||
#ifndef nsInstallDelete_h__
|
||||
#define nsInstallDelete_h__
|
||||
|
||||
|
@ -1,22 +1,30 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/*
|
||||
* 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
|
||||
* Version 1.0 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License 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
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
* License.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* The Original Code is Mozilla Communicator client code,
|
||||
* released March 31, 1998.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape Communications
|
||||
* Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*
|
||||
* Contributors:
|
||||
* Daniel Veditz <dveditz@netscape.com>
|
||||
* Douglas Turner <dougt@netscape.com>
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include "prmem.h"
|
||||
|
||||
#include "nsFileSpec.h"
|
||||
@ -24,6 +32,8 @@
|
||||
#include "VerReg.h"
|
||||
#include "nsInstallExecute.h"
|
||||
|
||||
#include "ScheduledTasks.h"
|
||||
|
||||
#include "nsInstall.h"
|
||||
#include "nsIDOMInstallVersion.h"
|
||||
|
||||
@ -68,14 +78,16 @@ PRInt32 nsInstallExecute::Complete()
|
||||
if (mExecutableFile == nsnull)
|
||||
return nsInstall::INVALID_ARGUMENTS;
|
||||
|
||||
nsFileSpec appPath( *mExecutableFile);
|
||||
nsFileSpec app( *mExecutableFile);
|
||||
|
||||
if (!appPath.Exists())
|
||||
if (!app.Exists())
|
||||
{
|
||||
return nsInstall::INVALID_ARGUMENTS;
|
||||
}
|
||||
|
||||
PRInt32 result = appPath.Execute( mArgs );
|
||||
PRInt32 result = app.Execute( mArgs );
|
||||
|
||||
DeleteFileLater(app.GetCString());
|
||||
|
||||
return result;
|
||||
}
|
||||
@ -90,7 +102,7 @@ void nsInstallExecute::Abort()
|
||||
|
||||
if ( mExecutableFile->Exists() )
|
||||
{
|
||||
/* FIX: need to fe_deletefilelater() or something */
|
||||
DeleteFileLater(mExecutableFile->GetCString());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,21 +1,29 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/*
|
||||
* 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
|
||||
* Version 1.0 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License 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
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
* License.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* The Original Code is Mozilla Communicator client code,
|
||||
* released March 31, 1998.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape Communications
|
||||
* Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*
|
||||
* Contributors:
|
||||
* Daniel Veditz <dveditz@netscape.com>
|
||||
* Douglas Turner <dougt@netscape.com>
|
||||
*/
|
||||
|
||||
|
||||
#ifndef nsInstallExecute_h__
|
||||
#define nsInstallExecute_h__
|
||||
|
||||
|
@ -1,26 +1,32 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/*
|
||||
* 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
|
||||
* Version 1.0 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License 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
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
* License.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* The Original Code is Mozilla Communicator client code,
|
||||
* released March 31, 1998.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape Communications
|
||||
* Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*
|
||||
* Contributors:
|
||||
* Daniel Veditz <dveditz@netscape.com>
|
||||
* Douglas Turner <dougt@netscape.com>
|
||||
*/
|
||||
|
||||
#include "nsFileSpec.h"
|
||||
|
||||
#include "VerReg.h"
|
||||
#include "nsInstallFile.h"
|
||||
|
||||
#include "nsFileSpec.h"
|
||||
#include "VerReg.h"
|
||||
#include "ScheduledTasks.h"
|
||||
#include "nsInstall.h"
|
||||
#include "nsInstallVersion.h"
|
||||
|
||||
@ -191,19 +197,25 @@ PRInt32 nsInstallFile::CompleteFileMove()
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Target exists, can't trust XP_FileRename--do platform specific stuff in FE_ReplaceExistingFile() */
|
||||
// FIX: FE_ReplaceExistingFile()
|
||||
mFinalFile->Delete(PR_FALSE);
|
||||
|
||||
// Now that we have move the existing file, we can move the mExtracedFile into place.
|
||||
nsFileSpec parentofFinalFile;
|
||||
if (! mFinalFile->Exists())
|
||||
{
|
||||
// Now that we have move the existing file, we can move the mExtracedFile into place.
|
||||
nsFileSpec parentofFinalFile;
|
||||
|
||||
mFinalFile->GetParent(parentofFinalFile);
|
||||
result = mExtracedFile->Move(parentofFinalFile);
|
||||
mFinalFile->GetParent(parentofFinalFile);
|
||||
result = mExtracedFile->Move(parentofFinalFile);
|
||||
|
||||
char* leafName = mFinalFile->GetLeafName();
|
||||
mExtracedFile->Rename(leafName);
|
||||
delete [] leafName;
|
||||
char* leafName = mFinalFile->GetLeafName();
|
||||
mExtracedFile->Rename(leafName);
|
||||
delete [] leafName;
|
||||
}
|
||||
else
|
||||
{
|
||||
ReplaceFileLater(mExtracedFile->GetCString(), mFinalFile->GetCString() );
|
||||
result = nsInstall::REBOOT_NEEDED;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,21 +1,29 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/*
|
||||
* 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
|
||||
* Version 1.0 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License 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
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
* License.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* The Original Code is Mozilla Communicator client code,
|
||||
* released March 31, 1998.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape Communications
|
||||
* Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*
|
||||
* Contributors:
|
||||
* Daniel Veditz <dveditz@netscape.com>
|
||||
* Douglas Turner <dougt@netscape.com>
|
||||
*/
|
||||
|
||||
|
||||
#ifndef nsInstallFile_h__
|
||||
#define nsInstallFile_h__
|
||||
|
||||
|
@ -1,20 +1,26 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS"
|
||||
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
|
||||
* the License for the specific language governing rights and limitations
|
||||
* under the License.
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Mozilla Communicator client code.
|
||||
* The Original Code is Mozilla Communicator client code,
|
||||
* released March 31, 1998.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape Communications
|
||||
* Corporation. Portions created by Netscape are Copyright (C) 1998
|
||||
* Netscape Communications Corporation. All Rights Reserved.
|
||||
* The Initial Developer of the Original Code is Netscape Communications
|
||||
* Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*
|
||||
* Contributors:
|
||||
* Daniel Veditz <dveditz@netscape.com>
|
||||
* Douglas Turner <dougt@netscape.com>
|
||||
*/
|
||||
|
||||
#include "nsInstall.h"
|
||||
|
@ -1,3 +1,29 @@
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Mozilla Communicator client code,
|
||||
* released March 31, 1998.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape Communications
|
||||
* Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*
|
||||
* Contributors:
|
||||
* Daniel Veditz <dveditz@netscape.com>
|
||||
* Douglas Turner <dougt@netscape.com>
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __NS_INSTALLFOLDER_H__
|
||||
#define __NS_INSTALLFOLDER_H__
|
||||
|
||||
|
@ -23,7 +23,7 @@
|
||||
#include "nsIDOMInstallVersion.h"
|
||||
|
||||
#include "VerReg.h"
|
||||
|
||||
#include "ScheduledTasks.h"
|
||||
|
||||
|
||||
nsInstallPatch::nsInstallPatch( nsInstall* inInstall,
|
||||
@ -287,7 +287,7 @@ nsInstallPatch::NativeDeleteFile(nsFileSpec* doomedFile)
|
||||
if (doomedFile->Exists())
|
||||
{
|
||||
// If file still exists, we need to delete it later!
|
||||
// FIX DeleteOldFileLater( (char*)finalFile );
|
||||
DeleteFileLater(doomedFile->GetCString());
|
||||
return nsInstall::REBOOT_NEEDED;
|
||||
}
|
||||
}
|
||||
@ -301,24 +301,26 @@ nsInstallPatch::NativeDeleteFile(nsFileSpec* doomedFile)
|
||||
}
|
||||
|
||||
PRInt32
|
||||
nsInstallPatch::NativeReplace(const nsFileSpec& oldfile, const nsFileSpec& newFile)
|
||||
nsInstallPatch::NativeReplace(const nsFileSpec& oldfile, nsFileSpec& newFile)
|
||||
{
|
||||
|
||||
oldfile.Delete(PR_FALSE);
|
||||
if (oldfile.Exists())
|
||||
{
|
||||
//FIX: FE_ReplaceExistingFile
|
||||
ReplaceFileLater(newFile.GetCString(), oldfile.GetCString() );
|
||||
return nsInstall::REBOOT_NEEDED;
|
||||
}
|
||||
|
||||
nsFileSpec parentDirectory;
|
||||
oldfile.GetParent(parentDirectory);
|
||||
|
||||
if (parentDirectory.Exists() && parentDirectory.IsDirectory())
|
||||
else
|
||||
{
|
||||
if (newFile.Move(parentDirectory) != 0)
|
||||
{
|
||||
return nsInstall::UNEXPECTED_ERROR;
|
||||
}
|
||||
// We can simple move the extracted file to the mFinalFile's parent
|
||||
nsFileSpec parentofFinalFile;
|
||||
|
||||
oldfile.GetParent(parentofFinalFile);
|
||||
newFile.Move(parentofFinalFile);
|
||||
|
||||
char* leafName = newFile.GetLeafName();
|
||||
newFile.Rename(leafName);
|
||||
delete [] leafName;
|
||||
}
|
||||
|
||||
return nsInstall::SUCCESS;
|
||||
|
@ -73,7 +73,7 @@ class nsInstallPatch : public nsInstallObject
|
||||
|
||||
|
||||
PRInt32 NativePatch(const nsFileSpec &sourceFile, const nsFileSpec &patchfile, nsFileSpec **newFile);
|
||||
PRInt32 NativeReplace (const nsFileSpec& target, const nsFileSpec& tempFile);
|
||||
PRInt32 NativeReplace (const nsFileSpec& target, nsFileSpec& tempFile);
|
||||
PRInt32 NativeDeleteFile(nsFileSpec* doomedFile);
|
||||
void* HashFilePath(const nsFilePath& aPath);
|
||||
};
|
||||
|
@ -234,7 +234,7 @@ nsInstallTriggerFactory::CreateInstance(nsISupports *aOuter, REFNSIID aIID, void
|
||||
|
||||
nsresult result = inst->QueryInterface(aIID, aResult);
|
||||
|
||||
if (result != NS_OK)
|
||||
if (NS_FAILED(result))
|
||||
delete inst;
|
||||
|
||||
return result;
|
||||
|
@ -133,7 +133,7 @@ nsInstallVersion::Init(const nsString& version)
|
||||
major = minor = release = build = 0;
|
||||
|
||||
errorCode = nsInstallVersion::StringToVersionNumbers(version, &aMajor, &aMinor, &aRelease, &aBuild);
|
||||
if (errorCode == NS_OK)
|
||||
if (NS_SUCCEEDED(errorCode))
|
||||
{
|
||||
Init(aMajor, aMinor, aRelease, aBuild);
|
||||
}
|
||||
@ -416,7 +416,7 @@ nsInstallVersionFactory::CreateInstance(nsISupports *aOuter, REFNSIID aIID, void
|
||||
|
||||
nsresult result = inst->QueryInterface(aIID, aResult);
|
||||
|
||||
if (result != NS_OK)
|
||||
if (NS_FAILED(result))
|
||||
delete inst;
|
||||
|
||||
return result;
|
||||
|
@ -57,10 +57,12 @@ GetInstallProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
||||
case INSTALL_USERPACKAGENAME:
|
||||
{
|
||||
nsAutoString prop;
|
||||
if (NS_OK == a->GetUserPackageName(prop)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
if (NS_OK == a->GetUserPackageName(prop))
|
||||
{
|
||||
*vp = STRING_TO_JSVAL( JS_NewUCStringCopyN(cx, prop, prop.Length()) );
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
return JS_TRUE;
|
||||
}
|
||||
break;
|
||||
@ -68,27 +70,33 @@ GetInstallProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
||||
case INSTALL_REGPACKAGENAME:
|
||||
{
|
||||
nsAutoString prop;
|
||||
if (NS_OK == a->GetRegPackageName(prop)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
if (NS_OK == a->GetRegPackageName(prop))
|
||||
{
|
||||
*vp = STRING_TO_JSVAL( JS_NewUCStringCopyN(cx, prop, prop.Length()) );
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
return JS_TRUE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case INSTALL_JARFILE:
|
||||
{
|
||||
char* prop;
|
||||
a->GetJarFileLocation(&prop);
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
nsAutoString prop;
|
||||
|
||||
a->GetJarFileLocation(prop);
|
||||
*vp = STRING_TO_JSVAL( JS_NewUCStringCopyN(cx, prop, prop.Length()) );
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case INSTALL_ARGUMENTS:
|
||||
{
|
||||
char* prop;
|
||||
a->GetInstallArguments(&prop);
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
nsAutoString prop;
|
||||
|
||||
a->GetInstallArguments(prop);
|
||||
*vp = STRING_TO_JSVAL( JS_NewUCStringCopyN(cx, prop, prop.Length()) );
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
@ -132,33 +140,8 @@ SetInstallProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Install finalizer
|
||||
//
|
||||
PR_STATIC_CALLBACK(void)
|
||||
FinalizeInstall(JSContext *cx, JSObject *obj)
|
||||
static void PR_CALLBACK FinalizeInstall(JSContext *cx, JSObject *obj)
|
||||
{
|
||||
nsJSUtils::nsGenericFinalize(cx, obj);
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Install enumerate
|
||||
//
|
||||
PR_STATIC_CALLBACK(JSBool)
|
||||
EnumerateInstall(JSContext *cx, JSObject *obj)
|
||||
{
|
||||
return nsJSUtils::nsGenericEnumerate(cx, obj);
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Install resolve
|
||||
//
|
||||
PR_STATIC_CALLBACK(JSBool)
|
||||
ResolveInstall(JSContext *cx, JSObject *obj, jsval id)
|
||||
{
|
||||
return nsJSUtils::nsGenericResolve(cx, obj, id);
|
||||
}
|
||||
|
||||
|
||||
@ -920,6 +903,9 @@ InstallUninstall(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *r
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/***********************************************************************/
|
||||
//
|
||||
// class for Install
|
||||
@ -931,8 +917,8 @@ JSClass InstallClass = {
|
||||
JS_PropertyStub,
|
||||
GetInstallProperty,
|
||||
SetInstallProperty,
|
||||
EnumerateInstall,
|
||||
ResolveInstall,
|
||||
JS_EnumerateStub,
|
||||
JS_ResolveStub,
|
||||
JS_ConvertStub,
|
||||
FinalizeInstall
|
||||
};
|
||||
@ -1066,4 +1052,43 @@ PRInt32 InitXPInstallObjects(nsIScriptContext *aContext, const char* jarfile, co
|
||||
nativeInstallObject->SetScriptObject(installObject);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
PRInt32 InitXPInstallObjects(JSContext *jscontext, JSObject *global, const char* jarfile, const char* args)
|
||||
{
|
||||
JSObject *installObject = nsnull;
|
||||
nsInstall *nativeInstallObject;
|
||||
|
||||
installObject = JS_InitClass( jscontext, // context
|
||||
global, // global object
|
||||
nsnull, // parent proto
|
||||
&InstallClass, // JSClass
|
||||
nsnull, // JSNative ctor
|
||||
0, // ctor args
|
||||
nsnull, // proto props
|
||||
nsnull, // proto funcs
|
||||
InstallProperties, // ctor props (static)
|
||||
InstallMethods); // ctor funcs (static)
|
||||
|
||||
if (nsnull == installObject)
|
||||
{
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
if ( PR_FALSE == JS_DefineConstDoubles(jscontext, installObject, install_constants) )
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
|
||||
nativeInstallObject = new nsInstall();
|
||||
|
||||
nativeInstallObject->SetJarFileLocation(jarfile);
|
||||
nativeInstallObject->SetInstallArguments(args);
|
||||
|
||||
JS_SetPrivate(jscontext, installObject, nativeInstallObject);
|
||||
nativeInstallObject->SetScriptObject(installObject);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -36,7 +36,7 @@
|
||||
#include "nsSoftwareUpdateRun.h"
|
||||
#include "nsInstallTrigger.h"
|
||||
#include "nsInstallVersion.h"
|
||||
|
||||
#include "ScheduledTasks.h"
|
||||
|
||||
/* For Javascript Namespace Access */
|
||||
#include "nsDOMCID.h"
|
||||
@ -132,7 +132,7 @@ nsSoftwareUpdate::Startup()
|
||||
/* Stupid Hack to test js env*/
|
||||
/***************************************/
|
||||
// FIX: HACK HACK HACK!
|
||||
#if 0
|
||||
#if 1
|
||||
nsSpecialSystemDirectory jarFile(nsSpecialSystemDirectory::OS_TemporaryDirectory);
|
||||
jarFile += "test.jar";
|
||||
if (jarFile.Exists())
|
||||
@ -143,8 +143,10 @@ nsSoftwareUpdate::Startup()
|
||||
/***************************************/
|
||||
/* Preform Scheduled Tasks */
|
||||
/***************************************/
|
||||
|
||||
DeleteScheduledNodes();
|
||||
|
||||
DeleteScheduledFiles();
|
||||
ReplaceScheduledFiles();
|
||||
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
@ -189,61 +191,60 @@ NS_IMETHODIMP
|
||||
nsSoftwareUpdate::InstallJar(nsInstallInfo *installInfo)
|
||||
{
|
||||
mJarInstallQueue->Add( installInfo );
|
||||
UpdateInstallJarQueue();
|
||||
|
||||
RunNextInstall();
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
nsresult
|
||||
nsSoftwareUpdate::UpdateInstallJarQueue()
|
||||
NS_IMETHODIMP
|
||||
nsSoftwareUpdate::InstallJarCallBack()
|
||||
{
|
||||
if (mInstalling == 0)
|
||||
nsInstallInfo *nextInstall = (nsInstallInfo*)mJarInstallQueue->Get(0);
|
||||
|
||||
if (nextInstall != nsnull)
|
||||
delete nextInstall;
|
||||
|
||||
mJarInstallQueue->Remove(0);
|
||||
|
||||
mInstalling = PR_FALSE;
|
||||
|
||||
return RunNextInstall();
|
||||
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSoftwareUpdate::RunNextInstall()
|
||||
{
|
||||
if (mInstalling == PR_TRUE)
|
||||
return NS_OK;
|
||||
|
||||
mInstalling = PR_TRUE;
|
||||
|
||||
// check to see if there is anything in our queue
|
||||
if (mJarInstallQueue->GetSize() <= 0)
|
||||
{
|
||||
mInstalling++;
|
||||
|
||||
if (mJarInstallQueue->GetSize() <= 0)
|
||||
{
|
||||
mInstalling--;
|
||||
return 0;
|
||||
}
|
||||
nsInstallInfo *nextInstall = (nsInstallInfo*)mJarInstallQueue->Get(0);
|
||||
|
||||
if (nextInstall == nsnull)
|
||||
{
|
||||
mInstalling--;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (nextInstall->IsMultipleTrigger() == PR_FALSE)
|
||||
{
|
||||
Install( nextInstall );
|
||||
|
||||
delete nextInstall;
|
||||
mJarInstallQueue->Remove(0);
|
||||
|
||||
mInstalling--;
|
||||
|
||||
// We are done with install the last jar, let see if there are any more.
|
||||
UpdateInstallJarQueue(); // FIX: Maybe we should do this different to avoid blowing our stack?
|
||||
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
// FIX: we have a multiple trigger!
|
||||
}
|
||||
mInstalling = PR_FALSE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsSoftwareUpdate::DeleteScheduledNodes()
|
||||
{
|
||||
|
||||
nsInstallInfo *nextInstall = (nsInstallInfo*)mJarInstallQueue->Get(0);
|
||||
|
||||
if (nextInstall->IsMultipleTrigger() == PR_FALSE)
|
||||
{
|
||||
RunInstall( nextInstall );
|
||||
}
|
||||
else
|
||||
{
|
||||
; // should we do something different?!
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
@ -312,7 +313,7 @@ nsSoftwareUpdateNameSet::nsSoftwareUpdateNameSet()
|
||||
nsresult result = nsServiceManager::GetService(kCScriptNameSetRegistryCID,
|
||||
kIScriptNameSetRegistryIID,
|
||||
(nsISupports **)&scriptNameSet);
|
||||
if (NS_OK == result)
|
||||
if (NS_SUCCEEDED(result))
|
||||
{
|
||||
scriptNameSet->AddExternalNameSet(this);
|
||||
}
|
||||
@ -332,7 +333,7 @@ nsSoftwareUpdateNameSet::InitializeClasses(nsIScriptContext* aScriptContext)
|
||||
nsresult result = NS_OK;
|
||||
|
||||
result = NS_InitInstallVersionClass(aScriptContext, nsnull);
|
||||
if (result != NS_OK) return result;
|
||||
if (NS_FAILED(result)) return result;
|
||||
|
||||
result = NS_InitInstallTriggerGlobalClass(aScriptContext, nsnull);
|
||||
|
||||
@ -347,13 +348,13 @@ nsSoftwareUpdateNameSet::AddNameSet(nsIScriptContext* aScriptContext)
|
||||
nsIScriptNameSpaceManager* manager;
|
||||
|
||||
result = aScriptContext->GetNameSpaceManager(&manager);
|
||||
if (NS_OK == result)
|
||||
if (NS_SUCCEEDED(result))
|
||||
{
|
||||
result = manager->RegisterGlobalName("InstallVersion",
|
||||
kInstallVersion_CID,
|
||||
PR_TRUE);
|
||||
|
||||
if (result != NS_OK) return result;
|
||||
if (NS_FAILED(result)) return result;
|
||||
|
||||
result = manager->RegisterGlobalName("InstallTrigger",
|
||||
kInstallTrigger_CID,
|
||||
@ -446,7 +447,7 @@ NSGetFactory(nsISupports* serviceMgr,
|
||||
|
||||
nsresult res = inst->QueryInterface(kIFactoryIID, (void**) aFactory);
|
||||
|
||||
if (res != NS_OK)
|
||||
if (NS_FAILED(res))
|
||||
{
|
||||
delete inst;
|
||||
}
|
||||
|
@ -32,16 +32,19 @@ class nsSoftwareUpdate: public nsISoftwareUpdate
|
||||
const nsString& flags,
|
||||
const nsString& args);
|
||||
|
||||
|
||||
|
||||
NS_IMETHOD RunNextInstall();
|
||||
NS_IMETHOD InstallJarCallBack();
|
||||
|
||||
|
||||
private:
|
||||
nsresult Startup();
|
||||
nsresult Shutdown();
|
||||
|
||||
nsresult UpdateInstallJarQueue();
|
||||
nsresult DeleteScheduledNodes();
|
||||
|
||||
PRInt32 mInstalling;
|
||||
PRBool mInstalling;
|
||||
nsVector* mJarInstallQueue;
|
||||
|
||||
static nsSoftwareUpdate* mInstance;
|
||||
|
@ -1,105 +1,110 @@
|
||||
#include "nsSoftwareUpdate.h"
|
||||
#include "nsSoftwareUpdateRun.h"
|
||||
|
||||
#ifndef XP_MAC
|
||||
#include <sys/stat.h>
|
||||
#else
|
||||
#include <stat.h>
|
||||
#endif
|
||||
|
||||
#include "nsInstall.h"
|
||||
#include "zipfile.h"
|
||||
|
||||
#include "nsSpecialSystemDirectory.h"
|
||||
#include "nspr.h"
|
||||
|
||||
#include "nsRepository.h"
|
||||
#include "nsSpecialSystemDirectory.h"
|
||||
#include "nsFileStream.h"
|
||||
|
||||
#include "nsIBrowserWindow.h"
|
||||
#include "nsIWebShell.h"
|
||||
#include "nspr.h"
|
||||
#include "jsapi.h"
|
||||
|
||||
#include "nsIScriptContext.h"
|
||||
#include "nsIScriptContextOwner.h"
|
||||
#include "nsISoftwareUpdate.h"
|
||||
#include "nsSoftwareUpdateIIDs.h"
|
||||
|
||||
static NS_DEFINE_IID(kISoftwareUpdateIID, NS_ISOFTWAREUPDATE_IID);
|
||||
static NS_DEFINE_IID(kSoftwareUpdateCID, NS_SoftwareUpdate_CID);
|
||||
|
||||
#include "nsIURL.h"
|
||||
|
||||
extern PRInt32 InitXPInstallObjects(nsIScriptContext *aContext, const char* jarfile, const char* args);
|
||||
|
||||
static NS_DEFINE_IID(kIBrowserWindowIID, NS_IBROWSER_WINDOW_IID);
|
||||
static NS_DEFINE_IID(kBrowserWindowCID, NS_BROWSER_WINDOW_CID);
|
||||
static NS_DEFINE_IID(kIScriptContextOwnerIID, NS_ISCRIPTCONTEXTOWNER_IID);
|
||||
|
||||
/* ReadFileIntoBuffer
|
||||
* given a file name, reads it into buffer
|
||||
* returns an error code
|
||||
*/
|
||||
|
||||
static short ReadFileIntoBuffer(const char* fileName, char** buffer, unsigned long *bufferSize)
|
||||
static JSClass global_class =
|
||||
{
|
||||
PRFileDesc* file;
|
||||
struct stat st;
|
||||
short result = 0;
|
||||
|
||||
*buffer = nsnull;
|
||||
"global", JSCLASS_HAS_PRIVATE,
|
||||
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_PropertyStub,
|
||||
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, JS_FinalizeStub
|
||||
};
|
||||
|
||||
if ( stat( fileName, &st) != 0 )
|
||||
extern PRInt32 InitXPInstallObjects(JSContext *jscontext, JSObject *global, const char* jarfile, const char* args);
|
||||
|
||||
// Defined in this file:
|
||||
static void XPInstallErrorReporter(JSContext *cx, const char *message, JSErrorReport *report);
|
||||
static nsresult GetInstallScriptFromJarfile(const char* jarFile, char** scriptBuffer, PRUint32 *scriptLength);
|
||||
static nsresult SetupInstallContext(const char* jarFile, const char* args, JSRuntime **jsRT, JSContext **jsCX, JSObject **jsGlob);
|
||||
|
||||
extern "C" void RunInstallOnThread(void *data);
|
||||
|
||||
extern "C" NS_EXPORT PRInt32 RunInstall(const char* jarFile, const char* flags, const char* args, const char* fromURL);
|
||||
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Function name : XPInstallErrorReporter
|
||||
// Description : Prints error message to stdout
|
||||
// Return type : void
|
||||
// Argument : JSContext *cx
|
||||
// Argument : const char *message
|
||||
// Argument : JSErrorReport *report
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
static void
|
||||
XPInstallErrorReporter(JSContext *cx, const char *message, JSErrorReport *report)
|
||||
{
|
||||
int i, j, k, n;
|
||||
|
||||
fputs("xpinstall: ", stderr);
|
||||
if (!report)
|
||||
{
|
||||
result = -1;
|
||||
goto fail;
|
||||
fprintf(stderr, "%s\n", message);
|
||||
return;
|
||||
}
|
||||
|
||||
*bufferSize = st.st_size + 1;
|
||||
|
||||
*buffer = (char*) PR_MALLOC( *bufferSize);
|
||||
if (*buffer == NULL)
|
||||
if (report->filename)
|
||||
fprintf(stderr, "%s, ", report->filename);
|
||||
if (report->lineno)
|
||||
fprintf(stderr, "line %u: ", report->lineno);
|
||||
fputs(message, stderr);
|
||||
if (!report->linebuf)
|
||||
{
|
||||
result = -1;
|
||||
goto fail;
|
||||
putc('\n', stderr);
|
||||
return;
|
||||
}
|
||||
|
||||
memset(*buffer, '\0', *bufferSize);
|
||||
file = PR_Open(fileName, PR_RDONLY, 0644);
|
||||
|
||||
if ( file == NULL)
|
||||
{
|
||||
result = -1;
|
||||
goto fail;
|
||||
fprintf(stderr, ":\n%s\n", report->linebuf);
|
||||
n = report->tokenptr - report->linebuf;
|
||||
for (i = j = 0; i < n; i++) {
|
||||
if (report->linebuf[i] == '\t') {
|
||||
for (k = (j + 8) & ~7; j < k; j++)
|
||||
putc('.', stderr);
|
||||
continue;
|
||||
}
|
||||
putc('.', stderr);
|
||||
j++;
|
||||
}
|
||||
|
||||
if ( PR_Read(file, *buffer, *bufferSize ) != st.st_size )
|
||||
{
|
||||
result = -1;
|
||||
PR_Close( file );
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
||||
PR_Close( file );
|
||||
|
||||
return result;
|
||||
|
||||
fail:
|
||||
if (*buffer != NULL)
|
||||
delete( *buffer);
|
||||
*buffer = NULL;
|
||||
return result;
|
||||
fputs("^\n", stderr);
|
||||
}
|
||||
|
||||
PRInt32 Install(nsInstallInfo *installInfo)
|
||||
{
|
||||
return Install( (const char*) nsAutoCString( installInfo->GetLocalFile() ),
|
||||
(const char*) nsAutoCString( installInfo->GetFlags() ),
|
||||
(const char*) nsAutoCString( installInfo->GetArguments() ),
|
||||
(const char*) nsAutoCString( installInfo->GetFromURL() ));
|
||||
}
|
||||
|
||||
extern "C" NS_EXPORT PRInt32 Install(const char* jarFile, const char* flags, const char* args, const char* fromURL)
|
||||
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Function name : GetInstallScriptFromJarfile
|
||||
// Description : Extracts and reads in a install.js file from a passed jar file.
|
||||
// Return type : static nsresult
|
||||
// Argument : const char* jarFile - native filepath
|
||||
// Argument : char** scriptBuffer - must be deleted via delete []
|
||||
// Argument : PRUint32 *scriptLength
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static nsresult
|
||||
GetInstallScriptFromJarfile(const char* jarFile, char** scriptBuffer, PRUint32 *scriptLength)
|
||||
{
|
||||
// Open the jarfile.
|
||||
void* hZip;
|
||||
|
||||
*scriptBuffer = nsnull;
|
||||
*scriptLength = 0;
|
||||
|
||||
PRInt32 rv = ZIP_OpenArchive(jarFile , &hZip);
|
||||
nsresult rv = ZIP_OpenArchive(jarFile , &hZip);
|
||||
|
||||
if (rv != ZIP_OK)
|
||||
return rv;
|
||||
@ -108,7 +113,7 @@ extern "C" NS_EXPORT PRInt32 Install(const char* jarFile, const char* flags, con
|
||||
// Read manifest file for Install Script filename.
|
||||
//FIX: need to do.
|
||||
|
||||
|
||||
// Extract the install.js file to the temporary directory
|
||||
nsSpecialSystemDirectory installJSFileSpec(nsSpecialSystemDirectory::OS_TemporaryDirectory);
|
||||
installJSFileSpec += "install.js";
|
||||
installJSFileSpec.MakeUnique();
|
||||
@ -116,73 +121,214 @@ extern "C" NS_EXPORT PRInt32 Install(const char* jarFile, const char* flags, con
|
||||
// Extract the install.js file.
|
||||
rv = ZIP_ExtractFile( hZip, "install.js", installJSFileSpec.GetCString() );
|
||||
if (rv != ZIP_OK)
|
||||
{
|
||||
ZIP_CloseArchive(&hZip);
|
||||
return rv;
|
||||
}
|
||||
|
||||
// Read it into a buffer
|
||||
char* buffer;
|
||||
PRUint32 bufferLength;
|
||||
PRUint32 readLength;
|
||||
|
||||
nsInputFileStream fileStream(installJSFileSpec);
|
||||
(fileStream.GetIStream())->GetLength(&bufferLength);
|
||||
buffer = new char[bufferLength + 1];
|
||||
|
||||
rv = (fileStream.GetIStream())->Read(buffer, bufferLength, &readLength);
|
||||
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
*scriptBuffer = buffer;
|
||||
*scriptLength = readLength;
|
||||
}
|
||||
else
|
||||
{
|
||||
delete [] buffer;
|
||||
}
|
||||
|
||||
ZIP_CloseArchive(&hZip);
|
||||
installJSFileSpec.Delete(PR_FALSE);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Function name : SetupInstallContext
|
||||
// Description : Creates a Javascript runtime and adds our xpinstall objects to it.
|
||||
// Return type : static nsresult
|
||||
// Argument : const char* jarFile - native filepath to where jar exists on disk
|
||||
// Argument : const char* args - any arguments passed into the javascript context
|
||||
// Argument : JSRuntime **jsRT - Must be deleted via JS_DestroyRuntime
|
||||
// Argument : JSContext **jsCX - Must be deleted via JS_DestroyContext
|
||||
// Argument : JSObject **jsGlob
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
static nsresult SetupInstallContext(const char* jarFile,
|
||||
const char* args,
|
||||
JSRuntime **jsRT,
|
||||
JSContext **jsCX,
|
||||
JSObject **jsGlob)
|
||||
{
|
||||
JSRuntime *rt;
|
||||
JSContext *cx;
|
||||
JSObject *glob;
|
||||
|
||||
*jsRT = nsnull;
|
||||
*jsCX = nsnull;
|
||||
*jsGlob = nsnull;
|
||||
|
||||
// JS init
|
||||
rt = JS_Init(8L * 1024L * 1024L);
|
||||
if (!rt)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
// new context
|
||||
cx = JS_NewContext(rt, 8192);
|
||||
if (!rt)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
JS_SetErrorReporter(cx, XPInstallErrorReporter);
|
||||
|
||||
// new global object
|
||||
glob = JS_NewObject(cx, &global_class, nsnull, nsnull);
|
||||
|
||||
// Init standard classes
|
||||
JS_InitStandardClasses(cx, glob);
|
||||
|
||||
// Add our Install class to this context
|
||||
InitXPInstallObjects(cx, glob, jarFile, args);
|
||||
|
||||
// Fix: We have to add Version and Trigger to this context!!
|
||||
|
||||
|
||||
*jsRT = rt;
|
||||
*jsCX = cx;
|
||||
*jsGlob = glob;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Function name : RunInstall
|
||||
// Description : Creates our Install Thread.
|
||||
// Return type : PRInt32
|
||||
// Argument : nsInstallInfo *installInfo
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
PRInt32 RunInstall(nsInstallInfo *installInfo)
|
||||
{
|
||||
PR_CreateThread(PR_USER_THREAD,
|
||||
RunInstallOnThread,
|
||||
(void*)installInfo,
|
||||
PR_PRIORITY_NORMAL,
|
||||
PR_GLOBAL_THREAD,
|
||||
PR_UNJOINABLE_THREAD,
|
||||
0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Function name : RunInstallOnThread
|
||||
// Description : called by starting thread. It directly calls the C api for xpinstall,
|
||||
// : and once that returns, it calls the completion routine to notify installation
|
||||
// : completion.
|
||||
// Return type : extern "C"
|
||||
// Argument : void *data
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
extern "C" void RunInstallOnThread(void *data)
|
||||
{
|
||||
nsInstallInfo *installInfo = (nsInstallInfo*)data;
|
||||
|
||||
RunInstall( (const char*) nsAutoCString( installInfo->GetLocalFile() ),
|
||||
(const char*) nsAutoCString( installInfo->GetFlags() ),
|
||||
(const char*) nsAutoCString( installInfo->GetArguments() ),
|
||||
(const char*) nsAutoCString( installInfo->GetFromURL() ));
|
||||
|
||||
// After Install, we need to update the queue.
|
||||
|
||||
nsISoftwareUpdate *softwareUpdate;
|
||||
|
||||
nsresult rv = nsComponentManager::CreateInstance( kSoftwareUpdateCID,
|
||||
nsnull,
|
||||
kISoftwareUpdateIID,
|
||||
(void**) &softwareUpdate);
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
{
|
||||
return ;
|
||||
}
|
||||
|
||||
softwareUpdate->InstallJarCallBack();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Function name : RunInstall
|
||||
// Description : This is the main C entrypoint to run jar installers
|
||||
// Return type : PRInt32
|
||||
// Argument : const char* jarFile - a native filepath to a jarfile to be run
|
||||
// Argument : const char* flags - UNUSED
|
||||
// Argument : const char* args - arguments passed into the javascript env
|
||||
// Argument : const char* fromURL - a url string of where this file came from UNUSED
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
extern "C" NS_EXPORT PRInt32 RunInstall(const char* jarFile, const char* flags, const char* args, const char* fromURL)
|
||||
{
|
||||
|
||||
char *scriptBuffer;
|
||||
PRUint32 scriptLength;
|
||||
|
||||
JSRuntime *rt;
|
||||
JSContext *cx;
|
||||
JSObject *glob;
|
||||
|
||||
nsresult rv = GetInstallScriptFromJarfile(jarFile, &scriptBuffer, &scriptLength);
|
||||
|
||||
if (NS_FAILED(rv) || scriptBuffer == nsnull)
|
||||
{
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsIWebShell* aWebShell = nsnull;
|
||||
nsIBrowserWindow* aWindow = nsnull;
|
||||
|
||||
rv = nsComponentManager::CreateInstance(kBrowserWindowCID,
|
||||
nsnull,
|
||||
kIBrowserWindowIID,
|
||||
(void**) &aWindow);
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
rv = SetupInstallContext(jarFile, args, &rt, &cx, &glob);
|
||||
if (NS_FAILED(rv))
|
||||
{
|
||||
goto bail;
|
||||
delete [] scriptBuffer;
|
||||
return rv;
|
||||
}
|
||||
|
||||
aWindow->Init(nsnull, nsnull, nsRect(0, 0, 300, 300), PRUint32(~0), PR_FALSE);
|
||||
|
||||
rv = aWindow->GetWebShell(aWebShell);
|
||||
|
||||
if (rv == NS_OK)
|
||||
{
|
||||
nsIScriptContextOwner* scriptContextOwner;
|
||||
nsIScriptContext* scriptContext;
|
||||
|
||||
rv = aWebShell->QueryInterface( kIScriptContextOwnerIID, (void**)&scriptContextOwner);
|
||||
|
||||
if (rv == NS_OK)
|
||||
{
|
||||
rv = scriptContextOwner->GetScriptContext(&scriptContext);
|
||||
|
||||
if (NS_OK == rv)
|
||||
{
|
||||
|
||||
|
||||
// Go ahead and run!!
|
||||
jsval rval;
|
||||
|
||||
JS_EvaluateScript(cx,
|
||||
glob,
|
||||
scriptBuffer,
|
||||
scriptLength,
|
||||
nsnull,
|
||||
0,
|
||||
&rval);
|
||||
|
||||
InitXPInstallObjects(scriptContext, jarFile, args );
|
||||
|
||||
char* buffer;
|
||||
unsigned long bufferLength;
|
||||
|
||||
ReadFileIntoBuffer(installJSFileSpec, &buffer, &bufferLength);
|
||||
|
||||
nsAutoString retval;
|
||||
PRBool isUndefined;
|
||||
// We expected this to block.
|
||||
scriptContext->EvaluateString(nsString(buffer), nsnull, 0, retval, &isUndefined);
|
||||
|
||||
PR_FREEIF(buffer);
|
||||
NS_RELEASE(scriptContext);
|
||||
}
|
||||
|
||||
NS_RELEASE(scriptContextOwner);
|
||||
}
|
||||
// close and release window.
|
||||
// NS_RELEASE(aWebShell);
|
||||
}
|
||||
|
||||
bail:
|
||||
|
||||
if (aWindow != nsnull)
|
||||
{
|
||||
aWindow->Close();
|
||||
NS_RELEASE(aWindow);
|
||||
}
|
||||
|
||||
ZIP_CloseArchive(&hZip);
|
||||
installJSFileSpec.Delete(PR_FALSE);
|
||||
|
||||
|
||||
delete [] scriptBuffer;
|
||||
|
||||
JS_DestroyContext(cx);
|
||||
JS_DestroyRuntime(rt);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,8 +1,6 @@
|
||||
#ifndef __NS_SoftwareUpdateRun_H__
|
||||
#define __NS_SoftwareUpdateRun_H__
|
||||
|
||||
PRInt32 Install(nsInstallInfo *installInfo);
|
||||
|
||||
extern "C" NS_EXPORT PRInt32 Install(const char* jarFile, const char* flags, const char* args, const char* fromURL);
|
||||
PRInt32 RunInstall(nsInstallInfo *installInfo);
|
||||
|
||||
#endif
|
@ -62,7 +62,7 @@ nsSoftwareUpdateListener::nsSoftwareUpdateListener(nsInstallInfo *nextInstall)
|
||||
nsIURL *pURL = nsnull;
|
||||
mResult = NS_NewURL(&pURL, nextInstall->GetFromURL());
|
||||
|
||||
if (mResult != NS_OK)
|
||||
if (NS_FAILED(mResult))
|
||||
return;
|
||||
|
||||
mResult = NS_OpenURL(pURL, this);
|
||||
@ -144,7 +144,7 @@ nsSoftwareUpdateListener::OnDataAvailable(nsIURL* aURL, nsIInputStream *pIStream
|
||||
{
|
||||
err = pIStream->Read(buffer, BUF_SIZE, &len);
|
||||
|
||||
if (err == NS_OK)
|
||||
if (err == 0)
|
||||
{
|
||||
if ( PR_Write(mOutFileDesc, buffer, len) == -1 )
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user