Run is working in the viewer.

Removing some older unused files.
This commit is contained in:
dougt%netscape.com 1999-03-19 23:21:30 +00:00
parent fb1366b389
commit 2da15c6b9f
13 changed files with 119 additions and 1166 deletions

View File

@ -1,52 +0,0 @@
interface InstallFolder
{
/* IID: { 0x18c2f993, 0xb09f, 0x11d2, \
{0xbc, 0xde, 0x00, 0x80, 0x5f, 0x0e, 0x13, 0x53}} */
const int BadFolder = 0;
const int PluginFolder = 1;
const int ProgramFolder = 2;
const int PackageFolder = 3;
const int TemporaryFolder = 4;
const int CommunicatorFolder = 5;
const int InstalledFolder = 6;
const int CurrentUserFolder = 7;
const int NetHelpFolder = 8;
const int OSDriveFolder = 9;
const int FileURLFolder = 10;
const int JavaBinFolder = 11;
const int JavaClassesFolder = 12;
const int JavaDownloadFolder = 13;
const int Win_WindowsFolder = 14;
const int Win_SystemFolder = 15;
const int Win_System16Folder = 16;
const int Mac_SystemFolder = 17;
const int Mac_DesktopFolder = 18;
const int Mac_TrashFolder = 19;
const int Mac_StartupFolder = 20;
const int Mac_ShutdownFolder = 21;
const int Mac_AppleMenuFolder = 22;
const int Mac_ControlPanelFolder = 23;
const int Mac_ExtensionFolder = 24;
const int Mac_FontsFolder = 25;
const int Mac_PreferencesFolder = 26;
const int Unix_LocalFolder = 27;
const int Unix_LibFolder = 28;
void InstallFolder();
void init(in wstring folderID, in wstring vrPath, in wstring packageName);
void GetDirectoryPath(out wstring directoryPath);
void MakeFullPath(in wstring relativePath, out wstring fullPath);
boolean IsJavaCapable();
void ToString(out wstring folderString);
};

View File

