зеркало из https://github.com/mozilla/pjs.git
Embeddable XPI landing, including bugs 76424, 83702, 88757, 97691, 98458, 105083, 105085, 113149,124467,124470 r=syd (and others) sr=alecf, a=drivers
This commit is contained in:
Родитель
17ec7454ac
Коммит
cd26f593d4
|
@ -14,7 +14,7 @@
|
|||
*
|
||||
* The Original Code is Mozilla Communicator client code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998-1999
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
|
@ -22,9 +22,10 @@
|
|||
* Contributor(s):
|
||||
* Don Bragg (dbragg@netscape.com) 12/08/1999
|
||||
* Blake Ross (BlakeR1234@aol.com) 6/12/2000
|
||||
* Daniel Veditz <dveditz@netscape.com> 2002
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
|
@ -37,73 +38,30 @@
|
|||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
@import url("chrome://global/skin");
|
||||
@import url("chrome://communicator/skin");
|
||||
|
||||
@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
|
||||
|
||||
div.label {
|
||||
margin : 3px;
|
||||
#confirmBox {
|
||||
margin: 1ex;
|
||||
}
|
||||
|
||||
div#tree-housing {
|
||||
height : 3em;
|
||||
#urlColumn {
|
||||
margin-left: 1ex;
|
||||
}
|
||||
|
||||
box#mainBox{
|
||||
margin : 5px;
|
||||
width : 40em;
|
||||
.confirmSeparator {
|
||||
height: 1em;
|
||||
}
|
||||
|
||||
box#okcancelBox{
|
||||
margin-left : 22em;
|
||||
margin-top : 3px;
|
||||
margin-bottom : 3px;
|
||||
}
|
||||
|
||||
|
||||
box#treeBox{
|
||||
height : 18ex;
|
||||
margin : 0em;
|
||||
}
|
||||
|
||||
box#statusMessages{
|
||||
width : 36em;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
div#table-housing {
|
||||
height : 100%;
|
||||
}
|
||||
*/
|
||||
|
||||
#modulesTree {
|
||||
height : 16ex;
|
||||
width : 32em;
|
||||
}
|
||||
|
||||
spacer#verticalSmallSpacer {
|
||||
height : 1ex;
|
||||
}
|
||||
|
||||
spacer#verticalLargeSpacer {
|
||||
height : 6ex;
|
||||
}
|
||||
|
||||
spacer#verticalMediumSpacer {
|
||||
height : 3ex;
|
||||
}
|
||||
|
||||
spacer#horizontalSmallSpacer {
|
||||
width : 2em;
|
||||
}
|
||||
|
||||
spacer#horizontalLargeSpacer {
|
||||
width : 10em;
|
||||
}
|
||||
|
||||
.headline {
|
||||
font-size : x-large;
|
||||
margin : 4px;
|
||||
.confirmName {
|
||||
font-weight : bold;
|
||||
}
|
||||
|
||||
.packageName {
|
||||
font-weight : bold;
|
||||
}
|
||||
|
||||
#alert-image {
|
||||
margin: 1em;
|
||||
}
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
* Don Bragg (dbragg@netscape.com) 12/08/1999
|
||||
* Blake Ross (BlakeR1234@aol.com) 6/12/2000
|
||||
* Joe Hewitt <hewitt@netscape.com>
|
||||
* Daniel Veditz <dveditz@netscape.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
|
@ -41,35 +42,32 @@
|
|||
== Styles used by the XPInstall dialogs.
|
||||
======================================================================= */
|
||||
|
||||
@import url("chrome://global/skin");
|
||||
@import url("chrome://communicator/skin");
|
||||
|
||||
@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
|
||||
|
||||
/* ::::: Install Confirm and Progress dialogs ::::: */
|
||||
|
||||
#mainBox {
|
||||
margin: 5px;
|
||||
}
|
||||
|
||||
.headline {
|
||||
margin: 4px;
|
||||
font-size: x-large;
|
||||
.packageName {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.warning-text {
|
||||
max-width: 40em;
|
||||
#confirmBox {
|
||||
margin: 1ex;
|
||||
}
|
||||
|
||||
#modulesTree {
|
||||
height: 16ex;
|
||||
.confirmSeparator {
|
||||
height: 1em;
|
||||
}
|
||||
|
||||
[id="dialog.progress"] {
|
||||
width: 200px;
|
||||
.confirmName {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.vertical-small-spacer {
|
||||
height: 1ex;
|
||||
#urlColumn {
|
||||
margin-left: 1ex;
|
||||
}
|
||||
|
||||
#alert-image {
|
||||
margin: 1em;
|
||||
}
|
||||
|
|
|
@ -1099,13 +1099,6 @@
|
|||
<FILEKIND>Library</FILEKIND>
|
||||
<FILEFLAGS>Debug</FILEFLAGS>
|
||||
</FILE>
|
||||
<FILE>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>nsInstallProgressDialog.cpp</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
<FILEKIND>Text</FILEKIND>
|
||||
<FILEFLAGS>Debug</FILEFLAGS>
|
||||
</FILE>
|
||||
<FILE>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>nsXPInstallManager.cpp</PATH>
|
||||
|
@ -1318,11 +1311,6 @@
|
|||
<PATH>zlibDebug.shlb</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
</FILEREF>
|
||||
<FILEREF>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>nsInstallProgressDialog.cpp</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
</FILEREF>
|
||||
<FILEREF>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>nsXPInstallManager.cpp</PATH>
|
||||
|
@ -2416,13 +2404,6 @@
|
|||
<FILEKIND>Text</FILEKIND>
|
||||
<FILEFLAGS>Debug</FILEFLAGS>
|
||||
</FILE>
|
||||
<FILE>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>nsInstallProgressDialog.cpp</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
<FILEKIND>Text</FILEKIND>
|
||||
<FILEFLAGS>Debug</FILEFLAGS>
|
||||
</FILE>
|
||||
<FILE>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>nsXPInstallManager.cpp</PATH>
|
||||
|
@ -2635,11 +2616,6 @@
|
|||
<PATH>nsInstallFileOpItem.cpp</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
</FILEREF>
|
||||
<FILEREF>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>nsInstallProgressDialog.cpp</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
</FILEREF>
|
||||
<FILEREF>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>nsXPInstallManager.cpp</PATH>
|
||||
|
@ -2810,12 +2786,6 @@
|
|||
<PATH>nsLoggingProgressNotifier.cpp</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
</FILEREF>
|
||||
<FILEREF>
|
||||
<TARGETNAME>xpinstallDebug.shlb</TARGETNAME>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>nsInstallProgressDialog.cpp</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
</FILEREF>
|
||||
<FILEREF>
|
||||
<TARGETNAME>xpinstallDebug.shlb</TARGETNAME>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
|
|
|
@ -719,7 +719,7 @@
|
|||
</FILE>
|
||||
<FILE>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>nsIXPIProgressDlg.idl</PATH>
|
||||
<PATH>nsIXPIProgressDialog.idl</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
<FILEKIND>Text</FILEKIND>
|
||||
<FILEFLAGS></FILEFLAGS>
|
||||
|
@ -733,7 +733,7 @@
|
|||
</FILE>
|
||||
<FILE>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>nsPIXPIManagerCallbacks.idl</PATH>
|
||||
<PATH>nsIXPIDialogService.idl</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
<FILEKIND>Text</FILEKIND>
|
||||
<FILEFLAGS></FILEFLAGS>
|
||||
|
@ -754,7 +754,7 @@
|
|||
</FILEREF>
|
||||
<FILEREF>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>nsIXPIProgressDlg.idl</PATH>
|
||||
<PATH>nsIXPIProgressDialog.idl</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
</FILEREF>
|
||||
<FILEREF>
|
||||
|
@ -764,7 +764,7 @@
|
|||
</FILEREF>
|
||||
<FILEREF>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>nsPIXPIManagerCallbacks.idl</PATH>
|
||||
<PATH>nsIXPIDialogService.idl</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
</FILEREF>
|
||||
<FILEREF>
|
||||
|
@ -1440,7 +1440,7 @@
|
|||
</FILE>
|
||||
<FILE>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>nsIXPIProgressDlg.idl</PATH>
|
||||
<PATH>nsIXPIProgressDialog.idl</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
<FILEKIND>Text</FILEKIND>
|
||||
<FILEFLAGS></FILEFLAGS>
|
||||
|
@ -1454,7 +1454,7 @@
|
|||
</FILE>
|
||||
<FILE>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>nsPIXPIManagerCallbacks.idl</PATH>
|
||||
<PATH>nsIXPIDialogService.idl</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
<FILEKIND>Text</FILEKIND>
|
||||
<FILEFLAGS></FILEFLAGS>
|
||||
|
@ -1475,7 +1475,7 @@
|
|||
</FILEREF>
|
||||
<FILEREF>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>nsIXPIProgressDlg.idl</PATH>
|
||||
<PATH>nsIXPIProgressDialog.idl</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
</FILEREF>
|
||||
<FILEREF>
|
||||
|
@ -1485,7 +1485,7 @@
|
|||
</FILEREF>
|
||||
<FILEREF>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>nsPIXPIManagerCallbacks.idl</PATH>
|
||||
<PATH>nsIXPIDialogService.idl</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
</FILEREF>
|
||||
<FILEREF>
|
||||
|
@ -1512,7 +1512,7 @@
|
|||
<FILEREF>
|
||||
<TARGETNAME>headers</TARGETNAME>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>nsIXPIProgressDlg.idl</PATH>
|
||||
<PATH>nsIXPIProgressDialog.idl</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
</FILEREF>
|
||||
<FILEREF>
|
||||
|
@ -1524,7 +1524,7 @@
|
|||
<FILEREF>
|
||||
<TARGETNAME>headers</TARGETNAME>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>nsPIXPIManagerCallbacks.idl</PATH>
|
||||
<PATH>nsIXPIDialogService.idl</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
</FILEREF>
|
||||
<FILEREF>
|
||||
|
|
|
@ -32,11 +32,11 @@ include $(DEPTH)/config/autoconf.mk
|
|||
MODULE = xpinstall
|
||||
|
||||
XPIDLSRCS = \
|
||||
nsIXPIDialogService.idl \
|
||||
nsIXPIProgressDialog.idl \
|
||||
nsIXPINotifier.idl \
|
||||
nsIXPIProgressDlg.idl \
|
||||
nsPIXPIProxy.idl \
|
||||
nsPIXPIStubHook.idl \
|
||||
nsPIXPIManagerCallbacks.idl \
|
||||
$(NULL)
|
||||
|
||||
EXPORTS = \
|
||||
|
|
|
@ -1,48 +0,0 @@
|
|||
#!nmake
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public
|
||||
# License Version 1.1 (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.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Daniel Veditz <dveditz@netscape.com>
|
||||
# Douglas Turner <dougt@netscape.com>
|
||||
|
||||
MODULE=xpinstall
|
||||
DEPTH=..\..
|
||||
|
||||
EXPORTS= nsIDOMInstallTriggerGlobal.h \
|
||||
nsIDOMInstallVersion.h \
|
||||
nsSoftwareUpdateIIDs.h \
|
||||
nsISoftwareUpdate.h \
|
||||
$(NULL)
|
||||
|
||||
XPIDLSRCS = \
|
||||
.\nsIXPINotifier.idl \
|
||||
.\nsIXPIProgressDlg.idl \
|
||||
.\nsPIXPIStubHook.idl \
|
||||
.\nsPIXPIManagerCallbacks.idl \
|
||||
.\nsPIXPIProxy.idl \
|
||||
# .\nsIUpdateNotification.idl \
|
||||
$(NULL)
|
||||
|
||||
include <$(DEPTH)\config\rules.mak>
|
||||
|
||||
libs::
|
||||
$(MAKE_INSTALL) .\xpinstall.js $(DIST)\bin\defaults\pref
|
||||
|
||||
|
|
@ -35,7 +35,6 @@
|
|||
#include "nsCOMPtr.h"
|
||||
#include "nsIModule.h"
|
||||
#include "nsIGenericFactory.h"
|
||||
#include "nsIDOMWindowInternal.h"
|
||||
|
||||
#include "nsIRegistry.h"
|
||||
#include "nsIRegistryUtils.h"
|
||||
|
@ -68,7 +67,6 @@ class nsISoftwareUpdate : public nsISupports
|
|||
NS_IMETHOD InstallJar(nsIFile* localFile,
|
||||
const PRUnichar* URL,
|
||||
const PRUnichar* arguments,
|
||||
nsIDOMWindowInternal* aParentWindow,
|
||||
PRUint32 flags,
|
||||
nsIXPIListener* aListener = 0) = 0;
|
||||
|
||||
|
|
|
@ -0,0 +1,101 @@
|
|||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (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/MPL/
|
||||
*
|
||||
* 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 the Mozilla XPInstall.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2002
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Daniel Veditz <dveditz@netscape.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
interface nsIDOMWindow;
|
||||
interface nsIXPIProgressDialog;
|
||||
interface nsIObserver;
|
||||
|
||||
/**
|
||||
* A service provided by embedding applications to override
|
||||
* the default XUL implmementation of XPInstall dialogs.
|
||||
*
|
||||
* Embedding applications which wish to override the default
|
||||
* XUL dialogs need to create a component which implements
|
||||
* this interface and registers with the Contract ID
|
||||
* "@mozilla.org/embedui/xpinstall-dialog-service;1"
|
||||
*
|
||||
* @status UNDER_REVIEW
|
||||
*/
|
||||
[scriptable, uuid(8cdd8baa-1dd2-11b2-909a-f0178da5c5ff)]
|
||||
interface nsIXPIDialogService : nsISupports
|
||||
{
|
||||
/**
|
||||
* @brief Ask the user if it's OK to install
|
||||
*
|
||||
* When called the XPIDialogService implementation should pose an
|
||||
* install confirmation dialog and return the user's response
|
||||
*
|
||||
* @param parent a window that can be used to parent the modal dialog
|
||||
*
|
||||
* @param packageList For each install package there will be two strings,
|
||||
* a display name and a source URL.
|
||||
*
|
||||
* @param count The number of strings in the packageList. This
|
||||
* will always be even (twice the number of packages)
|
||||
*
|
||||
* @return true to install, false to cancel
|
||||
*/
|
||||
boolean confirmInstall(in nsIDOMWindow parent,
|
||||
[array, size_is(count)] in wstring packageList,
|
||||
in unsigned long count);
|
||||
|
||||
/**
|
||||
* @brief Create and open a download-and-install progress dialog
|
||||
*
|
||||
* When called the XPIDialogService implementation creates and opens
|
||||
* a dialog to display the status of the install. When the dialog
|
||||
* is ready to be used then the observer must be called: the subject
|
||||
* is an nsIXPIProgressDialog that nsXPInstallManager can use to control
|
||||
* the dialog, the topic is "xpinstall-progress" and the data is "open".
|
||||
*
|
||||
* If the user wishes to cancel the download, the dialog can call the
|
||||
* observe method with the same subject and topic and the data "cancel".
|
||||
*
|
||||
* @note Unless this routine throws an exception the observer <b>must</b>
|
||||
* be called or nsXPInstallManager will wait forever and never clean
|
||||
* itself up.
|
||||
*
|
||||
* @param packageList two strings per package as in confirmInstall()
|
||||
* @param count the number of strings in the list
|
||||
* @param observer nsIObserver to receive messages from the dialog
|
||||
*/
|
||||
void openProgressDialog([array, size_is(count)] in wstring packageList,
|
||||
in unsigned long count,
|
||||
in nsIObserver observer);
|
||||
};
|
|
@ -10,15 +10,15 @@
|
|||
* 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 Original Code is Mozilla Communicator client code,
|
||||
* released March 31, 1998.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape Communications
|
||||
* The Initial Developer of the Original Code is Netscape Communications
|
||||
* Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 2000 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Contributor(s):
|
||||
* Douglas Turner <dougt@netscape.com>
|
||||
* Daniel Veditz <dveditz@netscape.com>
|
||||
*/
|
||||
|
@ -28,11 +28,10 @@
|
|||
[uuid(eea90d40-b059-11d2-915e-c12b696c9333)]
|
||||
interface nsIXPIListener : nsISupports
|
||||
{
|
||||
void BeforeJavascriptEvaluation(in wstring URL);
|
||||
void AfterJavascriptEvaluation(in wstring URL);
|
||||
void InstallStarted(in wstring URL, in wstring UIPackageName);
|
||||
void ItemScheduled(in wstring message );
|
||||
void FinalizeProgress(in wstring message, in long itemNum, in long totNum );
|
||||
void FinalStatus(in wstring URL, in long status);
|
||||
void LogComment(in wstring comment);
|
||||
void onInstallStart(in wstring URL);
|
||||
void onInstallDone(in wstring URL, in long status);
|
||||
void onPackageNameSet(in wstring URL, in wstring UIPackageName);
|
||||
void onItemScheduled(in wstring message );
|
||||
void onFinalizeProgress(in wstring message, in long itemNum, in long totNum );
|
||||
void onLogComment(in wstring comment);
|
||||
};
|
||||
|
|
|
@ -0,0 +1,82 @@
|
|||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (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/MPL/
|
||||
*
|
||||
* 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 the Mozilla XPInstall.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2002
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Daniel Veditz <dveditz@netscape.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
/**
|
||||
* Interface to display XPInstall download and install status.
|
||||
*
|
||||
* @status UNDER_REVIEW
|
||||
*/
|
||||
[scriptable, uuid(8cdf1192-8709-4428-ab97-c5b6ceecd7e9)]
|
||||
interface nsIXPIProgressDialog : nsISupports
|
||||
{
|
||||
/**
|
||||
* state values for onStateChange
|
||||
*/
|
||||
const short DOWNLOAD_START = 0;
|
||||
const short DOWNLOAD_DONE = 1;
|
||||
const short INSTALL_START = 2;
|
||||
const short INSTALL_DONE = 3;
|
||||
const short DIALOG_CLOSE = 4;
|
||||
|
||||
/**
|
||||
* basic info to control the install progress dialog. The dialog can
|
||||
* go away any time after it has received the DIALOG_CLOSE state message
|
||||
* but needs to accept messages until that time even if it is not visible.
|
||||
*
|
||||
* Normally for each install package the dialog will receive the download
|
||||
* and install messages in START/DONE pairs, but in the case of a download
|
||||
* error the dialog will be sent only the DOWNLOAD_START followed by an
|
||||
* INSTALL_DONE message with the value nsInstall::DOWNLOAD_ERROR
|
||||
*
|
||||
* @param index the package this message is about of those passed into
|
||||
* openProgressDialog. ignored when state==DIALOG_CLOSE
|
||||
* @param state the kind of message
|
||||
* @param value final result when state==INSTALL_DONE, otherwise ignored
|
||||
*/
|
||||
void onStateChange( in unsigned long index, in short state, in long value );
|
||||
|
||||
/**
|
||||
* download progress
|
||||
*
|
||||
* @param index the package to which this refers
|
||||
* @param value number of bytes downloaded
|
||||
* @param maxValue the total size
|
||||
*/
|
||||
void onProgress( in unsigned long index, in unsigned long value, in unsigned long maxValue );
|
||||
};
|
|
@ -33,6 +33,9 @@
|
|||
[scriptable,uuid(6F9D2890-167D-11d5-8DAF-000064657374)]
|
||||
interface nsPIXPIProxy : nsISupports
|
||||
{
|
||||
void refreshPlugins(in nsISupports aWindow);
|
||||
void refreshPlugins(in boolean reloadPages);
|
||||
void notifyRestartNeeded();
|
||||
|
||||
void alert(in wstring title, in wstring text);
|
||||
boolean confirm(in wstring title, in wstring text);
|
||||
};
|
||||
|
|
|
@ -4,68 +4,65 @@
|
|||
* 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.
|
||||
*/
|
||||
|
||||
var toolkit;
|
||||
var browser;
|
||||
var dialog;
|
||||
|
||||
// dialog param block
|
||||
var param;
|
||||
var gParams;
|
||||
|
||||
function addTreeItem(num, modName, url)
|
||||
function addTreeItem(num, aName, aUrl)
|
||||
{
|
||||
dump("Adding element " + num + " : " + name + "\n");
|
||||
var body = document.getElementById("theTreeBody");
|
||||
// first column is the package name
|
||||
var item = document.createElement("description");
|
||||
item.setAttribute("value", aName);
|
||||
item.setAttribute("tooltiptext", aUrl);
|
||||
item.setAttribute("class", "confirmName");
|
||||
|
||||
var newitem = document.createElement('treeitem');
|
||||
var newrow = document.createElement('treerow');
|
||||
|
||||
newrow.setAttribute("rowNum", num);
|
||||
newrow.setAttribute("rowName", modName);
|
||||
// second column is the host serving the file
|
||||
var urltext = aUrl.replace(/^([^:]*:\/*[^\/]+).*/, "$1");
|
||||
var url = document.createElement('description');
|
||||
url.setAttribute("value", aUrl);
|
||||
url.setAttribute("tooltiptext", aUrl);
|
||||
url.setAttribute("class", "confirmURL");
|
||||
url.setAttribute("crop", "end");
|
||||
|
||||
var elem = document.createElement('treecell');
|
||||
elem.setAttribute("label", modName);
|
||||
newrow.appendChild(elem);
|
||||
// create row and add it to the grid
|
||||
var row = document.createElement("row");
|
||||
row.appendChild(item);
|
||||
row.appendChild(url);
|
||||
|
||||
elem = document.createElement('treecell');
|
||||
elem.setAttribute("label", url);
|
||||
newrow.appendChild(elem);
|
||||
|
||||
newitem.appendChild(newrow);
|
||||
body.appendChild(newitem);
|
||||
document.getElementById("xpirows").appendChild(row);
|
||||
}
|
||||
|
||||
|
||||
function onLoad()
|
||||
function onLoad()
|
||||
{
|
||||
var row = 0;
|
||||
var moduleName, URL, numberOfDialogTreeElements;
|
||||
|
||||
doSetOKCancel(onOk, onCancel);
|
||||
|
||||
param = window.arguments[0].QueryInterface(Components.interfaces.nsIDialogParamBlock);
|
||||
gParam = window.arguments[0].QueryInterface(Components.interfaces.nsIDialogParamBlock);
|
||||
|
||||
param.SetInt(0, 1 ); /* Set the default return to Cancel */
|
||||
gParam.SetInt(0, 1 ); /* Set the default return to Cancel */
|
||||
|
||||
numberOfDialogTreeElements = param.GetInt(1);
|
||||
numberOfDialogTreeElements = gParam.GetInt(1);
|
||||
|
||||
for (var i=0; i < numberOfDialogTreeElements; i++)
|
||||
{
|
||||
moduleName = param.GetString(i);
|
||||
URL = param.GetString(++i);
|
||||
moduleName = gParam.GetString(i);
|
||||
URL = gParam.GetString(++i);
|
||||
addTreeItem(row++, moduleName, URL);
|
||||
}
|
||||
|
||||
|
@ -74,21 +71,21 @@ function onLoad()
|
|||
document.getElementById("ok").label = okButton;
|
||||
}
|
||||
|
||||
function onOk()
|
||||
function onOk()
|
||||
{
|
||||
// set the okay button in the param block
|
||||
if (param)
|
||||
param.SetInt(0, 0 );
|
||||
if (gParam)
|
||||
gParam.SetInt(0, 0 );
|
||||
|
||||
window.close();
|
||||
}
|
||||
|
||||
function onCancel()
|
||||
function onCancel()
|
||||
{
|
||||
// set the cancel button in the param block
|
||||
if (param)
|
||||
param.SetInt(0, 1 );
|
||||
|
||||
window.close();
|
||||
// set the cancel button in the param block
|
||||
if (gParam)
|
||||
gParam.SetInt(0, 1 );
|
||||
|
||||
window.close();
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<!-- The contents of this file are subject to the Netscape Public
|
||||
License Version 1.1 (the "License"); you may not use this file
|
||||
|
@ -17,14 +17,13 @@ Communications Corporation. Portions created by Netscape are
|
|||
Copyright (C) 1998-1999 Netscape Communications Corporation. All
|
||||
Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Don Bragg (dbragg@netscape.com)
|
||||
Contributor(s):
|
||||
Don Bragg <dbragg@netscape.com>
|
||||
Dan Veditz <dveditz@netscape.com>
|
||||
Blake Ross <blakeross@telocity.com>
|
||||
Håkan Waara <hwaara@chello.se>
|
||||
-->
|
||||
|
||||
<?xml-stylesheet href="chrome://global/skin/global.css" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://communicator/skin/xpinstall/xpinstall.css" type="text/css"?>
|
||||
<?xul-overlay href="chrome://global/content/dialogOverlay.xul"?>
|
||||
<!DOCTYPE window SYSTEM "chrome://communicator/locale/xpinstall/institems.dtd">
|
||||
|
@ -32,9 +31,10 @@ Contributor(s):
|
|||
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
onload="onLoad()"
|
||||
title="&dialog.title;"
|
||||
id="confirmDlg"
|
||||
class="dialog"
|
||||
width="450"
|
||||
height="260">
|
||||
style="width: 50em"
|
||||
>
|
||||
|
||||
<script src="chrome://communicator/content/xpinstall/institems.js"/>
|
||||
<keyset id="dialogKeys"/>
|
||||
|
@ -42,35 +42,31 @@ Contributor(s):
|
|||
|
||||
<hbox flex="1" align="center">
|
||||
<hbox align="center">
|
||||
<image class="alert-icon" style="margin: 5px"/>
|
||||
<image id="alert-image" class="alert-icon"/>
|
||||
</hbox>
|
||||
|
||||
<vbox flex="1">
|
||||
<separator class="thin"/>
|
||||
<label value="&areYouSure.label;" id="sureText"/>
|
||||
<separator class="thin"/>
|
||||
<vbox id="confirmBox" flex="1">
|
||||
<description id="warn1" flex="1">
|
||||
&warningText.label;
|
||||
</description>
|
||||
|
||||
<tree id="modulesTree">
|
||||
<treecolgroup>
|
||||
<treecol flex="35%"/>
|
||||
<splitter class="tree-splitter"/>
|
||||
<treecol flex="65%"/>
|
||||
</treecolgroup>
|
||||
<separator class="confirmSeparator"/>
|
||||
|
||||
<treehead>
|
||||
<treerow>
|
||||
<treecell id="moduleName" class="treecell-header" label="&moduleName.label;"/>
|
||||
<treecell id="moduleSource" class="treecell-header" label="&moduleSource.label;"/>
|
||||
</treerow>
|
||||
</treehead>
|
||||
<grid id="confirmGrid" flex="1">
|
||||
<columns>
|
||||
<column id="xpiColumn"/>
|
||||
<column id="urlColumn" flex="1"/>
|
||||
</columns>
|
||||
<rows id="xpirows">
|
||||
</rows>
|
||||
</grid>
|
||||
|
||||
<treechildren id="theTreeBody" flex="1"/>
|
||||
</tree>
|
||||
<separator class="confirmSeparator"/>
|
||||
|
||||
<description>&warningText2.label;</description>
|
||||
<description id="warn2" flex="1">
|
||||
&warningText2.label;
|
||||
</description>
|
||||
</vbox>
|
||||
</hbox>
|
||||
<separator class="thin"/>
|
||||
|
||||
<hbox id="okCancelButtonsRight"/>
|
||||
</window>
|
||||
|
|
|
@ -21,69 +21,153 @@
|
|||
* Contributor(s):
|
||||
*/
|
||||
|
||||
var browser;
|
||||
var dialog;
|
||||
var param;
|
||||
var manager;
|
||||
var gManager;
|
||||
var gBundle;
|
||||
var gCanClose = false;
|
||||
var gCancelled = false;
|
||||
|
||||
// implements nsIXPIProgressDialog
|
||||
var progressHooks =
|
||||
{
|
||||
onStateChange: function( aIndex, aState, aValue )
|
||||
{
|
||||
const state = Components.interfaces.nsIXPIProgressDialog;
|
||||
var status = document.getElementById("status"+aIndex);
|
||||
var progress = document.getElementById("progress"+aIndex);
|
||||
|
||||
switch( aState ) {
|
||||
case state.DOWNLOAD_START:
|
||||
status.setAttribute("value",
|
||||
gBundle.getString("progress.downloading"));
|
||||
progress.setAttribute("value","0%");
|
||||
break;
|
||||
|
||||
case state.DOWNLOAD_DONE:
|
||||
status.setAttribute("value",
|
||||
gBundle.getString("progress.downloaded"));
|
||||
progress.setAttribute("value","100%");
|
||||
break;
|
||||
|
||||
case state.INSTALL_START:
|
||||
status.setAttribute("value",
|
||||
gBundle.getString("progress.installing"));
|
||||
progress.setAttribute("mode","undetermined");
|
||||
break;
|
||||
|
||||
case state.INSTALL_DONE:
|
||||
progress.setAttribute("mode","determined");
|
||||
progress.hidden = true;
|
||||
var msg;
|
||||
try
|
||||
{
|
||||
msg = gBundle.getString("error"+aValue);
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
msg = gBundle.stringBundle.formatStringFromName(
|
||||
"unknown.error", [aValue], 1 );
|
||||
}
|
||||
status.setAttribute("value",msg);
|
||||
break;
|
||||
|
||||
case state.DIALOG_CLOSE:
|
||||
// nsXPInstallManager is done with us, but we'll let users
|
||||
// dismiss the dialog themselves so they can see the status
|
||||
// (unless we're closing because the user cancelled)
|
||||
document.getElementById("ok").disabled = false;
|
||||
document.getElementById("cancel").disabled = true;
|
||||
gCanClose = true;
|
||||
|
||||
if (gCancelled)
|
||||
window.close();
|
||||
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
||||
onProgress: function( aIndex, aValue, aMaxValue )
|
||||
{
|
||||
var percent = Math.round( 100 * (aValue/aMaxValue) );
|
||||
var node = document.getElementById("progress"+aIndex);
|
||||
node.setAttribute("value", percent);
|
||||
},
|
||||
|
||||
QueryInterface: function( iid )
|
||||
{
|
||||
if (!iid.equals(Components.interfaces.nsISupports) &&
|
||||
!iid.equals(Components.interfaces.nsIXPIProgressDialog))
|
||||
throw Components.results.NS_ERROR_NO_INTERFACE;
|
||||
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function onLoad()
|
||||
{
|
||||
doSetOKCancel(dlgOK, dlgCancel);
|
||||
document.getElementById("ok").disabled = true;
|
||||
document.getElementById("cancel").focus();
|
||||
gBundle = document.getElementById("xpinstallBundle");
|
||||
|
||||
var param = window.arguments[0].QueryInterface(
|
||||
Components.interfaces.nsIDialogParamBlock );
|
||||
if ( !param )
|
||||
dump (" error getting param block interface \n");
|
||||
|
||||
var i = 0;
|
||||
var row = 0;
|
||||
var moduleName;
|
||||
var URL;
|
||||
var numberOfDialogTreeElements;
|
||||
|
||||
param = window.arguments[0].QueryInterface( Components.interfaces.nsIDialogParamBlock );
|
||||
if ( !param )
|
||||
var numElements = param.GetInt(1);
|
||||
while ( i < numElements )
|
||||
{
|
||||
dump (" error getting param block interface \n");
|
||||
}
|
||||
numberOfDialogTreeElements = param.GetInt(1);
|
||||
dump(numberOfDialogTreeElements += "\n");
|
||||
|
||||
manager = window.arguments[1];
|
||||
|
||||
for (i = 0; i < numberOfDialogTreeElements; i++)
|
||||
{
|
||||
moduleName = param.GetString(i);
|
||||
URL = param.GetString(++i);
|
||||
var moduleName = param.GetString(i++);
|
||||
var URL = param.GetString(i++);
|
||||
addTreeItem(row++, moduleName, URL);
|
||||
}
|
||||
manager.dialogOpened(window);
|
||||
document.getElementById("cancel").focus();
|
||||
|
||||
return;
|
||||
gManager = window.arguments[1];
|
||||
|
||||
// inform nsXPInstallManager we're open for business
|
||||
gManager.observe( progressHooks, "xpinstall-progress", "open" );
|
||||
}
|
||||
|
||||
function addTreeItem(num, modName, url)
|
||||
function addTreeItem(aRow, aName, aUrl)
|
||||
{
|
||||
dump("Adding Progress element " + num + " : " + name + "\n");
|
||||
var body = document.getElementById("theTreeBody");
|
||||
// first column is the package name
|
||||
var item = document.createElement("description");
|
||||
item.setAttribute("class", "packageName");
|
||||
item.setAttribute("id", "package"+aRow);
|
||||
item.setAttribute("value", aName);
|
||||
item.setAttribute("tooltiptext", aUrl);
|
||||
|
||||
var newitem = document.createElement('treeitem');
|
||||
var newrow = document.createElement('treerow');
|
||||
// second column is the status
|
||||
var status = document.createElement('description');
|
||||
status.setAttribute("class", "packageStatus");
|
||||
status.setAttribute("id", "status"+aRow);
|
||||
status.setAttribute("value", gBundle.getString("progress.queued"));
|
||||
|
||||
newrow.setAttribute("rowNum", num);
|
||||
newrow.setAttribute("rowName", modName);
|
||||
// third row is a progress meter
|
||||
var progress = document.createElement("progressmeter");
|
||||
progress.setAttribute("class", "packageProgress");
|
||||
progress.setAttribute("id", "progress"+aRow);
|
||||
progress.setAttribute("value", "0%");
|
||||
|
||||
var elem = document.createElement('treecell');
|
||||
elem.setAttribute("label", modName);
|
||||
newrow.appendChild(elem);
|
||||
|
||||
elem = document.createElement('treecell');
|
||||
elem.setAttribute("label", url);
|
||||
newrow.appendChild(elem);
|
||||
|
||||
newitem.appendChild(newrow);
|
||||
body.appendChild(newitem);
|
||||
// create row and add it to the grid
|
||||
var row = document.createElement("row");
|
||||
row.appendChild(item);
|
||||
row.appendChild(status);
|
||||
row.appendChild(progress);
|
||||
document.getElementById("xpirows").appendChild(row);
|
||||
}
|
||||
|
||||
function cancel()
|
||||
function dlgOK() { return true; }
|
||||
|
||||
function dlgCancel()
|
||||
{
|
||||
if (manager)
|
||||
manager.cancelInstall();
|
||||
gCancelled = true;
|
||||
if (gManager)
|
||||
gManager.observe( progressHooks, "xpinstall-progress", "cancel");
|
||||
|
||||
// window is closed by native impl after cleanup
|
||||
return gCanClose;
|
||||
}
|
||||
|
|
|
@ -1,26 +1,27 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<!--
|
||||
<!--
|
||||
The contents of this file are subject to the Netscape Public
|
||||
License Version 1.1 (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.
|
||||
|
||||
|
||||
The Initial Developer of the Original Code is Netscape
|
||||
Communications Corporation. Portions created by Netscape are
|
||||
Copyright (C) 1998-1999 Netscape Communications Corporation. All
|
||||
Copyright (C) 1998-2002 Netscape Communications Corporation. All
|
||||
Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
|
||||
Contributor(s):
|
||||
Don Bragg (dbragg@netscape.com) 12/08/1999
|
||||
Blake Ross (BlakeR1234@aol.com) 7/05/2000
|
||||
Daniel Veditz <dveditz@netscape.com> 1/2002
|
||||
-->
|
||||
|
||||
<?xml-stylesheet href="chrome://communicator/skin/xpinstall/xpinstall.css" type="text/css"?>
|
||||
|
@ -30,61 +31,35 @@
|
|||
|
||||
|
||||
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
onload="onLoad()"
|
||||
onclose="return false"
|
||||
title="&progressTitle.label;"
|
||||
class = "dialog"
|
||||
>
|
||||
onload="onLoad()"
|
||||
onclose="return gCanClose"
|
||||
id="statusDlg"
|
||||
class="dialog"
|
||||
style="width: 50em"
|
||||
>
|
||||
|
||||
<script src="chrome://communicator/content/xpinstall/xpistatus.js"/>
|
||||
<keyset id="keyset"/>
|
||||
<keyset id="dialogKeys"/>
|
||||
<stringbundle id="xpinstallBundle" src="chrome://communicator/locale/xpinstall/xpinstall.properties"/>
|
||||
|
||||
<vbox id="mainBox">
|
||||
<hbox id="interiorTitleBox" align="center">
|
||||
<label class="headline" id="interiorTitle" value="&progress.label;"/>
|
||||
<spacer flex="100%"/>
|
||||
<image src="chrome://global/skin/animthrob_single.gif" />
|
||||
</hbox>
|
||||
<vbox id="mainProgressBox" flex="1">
|
||||
<groupbox id="progressGroup" orient="vertical" flex="1">
|
||||
<caption id="progressCaption" label="&group.caption;"/>
|
||||
<grid id="progressGrid" flex="1">
|
||||
<columns>
|
||||
<column id="xpiColumn" flex="3"/>
|
||||
<column id="statusColumn" flex="2"/>
|
||||
<column id="progressColumn"/>
|
||||
</columns>
|
||||
<rows id="xpirows">
|
||||
</rows>
|
||||
</grid>
|
||||
</groupbox>
|
||||
|
||||
<spacer class="vertical-small-spacer"/>
|
||||
<separator class="groove" flex="100%"/>
|
||||
<spacer class="vertical-small-spacer"/>
|
||||
|
||||
<label id="componentList" value="&downloadBeforeUpdate.text;"/>
|
||||
<spacer class="vertical-small-spacer"/>
|
||||
<spacer class="vertical-small-spacer"/>
|
||||
|
||||
<vbox id="treebox">
|
||||
<tree id="modulesTree" class="inset">
|
||||
<treecolgroup>
|
||||
<treecol flex="1"/>
|
||||
<splitter class="tree-splitter"/>
|
||||
<treecol flex="1"/>
|
||||
</treecolgroup>
|
||||
<treehead>
|
||||
<treerow>
|
||||
<treecell id="moduleName" class="treecell-header" label="&moduleName.label;" />
|
||||
<treecell id="moduleSource" class="treecell-header" label="&moduleSource.label;"/>
|
||||
</treerow>
|
||||
</treehead>
|
||||
|
||||
<treechildren id="theTreeBody" flex="1">
|
||||
</treechildren>
|
||||
</tree>
|
||||
</vbox>
|
||||
|
||||
<spacer class="vertical-small-spacer"/>
|
||||
|
||||
<vbox id="statusMessages">
|
||||
<textbox id="dialog.uiPackageName" readonly="" />
|
||||
<textbox id="dialog.currentAction" readonly="" />
|
||||
</vbox>
|
||||
|
||||
<hbox id="progressBox" align="center">
|
||||
<progressmeter id="dialog.progress" mode="normal" value="0"/>
|
||||
<button id="cancel" oncommand="cancel()" label="&dialogCancel.label;"/>
|
||||
</hbox>
|
||||
<separator class="thin"/>
|
||||
|
||||
<hbox id="okCancelButtonsRight"/>
|
||||
</vbox>
|
||||
|
||||
</window>
|
||||
|
|
|
@ -1,7 +0,0 @@
|
|||
<!-- extracted from institems.xul -->
|
||||
|
||||
<!ENTITY dialog.title "Software Installation">
|
||||
<!ENTITY warningText2.label "Malicious software could damage files stored on your computer or violate your privacy. You should only install software from sources that you trust.">
|
||||
<!ENTITY moduleName.label "Name">
|
||||
<!ENTITY moduleSource.label "Source">
|
||||
<!ENTITY areYouSure.label "Are you sure you want to install the following software?">
|
|
@ -1,23 +1,23 @@
|
|||
# The contents of this file are subject to the Netscape Public License
|
||||
# Version 1.1 (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/
|
||||
# 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.
|
||||
#
|
||||
# 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.
|
||||
# 31, 1998.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape Communications
|
||||
# Corporation. Portions created by Netscape are Copyright (C) 1998-1999
|
||||
# Netscape Communications Corporation. All Rights Reserved.
|
||||
#
|
||||
#
|
||||
# Contributors:
|
||||
# Samir Gehani <sgehani@netscape.com>
|
||||
|
||||
# Daniel Veditz <dveditz@netscape.com>
|
||||
#
|
||||
# String resources for xpinstall user interface dialogs
|
||||
#
|
||||
|
@ -64,8 +64,6 @@ RegPackage=Register Package: %s
|
|||
# Dialog Messages
|
||||
#--------------------------------------------------------------------
|
||||
|
||||
FinishingInstallMsg=Finishing install... please wait.
|
||||
|
||||
ApplyNowSkin=Use this theme
|
||||
ApplyNowLocale=Use this locale
|
||||
|
||||
|
@ -74,7 +72,39 @@ ConfirmLocale=Install the locale "%1$S" from %2$S?
|
|||
|
||||
OK=Install
|
||||
|
||||
progress.queued=Queued
|
||||
progress.downloading=Downloading...
|
||||
progress.downloaded=Downloaded
|
||||
progress.installing=Installing...
|
||||
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# Miscellaneous
|
||||
#--------------------------------------------------------------------
|
||||
ERROR=ERROR
|
||||
|
||||
error0=Success
|
||||
error999=Restart to complete
|
||||
error-202=Access denied
|
||||
error-204=Install script not found
|
||||
error-207=Not a valid install package
|
||||
error-208=Invalid argument
|
||||
error-210=User cancelled
|
||||
error-214=Required file does not exist
|
||||
error-215=Read only
|
||||
error-218=AppleSingle extraction error
|
||||
error-219=Invalid path
|
||||
error-225=EXTRACTION_FAILED
|
||||
error-227=Cancelled
|
||||
error-228=Download error
|
||||
error-229=Script error
|
||||
error-230=Already exists
|
||||
error-235=Out of space
|
||||
error-239=Chrome registration failed
|
||||
error-240=Unfinished install
|
||||
error-299=Out of memory
|
||||
|
||||
# there are other error codes, either rare or obsolete,
|
||||
# that are not worth translating at this time.
|
||||
unknown.error=Unexpected error %S
|
||||
|
||||
|
|
|
@ -1,7 +0,0 @@
|
|||
<!ENTITY dialogCancel.label "Cancel">
|
||||
<!ENTITY progress.label "Downloading...">
|
||||
<!ENTITY progressTitle.label "Software Installation">
|
||||
<!ENTITY currentlyProcessing.text "Products">
|
||||
<!ENTITY downloadBeforeUpdate.text "All items will be downloaded before they are updated.">
|
||||
<!ENTITY moduleName.label "Module name">
|
||||
<!ENTITY moduleSource.label "Location">
|
|
@ -58,6 +58,7 @@ REQUIRES = xpcom \
|
|||
docshell \
|
||||
dom \
|
||||
windowwatcher \
|
||||
plugin \
|
||||
$(ZLIB_REQUIRES) \
|
||||
$(NULL)
|
||||
|
||||
|
@ -84,7 +85,6 @@ CPPSRCS = \
|
|||
nsTopProgressNotifier.cpp \
|
||||
nsLoggingProgressNotifier.cpp \
|
||||
ScheduledTasks.cpp \
|
||||
nsInstallProgressDialog.cpp \
|
||||
nsXPIProxy.cpp \
|
||||
nsXPITriggerInfo.cpp \
|
||||
nsXPInstallManager.cpp \
|
||||
|
|
|
@ -48,6 +48,7 @@ REQUIRES = xpcom \
|
|||
windowwatcher \
|
||||
zlib \
|
||||
content \
|
||||
plugin \
|
||||
$(NULL)
|
||||
|
||||
include <$(DEPTH)/config/config.mak>
|
||||
|
@ -102,7 +103,6 @@ OBJS = \
|
|||
.\$(OBJDIR)\nsWinProfile.obj \
|
||||
.\$(OBJDIR)\nsJSWinProfile.obj \
|
||||
.\$(OBJDIR)\nsWinProfileItem.obj \
|
||||
.\$(OBJDIR)\nsInstallProgressDialog.obj \
|
||||
.\$(OBJDIR)\nsXPIProxy.obj \
|
||||
.\$(OBJDIR)\nsXPITriggerInfo.obj \
|
||||
.\$(OBJDIR)\nsXPInstallManager.obj \
|
||||
|
|
|
@ -65,8 +65,6 @@
|
|||
|
||||
#include "nsIProxyObjectManager.h"
|
||||
#include "nsProxiedService.h"
|
||||
#include "nsIPromptService.h"
|
||||
#include "nsIPrompt.h"
|
||||
|
||||
#ifdef _WINDOWS
|
||||
#include "nsWinReg.h"
|
||||
|
@ -110,7 +108,6 @@ nsInstallInfo::nsInstallInfo(PRUint32 aInstallType,
|
|||
const PRUnichar* aArgs,
|
||||
PRUint32 flags,
|
||||
nsIXPIListener* aListener,
|
||||
nsIDOMWindowInternal* aParentWindow,
|
||||
nsIChromeRegistry* aChromeReg)
|
||||
: mError(0),
|
||||
mType(aInstallType),
|
||||
|
@ -119,7 +116,6 @@ nsInstallInfo::nsInstallInfo(PRUint32 aInstallType,
|
|||
mArgs(aArgs),
|
||||
mFile(aFile),
|
||||
mListener(aListener),
|
||||
mParent(aParentWindow),
|
||||
mChromeReg(aChromeReg)
|
||||
{
|
||||
MOZ_COUNT_CTOR(nsInstallInfo);
|
||||
|
@ -151,7 +147,7 @@ nsInstall::nsInstall(nsIZipReader * theJARFile)
|
|||
mPatchList = nsnull;
|
||||
mUninstallPackage = PR_FALSE;
|
||||
mRegisterPackage = PR_FALSE;
|
||||
mStatusSent = PR_FALSE;
|
||||
mFinalStatus = SUCCESS;
|
||||
mStartInstallCompleted = PR_FALSE;
|
||||
mJarFileLocation = nsnull;
|
||||
//mInstallArguments = "";
|
||||
|
@ -321,11 +317,7 @@ nsInstall::GetInstallPlatform(nsCString& aPlatform)
|
|||
void
|
||||
nsInstall::InternalAbort(PRInt32 errcode)
|
||||
{
|
||||
if (mListener)
|
||||
{
|
||||
mListener->FinalStatus(mInstallURL.get(), errcode);
|
||||
mStatusSent = PR_TRUE;
|
||||
}
|
||||
mFinalStatus = errcode;
|
||||
|
||||
nsInstallObject* ie;
|
||||
if (mInstalledFiles != nsnull)
|
||||
|
@ -763,11 +755,7 @@ nsInstall::FinalizeInstall(PRInt32* aReturn)
|
|||
if (*aReturn != nsInstall::SUCCESS)
|
||||
{
|
||||
SaveError( *aReturn );
|
||||
if (mListener)
|
||||
{
|
||||
mListener->FinalStatus(mInstallURL.get(), *aReturn);
|
||||
mStatusSent = PR_TRUE;
|
||||
}
|
||||
mFinalStatus = *aReturn;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -813,8 +801,9 @@ nsInstall::FinalizeInstall(PRInt32* aReturn)
|
|||
char *objString = ie->toString();
|
||||
if (objString)
|
||||
{
|
||||
mListener->FinalizeProgress(NS_ConvertASCIItoUCS2(objString).get(),
|
||||
(i+1), mInstalledFiles->Count());
|
||||
mListener->OnFinalizeProgress(
|
||||
NS_ConvertASCIItoUCS2(objString).get(),
|
||||
(i+1), mInstalledFiles->Count());
|
||||
delete [] objString;
|
||||
}
|
||||
}
|
||||
|
@ -859,22 +848,14 @@ nsInstall::FinalizeInstall(PRInt32* aReturn)
|
|||
else
|
||||
*aReturn = SaveError( result );
|
||||
|
||||
if (mListener)
|
||||
{
|
||||
mListener->FinalStatus(mInstallURL.get(), *aReturn);
|
||||
mStatusSent = PR_TRUE;
|
||||
}
|
||||
mFinalStatus = *aReturn;
|
||||
}
|
||||
else
|
||||
{
|
||||
// no actions queued: don't register the package version
|
||||
// and no need for user confirmation
|
||||
|
||||
if (mListener)
|
||||
{
|
||||
mListener->FinalStatus(mInstallURL.get(), *aReturn);
|
||||
mStatusSent = PR_TRUE;
|
||||
}
|
||||
mFinalStatus = *aReturn;
|
||||
}
|
||||
|
||||
CleanUp();
|
||||
|
@ -1358,14 +1339,13 @@ nsPIXPIProxy* nsInstall::GetUIThreadProxy()
|
|||
}
|
||||
|
||||
PRInt32
|
||||
nsInstall::RefreshPlugins()
|
||||
nsInstall::RefreshPlugins(PRBool aReloadPages)
|
||||
{
|
||||
nsPIXPIProxy* proxy = GetUIThreadProxy();
|
||||
if (!proxy)
|
||||
return UNEXPECTED_ERROR;
|
||||
|
||||
if (proxy)
|
||||
return proxy->RefreshPlugins(GetParentDOMWindow());
|
||||
|
||||
return NS_ERROR_FAILURE;
|
||||
return proxy->RefreshPlugins(aReloadPages);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1373,7 +1353,7 @@ PRInt32
|
|||
nsInstall::ResetError(PRInt32 aError)
|
||||
{
|
||||
mLastError = aError;
|
||||
return NS_OK;
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
PRInt32
|
||||
|
@ -1385,24 +1365,24 @@ nsInstall::SetPackageFolder(nsInstallFolder& aFolder)
|
|||
nsInstallFolder* folder = new nsInstallFolder();
|
||||
if (folder == nsnull)
|
||||
{
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
return OUT_OF_MEMORY;
|
||||
}
|
||||
nsresult res = folder->Init(aFolder, nsAutoString());
|
||||
|
||||
if (NS_FAILED(res))
|
||||
{
|
||||
delete folder;
|
||||
return res;
|
||||
return UNEXPECTED_ERROR;
|
||||
}
|
||||
mPackageFolder = folder;
|
||||
return NS_OK;
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
PRInt32
|
||||
nsInstall::StartInstall(const nsString& aUserPackageName, const nsString& aRegistryPackageName, const nsString& aVersion, PRInt32* aReturn)
|
||||
{
|
||||
if ( aUserPackageName.Length() == 0 )
|
||||
if ( aUserPackageName.IsEmpty() )
|
||||
{
|
||||
// There must be some pretty name for the UI and the uninstall list
|
||||
*aReturn = SaveError(INVALID_ARGUMENTS);
|
||||
|
@ -1424,58 +1404,63 @@ nsInstall::StartInstall(const nsString& aUserPackageName, const nsString& aRegis
|
|||
|
||||
if (*aReturn != nsInstall::SUCCESS)
|
||||
{
|
||||
SaveError( *aReturn );
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if(REGERR_OK == VR_GetDefaultDirectory(
|
||||
NS_CONST_CAST(char *, NS_ConvertUCS2toUTF8(mRegistryPackageName).get()),
|
||||
sizeof(szRegPackagePath), szRegPackagePath))
|
||||
{
|
||||
nsInstallFolder* folder = new nsInstallFolder();
|
||||
if (folder == nsnull)
|
||||
{
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
nsresult res = folder->Init(NS_ConvertASCIItoUCS2(szRegPackagePath), nsAutoString());
|
||||
|
||||
if (NS_FAILED(res))
|
||||
{
|
||||
delete folder;
|
||||
}
|
||||
else
|
||||
{
|
||||
mPackageFolder = folder;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
mPackageFolder = nsnull;
|
||||
}
|
||||
|
||||
// initialize default version
|
||||
if (mVersionInfo != nsnull)
|
||||
delete mVersionInfo;
|
||||
|
||||
mVersionInfo = new nsInstallVersion();
|
||||
if (mVersionInfo == nsnull)
|
||||
{
|
||||
*aReturn = nsInstall::OUT_OF_MEMORY;
|
||||
return SaveError(nsInstall::OUT_OF_MEMORY);
|
||||
*aReturn = SaveError(nsInstall::OUT_OF_MEMORY);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
mVersionInfo->Init(aVersion);
|
||||
|
||||
// initialize item queue
|
||||
mInstalledFiles = new nsVoidArray();
|
||||
|
||||
if (mInstalledFiles == nsnull)
|
||||
{
|
||||
*aReturn = nsInstall::OUT_OF_MEMORY;
|
||||
return SaveError(nsInstall::OUT_OF_MEMORY);
|
||||
*aReturn = SaveError(nsInstall::OUT_OF_MEMORY);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if (mListener)
|
||||
mListener->InstallStarted(mInstallURL.get(), mUIName.get());
|
||||
// initialize default folder if any (errors are OK)
|
||||
if (mPackageFolder != nsnull)
|
||||
delete mPackageFolder;
|
||||
|
||||
mPackageFolder = nsnull;
|
||||
if(REGERR_OK == VR_GetDefaultDirectory(
|
||||
NS_CONST_CAST(char *, NS_ConvertUCS2toUTF8(mRegistryPackageName).get()),
|
||||
sizeof(szRegPackagePath), szRegPackagePath))
|
||||
{
|
||||
// found one saved in the registry
|
||||
mPackageFolder = new nsInstallFolder();
|
||||
if (mPackageFolder)
|
||||
{
|
||||
if (NS_FAILED( mPackageFolder->Init(
|
||||
NS_ConvertASCIItoUCS2(szRegPackagePath),
|
||||
nsAutoString() ) ))
|
||||
{
|
||||
delete mPackageFolder;
|
||||
mPackageFolder = nsnull;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// We've correctly initialized an install transaction
|
||||
// - note that for commands that are only valid within one
|
||||
// - save error in case script doesn't call performInstall or cancelInstall
|
||||
// - broadcast to listeners
|
||||
mStartInstallCompleted = PR_TRUE;
|
||||
mFinalStatus = MALFORMED_INSTALL;
|
||||
if (mListener)
|
||||
mListener->OnPackageNameSet(mInstallURL.get(), mUIName.get());
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -2204,7 +2189,7 @@ void
|
|||
nsInstall::LogComment(nsString& aComment)
|
||||
{
|
||||
if(mListener)
|
||||
mListener->LogComment(aComment.get());
|
||||
mListener->OnLogComment(aComment.get());
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
|
@ -2227,7 +2212,7 @@ nsInstall::ScheduleForInstall(nsInstallObject* ob)
|
|||
// flash current item
|
||||
|
||||
if (mListener)
|
||||
mListener->ItemScheduled(NS_ConvertASCIItoUCS2(objString).get());
|
||||
mListener->OnItemScheduled(NS_ConvertASCIItoUCS2(objString).get());
|
||||
|
||||
|
||||
// do any unpacking or other set-up
|
||||
|
@ -2257,7 +2242,7 @@ nsInstall::ScheduleForInstall(nsInstallObject* ob)
|
|||
nsString errstr; errstr.AssignWithConversion(errprefix);
|
||||
errstr.AppendWithConversion(objString);
|
||||
|
||||
mListener->LogComment( errstr.get() );
|
||||
mListener->OnLogComment( errstr.get() );
|
||||
|
||||
PR_smprintf_free(errprefix);
|
||||
nsCRT::free(errRsrc);
|
||||
|
@ -2549,18 +2534,12 @@ PRUnichar *GetTranslatedString(const PRUnichar* aString)
|
|||
PRInt32
|
||||
nsInstall::Alert(nsString& string)
|
||||
{
|
||||
nsCOMPtr<nsIProxyObjectManager> proxyman(do_GetService(NS_XPCOMPROXY_CONTRACTID));
|
||||
nsCOMPtr<nsIPromptService> dialog(do_GetService("@mozilla.org/embedcomp/prompt-service;1"));
|
||||
nsCOMPtr<nsIPromptService> proxiedDialog;
|
||||
if (proxyman && dialog)
|
||||
proxyman->GetProxyForObject(NS_UI_THREAD_EVENTQ, NS_GET_IID(nsIPromptService),
|
||||
dialog, PROXY_SYNC, getter_AddRefs(proxiedDialog));
|
||||
if (!proxiedDialog)
|
||||
return NS_ERROR_FAILURE;
|
||||
nsPIXPIProxy *ui = GetUIThreadProxy();
|
||||
if (!ui)
|
||||
return UNEXPECTED_ERROR;
|
||||
|
||||
PRUnichar *title = GetTranslatedString(NS_LITERAL_STRING("Alert").get());
|
||||
|
||||
return proxiedDialog->Alert(mParent, title, string.get());
|
||||
return ui->Alert( GetTranslatedString(NS_LITERAL_STRING("Alert").get()),
|
||||
string.get());
|
||||
}
|
||||
|
||||
PRInt32
|
||||
|
@ -2568,18 +2547,13 @@ nsInstall::Confirm(nsString& string, PRBool* aReturn)
|
|||
{
|
||||
*aReturn = PR_FALSE; /* default value */
|
||||
|
||||
nsCOMPtr<nsIProxyObjectManager> proxyman(do_GetService(NS_XPCOMPROXY_CONTRACTID));
|
||||
nsCOMPtr<nsIPromptService> dialog(do_GetService("@mozilla.org/embedcomp/prompt-service;1"));
|
||||
nsCOMPtr<nsIPromptService> proxiedDialog;
|
||||
if (proxyman && dialog)
|
||||
proxyman->GetProxyForObject(NS_UI_THREAD_EVENTQ, NS_GET_IID(nsIPromptService),
|
||||
dialog, PROXY_SYNC, getter_AddRefs(proxiedDialog));
|
||||
if (!proxiedDialog)
|
||||
return NS_ERROR_FAILURE;
|
||||
nsPIXPIProxy *ui = GetUIThreadProxy();
|
||||
if (!ui)
|
||||
return UNEXPECTED_ERROR;
|
||||
|
||||
PRUnichar *title = GetTranslatedString(NS_LITERAL_STRING("Confirm").get());
|
||||
|
||||
return proxiedDialog->Confirm(mParent, title, string.get(), aReturn);
|
||||
return ui->Confirm( GetTranslatedString(NS_LITERAL_STRING("Confirm").get()),
|
||||
string.get(),
|
||||
aReturn);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -81,7 +81,6 @@ class nsInstallInfo
|
|||
const PRUnichar* aArgs,
|
||||
PRUint32 aFlags,
|
||||
nsIXPIListener* aListener,
|
||||
nsIDOMWindowInternal* aParentWindow,
|
||||
nsIChromeRegistry* aChromeReg);
|
||||
|
||||
virtual ~nsInstallInfo();
|
||||
|
@ -93,7 +92,6 @@ class nsInstallInfo
|
|||
PRUint32 GetType() { return mType; }
|
||||
nsIXPIListener* GetListener() { return mListener.get(); }
|
||||
nsIChromeRegistry* GetChromeRegistry() { return mChromeReg.get(); }
|
||||
nsIDOMWindowInternal* GetParentDOMWindow() { return mParent.get(); }
|
||||
|
||||
private:
|
||||
|
||||
|
@ -106,7 +104,6 @@ class nsInstallInfo
|
|||
|
||||
nsCOMPtr<nsIFile> mFile;
|
||||
nsCOMPtr<nsIXPIListener> mListener;
|
||||
nsCOMPtr<nsIDOMWindowInternal> mParent;
|
||||
nsCOMPtr<nsIChromeRegistry> mChromeReg;
|
||||
};
|
||||
|
||||
|
@ -234,7 +231,7 @@ class nsInstall
|
|||
PRInt32 Patch(const nsString& aRegName, const nsString& aVersion, const nsString& aJarSource, nsInstallFolder* aFolder, const nsString& aTargetName, PRInt32* aReturn);
|
||||
PRInt32 Patch(const nsString& aRegName, const nsString& aJarSource, nsInstallFolder* aFolder, const nsString& aTargetName, PRInt32* aReturn);
|
||||
PRInt32 RegisterChrome(nsIFile* chrome, PRUint32 chromeType, const char* path);
|
||||
PRInt32 RefreshPlugins();
|
||||
PRInt32 RefreshPlugins(PRBool aReloadPages);
|
||||
PRInt32 ResetError(PRInt32 aError);
|
||||
PRInt32 SetPackageFolder(nsInstallFolder& aFolder);
|
||||
PRInt32 StartInstall(const nsString& aUserPackageName, const nsString& aPackageName, const nsString& aVersion, PRInt32* aReturn);
|
||||
|
@ -289,11 +286,7 @@ class nsInstall
|
|||
void SetChromeRegistry(nsIChromeRegistry* reg)
|
||||
{ mChromeRegistry = reg; }
|
||||
|
||||
nsIDOMWindowInternal* GetParentDOMWindow() { return mParent; }
|
||||
void SetParentDOMWindow(nsIDOMWindowInternal* parent)
|
||||
{ mParent = parent; }
|
||||
|
||||
PRBool GetStatusSent() { return mStatusSent; }
|
||||
PRUint32 GetFinalStatus() { return mFinalStatus; }
|
||||
PRBool InInstallTransaction(void) { return mInstalledFiles != nsnull; }
|
||||
|
||||
PRInt32 Alert(nsString& string);
|
||||
|
@ -319,11 +312,10 @@ class nsInstall
|
|||
PRUint32 mInstallFlags;
|
||||
nsCString mInstallPlatform;
|
||||
nsIChromeRegistry* mChromeRegistry; // we don't own it, it outlives us
|
||||
nsIDOMWindowInternal* mParent;
|
||||
nsInstallFolder* mPackageFolder;
|
||||
|
||||
PRBool mUserCancelled;
|
||||
PRBool mStatusSent;
|
||||
PRUint32 mFinalStatus;
|
||||
|
||||
PRBool mUninstallPackage;
|
||||
PRBool mRegisterPackage;
|
||||
|
|
|
@ -89,31 +89,25 @@ nsInstallProgressDialog::QueryInterface(REFNSIID aIID,void** aInstancePtr)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsInstallProgressDialog::BeforeJavascriptEvaluation(const PRUnichar *URL)
|
||||
nsInstallProgressDialog::OnInstallStart(const PRUnichar *URL)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsInstallProgressDialog::AfterJavascriptEvaluation(const PRUnichar *URL)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsInstallProgressDialog::InstallStarted(const PRUnichar *URL, const PRUnichar *UIPackageName)
|
||||
nsInstallProgressDialog::OnPackageNameSet(const PRUnichar *URL, const PRUnichar *UIPackageName)
|
||||
{
|
||||
return SetHeading( UIPackageName );
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsInstallProgressDialog::ItemScheduled(const PRUnichar *message)
|
||||
nsInstallProgressDialog::OnItemScheduled(const PRUnichar *message)
|
||||
{
|
||||
return SetActionText( message );
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsInstallProgressDialog::FinalizeProgress(const PRUnichar *message, PRInt32 itemNum, PRInt32 totNum)
|
||||
nsInstallProgressDialog::OnFinalizeProgress(const PRUnichar *message, PRInt32 itemNum, PRInt32 totNum)
|
||||
{
|
||||
|
||||
nsresult rv = SetActionText( message );
|
||||
|
@ -125,14 +119,14 @@ nsInstallProgressDialog::FinalizeProgress(const PRUnichar *message, PRInt32 item
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsInstallProgressDialog::FinalStatus(const PRUnichar *URL, PRInt32 status)
|
||||
nsInstallProgressDialog::OnInstallDone(const PRUnichar *URL, PRInt32 status)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsInstallProgressDialog::LogComment(const PRUnichar* comment)
|
||||
nsInstallProgressDialog::OnLogComment(const PRUnichar* comment)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -67,11 +67,6 @@ static nsXPIResourceTableItem XPIResTable[] =
|
|||
// XXX FileOp*() action strings
|
||||
// XXX WinReg and WinProfile action strings
|
||||
|
||||
/*---------------------------------------------------------------------*
|
||||
* Dialog Messages
|
||||
*---------------------------------------------------------------------*/
|
||||
{ "FinishingInstallMsg", "Finishing install... please wait." },
|
||||
|
||||
/*---------------------------------------------------------------------*
|
||||
* Miscellaneous
|
||||
*---------------------------------------------------------------------*/
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
|
||||
#include "nsIContentHandler.h"
|
||||
|
||||
#define NOT_CHROME 0
|
||||
#define CHROME_SKIN 1
|
||||
#define CHROME_LOCALE 2
|
||||
#define CHROME_SAFEMAX CHROME_SKIN
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
|
@ -22,7 +22,7 @@
|
|||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
|
@ -67,7 +67,7 @@ extern JSClass FileOpClass;
|
|||
//
|
||||
// Install property ids
|
||||
//
|
||||
enum Install_slots
|
||||
enum Install_slots
|
||||
{
|
||||
INSTALL_PLATFORM = -1,
|
||||
INSTALL_JARFILE = -2,
|
||||
|
@ -75,7 +75,7 @@ enum Install_slots
|
|||
INSTALL_ARGUMENTS = -4,
|
||||
INSTALL_URL = -5,
|
||||
INSTALL_FLAGS = -6,
|
||||
INSTALL_STATUSSENT = -7,
|
||||
INSTALL_FINALSTATUS = -7,
|
||||
INSTALL_INSTALL = -8,
|
||||
INSTALL_INSTALLED_FILES = -9
|
||||
};
|
||||
|
@ -102,7 +102,7 @@ GetInstallProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
if (JSVAL_IS_INT(id))
|
||||
if (JSVAL_IS_INT(id))
|
||||
{
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case INSTALL_PLATFORM:
|
||||
|
@ -120,7 +120,7 @@ GetInstallProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
if ( folder )
|
||||
{
|
||||
folder->Init(a->GetJarFileLocation());
|
||||
JSObject* fileSpecObject =
|
||||
JSObject* fileSpecObject =
|
||||
JS_NewObject(cx, &FileSpecObjectClass, gFileSpecProto, NULL);
|
||||
|
||||
if (fileSpecObject)
|
||||
|
@ -137,20 +137,20 @@ GetInstallProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
case INSTALL_ARGUMENTS:
|
||||
{
|
||||
nsAutoString prop;
|
||||
|
||||
a->GetInstallArguments(prop);
|
||||
|
||||
a->GetInstallArguments(prop);
|
||||
*vp = STRING_TO_JSVAL( JS_NewUCStringCopyN(cx, NS_REINTERPRET_CAST(const jschar*, prop.get()), prop.Length()) );
|
||||
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
case INSTALL_URL:
|
||||
{
|
||||
nsString prop;
|
||||
|
||||
a->GetInstallURL(prop);
|
||||
|
||||
a->GetInstallURL(prop);
|
||||
*vp = STRING_TO_JSVAL( JS_NewUCStringCopyN(cx, NS_REINTERPRET_CAST(const jschar*, prop.get()), prop.Length()) );
|
||||
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -158,14 +158,14 @@ GetInstallProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
*vp = INT_TO_JSVAL( a->GetInstallFlags() );
|
||||
break;
|
||||
|
||||
case INSTALL_STATUSSENT:
|
||||
*vp = BOOLEAN_TO_JSVAL( a->GetStatusSent() );
|
||||
case INSTALL_FINALSTATUS:
|
||||
*vp = INT_TO_JSVAL( a->GetFinalStatus() );
|
||||
break;
|
||||
|
||||
case INSTALL_INSTALL:
|
||||
*vp = OBJECT_TO_JSVAL(obj);
|
||||
break;
|
||||
|
||||
|
||||
case INSTALL_INSTALLED_FILES:
|
||||
*vp = BOOLEAN_TO_JSVAL( a->InInstallTransaction() );
|
||||
break;
|
||||
|
@ -273,7 +273,7 @@ PRBool ConvertJSValToObj(nsISupports** aSupports,
|
|||
*aSupports = nsnull;
|
||||
}
|
||||
else if (JSVAL_IS_OBJECT(aValue)) {
|
||||
JSObject* jsobj = JSVAL_TO_OBJECT(aValue);
|
||||
JSObject* jsobj = JSVAL_TO_OBJECT(aValue);
|
||||
JSClass* jsclass = JS_GetClass(aContext, jsobj);
|
||||
if ((nsnull != jsclass) && (jsclass->flags & JSCLASS_HAS_PRIVATE)) {
|
||||
nsISupports *supports = (nsISupports *)JS_GetPrivate(aContext, jsobj);
|
||||
|
@ -303,7 +303,7 @@ PRBool ConvertJSValToObj(nsISupports** aSupports,
|
|||
void ConvertJSvalToVersionString(nsString& versionString, JSContext* cx, jsval argument)
|
||||
{
|
||||
versionString.SetLength(0);
|
||||
|
||||
|
||||
if( JSVAL_IS_OBJECT(argument) )
|
||||
{
|
||||
if(!JSVAL_IS_NULL(argument))
|
||||
|
@ -311,7 +311,7 @@ void ConvertJSvalToVersionString(nsString& versionString, JSContext* cx, jsval a
|
|||
JSObject* jsobj = JSVAL_TO_OBJECT(argument);
|
||||
JSClass* jsclass = JS_GetClass(cx, jsobj);
|
||||
|
||||
if ((nsnull != jsclass) && (jsclass->flags & JSCLASS_HAS_PRIVATE))
|
||||
if ((nsnull != jsclass) && (jsclass->flags & JSCLASS_HAS_PRIVATE))
|
||||
{
|
||||
nsIDOMInstallVersion* version = (nsIDOMInstallVersion*)JS_GetPrivate(cx, jsobj);
|
||||
version->ToString(versionString);
|
||||
|
@ -404,12 +404,12 @@ InstallAddDirectory(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
if (argc == 1)
|
||||
if (argc == 1)
|
||||
{
|
||||
// public int AddDirectory (String jarSourcePath)
|
||||
|
||||
ConvertJSValToStr(b0, cx, argv[0]);
|
||||
|
||||
|
||||
if(NS_OK != nativeThis->AddDirectory(b0, &nativeRet))
|
||||
{
|
||||
return JS_FALSE;
|
||||
|
@ -417,12 +417,12 @@ InstallAddDirectory(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval
|
|||
|
||||
*rval = INT_TO_JSVAL(nativeRet);
|
||||
}
|
||||
else if (argc == 4)
|
||||
else if (argc == 4)
|
||||
{
|
||||
// public int AddDirectory ( String registryName,
|
||||
// String jarSourcePath,
|
||||
// String localDirSpec,
|
||||
// String relativeLocalPath);
|
||||
// String relativeLocalPath);
|
||||
|
||||
ConvertJSValToStr(b0, cx, argv[0]);
|
||||
ConvertJSValToStr(b1, cx, argv[1]);
|
||||
|
@ -451,13 +451,13 @@ InstallAddDirectory(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval
|
|||
|
||||
*rval = INT_TO_JSVAL(nativeRet);
|
||||
}
|
||||
else if (argc == 5)
|
||||
else if (argc == 5)
|
||||
{
|
||||
// public int AddDirectory ( String registryName,
|
||||
// String version, --OR-- VersionInfo version
|
||||
// String jarSourcePath,
|
||||
// Object localDirSpec,
|
||||
// String relativeLocalPath);
|
||||
// String relativeLocalPath);
|
||||
|
||||
ConvertJSValToStr(b0, cx, argv[0]);
|
||||
ConvertJSvalToVersionString(b1, cx, argv[1]);
|
||||
|
@ -470,33 +470,33 @@ InstallAddDirectory(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval
|
|||
nativeThis->SaveError(nsInstall::INVALID_ARGUMENTS);
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
|
||||
jsObj = JSVAL_TO_OBJECT(argv[3]);
|
||||
if (!JS_InstanceOf(cx, jsObj, &FileSpecObjectClass, nsnull))
|
||||
{
|
||||
*rval = INT_TO_JSVAL(nsInstall::INVALID_ARGUMENTS);
|
||||
nativeThis->SaveError(nsInstall::INVALID_ARGUMENTS);
|
||||
return JS_TRUE;
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
|
||||
folder = (nsInstallFolder*)JS_GetPrivate(cx, jsObj);
|
||||
|
||||
if(NS_OK != nativeThis->AddDirectory(b0, b1, b2, folder, b4, &nativeRet))
|
||||
{
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
|
||||
*rval = INT_TO_JSVAL(nativeRet);
|
||||
|
||||
}
|
||||
else if (argc == 6)
|
||||
{
|
||||
// public int AddDirectory ( String registryName,
|
||||
// String version, --OR-- VersionInfo version,
|
||||
// String version, --OR-- VersionInfo version,
|
||||
// String jarSourcePath,
|
||||
// Object localDirSpec,
|
||||
// String relativeLocalPath,
|
||||
// Int flags);
|
||||
// Int flags);
|
||||
|
||||
ConvertJSValToStr(b0, cx, argv[0]);
|
||||
ConvertJSvalToVersionString(b1, cx, argv[1]);
|
||||
|
@ -515,7 +515,7 @@ InstallAddDirectory(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval
|
|||
{
|
||||
*rval = INT_TO_JSVAL(nsInstall::INVALID_ARGUMENTS);
|
||||
nativeThis->SaveError(nsInstall::INVALID_ARGUMENTS);
|
||||
return JS_TRUE;
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
if(JSVAL_IS_INT(argv[5]))
|
||||
|
@ -529,7 +529,7 @@ InstallAddDirectory(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval
|
|||
{
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
|
||||
*rval = INT_TO_JSVAL(nativeRet);
|
||||
}
|
||||
else
|
||||
|
@ -570,17 +570,17 @@ InstallAddSubcomponent(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, js
|
|||
if(argc >= 6)
|
||||
{
|
||||
// public int AddSubcomponent ( String registryName,
|
||||
// String version, --OR-- VersionInfo version,
|
||||
// String version, --OR-- VersionInfo version,
|
||||
// String jarSourcePath,
|
||||
// Object localDirSpec,
|
||||
// String relativeLocalPath,
|
||||
// Int flags);
|
||||
// Int flags);
|
||||
|
||||
ConvertJSValToStr(b0, cx, argv[0]);
|
||||
ConvertJSvalToVersionString(b1, cx, argv[1]);
|
||||
ConvertJSValToStr(b2, cx, argv[2]);
|
||||
ConvertJSValToStr(b4, cx, argv[4]);
|
||||
|
||||
|
||||
if ((argv[3] == JSVAL_NULL) || !JSVAL_IS_OBJECT(argv[3])) //argv[3] MUST be a jsval
|
||||
{
|
||||
*rval = INT_TO_JSVAL(nsInstall::INVALID_ARGUMENTS);
|
||||
|
@ -593,7 +593,7 @@ InstallAddSubcomponent(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, js
|
|||
{
|
||||
*rval = INT_TO_JSVAL(nsInstall::INVALID_ARGUMENTS);
|
||||
nativeThis->SaveError(nsInstall::INVALID_ARGUMENTS);
|
||||
return JS_TRUE;
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
if(JSVAL_IS_INT(argv[5]))
|
||||
|
@ -638,7 +638,7 @@ InstallAddSubcomponent(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, js
|
|||
{
|
||||
*rval = INT_TO_JSVAL(nsInstall::INVALID_ARGUMENTS);
|
||||
nativeThis->SaveError(nsInstall::INVALID_ARGUMENTS);
|
||||
return JS_TRUE;
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
folder = (nsInstallFolder*)JS_GetPrivate(cx, jsObj);
|
||||
|
@ -649,7 +649,7 @@ InstallAddSubcomponent(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, js
|
|||
JS_ResumeRequest(cx, saveDepth);
|
||||
if (NS_FAILED(rv))
|
||||
return JS_FALSE;
|
||||
|
||||
|
||||
*rval = INT_TO_JSVAL(nativeRet);
|
||||
}
|
||||
else if(argc >= 4)
|
||||
|
@ -669,13 +669,13 @@ InstallAddSubcomponent(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, js
|
|||
nativeThis->SaveError(nsInstall::INVALID_ARGUMENTS);
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
|
||||
jsObj = JSVAL_TO_OBJECT(argv[2]);
|
||||
if (!JS_InstanceOf(cx, jsObj, &FileSpecObjectClass, nsnull))
|
||||
{
|
||||
*rval = INT_TO_JSVAL(nsInstall::INVALID_ARGUMENTS);
|
||||
nativeThis->SaveError(nsInstall::INVALID_ARGUMENTS);
|
||||
return JS_TRUE;
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
folder = (nsInstallFolder*)JS_GetPrivate(cx, jsObj);
|
||||
|
@ -752,10 +752,10 @@ InstallDiskSpaceAvailable(JSContext *cx, JSObject *obj, uintN argc, jsval *argv,
|
|||
}
|
||||
|
||||
double d;
|
||||
|
||||
|
||||
LL_L2D(d, nativeRet);
|
||||
JS_NewDoubleValue( cx, d, rval );
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -791,7 +791,7 @@ InstallExecute(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rva
|
|||
// public int Execute ( String jarSourcePath,
|
||||
// String args,
|
||||
// Bool blocking);
|
||||
|
||||
|
||||
ConvertJSValToStr(b1, cx, argv[1]);
|
||||
ConvertJSValToBool(&blocking, cx,argv[2]);
|
||||
}
|
||||
|
@ -957,7 +957,7 @@ InstallGetComponentFolder(JSContext *cx, JSObject *obj, uintN argc, jsval *argv,
|
|||
{
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
|
||||
/* Now create the new JSObject */
|
||||
JSObject* fileSpecObject;
|
||||
|
||||
|
@ -997,7 +997,7 @@ InstallGetFolder(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *r
|
|||
if(argc >= 2)
|
||||
{
|
||||
ConvertJSValToStr(b1, cx, argv[1]); // we know that the second param must be a string
|
||||
if(JSVAL_IS_STRING(argv[0])) // check if the first argument is a string
|
||||
if(JSVAL_IS_STRING(argv[0])) // check if the first argument is a string
|
||||
{
|
||||
ConvertJSValToStr(b0, cx, argv[0]);
|
||||
if(NS_OK != nativeThis->GetFolder(b0, b1, &folder))
|
||||
|
@ -1005,7 +1005,7 @@ InstallGetFolder(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *r
|
|||
}
|
||||
else /* it must be an object */
|
||||
{
|
||||
|
||||
|
||||
if ((argv[0] == JSVAL_NULL) || !JSVAL_IS_OBJECT(argv[0])) //argv[0] MUST be a jsval
|
||||
{
|
||||
*rval = JSVAL_NULL;
|
||||
|
@ -1018,7 +1018,7 @@ InstallGetFolder(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *r
|
|||
{
|
||||
*rval = JSVAL_NULL;
|
||||
JS_ReportError(cx, "GetFolder:Invalid Parameter");
|
||||
return JS_TRUE;
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
folder = (nsInstallFolder*)JS_GetPrivate(cx, jsObj);
|
||||
|
@ -1071,7 +1071,7 @@ InstallGetFolder(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *r
|
|||
}
|
||||
|
||||
|
||||
return JS_TRUE;
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1115,7 +1115,7 @@ InstallGetWinProfile(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsva
|
|||
nsInstall *nativeThis = (nsInstall*)JS_GetPrivate(cx, obj);
|
||||
nsAutoString b0;
|
||||
nsAutoString b1;
|
||||
|
||||
|
||||
// If there's no private data, this must be the prototype, so ignore
|
||||
if(nsnull == nativeThis)
|
||||
{
|
||||
|
@ -1155,7 +1155,7 @@ InstallGetWinRegistry(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsv
|
|||
*rval = JSVAL_NULL;
|
||||
|
||||
#ifdef _WINDOWS
|
||||
|
||||
|
||||
nsInstall *nativeThis = (nsInstall*)JS_GetPrivate(cx, obj);
|
||||
|
||||
// If there's no private data, this must be the prototype, so ignore
|
||||
|
@ -1194,16 +1194,16 @@ InstallLoadResources(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsva
|
|||
|
||||
if (argc >= 1)
|
||||
{
|
||||
ConvertJSValToStr(b0, cx, argv[0]);
|
||||
if (NS_OK != nativeThis->LoadResources(cx, b0, rval))
|
||||
{
|
||||
return JS_FALSE;
|
||||
}
|
||||
ConvertJSValToStr(b0, cx, argv[0]);
|
||||
if (NS_OK != nativeThis->LoadResources(cx, b0, rval))
|
||||
{
|
||||
return JS_FALSE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
JS_ReportError(cx, "Function LoadResources requires 1 parameter");
|
||||
return JS_FALSE;
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
return JS_TRUE;
|
||||
|
@ -1225,7 +1225,7 @@ InstallPatch(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
|||
nsAutoString b4;
|
||||
|
||||
JSObject *jsObj;
|
||||
|
||||
|
||||
nsInstallFolder *folder = nsnull;
|
||||
|
||||
|
||||
|
@ -1255,7 +1255,7 @@ InstallPatch(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
|||
nativeThis->SaveError(nsInstall::INVALID_ARGUMENTS);
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
|
||||
jsObj = JSVAL_TO_OBJECT(argv[3]);
|
||||
if (!JS_InstanceOf(cx, jsObj, &FileSpecObjectClass, nsnull))
|
||||
{
|
||||
|
@ -1283,14 +1283,14 @@ InstallPatch(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
|||
ConvertJSValToStr(b0, cx, argv[0]);
|
||||
ConvertJSValToStr(b1, cx, argv[1]);
|
||||
ConvertJSValToStr(b2, cx, argv[3]);
|
||||
|
||||
|
||||
if ((argv[2] == JSVAL_NULL) || !JSVAL_IS_OBJECT(argv[2])) //argv[2] MUST be a jsval
|
||||
{
|
||||
*rval = INT_TO_JSVAL(nsInstall::INVALID_ARGUMENTS);
|
||||
nativeThis->SaveError(nsInstall::INVALID_ARGUMENTS);
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
|
||||
jsObj = JSVAL_TO_OBJECT(argv[2]);
|
||||
if (!JS_InstanceOf(cx, jsObj, &FileSpecObjectClass, nsnull))
|
||||
{
|
||||
|
@ -1323,7 +1323,7 @@ InstallPatch(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
|||
// int registerChrome(
|
||||
// int type,
|
||||
// FileSpecObject chrome,
|
||||
// String extraPath)
|
||||
// String extraPath)
|
||||
PR_STATIC_CALLBACK(JSBool)
|
||||
InstallRegisterChrome(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
||||
{
|
||||
|
@ -1373,11 +1373,17 @@ InstallRefreshPlugins(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsv
|
|||
{
|
||||
// If there's no private data, this must be the prototype, so ignore
|
||||
nsInstall *nativeThis = (nsInstall*)JS_GetPrivate(cx, obj);
|
||||
if (!nativeThis) {
|
||||
if (!nativeThis)
|
||||
{
|
||||
*rval = INT_TO_JSVAL(nsInstall::UNEXPECTED_ERROR);
|
||||
}
|
||||
else {
|
||||
*rval = INT_TO_JSVAL(nativeThis->RefreshPlugins());
|
||||
else
|
||||
{
|
||||
PRBool reloadPages = PR_TRUE;
|
||||
if (argc >= 1)
|
||||
reloadPages = JSVAL_TO_BOOLEAN(argv[0]);
|
||||
|
||||
*rval = INT_TO_JSVAL(nativeThis->RefreshPlugins(reloadPages));
|
||||
}
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
@ -1397,7 +1403,7 @@ InstallResetError(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *
|
|||
if (!nativeThis)
|
||||
return JS_TRUE;
|
||||
|
||||
// Supported forms:
|
||||
// Supported forms:
|
||||
// void resetError()
|
||||
// void resetError(int error)
|
||||
int32 val = 0;
|
||||
|
@ -1443,16 +1449,16 @@ InstallSetPackageFolder(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, j
|
|||
{
|
||||
*rval = INT_TO_JSVAL(nsInstall::INVALID_ARGUMENTS);
|
||||
nativeThis->SaveError(nsInstall::INVALID_ARGUMENTS);
|
||||
return JS_TRUE;
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
folder = (nsInstallFolder*)JS_GetPrivate(cx, jsObj);
|
||||
if (!folder)
|
||||
{
|
||||
JS_ReportError(cx, "setPackageFolder:Invalid Parameter");
|
||||
return JS_FALSE;
|
||||
return JS_FALSE;
|
||||
}
|
||||
else
|
||||
else
|
||||
if(NS_OK != nativeThis->SetPackageFolder(*folder))
|
||||
return JS_FALSE;
|
||||
|
||||
|
@ -1565,9 +1571,9 @@ PR_STATIC_CALLBACK(JSBool)
|
|||
InstallTRACE(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
||||
{
|
||||
nsAutoString b0;
|
||||
|
||||
|
||||
ConvertJSValToStr(b0, cx, argv[0]);
|
||||
|
||||
|
||||
char *tempStr;
|
||||
tempStr = ToNewCString(b0);
|
||||
printf("Install:\t%s\n", tempStr);
|
||||
|
@ -1680,7 +1686,7 @@ InstallConfirm(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rva
|
|||
jsrefcount saveDepth = JS_SuspendRequest(cx);//Need to suspend use of thread or deadlock occurs
|
||||
|
||||
nativeThis->Confirm(b0, &nativeRet);
|
||||
|
||||
|
||||
JS_ResumeRequest(cx, saveDepth);
|
||||
|
||||
*rval = INT_TO_JSVAL(nativeRet);
|
||||
|
@ -1699,7 +1705,7 @@ InstallConfirm(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rva
|
|||
// class for Install
|
||||
//
|
||||
JSClass InstallClass = {
|
||||
"Install",
|
||||
"Install",
|
||||
JSCLASS_HAS_PRIVATE,
|
||||
JS_PropertyStub,
|
||||
JS_PropertyStub,
|
||||
|
@ -1722,14 +1728,14 @@ static JSPropertySpec InstallProperties[] =
|
|||
{"arguments", INSTALL_ARGUMENTS, JSPROP_ENUMERATE | JSPROP_READONLY},
|
||||
{"url", INSTALL_URL, JSPROP_ENUMERATE | JSPROP_READONLY},
|
||||
{"flags", INSTALL_FLAGS, JSPROP_ENUMERATE | JSPROP_READONLY},
|
||||
{"_statusSent", INSTALL_STATUSSENT, JSPROP_READONLY},
|
||||
{"_finalStatus", INSTALL_FINALSTATUS, JSPROP_READONLY},
|
||||
{"Install", INSTALL_INSTALL, JSPROP_READONLY},
|
||||
{"_installedFiles", INSTALL_INSTALLED_FILES, JSPROP_READONLY},
|
||||
{0}
|
||||
};
|
||||
|
||||
|
||||
static JSConstDoubleSpec install_constants[] =
|
||||
static JSConstDoubleSpec install_constants[] =
|
||||
{
|
||||
{ nsInstall::BAD_PACKAGE_NAME, "BAD_PACKAGE_NAME" },
|
||||
{ nsInstall::UNEXPECTED_ERROR, "UNEXPECTED_ERROR" },
|
||||
|
@ -1803,7 +1809,7 @@ static JSConstDoubleSpec install_constants[] =
|
|||
//
|
||||
// Install class methods
|
||||
//
|
||||
static JSFunctionSpec InstallMethods[] =
|
||||
static JSFunctionSpec InstallMethods[] =
|
||||
{
|
||||
/*START HACK FOR DEBUGGING UNTIL ALERTS WORK*/
|
||||
{"TRACE", InstallTRACE, 1},
|
||||
|
@ -1827,7 +1833,7 @@ static JSFunctionSpec InstallMethods[] =
|
|||
{"patch", InstallPatch, 5},
|
||||
{"performInstall", InstallFinalizeInstall, 0},
|
||||
{"registerChrome", InstallRegisterChrome, 2},
|
||||
{"refreshPlugins", InstallRefreshPlugins, 0},
|
||||
{"refreshPlugins", InstallRefreshPlugins, 1},
|
||||
{"resetError", InstallResetError, 1},
|
||||
// {"selectChrome", InstallSelectChrome, 2},
|
||||
{"setPackageFolder", InstallSetPackageFolder, 1},
|
||||
|
@ -1860,7 +1866,7 @@ static JSFunctionSpec InstallMethods[] =
|
|||
{"deleteRegisteredFile", InstallDeleteComponent, 1},
|
||||
|
||||
// -- obsolete forms for temporary compatibility --
|
||||
{"abortInstall", InstallAbortInstall, 1},
|
||||
{"abortInstall", InstallAbortInstall, 1},
|
||||
{"finalizeInstall", InstallFinalizeInstall, 0},
|
||||
{"startInstall", InstallStartInstall, 4},
|
||||
{0}
|
||||
|
@ -1870,14 +1876,13 @@ static JSFunctionSpec InstallMethods[] =
|
|||
|
||||
|
||||
|
||||
JSObject * InitXPInstallObjects(JSContext *jscontext,
|
||||
JSObject *global,
|
||||
nsIFile* jarfile,
|
||||
JSObject * InitXPInstallObjects(JSContext *jscontext,
|
||||
JSObject *global,
|
||||
nsIFile* jarfile,
|
||||
const PRUnichar* url,
|
||||
const PRUnichar* args,
|
||||
PRUint32 flags,
|
||||
nsIChromeRegistry* reg,
|
||||
nsIDOMWindowInternal* aParent,
|
||||
nsIZipReader * theJARFile)
|
||||
{
|
||||
JSObject *installObject = nsnull;
|
||||
|
@ -1892,7 +1897,7 @@ JSObject * InitXPInstallObjects(JSContext *jscontext,
|
|||
|
||||
installObject = JS_InitClass( jscontext, // context
|
||||
global, // global object
|
||||
nsnull, // parent proto
|
||||
nsnull, // parent proto
|
||||
&InstallClass, // JSClass
|
||||
nsnull, // JSNative ctor
|
||||
0, // ctor args
|
||||
|
@ -1901,14 +1906,14 @@ JSObject * InitXPInstallObjects(JSContext *jscontext,
|
|||
InstallProperties, // ctor props (static)
|
||||
InstallMethods); // ctor funcs (static)
|
||||
|
||||
if (nsnull == installObject)
|
||||
if (nsnull == installObject)
|
||||
{
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
if ( PR_FALSE == JS_DefineConstDoubles(jscontext, installObject, install_constants) )
|
||||
return nsnull;
|
||||
|
||||
|
||||
nativeInstallObject = new nsInstall(theJARFile);
|
||||
|
||||
nativeInstallObject->SetJarFileLocation(jarfile);
|
||||
|
@ -1916,7 +1921,6 @@ JSObject * InitXPInstallObjects(JSContext *jscontext,
|
|||
nativeInstallObject->SetInstallURL(nsAutoString(url));
|
||||
nativeInstallObject->SetInstallFlags(flags);
|
||||
nativeInstallObject->SetChromeRegistry(reg);
|
||||
nativeInstallObject->SetParentDOMWindow(aParent);
|
||||
|
||||
JS_SetPrivate(jscontext, installObject, nativeInstallObject);
|
||||
nativeInstallObject->SetScriptObject(installObject);
|
||||
|
@ -1933,12 +1937,12 @@ JSObject * InitXPInstallObjects(JSContext *jscontext,
|
|||
gFileOpObject = JS_NewObject(jscontext, &FileOpClass, gFileOpProto, nsnull);
|
||||
if (gFileOpObject == nsnull)
|
||||
return nsnull;
|
||||
|
||||
|
||||
JS_SetPrivate(jscontext, gFileOpObject, nativeInstallObject);
|
||||
|
||||
JS_DefineProperty (jscontext, installObject, "File", OBJECT_TO_JSVAL(gFileOpObject),
|
||||
JS_PropertyStub, JS_PropertyStub, JSPROP_READONLY | JSPROP_PERMANENT);
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Initialize the FileSpecObject
|
||||
|
|
|
@ -10,15 +10,15 @@
|
|||
* 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 Original Code is Mozilla Communicator client code,
|
||||
* released March 31, 1998.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape Communications
|
||||
* 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.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Contributor(s):
|
||||
* Douglas Turner <dougt@netscape.com>
|
||||
* Pierre Phaneuf <pp@ludusdesign.com>
|
||||
* Samir Gehani <sgehani@netscape.com>
|
||||
|
@ -63,16 +63,16 @@ nsLoggingProgressListener::~nsLoggingProgressListener()
|
|||
NS_IMPL_ISUPPORTS1(nsLoggingProgressListener, nsIXPIListener)
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsLoggingProgressListener::BeforeJavascriptEvaluation(const PRUnichar *URL)
|
||||
nsLoggingProgressListener::OnInstallStart(const PRUnichar *URL)
|
||||
{
|
||||
nsCOMPtr<nsIFile> iFile;
|
||||
nsFileSpec *logFile = nsnull;
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
// Not in stub installer
|
||||
if (!nsSoftwareUpdate::GetProgramDirectory())
|
||||
if (!nsSoftwareUpdate::GetProgramDirectory())
|
||||
{
|
||||
nsCOMPtr<nsIProperties> dirSvc =
|
||||
nsCOMPtr<nsIProperties> dirSvc =
|
||||
do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID, &rv);
|
||||
if (!dirSvc) return NS_ERROR_FAILURE;
|
||||
dirSvc->Get(NS_OS_CURRENT_PROCESS_DIR, NS_GET_IID(nsIFile),
|
||||
|
@ -108,11 +108,11 @@ nsLoggingProgressListener::BeforeJavascriptEvaluation(const PRUnichar *URL)
|
|||
{
|
||||
nsCOMPtr<nsILocalFileMac> iMacFile = do_QueryInterface(iFile);
|
||||
iMacFile->SetFileType('TEXT');
|
||||
iMacFile->SetFileCreator('R*ch');
|
||||
iMacFile->SetFileCreator('R*ch');
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
if (!bTryProfileDir)
|
||||
{
|
||||
rv = iFile->IsWritable(&bWritable);
|
||||
|
@ -122,14 +122,14 @@ nsLoggingProgressListener::BeforeJavascriptEvaluation(const PRUnichar *URL)
|
|||
|
||||
if (bTryProfileDir)
|
||||
{
|
||||
// failed to create the log file in the application directory
|
||||
// failed to create the log file in the application directory
|
||||
// so try to create the log file in the user's profile directory
|
||||
nsCOMPtr<nsIProperties> dirSvc =
|
||||
nsCOMPtr<nsIProperties> dirSvc =
|
||||
do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID, &rv);
|
||||
if (!dirSvc) return NS_ERROR_FAILURE;
|
||||
dirSvc->Get(NS_APP_USER_PROFILE_50_DIR, NS_GET_IID(nsIFile),
|
||||
getter_AddRefs(iFile));
|
||||
|
||||
|
||||
if (!nsSoftwareUpdate::GetLogName())
|
||||
rv = iFile->Append(INSTALL_LOG);
|
||||
else
|
||||
|
@ -145,14 +145,14 @@ nsLoggingProgressListener::BeforeJavascriptEvaluation(const PRUnichar *URL)
|
|||
{
|
||||
rv = iFile->Create(nsIFile::NORMAL_FILE_TYPE, 0644);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
#ifdef XP_MAC
|
||||
|
||||
#ifdef XP_MAC
|
||||
nsCOMPtr<nsILocalFileMac> iMacFile = do_QueryInterface(iFile);
|
||||
iMacFile->SetFileType('TEXT');
|
||||
iMacFile->SetFileCreator('R*ch');
|
||||
#endif
|
||||
iMacFile->SetFileCreator('R*ch');
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
rv = iFile->IsWritable(&bWritable);
|
||||
if (NS_FAILED(rv) || !bWritable) return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
@ -162,7 +162,7 @@ nsLoggingProgressListener::BeforeJavascriptEvaluation(const PRUnichar *URL)
|
|||
if (!logFile) return NS_ERROR_NULL_POINTER;
|
||||
|
||||
mLogStream = new nsOutputFileStream(*logFile, PR_WRONLY | PR_CREATE_FILE | PR_APPEND, 0744 );
|
||||
if (!mLogStream)
|
||||
if (!mLogStream)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
char* time;
|
||||
|
@ -183,15 +183,39 @@ nsLoggingProgressListener::BeforeJavascriptEvaluation(const PRUnichar *URL)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsLoggingProgressListener::AfterJavascriptEvaluation(const PRUnichar *URL)
|
||||
nsLoggingProgressListener::OnInstallDone(const PRUnichar *aURL, PRInt32 aStatus)
|
||||
{
|
||||
if (mLogStream == nsnull) return NS_ERROR_NULL_POINTER;
|
||||
|
||||
|
||||
*mLogStream << nsEndl;
|
||||
|
||||
switch (aStatus)
|
||||
{
|
||||
case nsInstall::SUCCESS:
|
||||
*mLogStream << " Install completed successfully";
|
||||
break;
|
||||
|
||||
case nsInstall::REBOOT_NEEDED:
|
||||
*mLogStream << " Install completed successfully, restart required";
|
||||
break;
|
||||
|
||||
case nsInstall::INSTALL_CANCELLED:
|
||||
*mLogStream << " Install cancelled by script";
|
||||
break;
|
||||
|
||||
case nsInstall::USER_CANCELLED:
|
||||
*mLogStream << " Install cancelled by user";
|
||||
break;
|
||||
|
||||
default:
|
||||
*mLogStream << " Install **FAILED** with error " << aStatus;
|
||||
break;
|
||||
}
|
||||
|
||||
char* time;
|
||||
GetTime(&time);
|
||||
|
||||
// *mLogStream << nsEndl;
|
||||
*mLogStream << " Finished Installation " << time << nsEndl << nsEndl;
|
||||
*mLogStream << " -- " << time << nsEndl << nsEndl;
|
||||
|
||||
PL_strfree(time);
|
||||
|
||||
|
@ -203,7 +227,7 @@ nsLoggingProgressListener::AfterJavascriptEvaluation(const PRUnichar *URL)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsLoggingProgressListener::InstallStarted(const PRUnichar *URL, const PRUnichar* UIPackageName)
|
||||
nsLoggingProgressListener::OnPackageNameSet(const PRUnichar *URL, const PRUnichar* UIPackageName)
|
||||
{
|
||||
if (mLogStream == nsnull) return NS_ERROR_NULL_POINTER;
|
||||
|
||||
|
@ -220,7 +244,7 @@ nsLoggingProgressListener::InstallStarted(const PRUnichar *URL, const PRUnichar*
|
|||
*mLogStream << " " << uline.get() << nsEndl;
|
||||
|
||||
*mLogStream << nsEndl;
|
||||
// *mLogStream << " Starting Installation at " << time << nsEndl;
|
||||
// *mLogStream << " Starting Installation at " << time << nsEndl;
|
||||
// *mLogStream << nsEndl;
|
||||
|
||||
|
||||
|
@ -229,13 +253,13 @@ nsLoggingProgressListener::InstallStarted(const PRUnichar *URL, const PRUnichar*
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsLoggingProgressListener::ItemScheduled(const PRUnichar* message )
|
||||
nsLoggingProgressListener::OnItemScheduled(const PRUnichar* message )
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsLoggingProgressListener::FinalizeProgress(const PRUnichar* message, PRInt32 itemNum, PRInt32 totNum )
|
||||
nsLoggingProgressListener::OnFinalizeProgress(const PRUnichar* message, PRInt32 itemNum, PRInt32 totNum )
|
||||
{
|
||||
nsCString messageConverted;
|
||||
messageConverted.AssignWithConversion(message);
|
||||
|
@ -246,40 +270,7 @@ nsLoggingProgressListener::FinalizeProgress(const PRUnichar* message, PRInt32 it
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsLoggingProgressListener::FinalStatus(const PRUnichar *URL, PRInt32 status)
|
||||
{
|
||||
if (mLogStream == nsnull) return NS_ERROR_NULL_POINTER;
|
||||
|
||||
*mLogStream << nsEndl;
|
||||
|
||||
switch (status)
|
||||
{
|
||||
case nsInstall::SUCCESS:
|
||||
*mLogStream << " Install completed successfully" << nsEndl;
|
||||
break;
|
||||
|
||||
case nsInstall::REBOOT_NEEDED:
|
||||
*mLogStream << " Install completed successfully, restart required" << nsEndl;
|
||||
break;
|
||||
|
||||
case nsInstall::INSTALL_CANCELLED:
|
||||
*mLogStream << " Install cancelled by script" << nsEndl;
|
||||
break;
|
||||
|
||||
case nsInstall::USER_CANCELLED:
|
||||
*mLogStream << " Install cancelled by user" << nsEndl;
|
||||
break;
|
||||
|
||||
default:
|
||||
*mLogStream << " Install **FAILED** with error " << status << nsEndl;
|
||||
break;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
nsLoggingProgressListener::GetTime(char** aString)
|
||||
{
|
||||
PRExplodedTime et;
|
||||
|
@ -290,7 +281,7 @@ nsLoggingProgressListener::GetTime(char** aString)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsLoggingProgressListener::LogComment(const PRUnichar* comment)
|
||||
nsLoggingProgressListener::OnLogComment(const PRUnichar* comment)
|
||||
{
|
||||
nsCString commentConverted;
|
||||
commentConverted.AssignWithConversion(comment);
|
||||
|
@ -310,7 +301,7 @@ Convert_nsIFile_To_nsFileSpec(nsIFile *aInIFile, nsFileSpec **aOutFileSpec)
|
|||
return NS_ERROR_FAILURE;
|
||||
|
||||
*aOutFileSpec = nsnull;
|
||||
|
||||
|
||||
#ifdef XP_MAC
|
||||
FSSpec fsSpec;
|
||||
nsCOMPtr<nsILocalFileMac> iFileMac;
|
||||
|
@ -329,7 +320,7 @@ Convert_nsIFile_To_nsFileSpec(nsIFile *aInIFile, nsFileSpec **aOutFileSpec)
|
|||
{
|
||||
*aOutFileSpec = new nsFileSpec(path, PR_FALSE);
|
||||
}
|
||||
// NOTE: don't release path since nsFileSpec's mPath points to it
|
||||
// NOTE: don't release path since nsFileSpec's mPath points to it
|
||||
#endif
|
||||
|
||||
if (!*aOutFileSpec)
|
||||
|
|
|
@ -291,7 +291,6 @@ NS_IMETHODIMP
|
|||
nsSoftwareUpdate::InstallJar( nsIFile* aLocalFile,
|
||||
const PRUnichar* aURL,
|
||||
const PRUnichar* aArguments,
|
||||
nsIDOMWindowInternal* aParentWindow,
|
||||
PRUint32 flags,
|
||||
nsIXPIListener* aListener)
|
||||
{
|
||||
|
@ -310,7 +309,7 @@ nsSoftwareUpdate::InstallJar( nsIFile* aLocalFile,
|
|||
|
||||
// we want to call this with or without a chrome registry
|
||||
nsInstallInfo *info = new nsInstallInfo( 0, aLocalFile, aURL, aArguments,
|
||||
flags, aListener, aParentWindow, chromeReg );
|
||||
flags, aListener, chromeReg );
|
||||
|
||||
if (!info)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
@ -346,7 +345,6 @@ nsSoftwareUpdate::InstallChrome( PRUint32 aType,
|
|||
aName,
|
||||
(PRUint32)aSelect,
|
||||
aListener,
|
||||
nsnull,
|
||||
chromeReg);
|
||||
if (!info)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
|
|
@ -18,18 +18,17 @@
|
|||
class nsInstallInfo;
|
||||
|
||||
#include "nsIScriptExternalNameSet.h"
|
||||
#include "nsIDOMWindowInternal.h"
|
||||
#include "nsIObserver.h"
|
||||
#include "nsPIXPIStubHook.h"
|
||||
#include "nsTopProgressNotifier.h"
|
||||
|
||||
|
||||
class nsSoftwareUpdate: public nsISoftwareUpdate,
|
||||
class nsSoftwareUpdate: public nsISoftwareUpdate,
|
||||
public nsPIXPIStubHook,
|
||||
public nsIObserver
|
||||
{
|
||||
public:
|
||||
|
||||
|
||||
NS_DEFINE_STATIC_CID_ACCESSOR( NS_SoftwareUpdate_CID );
|
||||
|
||||
static nsSoftwareUpdate *GetInstance();
|
||||
|
@ -50,11 +49,10 @@ class nsSoftwareUpdate: public nsISoftwareUpdate,
|
|||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSPIXPISTUBHOOK
|
||||
NS_DECL_NSIOBSERVER
|
||||
|
||||
|
||||
NS_IMETHOD InstallJar( nsIFile* localFile,
|
||||
const PRUnichar* URL,
|
||||
const PRUnichar* arguments,
|
||||
nsIDOMWindowInternal* aParentWindow,
|
||||
PRUint32 flags = 0,
|
||||
nsIXPIListener* aListener = 0);
|
||||
|
||||
|
@ -66,7 +64,7 @@ class nsSoftwareUpdate: public nsISoftwareUpdate,
|
|||
nsIXPIListener* aListener = 0);
|
||||
|
||||
NS_IMETHOD RegisterListener(nsIXPIListener *aListener);
|
||||
|
||||
|
||||
NS_IMETHOD InstallJarCallBack();
|
||||
NS_IMETHOD GetMasterListener(nsIXPIListener **aListener);
|
||||
NS_IMETHOD SetActiveListener(nsIXPIListener *aListener);
|
||||
|
@ -86,7 +84,7 @@ class nsSoftwareUpdate: public nsISoftwareUpdate,
|
|||
nsresult RegisterNameset();
|
||||
void CreateMasterListener();
|
||||
void Shutdown();
|
||||
|
||||
|
||||
PRLock* mLock;
|
||||
PRBool mInstalling;
|
||||
nsVoidArray mJarInstallQueue;
|
||||
|
@ -96,7 +94,7 @@ class nsSoftwareUpdate: public nsISoftwareUpdate,
|
|||
};
|
||||
|
||||
|
||||
class nsSoftwareUpdateNameSet : public nsIScriptExternalNameSet
|
||||
class nsSoftwareUpdateNameSet : public nsIScriptExternalNameSet
|
||||
{
|
||||
public:
|
||||
nsSoftwareUpdateNameSet();
|
||||
|
|
|
@ -10,15 +10,15 @@
|
|||
* 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 Original Code is Mozilla Communicator client code,
|
||||
* released March 31, 1998.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape Communications
|
||||
* 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.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Contributor(s):
|
||||
* Daniel Veditz <dveditz@netscape.com>
|
||||
* Douglas Turner <dougt@netscape.com>
|
||||
*/
|
||||
|
@ -58,14 +58,14 @@
|
|||
static NS_DEFINE_CID(kSoftwareUpdateCID, NS_SoftwareUpdate_CID);
|
||||
static NS_DEFINE_CID(kEventQueueServiceCID, NS_EVENTQUEUESERVICE_CID);
|
||||
|
||||
extern JSObject *InitXPInstallObjects(JSContext *jscontext, JSObject *global, nsIFile* jarfile, const PRUnichar* url, const PRUnichar* args, PRUint32 flags, nsIChromeRegistry* reg, nsIDOMWindowInternal* aParent, nsIZipReader* hZip);
|
||||
extern JSObject *InitXPInstallObjects(JSContext *jscontext, JSObject *global, nsIFile* jarfile, const PRUnichar* url, const PRUnichar* args, PRUint32 flags, nsIChromeRegistry* reg, nsIZipReader* hZip);
|
||||
extern nsresult InitInstallVersionClass(JSContext *jscontext, JSObject *global, void** prototype);
|
||||
extern nsresult InitInstallTriggerGlobalClass(JSContext *jscontext, JSObject *global, void** prototype);
|
||||
|
||||
// Defined in this file:
|
||||
PR_STATIC_CALLBACK(void) XPInstallErrorReporter(JSContext *cx, const char *message, JSErrorReport *report);
|
||||
static PRInt32 GetInstallScriptFromJarfile(nsIZipReader* hZip, nsIFile* jarFile, char** scriptBuffer, PRUint32 *scriptLength);
|
||||
static nsresult SetupInstallContext(nsIZipReader* hZip, nsIFile* jarFile, const PRUnichar* url, const PRUnichar* args, PRUint32 flags, nsIChromeRegistry* reg, nsIDOMWindowInternal* aParent, JSRuntime *jsRT, JSContext **jsCX, JSObject **jsGlob);
|
||||
static nsresult SetupInstallContext(nsIZipReader* hZip, nsIFile* jarFile, const PRUnichar* url, const PRUnichar* args, PRUint32 flags, nsIChromeRegistry* reg, JSRuntime *jsRT, JSContext **jsCX, JSObject **jsGlob);
|
||||
|
||||
extern "C" void RunInstallOnThread(void *data);
|
||||
|
||||
|
@ -93,7 +93,7 @@ XPInstallErrorReporter(JSContext *cx, const char *message, JSErrorReport *report
|
|||
*/
|
||||
nsCOMPtr<nsIScriptError>
|
||||
errorObject(do_CreateInstance("@mozilla.org/scripterror;1"));
|
||||
|
||||
|
||||
if (consoleService != nsnull && errorObject != nsnull && report != nsnull) {
|
||||
/*
|
||||
* Got an error object; prepare appropriate-width versions of
|
||||
|
@ -116,14 +116,14 @@ XPInstallErrorReporter(JSContext *cx, const char *message, JSErrorReport *report
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!report)
|
||||
return;
|
||||
|
||||
nsIXPIListener *listener;
|
||||
|
||||
// lets set up an eventQ so that our xpcom/proxies will not have to:
|
||||
nsCOMPtr<nsISoftwareUpdate> softwareUpdate =
|
||||
nsCOMPtr<nsISoftwareUpdate> softwareUpdate =
|
||||
do_GetService(kSoftwareUpdateCID, &rv);
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
|
@ -134,7 +134,7 @@ XPInstallErrorReporter(JSContext *cx, const char *message, JSErrorReport *report
|
|||
}
|
||||
|
||||
softwareUpdate->GetMasterListener(&listener);
|
||||
|
||||
|
||||
if(listener)
|
||||
{
|
||||
nsAutoString logMessage;
|
||||
|
@ -142,11 +142,11 @@ XPInstallErrorReporter(JSContext *cx, const char *message, JSErrorReport *report
|
|||
logMessage.AppendInt(report->lineno, 10);
|
||||
logMessage.Append(NS_LITERAL_STRING("\t"));
|
||||
if (report->ucmessage)
|
||||
logMessage.Append( NS_REINTERPRET_CAST(const PRUnichar*, report->ucmessage) );
|
||||
logMessage.Append( NS_REINTERPRET_CAST(const PRUnichar*, report->ucmessage) );
|
||||
else
|
||||
logMessage.AppendWithConversion( message );
|
||||
logMessage.AppendWithConversion( message );
|
||||
|
||||
listener->LogComment( logMessage.get() );
|
||||
listener->OnLogComment( logMessage.get() );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -157,7 +157,7 @@ XPInstallErrorReporter(JSContext *cx, const char *message, JSErrorReport *report
|
|||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Function name : GetInstallScriptFromJarfile
|
||||
// Description : Extracts and reads in a install.js file from a passed jar file.
|
||||
// Return type : static PRInt32
|
||||
// Return type : static PRInt32
|
||||
// Argument : const char* jarFile - **NSPR** filepath
|
||||
// Argument : char** scriptBuffer - must be deleted via delete []
|
||||
// Argument : PRUint32 *scriptLength
|
||||
|
@ -167,7 +167,7 @@ static PRInt32
|
|||
GetInstallScriptFromJarfile(nsIZipReader* hZip, nsIFile* jarFile, char** scriptBuffer, PRUint32 *scriptLength)
|
||||
{
|
||||
PRInt32 result = NS_OK;
|
||||
|
||||
|
||||
*scriptBuffer = nsnull;
|
||||
*scriptLength = 0;
|
||||
|
||||
|
@ -244,7 +244,7 @@ GetInstallScriptFromJarfile(nsIZipReader* hZip, nsIFile* jarFile, char** scriptB
|
|||
result = nsInstall::NO_INSTALL_SCRIPT;
|
||||
}
|
||||
|
||||
return result;
|
||||
return result;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -252,7 +252,7 @@ GetInstallScriptFromJarfile(nsIZipReader* hZip, nsIFile* jarFile, char** scriptB
|
|||
// Description : Creates a Javascript context and adds our xpinstall objects to it.
|
||||
// Return type : static nsresult
|
||||
// Argument : nsIZipReader hZip - the handle to the open archive file
|
||||
// Argument : const char* jarFile - native filepath to where jar exists on disk
|
||||
// Argument : const char* jarFile - native filepath to where jar exists on disk
|
||||
// Argument : const PRUnichar* url - URL of where this package came from
|
||||
// Argument : const PRUnichar* args - any arguments passed into the javascript context
|
||||
// Argument : PRUint32 flags - bitmask of flags passed in
|
||||
|
@ -267,18 +267,17 @@ static nsresult SetupInstallContext(nsIZipReader* hZip,
|
|||
const PRUnichar* args,
|
||||
PRUint32 flags,
|
||||
nsIChromeRegistry* reg,
|
||||
nsIDOMWindowInternal* aParent,
|
||||
JSRuntime *rt,
|
||||
JSContext **jsCX,
|
||||
JSRuntime *rt,
|
||||
JSContext **jsCX,
|
||||
JSObject **jsGlob)
|
||||
{
|
||||
JSContext *cx;
|
||||
JSObject *glob;
|
||||
|
||||
|
||||
*jsCX = nsnull;
|
||||
*jsGlob = nsnull;
|
||||
|
||||
if (!rt)
|
||||
if (!rt)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
cx = JS_NewContext(rt, 8192);
|
||||
|
@ -290,7 +289,7 @@ static nsresult SetupInstallContext(nsIZipReader* hZip,
|
|||
JS_SetErrorReporter(cx, XPInstallErrorReporter);
|
||||
|
||||
|
||||
glob = InitXPInstallObjects(cx, nsnull, jarFile, url, args, flags, reg, aParent, hZip);
|
||||
glob = InitXPInstallObjects(cx, nsnull, jarFile, url, args, flags, reg, hZip);
|
||||
// Init standard classes
|
||||
JS_InitStandardClasses(cx, glob);
|
||||
|
||||
|
@ -308,13 +307,13 @@ static nsresult SetupInstallContext(nsIZipReader* hZip,
|
|||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Function name : RunInstall
|
||||
// Description : Creates our Install Thread.
|
||||
// Return type : PRInt32
|
||||
// Function name : RunInstall
|
||||
// Description : Creates our Install Thread.
|
||||
// Return type : PRInt32
|
||||
// Argument : nsInstallInfo *installInfo
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
PRInt32 RunInstall(nsInstallInfo *installInfo)
|
||||
{
|
||||
{
|
||||
if (installInfo->GetFlags() & XPI_NO_NEW_THREAD)
|
||||
{
|
||||
RunInstallOnThread((void *)installInfo);
|
||||
|
@ -323,28 +322,28 @@ PRInt32 RunInstall(nsInstallInfo *installInfo)
|
|||
{
|
||||
PR_CreateThread(PR_USER_THREAD,
|
||||
RunInstallOnThread,
|
||||
(void*)installInfo,
|
||||
PR_PRIORITY_NORMAL,
|
||||
PR_GLOBAL_THREAD,
|
||||
(void*)installInfo,
|
||||
PR_PRIORITY_NORMAL,
|
||||
PR_GLOBAL_THREAD,
|
||||
PR_UNJOINABLE_THREAD,
|
||||
0);
|
||||
0);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Function name : RunInstallOnThread
|
||||
// Description : called by starting thread. It directly calls the C api for xpinstall,
|
||||
// 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"
|
||||
// Return type : extern "C"
|
||||
// Argument : void *data
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
extern "C" void RunInstallOnThread(void *data)
|
||||
{
|
||||
nsInstallInfo *installInfo = (nsInstallInfo*)data;
|
||||
|
||||
|
||||
char *scriptBuffer = nsnull;
|
||||
PRUint32 scriptLength;
|
||||
|
||||
|
@ -356,7 +355,7 @@ extern "C" void RunInstallOnThread(void *data)
|
|||
|
||||
static NS_DEFINE_IID(kIZipReaderIID, NS_IZIPREADER_IID);
|
||||
static NS_DEFINE_IID(kZipReaderCID, NS_ZIPREADER_CID);
|
||||
nsresult rv = nsComponentManager::CreateInstance(kZipReaderCID, nsnull, kIZipReaderIID,
|
||||
nsresult rv = nsComponentManager::CreateInstance(kZipReaderCID, nsnull, kIZipReaderIID,
|
||||
getter_AddRefs(hZip));
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
|
@ -365,21 +364,20 @@ extern "C" void RunInstallOnThread(void *data)
|
|||
// we will plan on sending a failure status back from here unless we
|
||||
// find positive acknowledgement that the script sent the status
|
||||
PRInt32 finalStatus;
|
||||
PRBool sendStatus = PR_TRUE;
|
||||
|
||||
nsCOMPtr<nsIXPIListener> listener;
|
||||
|
||||
// lets set up an eventQ so that our xpcom/proxies will not have to:
|
||||
nsCOMPtr<nsIEventQueue> eventQ;
|
||||
nsCOMPtr<nsIEventQueueService> eventQService =
|
||||
nsCOMPtr<nsIEventQueueService> eventQService =
|
||||
do_GetService(kEventQueueServiceCID, &rv);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
eventQService->CreateMonitoredThreadEventQueue();
|
||||
eventQService->GetThreadEventQueue(NS_CURRENT_THREAD, getter_AddRefs(eventQ));
|
||||
}
|
||||
|
||||
nsCOMPtr<nsISoftwareUpdate> softwareUpdate =
|
||||
nsCOMPtr<nsISoftwareUpdate> softwareUpdate =
|
||||
do_GetService(kSoftwareUpdateCID, &rv);
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
|
@ -390,23 +388,23 @@ extern "C" void RunInstallOnThread(void *data)
|
|||
|
||||
softwareUpdate->SetActiveListener( installInfo->GetListener() );
|
||||
softwareUpdate->GetMasterListener(getter_AddRefs(listener));
|
||||
|
||||
|
||||
if(listener)
|
||||
listener->BeforeJavascriptEvaluation( installInfo->GetURL() );
|
||||
|
||||
listener->OnInstallStart( installInfo->GetURL() );
|
||||
|
||||
nsCOMPtr<nsIFile> jarpath = installInfo->GetFile();
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
finalStatus = GetInstallScriptFromJarfile( hZip,
|
||||
jarpath,
|
||||
&scriptBuffer,
|
||||
&scriptBuffer,
|
||||
&scriptLength);
|
||||
|
||||
if ( finalStatus == NS_OK && scriptBuffer )
|
||||
{
|
||||
PRBool ownRuntime = PR_FALSE;
|
||||
|
||||
nsCOMPtr<nsIJSRuntimeService> rtsvc =
|
||||
nsCOMPtr<nsIJSRuntimeService> rtsvc =
|
||||
do_GetService("@mozilla.org/js/xpc/RuntimeService;1", &rv);
|
||||
if(NS_FAILED(rv) || NS_FAILED(rtsvc->GetRuntime(&rt)))
|
||||
{
|
||||
|
@ -421,7 +419,6 @@ extern "C" void RunInstallOnThread(void *data)
|
|||
installInfo->GetArguments(),
|
||||
installInfo->GetFlags(),
|
||||
installInfo->GetChromeRegistry(),
|
||||
installInfo->GetParentDOMWindow(),
|
||||
rt, &cx, &glob);
|
||||
|
||||
if (NS_SUCCEEDED(rv))
|
||||
|
@ -429,7 +426,7 @@ extern "C" void RunInstallOnThread(void *data)
|
|||
// Go ahead and run!!
|
||||
jsval rval;
|
||||
jsval installedFiles;
|
||||
JS_BeginRequest(cx); //Increment JS thread counter associated
|
||||
JS_BeginRequest(cx); //Increment JS thread counter associated
|
||||
//with this context
|
||||
PRBool ok = JS_EvaluateScript( cx,
|
||||
glob,
|
||||
|
@ -458,20 +455,19 @@ extern "C" void RunInstallOnThread(void *data)
|
|||
// not the install may have been syntactically correct but
|
||||
// left the init/(perform|cancel) transaction open
|
||||
|
||||
jsval sent;
|
||||
|
||||
if(JS_GetProperty(cx, glob, "_installedFiles", &installedFiles) &&
|
||||
JSVAL_TO_BOOLEAN(installedFiles))
|
||||
{
|
||||
nsInstall *a = (nsInstall*)JS_GetPrivate(cx, glob);
|
||||
a->InternalAbort(nsInstall::MALFORMED_INSTALL);
|
||||
// install items remain in queue, must clean up!
|
||||
nsInstall *a = (nsInstall*)JS_GetPrivate(cx, glob);
|
||||
a->InternalAbort(nsInstall::MALFORMED_INSTALL);
|
||||
}
|
||||
|
||||
if ( JS_GetProperty( cx, glob, "_statusSent", &sent ) &&
|
||||
JSVAL_TO_BOOLEAN(sent) )
|
||||
sendStatus = PR_FALSE;
|
||||
jsval sent;
|
||||
if ( JS_GetProperty( cx, glob, "_finalStatus", &sent ) )
|
||||
finalStatus = JSVAL_TO_INT(sent);
|
||||
else
|
||||
finalStatus = nsInstall::MALFORMED_INSTALL;
|
||||
finalStatus = nsInstall::UNEXPECTED_ERROR;
|
||||
}
|
||||
JS_EndRequest(cx); //Decrement JS thread counter
|
||||
JS_DestroyContextMaybeGC(cx);
|
||||
|
@ -483,25 +479,20 @@ extern "C" void RunInstallOnThread(void *data)
|
|||
}
|
||||
|
||||
// clean up Runtime if we created it ourselves
|
||||
if ( ownRuntime )
|
||||
if ( ownRuntime )
|
||||
JS_DestroyRuntime(rt);
|
||||
}
|
||||
// force zip archive closed before other cleanup
|
||||
hZip = 0;
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
// no path to local jar archive
|
||||
finalStatus = nsInstall::DOWNLOAD_ERROR;
|
||||
}
|
||||
|
||||
if(listener)
|
||||
{
|
||||
if ( sendStatus )
|
||||
listener->FinalStatus( installInfo->GetURL(), finalStatus );
|
||||
|
||||
listener->AfterJavascriptEvaluation( installInfo->GetURL() );
|
||||
}
|
||||
if(listener)
|
||||
listener->OnInstallDone( installInfo->GetURL(), finalStatus );
|
||||
|
||||
if (scriptBuffer) delete [] scriptBuffer;
|
||||
|
||||
|
@ -528,7 +519,7 @@ extern "C" void RunChromeInstallOnThread(void *data)
|
|||
nsIXPIListener* listener = info->GetListener();
|
||||
|
||||
if (listener)
|
||||
listener->BeforeJavascriptEvaluation(info->GetURL());
|
||||
listener->OnInstallStart(info->GetURL());
|
||||
|
||||
// make sure we've got a chrome registry -- can't proceed if not
|
||||
nsIChromeRegistry* reg = info->GetChromeRegistry();
|
||||
|
@ -541,7 +532,7 @@ extern "C" void RunChromeInstallOnThread(void *data)
|
|||
|
||||
nsCOMPtr<nsIURI> pURL;
|
||||
rv = NS_NewURI(getter_AddRefs(pURL), "file:");
|
||||
if (NS_SUCCEEDED(rv))
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
nsCOMPtr<nsIFileURL> fileURL = do_QueryInterface(pURL);
|
||||
if (fileURL)
|
||||
|
@ -565,7 +556,7 @@ extern "C" void RunChromeInstallOnThread(void *data)
|
|||
PRBool isLocale = (info->GetType() & CHROME_LOCALE);
|
||||
PRBool isContent = (info->GetType() & CHROME_CONTENT);
|
||||
PRBool selected = (info->GetFlags() != 0);
|
||||
|
||||
|
||||
if ( isContent )
|
||||
{
|
||||
rv = reg->InstallPackage(spec.get(), PR_TRUE);
|
||||
|
@ -580,7 +571,7 @@ extern "C" void RunChromeInstallOnThread(void *data)
|
|||
}
|
||||
}
|
||||
|
||||
if ( isLocale )
|
||||
if ( isLocale )
|
||||
{
|
||||
rv = reg->InstallLocale(spec.get(), PR_TRUE);
|
||||
if (NS_SUCCEEDED(rv) && selected)
|
||||
|
@ -592,7 +583,7 @@ extern "C" void RunChromeInstallOnThread(void *data)
|
|||
// now that all types are registered try to activate
|
||||
if ( isSkin && selected )
|
||||
reg->RefreshSkins();
|
||||
|
||||
|
||||
#ifdef RELOAD_CHROME_WORKS
|
||||
// XXX ReloadChrome() crashes right now
|
||||
if ( isContent || (isLocale && selected) )
|
||||
|
@ -602,7 +593,7 @@ extern "C" void RunChromeInstallOnThread(void *data)
|
|||
}
|
||||
|
||||
if (listener)
|
||||
listener->AfterJavascriptEvaluation(info->GetURL());
|
||||
listener->OnInstallDone(info->GetURL(), nsInstall::SUCCESS);
|
||||
|
||||
delete info;
|
||||
}
|
||||
|
|
|
@ -10,15 +10,15 @@
|
|||
* 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 Original Code is Mozilla Communicator client code,
|
||||
* released March 31, 1998.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape Communications
|
||||
* 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.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Contributor(s):
|
||||
* Douglas Turner <dougt@netscape.com>
|
||||
* Daniel Veditz <dveditz@netscape.com>
|
||||
* Pierre Phaneuf <pp@ludusdesign.com>
|
||||
|
@ -41,7 +41,7 @@ nsTopProgressListener::~nsTopProgressListener()
|
|||
if (mListeners)
|
||||
{
|
||||
PRInt32 i=0;
|
||||
for (; i < mListeners->Count(); i++)
|
||||
for (; i < mListeners->Count(); i++)
|
||||
{
|
||||
nsIXPIListener* element = (nsIXPIListener*)mListeners->ElementAt(i);
|
||||
NS_IF_RELEASE(element);
|
||||
|
@ -89,79 +89,60 @@ nsTopProgressListener::UnregisterListener(long id)
|
|||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsTopProgressListener::BeforeJavascriptEvaluation(const PRUnichar *URL)
|
||||
nsTopProgressListener::OnInstallStart(const PRUnichar *URL)
|
||||
{
|
||||
if (mActive)
|
||||
mActive->BeforeJavascriptEvaluation(URL);
|
||||
mActive->OnInstallStart(URL);
|
||||
|
||||
if (mListeners)
|
||||
{
|
||||
PRInt32 i=0;
|
||||
for (; i < mListeners->Count(); i++)
|
||||
for (; i < mListeners->Count(); i++)
|
||||
{
|
||||
nsIXPIListener* element = (nsIXPIListener*)mListeners->ElementAt(i);
|
||||
if (element != NULL)
|
||||
element->BeforeJavascriptEvaluation(URL);
|
||||
element->OnInstallStart(URL);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsTopProgressListener::AfterJavascriptEvaluation(const PRUnichar *URL)
|
||||
nsTopProgressListener::OnPackageNameSet(const PRUnichar *URL, const PRUnichar* UIPackageName)
|
||||
{
|
||||
if (mActive)
|
||||
mActive->AfterJavascriptEvaluation(URL);
|
||||
mActive->OnPackageNameSet(URL, UIPackageName);
|
||||
|
||||
if (mListeners)
|
||||
{
|
||||
PRInt32 i=0;
|
||||
for (; i < mListeners->Count(); i++)
|
||||
for (; i < mListeners->Count(); i++)
|
||||
{
|
||||
nsIXPIListener* element = (nsIXPIListener*)mListeners->ElementAt(i);
|
||||
if (element != NULL)
|
||||
element->AfterJavascriptEvaluation(URL);
|
||||
element->OnPackageNameSet(URL, UIPackageName);
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsTopProgressListener::InstallStarted(const PRUnichar *URL, const PRUnichar* UIPackageName)
|
||||
{
|
||||
if (mActive)
|
||||
mActive->InstallStarted(URL, UIPackageName);
|
||||
|
||||
if (mListeners)
|
||||
{
|
||||
PRInt32 i=0;
|
||||
for (; i < mListeners->Count(); i++)
|
||||
{
|
||||
nsIXPIListener* element = (nsIXPIListener*)mListeners->ElementAt(i);
|
||||
if (element != NULL)
|
||||
element->InstallStarted(URL, UIPackageName);
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsTopProgressListener::ItemScheduled( const PRUnichar* message )
|
||||
nsTopProgressListener::OnItemScheduled( const PRUnichar* message )
|
||||
{
|
||||
long rv = 0;
|
||||
|
||||
if (mActive)
|
||||
mActive->ItemScheduled( message );
|
||||
mActive->OnItemScheduled( message );
|
||||
|
||||
if (mListeners)
|
||||
{
|
||||
PRInt32 i=0;
|
||||
for (; i < mListeners->Count(); i++)
|
||||
for (; i < mListeners->Count(); i++)
|
||||
{
|
||||
nsIXPIListener* element = (nsIXPIListener*)mListeners->ElementAt(i);
|
||||
if (element != NULL)
|
||||
element->ItemScheduled( message );
|
||||
element->OnItemScheduled( message );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -169,59 +150,58 @@ nsTopProgressListener::ItemScheduled( const PRUnichar* message )
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsTopProgressListener::FinalizeProgress( const PRUnichar* message, PRInt32 itemNum, PRInt32 totNum )
|
||||
nsTopProgressListener::OnFinalizeProgress( const PRUnichar* message, PRInt32 itemNum, PRInt32 totNum )
|
||||
{
|
||||
if (mActive)
|
||||
mActive->FinalizeProgress( message, itemNum, totNum );
|
||||
mActive->OnFinalizeProgress( message, itemNum, totNum );
|
||||
|
||||
if (mListeners)
|
||||
{
|
||||
PRInt32 i=0;
|
||||
for (; i < mListeners->Count(); i++)
|
||||
for (; i < mListeners->Count(); i++)
|
||||
{
|
||||
nsIXPIListener* element = (nsIXPIListener*)mListeners->ElementAt(i);
|
||||
if (element != NULL)
|
||||
element->FinalizeProgress( message, itemNum, totNum );
|
||||
element->OnFinalizeProgress( message, itemNum, totNum );
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsTopProgressListener::FinalStatus(const PRUnichar *URL, PRInt32 status)
|
||||
nsTopProgressListener::OnInstallDone(const PRUnichar *URL, PRInt32 status)
|
||||
{
|
||||
if (mActive)
|
||||
mActive->FinalStatus(URL, status);
|
||||
mActive->OnInstallDone(URL, status);
|
||||
|
||||
if (mListeners)
|
||||
{
|
||||
PRInt32 i=0;
|
||||
for (; i < mListeners->Count(); i++)
|
||||
for (; i < mListeners->Count(); i++)
|
||||
{
|
||||
nsIXPIListener* element = (nsIXPIListener*)mListeners->ElementAt(i);
|
||||
if (element != NULL)
|
||||
element->FinalStatus(URL,status);
|
||||
element->OnInstallDone(URL,status);
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsTopProgressListener::LogComment(const PRUnichar* comment)
|
||||
nsTopProgressListener::OnLogComment(const PRUnichar* comment)
|
||||
{
|
||||
if (mActive)
|
||||
mActive->LogComment(comment);
|
||||
mActive->OnLogComment(comment);
|
||||
|
||||
if (mListeners)
|
||||
{
|
||||
PRInt32 i=0;
|
||||
for (; i < mListeners->Count(); i++)
|
||||
for (; i < mListeners->Count(); i++)
|
||||
{
|
||||
nsIXPIListener* element = (nsIXPIListener*)mListeners->ElementAt(i);
|
||||
if (element != NULL)
|
||||
element->LogComment(comment);
|
||||
element->OnLogComment(comment);
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -10,26 +10,28 @@
|
|||
* 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 Original Code is Mozilla Communicator client code,
|
||||
* released March 31, 1998.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape Communications
|
||||
* The Initial Developer of the Original Code is Netscape Communications
|
||||
* Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 2001 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Contributor(s):
|
||||
* Daniel Veditz <dveditz@netscape.com>
|
||||
*/
|
||||
|
||||
/* used by XPInstall for actions that must be performed on the UI thread */
|
||||
|
||||
#include "nsXPIProxy.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsString.h"
|
||||
#include "nsIDOMWindowInternal.h"
|
||||
#include "nsIDOMNavigator.h"
|
||||
#include "nsIDOMPluginArray.h"
|
||||
#include "nsIPluginManager.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIObserverService.h"
|
||||
#include "nsIPromptService.h"
|
||||
|
||||
|
||||
nsXPIProxy::nsXPIProxy()
|
||||
{
|
||||
|
@ -43,27 +45,16 @@ nsXPIProxy::~nsXPIProxy()
|
|||
NS_IMPL_THREADSAFE_ISUPPORTS1(nsXPIProxy, nsPIXPIProxy);
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXPIProxy::RefreshPlugins(nsISupports *aWindow)
|
||||
nsXPIProxy::RefreshPlugins(PRBool aReloadPages)
|
||||
{
|
||||
if (!aWindow)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
NS_DEFINE_CID(pluginManagerCID,NS_PLUGINMANAGER_CID);
|
||||
|
||||
nsCOMPtr<nsIDOMWindowInternal> win(do_QueryInterface(aWindow));
|
||||
if (!win)
|
||||
nsCOMPtr<nsIPluginManager> plugins(do_GetService(pluginManagerCID));
|
||||
|
||||
if (!plugins)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsIDOMNavigator> nav;
|
||||
nsresult rv = win->GetNavigator(getter_AddRefs(nav));
|
||||
if (NS_FAILED(rv))
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsIDOMPluginArray> plugins;
|
||||
rv = nav->GetPlugins(getter_AddRefs(plugins));
|
||||
if (NS_FAILED(rv))
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
rv = plugins->Refresh(PR_TRUE);
|
||||
return rv;
|
||||
return plugins->ReloadPlugins(aReloadPages);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -75,3 +66,25 @@ nsXPIProxy::NotifyRestartNeeded()
|
|||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXPIProxy::Alert(const PRUnichar* aTitle, const PRUnichar* aText)
|
||||
{
|
||||
nsCOMPtr<nsIPromptService> dialog(do_GetService("@mozilla.org/embedcomp/prompt-service;1"));
|
||||
|
||||
if (!dialog)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
return dialog->Alert( nsnull, aTitle, aText );
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXPIProxy::Confirm(const PRUnichar* aTitle, const PRUnichar* aText, PRBool *aReturn)
|
||||
{
|
||||
nsCOMPtr<nsIPromptService> dialog(do_GetService("@mozilla.org/embedcomp/prompt-service;1"));
|
||||
|
||||
if (!dialog)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
return dialog->Confirm( nsnull, aTitle, aText, aReturn );
|
||||
}
|
|
@ -10,15 +10,15 @@
|
|||
* 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 Original Code is Mozilla Communicator client code,
|
||||
* released March 31, 1998.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape Communications
|
||||
* The Initial Developer of the Original Code is Netscape Communications
|
||||
* Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 2001 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Contributor(s):
|
||||
* Daniel Veditz <dveditz@netscape.com>
|
||||
*/
|
||||
|
||||
|
|
|
@ -55,10 +55,13 @@ nsXPITriggerItem::nsXPITriggerItem( const PRUnichar* aName,
|
|||
{
|
||||
// Use the filename as the display name by starting after the last
|
||||
// slash in the URL, looking backwards from the arguments delimiter if
|
||||
// we found one. By good fortune using kNotFound as the 3rd param of
|
||||
// RFindChar() makes it start at the end so we can always use qmark
|
||||
// we found one. By good fortune using kNotFound as the offset for
|
||||
// RFindChar() starts at the end, so we can use qmark in all cases.
|
||||
|
||||
PRInt32 namestart = mURL.RFindChar( '/', PR_FALSE, qmark ) + 1;
|
||||
PRInt32 namestart = mURL.RFindChar( '/', qmark );
|
||||
|
||||
// the real start is after the slash (or 0 if not found)
|
||||
namestart = ( namestart==kNotFound ) ? 0 : namestart + 1;
|
||||
|
||||
PRInt32 length;
|
||||
if (qmark == kNotFound)
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -10,15 +10,15 @@
|
|||
* 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 Original Code is Mozilla Communicator client code,
|
||||
* released March 31, 1998.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape Communications
|
||||
* The Initial Developer of the Original Code is Netscape Communications
|
||||
* Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998-1999 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Contributor(s):
|
||||
* Daniel Veditz <dveditz@netscape.com>
|
||||
*/
|
||||
|
||||
|
@ -35,10 +35,12 @@
|
|||
#include "nsIInputStream.h"
|
||||
#include "nsIStreamListener.h"
|
||||
#include "nsIXPINotifier.h"
|
||||
#include "nsIXPIDialogService.h"
|
||||
#include "nsXPITriggerInfo.h"
|
||||
#include "nsIXPIProgressDlg.h"
|
||||
#include "nsIXPIProgressDialog.h"
|
||||
#include "nsIChromeRegistry.h"
|
||||
#include "nsIDOMWindowInternal.h"
|
||||
#include "nsIObserver.h"
|
||||
|
||||
#include "nsISoftwareUpdate.h"
|
||||
|
||||
|
@ -47,68 +49,58 @@
|
|||
#include "nsIProgressEventSink.h"
|
||||
#include "nsIInterfaceRequestor.h"
|
||||
#include "nsIInterfaceRequestorUtils.h"
|
||||
#include "nsPIXPIManagerCallbacks.h"
|
||||
|
||||
#include "nsIDialogParamBlock.h"
|
||||
|
||||
#define NS_XPIDIALOGSERVICE_CONTRACTID "@mozilla.org/embedui/xpinstall-dialog-service;1"
|
||||
#define XPI_PROGRESS_TOPIC "xpinstall-progress"
|
||||
|
||||
class nsXPInstallManager : public nsIXPIListener,
|
||||
class nsXPInstallManager : public nsIXPIListener,
|
||||
public nsIXPIDialogService,
|
||||
public nsIObserver,
|
||||
public nsIStreamListener,
|
||||
public nsIProgressEventSink,
|
||||
public nsIInterfaceRequestor,
|
||||
public nsPIXPIManagerCallbacks
|
||||
public nsIInterfaceRequestor
|
||||
{
|
||||
public:
|
||||
nsXPInstallManager();
|
||||
virtual ~nsXPInstallManager();
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIXPILISTENER
|
||||
NS_DECL_NSIXPIDIALOGSERVICE
|
||||
NS_DECL_NSIOBSERVER
|
||||
NS_DECL_NSISTREAMLISTENER
|
||||
NS_DECL_NSIPROGRESSEVENTSINK
|
||||
NS_DECL_NSIREQUESTOBSERVER
|
||||
NS_DECL_NSIINTERFACEREQUESTOR
|
||||
|
||||
NS_IMETHOD InitManager(nsIScriptGlobalObject* aGlobalObject, nsXPITriggerInfo* aTrigger, PRUint32 aChromeType );
|
||||
|
||||
// nsIRequestObserver
|
||||
NS_DECL_NSIREQUESTOBSERVER
|
||||
|
||||
// nsIStreamListener
|
||||
NS_DECL_NSISTREAMLISTENER
|
||||
|
||||
// IXPIListener methods
|
||||
NS_DECL_NSIXPILISTENER
|
||||
|
||||
// nsIProgressEventSink
|
||||
NS_DECL_NSIPROGRESSEVENTSINK
|
||||
|
||||
// nsIInterfaceRequestor
|
||||
NS_DECL_NSIINTERFACEREQUESTOR
|
||||
|
||||
//nsPIXPIMANAGERCALLBACKS
|
||||
NS_DECL_NSPIXPIMANAGERCALLBACKS
|
||||
|
||||
|
||||
private:
|
||||
NS_IMETHOD DownloadNext();
|
||||
void Shutdown();
|
||||
NS_IMETHOD GetDestinationFile(nsString& url, nsILocalFile* *file);
|
||||
void LoadDialogWithNames(nsIDialogParamBlock* ioParamBlock);
|
||||
PRBool ConfirmInstall(nsIScriptGlobalObject* aGlobalObject, nsIDialogParamBlock* ioParamBlock);
|
||||
PRBool ConfirmChromeInstall(nsIScriptGlobalObject* aGlobalObject);
|
||||
NS_IMETHOD LoadParams(PRUint32 aCount, const PRUnichar** aPackageList, nsIDialogParamBlock** aParams);
|
||||
PRBool ConfirmChromeInstall(nsIDOMWindowInternal* aParentWindow, const PRUnichar** aPackage);
|
||||
PRBool TimeToUpdate(PRTime now);
|
||||
|
||||
PRInt32 GetIndexFromURL(const PRUnichar* aUrl);
|
||||
|
||||
nsXPITriggerInfo* mTriggers;
|
||||
nsXPITriggerItem* mItem;
|
||||
PRTime mLastUpdate;
|
||||
PRUint32 mNextItem;
|
||||
PRInt32 mNumJars;
|
||||
PRBool mFinalizing;
|
||||
PRBool mCancelled;
|
||||
PRUint32 mChromeType;
|
||||
PRBool mSelectChrome;
|
||||
PRInt32 mContentLength;
|
||||
PRTime mLastUpdate;
|
||||
PRBool mDialogOpen;
|
||||
PRBool mCancelled;
|
||||
PRBool mSelectChrome;
|
||||
PRBool mNeedsShutdown;
|
||||
|
||||
nsCOMPtr<nsIXPIProgressDlg> mDlg;
|
||||
nsCOMPtr<nsIDOMWindowInternal> mParentWindow;
|
||||
nsCOMPtr<nsIStringBundle> mStringBundle;
|
||||
nsCOMPtr<nsIXPIProgressDialog> mDlg;
|
||||
nsCOMPtr<nsIStringBundle> mStringBundle;
|
||||
nsCOMPtr<nsISoftwareUpdate> mInstallSvc;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -40,28 +40,21 @@ NS_IMPL_ISUPPORTS1(nsStubListener, nsIXPIListener)
|
|||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsStubListener::BeforeJavascriptEvaluation(const PRUnichar *URL)
|
||||
nsStubListener::OnInstallStart(const PRUnichar *URL)
|
||||
{
|
||||
// we're not interested in this one
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsStubListener::AfterJavascriptEvaluation(const PRUnichar *URL)
|
||||
nsStubListener::OnPackageNameSet(const PRUnichar *URL, const PRUnichar* UIPackageName)
|
||||
{
|
||||
// we're not interested in this one
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsStubListener::InstallStarted(const PRUnichar *URL, const PRUnichar* UIPackageName)
|
||||
{
|
||||
// we're not interested in this one
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsStubListener::ItemScheduled(const PRUnichar* message )
|
||||
nsStubListener::OnItemScheduled(const PRUnichar* message )
|
||||
{
|
||||
if (m_progress)
|
||||
{
|
||||
|
@ -71,7 +64,7 @@ nsStubListener::ItemScheduled(const PRUnichar* message )
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsStubListener::FinalizeProgress(const PRUnichar* message, PRInt32 itemNum, PRInt32 totNum )
|
||||
nsStubListener::OnFinalizeProgress(const PRUnichar* message, PRInt32 itemNum, PRInt32 totNum )
|
||||
{
|
||||
if (m_progress)
|
||||
{
|
||||
|
@ -81,7 +74,7 @@ nsStubListener::FinalizeProgress(const PRUnichar* message, PRInt32 itemNum, PRIn
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsStubListener::FinalStatus(const PRUnichar *URL, PRInt32 status)
|
||||
nsStubListener::OnInstallDone(const PRUnichar *URL, PRInt32 status)
|
||||
{
|
||||
// if (m_final)
|
||||
// m_final( nsCAutoString(URL), status );
|
||||
|
@ -90,7 +83,7 @@ nsStubListener::FinalStatus(const PRUnichar *URL, PRInt32 status)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsStubListener::LogComment(const PRUnichar* comment)
|
||||
nsStubListener::OnLogComment(const PRUnichar* comment)
|
||||
{
|
||||
// we're not interested in this one
|
||||
return NS_OK;
|
||||
|
|
|
@ -270,7 +270,6 @@ PR_PUBLIC_API(PRInt32) XPI_Install(
|
|||
rv = gXPI->InstallJar( iFile,
|
||||
URLstr.get(),
|
||||
args.get(),
|
||||
nsnull,
|
||||
(aFlags | XPI_NO_NEW_THREAD),
|
||||
gListener );
|
||||
|
||||
|
|
|
@ -0,0 +1,171 @@
|
|||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (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/MPL/
|
||||
*
|
||||
* 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 XPInstall.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2002
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Daniel Veditz <dveditz@netscape.com> (Original Author)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
/* implementation of a test XPInstall Dialog Service */
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Test the XPInstall embedding API's by dropping this component into
|
||||
// the Mozilla components directory and registering it.
|
||||
//
|
||||
// Do not export as part of a normal build since this will override the
|
||||
// built-in Mozilla UI we want to use.
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// constants
|
||||
// -----------------------------------------------------------------------
|
||||
const XPIDIALOGSERVICE_CONTRACTID =
|
||||
"@mozilla.org/embedui/xpinstall-dialog-service;1";
|
||||
|
||||
const XPIDIALOGSERVICE_CID =
|
||||
Components.ID("{9A5BEF68-3FDA-4926-9809-87A5A1CC8505}");
|
||||
|
||||
const XPI_TOPIC = "xpinstall-progress";
|
||||
const OPEN = "open";
|
||||
const CANCEL = "cancel";
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// XPInstall Dialog Service
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
function testXPIDialogService() {}
|
||||
|
||||
testXPIDialogService.prototype =
|
||||
{
|
||||
QueryInterface: function( iid )
|
||||
{
|
||||
if (!iid.equals(Components.interfaces.nsIXPIDialogService) &&
|
||||
!iid.equals(Components.interfaces.nsIXPIProgressDialog) &&
|
||||
!iid.equals(Components.interfaces.nsISupports))
|
||||
{
|
||||
throw Components.results.NS_ERROR_NO_INTERFACE;
|
||||
}
|
||||
return this;
|
||||
},
|
||||
|
||||
confirmInstall: function( parent, packages, count )
|
||||
{
|
||||
// stash parent window for use later
|
||||
this.mParent = parent;
|
||||
|
||||
// quick and dirty data display
|
||||
var str = "num packages: " + count/2 + "\n\n";
|
||||
for ( i = 0; i < count; ++i)
|
||||
str += packages[i++] + ' -- ' + packages[i] + '\n';
|
||||
|
||||
str += "\nDo you want to install?";
|
||||
|
||||
return parent.confirm(str);
|
||||
},
|
||||
|
||||
openProgressDialog: function( packages, count, mgr )
|
||||
{
|
||||
this.dlg = this.mParent.open();
|
||||
mgr.observe( this, XPI_TOPIC, OPEN );
|
||||
},
|
||||
|
||||
onStateChange: function( index, state, error )
|
||||
{
|
||||
dump("---XPIDlg--- State: "+index+', '+state+', '+error+'\n');
|
||||
},
|
||||
|
||||
onProgress: function( index, value, max )
|
||||
{
|
||||
dump("---XPIDlg--- "+index+": "+value+' of '+max+'\n');
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// XPInstall Dialog Service Module and Factory
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
// --- module entry point ---
|
||||
function NSGetModule(compMgr, fileSpec) { return XPIDlgSvcModule; }
|
||||
|
||||
|
||||
// --- module ---
|
||||
var XPIDlgSvcModule =
|
||||
{
|
||||
registerSelf: function( compMgr, fileSpec, location, type )
|
||||
{
|
||||
compMgr = compMgr.QueryInterface(Components.interfaces.nsIComponentRegistrar);
|
||||
|
||||
compMgr.registerFactoryLocation(XPIDIALOGSERVICE_CID,
|
||||
'XPInstall Dialog Service test component',
|
||||
XPIDIALOGSERVICE_CONTRACTID, fileSpec,
|
||||
location, type);
|
||||
},
|
||||
|
||||
unregisterSelf: function( compMgr, fileSpec, location )
|
||||
{
|
||||
compMgr = compMgr.QueryInterface(Components.interfaces.nsIComponentRegistrar);
|
||||
compMgr.unregisterFactoryLocation(XPIDIALOGSERVICE_CID, fileSpec);
|
||||
},
|
||||
|
||||
getClassObject: function( compMgr, cid, iid )
|
||||
{
|
||||
if (!cid.equals(XPIDIALOGSERVICE_CID))
|
||||
throw Components.results.NS_ERROR_NO_INTERFACE;
|
||||
|
||||
if (!iid.equals(Components.interfaces.nsIFactory))
|
||||
throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
|
||||
|
||||
return XPIDlgSvcFactory;
|
||||
},
|
||||
|
||||
canUnload: function( compMgr ) { return true; }
|
||||
};
|
||||
|
||||
|
||||
// --- factory ---
|
||||
var XPIDlgSvcFactory =
|
||||
{
|
||||
createInstance: function( outer, iid )
|
||||
{
|
||||
if (outer != null)
|
||||
throw Components.results.NS_ERROR_NO_AGGREGATION;
|
||||
|
||||
if (!iid.equals(Components.interfaces.nsIXPIDialogService) &&
|
||||
!iid.equals(Components.interfaces.nsISupports))
|
||||
throw Components.results.NS_ERROR_INVALID_ARG;
|
||||
|
||||
return new testXPIDialogService();
|
||||
}
|
||||
};
|
Загрузка…
Ссылка в новой задаче