@ -1,100 +0,0 @@
/* -*- Mode: C++; tab-width: 2; 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
* 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.
*/
/* AUTO-GENERATED. DO NOT EDIT!!! */
#ifndef nsIDOMInstallFolder_h__
#define nsIDOMInstallFolder_h__
#include "nsISupports.h"
#include "nsString.h"
#include "nsIScriptContext.h"
#define NS_IDOMINSTALLFOLDER_IID \
{ 0x18c2f993, 0xb09f, 0x11d2, \
{0xbc, 0xde, 0x00, 0x80, 0x5f, 0x0e, 0x13, 0x53}}
class nsIDOMInstallFolder : public nsISupports {
public:
static const nsIID& IID() { static nsIID iid = NS_IDOMINSTALLFOLDER_IID; return iid; }
enum {
BadFolder = 0,
PluginFolder = 1,
ProgramFolder = 2,
PackageFolder = 3,
TemporaryFolder = 4,
CommunicatorFolder = 5,
InstalledFolder = 6,
CurrentUserFolder = 7,
NetHelpFolder = 8,
OSDriveFolder = 9,
FileURLFolder = 10,
JavaBinFolder = 11,
JavaClassesFolder = 12,
JavaDownloadFolder = 13,
Win_WindowsFolder = 14,
Win_SystemFolder = 15,
Win_System16Folder = 16,
Mac_SystemFolder = 17,
Mac_DesktopFolder = 18,
Mac_TrashFolder = 19,
Mac_StartupFolder = 20,
Mac_ShutdownFolder = 21,
Mac_AppleMenuFolder = 22,
Mac_ControlPanelFolder = 23,
Mac_ExtensionFolder = 24,
Mac_FontsFolder = 25,
Mac_PreferencesFolder = 26,
Unix_LocalFolder = 27,
Unix_LibFolder = 28
};
NS_IMETHOD Init(const nsString& aFolderID, const nsString& aVrPatch, const nsString& aPackageName)=0;
NS_IMETHOD GetDirectoryPath(nsString& aDirectoryPath)=0;
NS_IMETHOD MakeFullPath(const nsString& aRelativePath, nsString& aFullPath)=0;
NS_IMETHOD IsJavaCapable(PRBool* aReturn)=0;
NS_IMETHOD ToString(nsString& aFolderString)=0;
};
#define NS_DECL_IDOMINSTALLFOLDER \
NS_IMETHOD Init(const nsString& aFolderID, const nsString& aVrPatch, const nsString& aPackageName); \
NS_IMETHOD GetDirectoryPath(nsString& aDirectoryPath); \
NS_IMETHOD MakeFullPath(const nsString& aRelativePath, nsString& aFullPath); \
NS_IMETHOD IsJavaCapable(PRBool* aReturn); \
NS_IMETHOD ToString(nsString& aFolderString); \
#define NS_FORWARD_IDOMINSTALLFOLDER(_to) \
NS_IMETHOD Init(const nsString& aFolderID, const nsString& aVrPatch, const nsString& aPackageName) { return _to##Init(aFolderID, aVrPatch, aPackageName); } \
NS_IMETHOD GetDirectoryPath(nsString& aDirectoryPath) { return _to##GetDirectoryPath(aDirectoryPath); } \
NS_IMETHOD MakeFullPath(const nsString& aRelativePath, nsString& aFullPath) { return _to##MakeFullPath(aRelativePath, aFullPath); } \
NS_IMETHOD IsJavaCapable(PRBool* aReturn) { return _to##IsJavaCapable(aReturn); } \
NS_IMETHOD ToString(nsString& aFolderString) { return _to##ToString(aFolderString); } \
extern nsresult NS_InitInstallFolderClass(nsIScriptContext *aContext, void **aPrototype);
extern "C" NS_DOM nsresult NS_NewScriptInstallFolder(nsIScriptContext *aContext, nsISupports *aSupports, nsISupports *aParent, void **aReturn);
#endif // nsIDOMInstallFolder_h__

View File

@ -34,10 +34,6 @@ class nsISoftwareUpdate : public nsISupports
{ {
public: public:
static const nsIID& IID() { static nsIID iid = NS_ISOFTWAREUPDATE_IID; return iid; } static const nsIID& IID() { static nsIID iid = NS_ISOFTWAREUPDATE_IID; return iid; }
NS_IMETHOD Startup() = 0;
NS_IMETHOD Shutdown()= 0;
NS_IMETHOD InstallJar(nsInstallInfo *installInfo) = 0; NS_IMETHOD InstallJar(nsInstallInfo *installInfo) = 0;

View File

@ -29,7 +29,6 @@ REQUIRES = dom js netlib raptor xpcom
CPPSRCS = \ CPPSRCS = \
nsSoftwareUpdate.cpp \ nsSoftwareUpdate.cpp \
nsSoftwareUpdateQueue.cpp \
nsInstall.cpp \ nsInstall.cpp \
nsInstallDelete.cpp \ nsInstallDelete.cpp \
nsInstallExecute.cpp \ nsInstallExecute.cpp \

View File

@ -72,7 +72,6 @@ OBJS = \
.\$(OBJDIR)\nsJSInstallTriggerGlobal.obj \ .\$(OBJDIR)\nsJSInstallTriggerGlobal.obj \
.\$(OBJDIR)\nsJSInstallVersion.obj \ .\$(OBJDIR)\nsJSInstallVersion.obj \
.\$(OBJDIR)\nsSoftwareUpdate.obj \ .\$(OBJDIR)\nsSoftwareUpdate.obj \
.\$(OBJDIR)\nsSoftwareUpdateQueue.obj \
.\$(OBJDIR)\nsSoftwareUpdateRun.obj \ .\$(OBJDIR)\nsSoftwareUpdateRun.obj \
.\$(OBJDIR)\nsSoftwareUpdateStream.obj \ .\$(OBJDIR)\nsSoftwareUpdateStream.obj \
.\$(OBJDIR)\nsInstallFile.obj \ .\$(OBJDIR)\nsInstallFile.obj \

View File

@ -1,128 +0,0 @@
/* -*- 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
* 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.
*/
#include "xp.h"
#include "xpgetstr.h"
#include "plstr.h"
#include "prmem.h"
#include "nsString.h"
#include "nsInstallErrorMessages.h"
#error
/// Need to rewrite!
char *
nsInstallErrorMessages::GetErrorMsg(int id, char* arg1)
{
char* errorMsg = "";
char* tag = XP_GetString(id);
PR_ASSERT(tag != NULL);
errorMsg = PL_strcat(tag, arg1);
return errorMsg;
}
char *
nsInstallErrorMessages::GetErrorMsg(int id, nsString* arg1, int reason)
{
char* errorMsg = "";
char* ptr;
char* tag = XP_GetString(id);
PR_ASSERT(tag != NULL);
char* argMsg = "";
if (argMsg)
argMsg = arg1->ToNewCString();
ptr = PR_sprintf_append(errorMsg, "%s %s %d", tag, argMsg, reason);
delete argMsg;
errorMsg = PL_strdup(ptr);
delete ptr;
return errorMsg;
}
char *
nsInstallErrorMessages::GetErrorMsg(char *str, int err)
{
char* errorMsg = "";
char* ptr;
PR_ASSERT(str != NULL);
ptr = PR_sprintf_append(errorMsg, "%s %d", str, err);
errorMsg = PL_strdup(ptr);
delete ptr;
return errorMsg;
}
char *
nsInstallErrorMessages::GetErrorMsg(int id, int reason)
{
char* msg;
char* ptr;
char* tag = XP_GetString(id);
PR_ASSERT(tag != NULL);
ptr = PR_sprintf_append(msg, "%s %d", tag, reason);
msg = PL_strdup(ptr);
delete ptr;
return msg;
}
char *
nsInstallErrorMessages::GetString(int id)
{
char *str = XP_GetString(id);
PR_ASSERT(str != NULL);
return PL_strdup(str);
}
char *
nsInstallErrorMessages::GetString(int id, char* arg1)
{
char* msg=NULL;
char* tag = XP_GetString(id);
PR_ASSERT(tag != NULL);
if (arg1)
{
msg = PL_strcat(msg, tag);
msg = PL_strcat(msg, arg1);
}
else
{
msg = PL_strcat(msg, tag);
}
return msg;
}
char *
nsInstallErrorMessages::GetString(int id, nsString* arg1)
{
char* msg=NULL;
char* tag = XP_GetString(id);
PR_ASSERT(tag != NULL);
char* argMsg = "";
msg = PL_strcat(msg, tag);
if (arg1)
{
argMsg = arg1->ToNewCString();
msg = PL_strcat(msg, argMsg);
delete argMsg;
}
return msg;
}

View File

@ -1,39 +0,0 @@
/* -*- 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
* 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.
*/
#ifndef nsInstallErrorMessages_h__
#define nsInstallErrorMessages_h__
#include "nsString.h"
class nsInstallErrorMessages
{
public:
static char * GetErrorMsg(int id, char* arg1);
static char * GetErrorMsg(int id, nsString* arg1, int reason);
static char * GetErrorMsg(char *str, int err);
static char * GetErrorMsg(int id, int reason);
static char * GetString(int id);
static char * GetString(int id, char* arg1);
static char * GetString(int id, nsString* arg1);
};
#endif

View File

@ -1,594 +0,0 @@
/* -*- Mode: C++; tab-width: 2; 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
* 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.
*/
/* AUTO-GENERATED. DO NOT EDIT!!! */
#include "jsapi.h"
#include "nsJSUtils.h"
#include "nscore.h"
#include "nsIScriptContext.h"
#include "nsIJSScriptObject.h"
#include "nsIScriptObjectOwner.h"
#include "nsIScriptGlobalObject.h"
#include "nsIPtr.h"
#include "nsString.h"
#include "nsIDOMInstallFolder.h"
#include "nsIScriptNameSpaceManager.h"
#include "nsRepository.h"
#include "nsDOMCID.h"
static NS_DEFINE_IID(kIScriptObjectOwnerIID, NS_ISCRIPTOBJECTOWNER_IID);
static NS_DEFINE_IID(kIJSScriptObjectIID, NS_IJSSCRIPTOBJECT_IID);
static NS_DEFINE_IID(kIScriptGlobalObjectIID, NS_ISCRIPTGLOBALOBJECT_IID);
static NS_DEFINE_IID(kIInstallFolderIID, NS_IDOMINSTALLFOLDER_IID);
NS_DEF_PTR(nsIDOMInstallFolder);
/***********************************************************************/
//
// InstallFolder Properties Getter
//
PR_STATIC_CALLBACK(JSBool)
GetInstallFolderProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
{
nsIDOMInstallFolder *a = (nsIDOMInstallFolder*)JS_GetPrivate(cx, obj);
// If there's no private data, this must be the prototype, so ignore
if (nsnull == a) {
return JS_TRUE;
}
if (JSVAL_IS_INT(id)) {
switch(JSVAL_TO_INT(id)) {
case 0:
default:
return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, id, vp);
}
}
else {
return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, id, vp);
}
return PR_TRUE;
}
/***********************************************************************/
//
// InstallFolder Properties Setter
//
PR_STATIC_CALLBACK(JSBool)
SetInstallFolderProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
{
nsIDOMInstallFolder *a = (nsIDOMInstallFolder*)JS_GetPrivate(cx, obj);
// If there's no private data, this must be the prototype, so ignore
if (nsnull == a) {
return JS_TRUE;
}
if (JSVAL_IS_INT(id)) {
switch(JSVAL_TO_INT(id)) {
case 0:
default:
return nsJSUtils::nsCallJSScriptObjectSetProperty(a, cx, id, vp);
}
}
else {
return nsJSUtils::nsCallJSScriptObjectSetProperty(a, cx, id, vp);
}
return PR_TRUE;
}
//
// InstallFolder finalizer
//
PR_STATIC_CALLBACK(void)
FinalizeInstallFolder(JSContext *cx, JSObject *obj)
{
nsJSUtils::nsGenericFinalize(cx, obj);
}
//
// InstallFolder enumerate
//
PR_STATIC_CALLBACK(JSBool)
EnumerateInstallFolder(JSContext *cx, JSObject *obj)
{
return nsJSUtils::nsGenericEnumerate(cx, obj);
}
//
// InstallFolder resolve
//
PR_STATIC_CALLBACK(JSBool)
ResolveInstallFolder(JSContext *cx, JSObject *obj, jsval id)
{
return nsJSUtils::nsGenericResolve(cx, obj, id);
}
//
// Native method Init
//
PR_STATIC_CALLBACK(JSBool)
InstallFolderInit(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
nsIDOMInstallFolder *nativeThis = (nsIDOMInstallFolder*)JS_GetPrivate(cx, obj);
JSBool rBool = JS_FALSE;
nsAutoString b0;
nsAutoString b1;
nsAutoString b2;
*rval = JSVAL_NULL;
// If there's no private data, this must be the prototype, so ignore
if (nsnull == nativeThis) {
return JS_TRUE;
}
if (argc >= 3) {
nsJSUtils::nsConvertJSValToString(b0, cx, argv[0]);
nsJSUtils::nsConvertJSValToString(b1, cx, argv[1]);
nsJSUtils::nsConvertJSValToString(b2, cx, argv[2]);
if (NS_OK != nativeThis->Init(b0, b1, b2)) {
return JS_FALSE;
}
*rval = JSVAL_VOID;
}
else {
JS_ReportError(cx, "Function init requires 3 parameters");
return JS_FALSE;
}
return JS_TRUE;
}
//
// Native method GetDirectoryPath
//
PR_STATIC_CALLBACK(JSBool)
InstallFolderGetDirectoryPath(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
nsIDOMInstallFolder *nativeThis = (nsIDOMInstallFolder*)JS_GetPrivate(cx, obj);
JSBool rBool = JS_FALSE;
nsAutoString b0;
*rval = JSVAL_NULL;
// If there's no private data, this must be the prototype, so ignore
if (nsnull == nativeThis) {
return JS_TRUE;
}
if (argc >= 1) {
nsJSUtils::nsConvertJSValToString(b0, cx, argv[0]);
if (NS_OK != nativeThis->GetDirectoryPath(b0)) {
return JS_FALSE;
}
*rval = JSVAL_VOID;
}
else {
JS_ReportError(cx, "Function GetDirectoryPath requires 1 parameters");
return JS_FALSE;
}
return JS_TRUE;
}
//
// Native method MakeFullPath
//
PR_STATIC_CALLBACK(JSBool)
InstallFolderMakeFullPath(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
nsIDOMInstallFolder *nativeThis = (nsIDOMInstallFolder*)JS_GetPrivate(cx, obj);
JSBool rBool = JS_FALSE;
nsAutoString b0;
nsAutoString b1;
*rval = JSVAL_NULL;
// If there's no private data, this must be the prototype, so ignore
if (nsnull == nativeThis) {
return JS_TRUE;
}
if (argc >= 2) {
nsJSUtils::nsConvertJSValToString(b0, cx, argv[0]);
nsJSUtils::nsConvertJSValToString(b1, cx, argv[1]);
if (NS_OK != nativeThis->MakeFullPath(b0, b1)) {
return JS_FALSE;
}
*rval = JSVAL_VOID;
}
else {
JS_ReportError(cx, "Function MakeFullPath requires 2 parameters");
return JS_FALSE;
}
return JS_TRUE;
}
//
// Native method IsJavaCapable
//
PR_STATIC_CALLBACK(JSBool)
InstallFolderIsJavaCapable(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
nsIDOMInstallFolder *nativeThis = (nsIDOMInstallFolder*)JS_GetPrivate(cx, obj);
JSBool rBool = JS_FALSE;
PRBool nativeRet;
*rval = JSVAL_NULL;
// If there's no private data, this must be the prototype, so ignore
if (nsnull == nativeThis) {
return JS_TRUE;
}
if (argc >= 0) {
if (NS_OK != nativeThis->IsJavaCapable(&nativeRet)) {
return JS_FALSE;
}
*rval = BOOLEAN_TO_JSVAL(nativeRet);
}
else {
JS_ReportError(cx, "Function IsJavaCapable requires 0 parameters");
return JS_FALSE;
}
return JS_TRUE;
}
//
// Native method ToString
//
PR_STATIC_CALLBACK(JSBool)
InstallFolderToString(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
nsIDOMInstallFolder *nativeThis = (nsIDOMInstallFolder*)JS_GetPrivate(cx, obj);
JSBool rBool = JS_FALSE;
nsAutoString b0;
*rval = JSVAL_NULL;
// If there's no private data, this must be the prototype, so ignore
if (nsnull == nativeThis) {
return JS_TRUE;
}
if (argc >= 1) {
nsJSUtils::nsConvertJSValToString(b0, cx, argv[0]);
if (NS_OK != nativeThis->ToString(b0)) {
return JS_FALSE;
}
*rval = JSVAL_VOID;
}
else {
JS_ReportError(cx, "Function ToString requires 1 parameters");
return JS_FALSE;
}
return JS_TRUE;
}
/***********************************************************************/
//
// class for InstallFolder
//
JSClass InstallFolderClass = {
"InstallFolder",
JSCLASS_HAS_PRIVATE,
JS_PropertyStub,
JS_PropertyStub,
GetInstallFolderProperty,
SetInstallFolderProperty,
EnumerateInstallFolder,
ResolveInstallFolder,
JS_ConvertStub,
FinalizeInstallFolder
};
//
// InstallFolder class properties
//
static JSPropertySpec InstallFolderProperties[] =
{
{0}
};
//
// InstallFolder class methods
//
static JSFunctionSpec InstallFolderMethods[] =
{
{"init", InstallFolderInit, 3},
{"GetDirectoryPath", InstallFolderGetDirectoryPath, 1},
{"MakeFullPath", InstallFolderMakeFullPath, 2},
{"IsJavaCapable", InstallFolderIsJavaCapable, 0},
{"ToString", InstallFolderToString, 1},
{0}
};
//
// InstallFolder constructor
//
PR_STATIC_CALLBACK(JSBool)
InstallFolder(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
nsresult result;
nsIID classID;
nsIScriptContext* context = (nsIScriptContext*)JS_GetContextPrivate(cx);
nsIScriptNameSpaceManager* manager;
nsIDOMInstallFolder *nativeThis;
nsIScriptObjectOwner *owner = nsnull;
static NS_DEFINE_IID(kIDOMInstallFolderIID, NS_IDOMINSTALLFOLDER_IID);
result = context->GetNameSpaceManager(&manager);
if (NS_OK != result) {
return JS_FALSE;
}
result = manager->LookupName("InstallFolder", PR_TRUE, classID);
NS_RELEASE(manager);
if (NS_OK != result) {
return JS_FALSE;
}
result = nsRepository::CreateInstance(classID,
nsnull,
kIDOMInstallFolderIID,
(void **)&nativeThis);
if (NS_OK != result) {
return JS_FALSE;
}
// XXX We should be calling Init() on the instance
result = nativeThis->QueryInterface(kIScriptObjectOwnerIID, (void **)&owner);
if (NS_OK != result) {
NS_RELEASE(nativeThis);
return JS_FALSE;
}
owner->SetScriptObject((void *)obj);
JS_SetPrivate(cx, obj, nativeThis);
NS_RELEASE(owner);
return JS_TRUE;
}
//
// InstallFolder class initialization
//
nsresult NS_InitInstallFolderClass(nsIScriptContext *aContext, void **aPrototype)
{
JSContext *jscontext = (JSContext *)aContext->GetNativeContext();
JSObject *proto = nsnull;
JSObject *constructor = nsnull;
JSObject *parent_proto = nsnull;
JSObject *global = JS_GetGlobalObject(jscontext);
jsval vp;
if ((PR_TRUE != JS_LookupProperty(jscontext, global, "InstallFolder", &vp)) ||
!JSVAL_IS_OBJECT(vp) ||
((constructor = JSVAL_TO_OBJECT(vp)) == nsnull) ||
(PR_TRUE != JS_LookupProperty(jscontext, JSVAL_TO_OBJECT(vp), "prototype", &vp)) ||
!JSVAL_IS_OBJECT(vp)) {
proto = JS_InitClass(jscontext, // context
global, // global object
parent_proto, // parent proto
&InstallFolderClass, // JSClass
InstallFolder, // JSNative ctor
0, // ctor args
InstallFolderProperties, // proto props
InstallFolderMethods, // proto funcs
nsnull, // ctor props (static)
nsnull); // ctor funcs (static)
if (nsnull == proto) {
return NS_ERROR_FAILURE;
}
if ((PR_TRUE == JS_LookupProperty(jscontext, global, "InstallFolder", &vp)) &&
JSVAL_IS_OBJECT(vp) &&
((constructor = JSVAL_TO_OBJECT(vp)) != nsnull)) {
vp = INT_TO_JSVAL(nsIDOMInstallFolder::BadFolder);
JS_SetProperty(jscontext, constructor, "BadFolder", &vp);
vp = INT_TO_JSVAL(nsIDOMInstallFolder::PluginFolder);
JS_SetProperty(jscontext, constructor, "PluginFolder", &vp);
vp = INT_TO_JSVAL(nsIDOMInstallFolder::ProgramFolder);
JS_SetProperty(jscontext, constructor, "ProgramFolder", &vp);
vp = INT_TO_JSVAL(nsIDOMInstallFolder::PackageFolder);
JS_SetProperty(jscontext, constructor, "PackageFolder", &vp);
vp = INT_TO_JSVAL(nsIDOMInstallFolder::TemporaryFolder);
JS_SetProperty(jscontext, constructor, "TemporaryFolder", &vp);
vp = INT_TO_JSVAL(nsIDOMInstallFolder::CommunicatorFolder);
JS_SetProperty(jscontext, constructor, "CommunicatorFolder", &vp);
vp = INT_TO_JSVAL(nsIDOMInstallFolder::InstalledFolder);
JS_SetProperty(jscontext, constructor, "InstalledFolder", &vp);
vp = INT_TO_JSVAL(nsIDOMInstallFolder::CurrentUserFolder);
JS_SetProperty(jscontext, constructor, "CurrentUserFolder", &vp);
vp = INT_TO_JSVAL(nsIDOMInstallFolder::NetHelpFolder);
JS_SetProperty(jscontext, constructor, "NetHelpFolder", &vp);
vp = INT_TO_JSVAL(nsIDOMInstallFolder::OSDriveFolder);
JS_SetProperty(jscontext, constructor, "OSDriveFolder", &vp);
vp = INT_TO_JSVAL(nsIDOMInstallFolder::FileURLFolder);
JS_SetProperty(jscontext, constructor, "FileURLFolder", &vp);
vp = INT_TO_JSVAL(nsIDOMInstallFolder::JavaBinFolder);
JS_SetProperty(jscontext, constructor, "JavaBinFolder", &vp);
vp = INT_TO_JSVAL(nsIDOMInstallFolder::JavaClassesFolder);
JS_SetProperty(jscontext, constructor, "JavaClassesFolder", &vp);
vp = INT_TO_JSVAL(nsIDOMInstallFolder::JavaDownloadFolder);
JS_SetProperty(jscontext, constructor, "JavaDownloadFolder", &vp);
vp = INT_TO_JSVAL(nsIDOMInstallFolder::Win_WindowsFolder);
JS_SetProperty(jscontext, constructor, "Win_WindowsFolder", &vp);
vp = INT_TO_JSVAL(nsIDOMInstallFolder::Win_SystemFolder);
JS_SetProperty(jscontext, constructor, "Win_SystemFolder", &vp);
vp = INT_TO_JSVAL(nsIDOMInstallFolder::Win_System16Folder);
JS_SetProperty(jscontext, constructor, "Win_System16Folder", &vp);
vp = INT_TO_JSVAL(nsIDOMInstallFolder::Mac_SystemFolder);
JS_SetProperty(jscontext, constructor, "Mac_SystemFolder", &vp);
vp = INT_TO_JSVAL(nsIDOMInstallFolder::Mac_DesktopFolder);
JS_SetProperty(jscontext, constructor, "Mac_DesktopFolder", &vp);
vp = INT_TO_JSVAL(nsIDOMInstallFolder::Mac_TrashFolder);
JS_SetProperty(jscontext, constructor, "Mac_TrashFolder", &vp);
vp = INT_TO_JSVAL(nsIDOMInstallFolder::Mac_StartupFolder);
JS_SetProperty(jscontext, constructor, "Mac_StartupFolder", &vp);
vp = INT_TO_JSVAL(nsIDOMInstallFolder::Mac_ShutdownFolder);
JS_SetProperty(jscontext, constructor, "Mac_ShutdownFolder", &vp);
vp = INT_TO_JSVAL(nsIDOMInstallFolder::Mac_AppleMenuFolder);
JS_SetProperty(jscontext, constructor, "Mac_AppleMenuFolder", &vp);
vp = INT_TO_JSVAL(nsIDOMInstallFolder::Mac_ControlPanelFolder);
JS_SetProperty(jscontext, constructor, "Mac_ControlPanelFolder", &vp);
vp = INT_TO_JSVAL(nsIDOMInstallFolder::Mac_ExtensionFolder);
JS_SetProperty(jscontext, constructor, "Mac_ExtensionFolder", &vp);
vp = INT_TO_JSVAL(nsIDOMInstallFolder::Mac_FontsFolder);
JS_SetProperty(jscontext, constructor, "Mac_FontsFolder", &vp);
vp = INT_TO_JSVAL(nsIDOMInstallFolder::Mac_PreferencesFolder);
JS_SetProperty(jscontext, constructor, "Mac_PreferencesFolder", &vp);
vp = INT_TO_JSVAL(nsIDOMInstallFolder::Unix_LocalFolder);
JS_SetProperty(jscontext, constructor, "Unix_LocalFolder", &vp);
vp = INT_TO_JSVAL(nsIDOMInstallFolder::Unix_LibFolder);
JS_SetProperty(jscontext, constructor, "Unix_LibFolder", &vp);
}
}
else if ((nsnull != constructor) && JSVAL_IS_OBJECT(vp)) {
proto = JSVAL_TO_OBJECT(vp);
}
else {
return NS_ERROR_FAILURE;
}
if (aPrototype) {
*aPrototype = proto;
}
return NS_OK;
}
//
// Method for creating a new InstallFolder JavaScript object
//
extern "C" NS_DOM nsresult NS_NewScriptInstallFolder(nsIScriptContext *aContext, nsISupports *aSupports, nsISupports *aParent, void **aReturn)
{
NS_PRECONDITION(nsnull != aContext && nsnull != aSupports && nsnull != aReturn, "null argument to NS_NewScriptInstallFolder");
JSObject *proto;
JSObject *parent;
nsIScriptObjectOwner *owner;
JSContext *jscontext = (JSContext *)aContext->GetNativeContext();
nsresult result = NS_OK;
nsIDOMInstallFolder *aInstallFolder;
if (nsnull == aParent) {
parent = nsnull;
}
else if (NS_OK == aParent->QueryInterface(kIScriptObjectOwnerIID, (void**)&owner)) {
if (NS_OK != owner->GetScriptObject(aContext, (void **)&parent)) {
NS_RELEASE(owner);
return NS_ERROR_FAILURE;
}
NS_RELEASE(owner);
}
else {
return NS_ERROR_FAILURE;
}
if (NS_OK != NS_InitInstallFolderClass(aContext, (void **)&proto)) {
return NS_ERROR_FAILURE;
}
result = aSupports->QueryInterface(kIInstallFolderIID, (void **)&aInstallFolder);
if (NS_OK != result) {
return result;
}
// create a js object for this class
*aReturn = JS_NewObject(jscontext, &InstallFolderClass, proto, parent);
if (nsnull != *aReturn) {
// connect the native object to the js object
JS_SetPrivate(jscontext, (JSObject *)*aReturn, aInstallFolder);
}
else {
NS_RELEASE(aInstallFolder);
return NS_ERROR_FAILURE;
}
return NS_OK;
}

View File

@ -68,62 +68,51 @@ static NS_DEFINE_IID(kInstallTrigger_CID, NS_SoftwareUpdateInstallTrigger_CID);
static NS_DEFINE_IID(kIInstallVersion_IID, NS_IDOMINSTALLVERSION_IID); static NS_DEFINE_IID(kIInstallVersion_IID, NS_IDOMINSTALLVERSION_IID);
static NS_DEFINE_IID(kInstallVersion_CID, NS_SoftwareUpdateInstallVersion_CID); static NS_DEFINE_IID(kInstallVersion_CID, NS_SoftwareUpdateInstallVersion_CID);
static PRInt32 gLockCnt = 0;
static PRInt32 gStarted = 0;
static PRInt32 gInstalling = 0;
static PRInt32 gDownloading = 0;
static nsVector* gJarInstallQueue = nsnull;
static nsVector* gJarDownloadQueue = nsnull;
nsSoftwareUpdate* nsSoftwareUpdate::mInstance = NULL;
nsSoftwareUpdate::nsSoftwareUpdate() nsSoftwareUpdate::nsSoftwareUpdate()
{ {
NS_INIT_ISUPPORTS(); NS_INIT_ISUPPORTS();
if (gStarted == 0) Startup();
Startup();
PR_AtomicIncrement(&gStarted);
} }
nsSoftwareUpdate::~nsSoftwareUpdate() nsSoftwareUpdate::~nsSoftwareUpdate()
{ {
PR_AtomicDecrement(&gStarted); Shutdown();
if (gStarted == 0)
Shutdown();
} }
nsSoftwareUpdate *nsSoftwareUpdate::GetInstance()
{
if (mInstance == NULL)
{
mInstance = new nsSoftwareUpdate();
}
return mInstance;
}
NS_IMPL_ISUPPORTS(nsSoftwareUpdate,NS_ISOFTWAREUPDATE_IID) NS_IMPL_ISUPPORTS(nsSoftwareUpdate,NS_ISOFTWAREUPDATE_IID)
NS_IMETHODIMP nsresult
nsSoftwareUpdate::Startup() nsSoftwareUpdate::Startup()
{ {
/***************************************/ /***************************************/
/* Create us a queue */ /* Create us a queue */
/***************************************/ /***************************************/
mInstalling = nsnull;
gJarInstallQueue = new nsVector();
mJarInstallQueue = new nsVector();
/***************************************/ /***************************************/
/* Add us to the Javascript Name Space */ /* Add us to the Javascript Name Space */
/***************************************/ /***************************************/
nsIScriptNameSetRegistry *scriptNameSet; new nsSoftwareUpdateNameSet();
nsresult result = nsServiceManager::GetService(kCScriptNameSetRegistryCID,
kIScriptNameSetRegistryIID,
(nsISupports **)&scriptNameSet);
if (NS_OK == result)
{
nsSoftwareUpdateNameSet* nameSet = new nsSoftwareUpdateNameSet();
scriptNameSet->AddExternalNameSet(nameSet);
}
/***************************************/ /***************************************/
/* Register us with NetLib */ /* Register us with NetLib */
/***************************************/ /***************************************/
@ -143,7 +132,7 @@ nsSoftwareUpdate::Startup()
/* Stupid Hack to test js env*/ /* Stupid Hack to test js env*/
/***************************************/ /***************************************/
// FIX: HACK HACK HACK! // FIX: HACK HACK HACK!
#if 1 #if 0
nsSpecialSystemDirectory jarFile(nsSpecialSystemDirectory::OS_TemporaryDirectory); nsSpecialSystemDirectory jarFile(nsSpecialSystemDirectory::OS_TemporaryDirectory);
jarFile += "test.jar"; jarFile += "test.jar";
if (jarFile.Exists()) if (jarFile.Exists())
@ -161,21 +150,22 @@ nsSoftwareUpdate::Startup()
} }
NS_IMETHODIMP nsresult
nsSoftwareUpdate::Shutdown() nsSoftwareUpdate::Shutdown()
{ {
if (gJarInstallQueue != nsnull) if (mJarInstallQueue != nsnull)
{ {
PRUint32 i=0; PRUint32 i=0;
for (; i < gJarInstallQueue->GetSize(); i++) for (; i < mJarInstallQueue->GetSize(); i++)
{ {
nsInstallInfo* element = (nsInstallInfo*)gJarInstallQueue->Get(i); nsInstallInfo* element = (nsInstallInfo*)mJarInstallQueue->Get(i);
//FIX: need to add to registry....
delete element; delete element;
} }
gJarInstallQueue->RemoveAll(); mJarInstallQueue->RemoveAll();
delete (gJarInstallQueue); delete (mJarInstallQueue);
gJarInstallQueue = nsnull; mJarInstallQueue = nsnull;
} }
NR_ShutdownRegistry(); NR_ShutdownRegistry();
@ -198,7 +188,7 @@ nsSoftwareUpdate::InstallJar( const nsString& fromURL,
NS_IMETHODIMP NS_IMETHODIMP
nsSoftwareUpdate::InstallJar(nsInstallInfo *installInfo) nsSoftwareUpdate::InstallJar(nsInstallInfo *installInfo)
{ {
gJarInstallQueue->Add( installInfo ); mJarInstallQueue->Add( installInfo );
UpdateInstallJarQueue(); UpdateInstallJarQueue();
return NS_OK; return NS_OK;
@ -208,20 +198,20 @@ nsSoftwareUpdate::InstallJar(nsInstallInfo *installInfo)
nsresult nsresult
nsSoftwareUpdate::UpdateInstallJarQueue() nsSoftwareUpdate::UpdateInstallJarQueue()
{ {
if (gInstalling == 0) if (mInstalling == 0)
{ {
gInstalling++; mInstalling++;
if (gJarInstallQueue->GetSize() <= 0) if (mJarInstallQueue->GetSize() <= 0)
{ {
gInstalling--; mInstalling--;
return 0; return 0;
} }
nsInstallInfo *nextInstall = (nsInstallInfo*)gJarInstallQueue->Get(0); nsInstallInfo *nextInstall = (nsInstallInfo*)mJarInstallQueue->Get(0);
if (nextInstall == nsnull) if (nextInstall == nsnull)
{ {
gInstalling--; mInstalling--;
return 0; return 0;
} }
@ -230,9 +220,9 @@ nsSoftwareUpdate::UpdateInstallJarQueue()
Install( nextInstall ); Install( nextInstall );
delete nextInstall; delete nextInstall;
gJarInstallQueue->Remove(0); mJarInstallQueue->Remove(0);
gInstalling--; mInstalling--;
// We are done with install the last jar, let see if there are any more. // 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? UpdateInstallJarQueue(); // FIX: Maybe we should do this different to avoid blowing our stack?
@ -280,15 +270,19 @@ nsSoftwareUpdateFactory::CreateInstance(nsISupports *aOuter, REFNSIID aIID, void
*aResult = NULL; *aResult = NULL;
nsSoftwareUpdate *inst = new nsSoftwareUpdate(); nsSoftwareUpdate *inst = nsSoftwareUpdate::GetInstance();
if (inst == NULL) if (inst == NULL)
return NS_ERROR_OUT_OF_MEMORY; return NS_ERROR_OUT_OF_MEMORY;
nsresult result = inst->QueryInterface(aIID, aResult); nsresult result = inst->QueryInterface(aIID, aResult);
if (result != NS_OK) if (NS_FAILED(result))
delete inst; {
*aResult = NULL;
}
NS_ADDREF(inst); // Are we sure that we need to addref???
return result; return result;
} }
@ -313,6 +307,16 @@ nsSoftwareUpdateFactory::LockFactory(PRBool aLock)
nsSoftwareUpdateNameSet::nsSoftwareUpdateNameSet() nsSoftwareUpdateNameSet::nsSoftwareUpdateNameSet()
{ {
NS_INIT_REFCNT(); NS_INIT_REFCNT();
nsIScriptNameSetRegistry *scriptNameSet;
nsresult result = nsServiceManager::GetService(kCScriptNameSetRegistryCID,
kIScriptNameSetRegistryIID,
(nsISupports **)&scriptNameSet);
if (NS_OK == result)
{
scriptNameSet->AddExternalNameSet(this);
}
} }
nsSoftwareUpdateNameSet::~nsSoftwareUpdateNameSet() nsSoftwareUpdateNameSet::~nsSoftwareUpdateNameSet()
@ -370,7 +374,7 @@ nsSoftwareUpdateNameSet::AddNameSet(nsIScriptContext* aScriptContext)
extern "C" NS_EXPORT PRBool extern "C" NS_EXPORT PRBool
NSCanUnload(nsISupports* serviceMgr) NSCanUnload(nsISupports* serviceMgr)
{ {
return PRBool (gStarted == 0 && gLockCnt == 0); return PR_FALSE;
} }
extern "C" NS_EXPORT nsresult extern "C" NS_EXPORT nsresult

View File

@ -23,10 +23,10 @@ class nsSoftwareUpdate: public nsISoftwareUpdate
nsSoftwareUpdate(); nsSoftwareUpdate();
~nsSoftwareUpdate(); ~nsSoftwareUpdate();
static nsSoftwareUpdate *GetInstance();
NS_DECL_ISUPPORTS NS_DECL_ISUPPORTS
NS_IMETHOD Startup();
NS_IMETHOD Shutdown();
NS_IMETHOD InstallJar(nsInstallInfo *installInfo); NS_IMETHOD InstallJar(nsInstallInfo *installInfo);
NS_IMETHOD InstallJar(const nsString& fromURL, NS_IMETHOD InstallJar(const nsString& fromURL,
const nsString& flags, const nsString& flags,
@ -35,8 +35,19 @@ class nsSoftwareUpdate: public nsISoftwareUpdate
private: private:
nsresult Startup();
nsresult Shutdown();
nsresult UpdateInstallJarQueue(); nsresult UpdateInstallJarQueue();
nsresult DeleteScheduledNodes(); nsresult DeleteScheduledNodes();
PRInt32 mInstalling;
nsVector* mJarInstallQueue;
static nsSoftwareUpdate* mInstance;
}; };

View File

@ -1,75 +0,0 @@
/* -*- 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
* 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.
*/
#include "nsSoftwareUpdateQueue.h"
#include "prmem.h"
/*
* This struct represents one entry in a queue setup to hold download
* requests if there are more than one.
*/
typedef struct su_QItem
{
struct su_QItem * next;
struct su_QItem * prev;
su_startCallback * QItem;
} su_QItem;
static su_QItem * Qhead = NULL;
static su_QItem * Qtail = NULL;
PRBool QInsert( su_startCallback * Item )
{
su_QItem *p = (su_QItem*) PR_MALLOC( sizeof (su_QItem));
if (p == NULL)
return FALSE;
p->QItem = Item;
p->next = Qhead;
p->prev = NULL;
if (Qhead != NULL)
Qhead->prev = p;
Qhead = p;
if (Qtail == NULL) /* First Item inserted in Q? */
Qtail = p;
return TRUE;
}
su_startCallback *QGetItem(void)
{
su_QItem *Qtemp = Qtail;
if (Qtemp != NULL)
{
su_startCallback *p = NULL;
Qtail = Qtemp->prev;
if (Qtail == NULL) /* Last Item deleted from Q? */
Qhead = NULL;
else
Qtail->next = NULL;
p = Qtemp->QItem;
PR_FREEIF(Qtemp);
return p;
}
return NULL;
}

View File

@ -1,51 +0,0 @@
/* -*- 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
* 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.
*/
#ifndef _NS_SOFTWAREUPDATEQUEUE_H__
#define _NS_SOFTWAREUPDATEQUEUE_H__
#include "ntypes.h" /* for MWContext */
typedef void (*SoftUpdateCompletionFunction) (int result, void * closure);
/* a struct to hold the arguments */
struct su_startCallback_
{
char * url;
char * name;
SoftUpdateCompletionFunction f;
void * completionClosure;
int32 flags;
MWContext * context;
};
typedef su_startCallback_ su_startCallback;
NSPR_BEGIN_EXTERN_C
PRBool QInsert( su_startCallback * Item );
su_startCallback *QGetItem(void);
NSPR_END_EXTERN_C
#endif

View File

@ -15,26 +15,21 @@
#include "nsRepository.h" #include "nsRepository.h"
#include "nsIWebShellWindow.h" #include "nsIBrowserWindow.h"
#include "nsIWebShell.h" #include "nsIWebShell.h"
#include "nsIScriptContext.h" #include "nsIScriptContext.h"
#include "nsIScriptContextOwner.h" #include "nsIScriptContextOwner.h"
#include "nsIServiceManager.h"
#include "nsAppShellCIDs.h"
#include "nsIAppShellService.h"
#include "nsIURL.h" #include "nsIURL.h"
extern PRInt32 InitXPInstallObjects(nsIScriptContext *aContext, const char* jarfile, const char* args); extern PRInt32 InitXPInstallObjects(nsIScriptContext *aContext, const char* jarfile, const char* args);
static NS_DEFINE_IID(kWebShellWindowIID, NS_IWEBSHELL_WINDOW_IID); 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); static NS_DEFINE_IID(kIScriptContextOwnerIID, NS_ISCRIPTCONTEXTOWNER_IID);
static NS_DEFINE_IID(kAppShellServiceCID, NS_APPSHELL_SERVICE_CID);
static NS_DEFINE_IID(kIAppShellServiceIID, NS_IAPPSHELL_SERVICE_IID);
/* ReadFileIntoBuffer /* ReadFileIntoBuffer
* given a file name, reads it into buffer * given a file name, reads it into buffer
* returns an error code * returns an error code
@ -104,12 +99,10 @@ extern "C" NS_EXPORT PRInt32 Install(const char* jarFile, const char* flags, con
// Open the jarfile. // Open the jarfile.
void* hZip; void* hZip;
PRInt32 result = ZIP_OpenArchive(jarFile , &hZip); PRInt32 rv = ZIP_OpenArchive(jarFile , &hZip);
if (result != ZIP_OK) if (rv != ZIP_OK)
{ return rv;
return result;
}
// Read manifest file for Install Script filename. // Read manifest file for Install Script filename.
@ -121,81 +114,71 @@ extern "C" NS_EXPORT PRInt32 Install(const char* jarFile, const char* flags, con
installJSFileSpec.MakeUnique(); installJSFileSpec.MakeUnique();
// Extract the install.js file. // Extract the install.js file.
result = ZIP_ExtractFile( hZip, "install.js", installJSFileSpec.GetCString() ); rv = ZIP_ExtractFile( hZip, "install.js", installJSFileSpec.GetCString() );
if (result != ZIP_OK) if (rv != ZIP_OK)
{
return result;
}
nsIAppShellService *appShell = nsnull;
nsIURL *url;
nsIWidget *newWindow;
nsIWebShellWindow *webShellWindow;
nsIWebShell *aWebShell;
nsresult rv = NS_NewURL(&url, "resource:/res/install/progress.xul");
if (NS_FAILED(rv))
{ {
return rv; return rv;
} }
nsIWebShell* aWebShell = nsnull;
nsIBrowserWindow* aWindow = nsnull;
// Create a new window so that we can display UI. rv = nsComponentManager::CreateInstance(kBrowserWindowCID,
nsnull,
rv = nsServiceManager::GetService( kAppShellServiceCID, kIBrowserWindowIID,
kIAppShellServiceIID, (void**) &aWindow);
(nsISupports**) &appShell);
if (NS_FAILED(rv)) if (NS_FAILED(rv))
return rv; {
goto bail;
}
aWindow->Init(nsnull, nsnull, nsRect(0, 0, 300, 300), PRUint32(~0), PR_FALSE);
rv = aWindow->GetWebShell(aWebShell);
appShell->CreateTopLevelWindow( nsnull, url, nsString("CID"), newWindow, nsnull, nsnull, 375, 375);
NS_RELEASE(url);
if (rv == NS_OK) if (rv == NS_OK)
{ {
// rv = newWindow->GetWebShell(aWebShell); nsIScriptContextOwner* scriptContextOwner;
nsIScriptContext* scriptContext;
rv = aWebShell->QueryInterface( kIScriptContextOwnerIID, (void**)&scriptContextOwner);
if (rv == NS_OK) if (rv == NS_OK)
{ {
nsIScriptContextOwner* scriptContextOwner; rv = scriptContextOwner->GetScriptContext(&scriptContext);
nsIScriptContext* scriptContext;
rv = aWebShell->QueryInterface( kIScriptContextOwnerIID, (void**)&scriptContextOwner); if (NS_OK == rv)
if (rv == NS_OK)
{ {
rv = scriptContextOwner->GetScriptContext(&scriptContext);
InitXPInstallObjects(scriptContext, jarFile, args );
if (NS_OK == rv) char* buffer;
{ unsigned long bufferLength;
InitXPInstallObjects(scriptContext, jarFile, args ); ReadFileIntoBuffer(installJSFileSpec, &buffer, &bufferLength);
char* buffer; nsAutoString retval;
unsigned long bufferLength; PRBool isUndefined;
// We expected this to block.
ReadFileIntoBuffer(installJSFileSpec, &buffer, &bufferLength); scriptContext->EvaluateString(nsString(buffer), nsnull, 0, retval, &isUndefined);
nsAutoString retval; PR_FREEIF(buffer);
PRBool isUndefined; NS_RELEASE(scriptContext);
// We expected this to block.
scriptContext->EvaluateString(nsString(buffer), nsnull, 0, retval, &isUndefined);
PR_FREEIF(buffer);
NS_RELEASE(scriptContext);
}
NS_RELEASE(scriptContextOwner);
} }
NS_RELEASE(scriptContextOwner);
} }
appShell->CloseTopLevelWindow(newWindow); // close and release window.
// NS_RELEASE(aWebShell);
} }
else
bail:
if (aWindow != nsnull)
{ {
return -1; aWindow->Close();
NS_RELEASE(aWindow);
} }
ZIP_CloseArchive(&hZip); ZIP_CloseArchive(&hZip);