Bug 652376: Remove xpinstall dead code. r=dveditz
authorDave Townsend <dtownsend@oxymoronical.com>
Fri, 02 Dec 2011 10:19:22 -0800
changeset 81995 8d5aa2c53f04e610866b08f9c9860a6ae1891394
parent 81994 bb764828a379ddf26e1952da10b530a2db990c9a
child 81996 6f88dd203a21d49f9ab74bbe9c27386c98e73f05
push idunknown
push userunknown
push dateunknown
reviewersdveditz
bugs652376
milestone11.0a1
Bug 652376: Remove xpinstall dead code. r=dveditz
xpinstall/Makefile.in
xpinstall/public/Makefile.in
xpinstall/public/nsIDOMInstallTriggerGlobal.h
xpinstall/public/nsIXPIDialogService.idl
xpinstall/public/nsIXPIInstallInfo.idl
xpinstall/public/nsIXPIProgressDialog.idl
xpinstall/public/nsIXPInstallManager.idl
xpinstall/public/nsPICertNotification.idl
xpinstall/public/nsSoftwareUpdateIIDs.h
xpinstall/public/xpinstall.js
xpinstall/src/CertReader.cpp
xpinstall/src/CertReader.h
xpinstall/src/Makefile.in
xpinstall/src/nsInstall.h
xpinstall/src/nsInstallTrigger.cpp
xpinstall/src/nsInstallTrigger.h
xpinstall/src/nsJSInstallTriggerGlobal.cpp
xpinstall/src/nsSoftwareUpdate.cpp
xpinstall/src/nsXPIInstallInfo.cpp
xpinstall/src/nsXPIInstallInfo.h
xpinstall/src/nsXPITriggerInfo.cpp
xpinstall/src/nsXPITriggerInfo.h
xpinstall/src/nsXPInstallManager.cpp
xpinstall/src/nsXPInstallManager.h
xpinstall/test/pre_checkin.xpi
xpinstall/test/pre_checkin_trigger.html
xpinstall/test/testXPIDialogService.js
xpinstall/tests/Makefile.in
xpinstall/tests/authRedirect.sjs
xpinstall/tests/browser_auth.js
xpinstall/tests/browser_auth2.js
xpinstall/tests/browser_auth3.js
xpinstall/tests/browser_badhash.js
xpinstall/tests/browser_badhashtype.js
xpinstall/tests/browser_bug540558.js
xpinstall/tests/browser_cancel.js
xpinstall/tests/browser_chrome.js
xpinstall/tests/browser_cookies.js
xpinstall/tests/browser_cookies2.js
xpinstall/tests/browser_cookies3.js
xpinstall/tests/browser_cookies4.js
xpinstall/tests/browser_corrupt.js
xpinstall/tests/browser_empty.js
xpinstall/tests/browser_enabled.js
xpinstall/tests/browser_enabled2.js
xpinstall/tests/browser_enabled3.js
xpinstall/tests/browser_hash.js
xpinstall/tests/browser_installchrome.js
xpinstall/tests/browser_localfile.js
xpinstall/tests/browser_localfile2.js
xpinstall/tests/browser_navigateaway.js
xpinstall/tests/browser_navigateaway2.js
xpinstall/tests/browser_offline.js
xpinstall/tests/browser_opendialog.js
xpinstall/tests/browser_signed_multiple.js
xpinstall/tests/browser_signed_naming.js
xpinstall/tests/browser_signed_tampered.js
xpinstall/tests/browser_signed_trigger.js
xpinstall/tests/browser_signed_untrusted.js
xpinstall/tests/browser_signed_url.js
xpinstall/tests/browser_softwareupdate.js
xpinstall/tests/browser_unsigned_trigger.js
xpinstall/tests/browser_unsigned_url.js
xpinstall/tests/browser_whitelist.js
xpinstall/tests/browser_whitelist2.js
xpinstall/tests/browser_whitelist3.js
xpinstall/tests/browser_whitelist4.js
xpinstall/tests/browser_whitelist5.js
xpinstall/tests/browser_whitelist6.js
xpinstall/tests/bug540558.html
xpinstall/tests/cookieRedirect.sjs
xpinstall/tests/corrupt.xpi
xpinstall/tests/empty.xpi
xpinstall/tests/enabled.html
xpinstall/tests/harness.js
xpinstall/tests/installchrome.html
xpinstall/tests/installtrigger.html
xpinstall/tests/signed-no-cn.xpi
xpinstall/tests/signed-no-o.xpi
xpinstall/tests/signed-tampered.xpi
xpinstall/tests/signed-untrusted.xpi
xpinstall/tests/signed.xpi
xpinstall/tests/signed2.xpi
xpinstall/tests/startsoftwareupdate.html
xpinstall/tests/unsigned.xpi
deleted file mode 100644
--- a/xpinstall/Makefile.in
+++ /dev/null
@@ -1,57 +0,0 @@
-#
-# ***** 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 Communicator client code, released
-# March 31, 1998.
-#
-# 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.
-#
-# Contributor(s):
-#   Daniel Veditz <dveditz@netscape.com>
-#   Douglas Turner <dougt@netscape.com>
-#   Samir Gehani <sgehani@netscape.com>
-#   Dave Townsend <dtownsend@oxymoronical.com>
-#
-# Alternatively, the contents of this file may be used under the terms of
-# either of 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 *****
-
-DEPTH		= ..
-topsrcdir	= @top_srcdir@
-srcdir		= @srcdir@
-VPATH		= @srcdir@
-
-include $(DEPTH)/config/autoconf.mk
-
-MODULE		= xpinstall
-DIRS		= public src
-
-ifdef ENABLE_TESTS
-DIRS += tests
-endif
-
-include $(topsrcdir)/config/rules.mk
deleted file mode 100644
--- a/xpinstall/public/Makefile.in
+++ /dev/null
@@ -1,65 +0,0 @@
-#
-# ***** 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 Communicator client code, released
-# March 31, 1998.
-#
-# 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.
-#
-# Contributor(s):
-#   Daniel Veditz <dveditz@netscape.com>
-#   Douglas Turner <dougt@netscape.com>
-#   Dave Townsend <dtownsend@oxymoronical.com>
-#
-# Alternatively, the contents of this file may be used under the terms of
-# either of 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 *****
-
-DEPTH		= ../..
-topsrcdir	= @top_srcdir@
-srcdir		= @srcdir@
-VPATH		= @srcdir@
-
-include $(DEPTH)/config/autoconf.mk
-
-MODULE		= xpinstall
-GRE_MODULE	= 1
-
-XPIDLSRCS	= \
-		nsIXPIDialogService.idl \
-		nsIXPIProgressDialog.idl \
-		nsIXPInstallManager.idl \
-		nsIXPIInstallInfo.idl \
-		nsPICertNotification.idl \
-		$(NULL)
-
-EXPORTS		= \
-		nsIDOMInstallTriggerGlobal.h \
-		nsSoftwareUpdateIIDs.h \
-		$(NULL)
-
-include $(topsrcdir)/config/rules.mk
deleted file mode 100644
--- a/xpinstall/public/nsIDOMInstallTriggerGlobal.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* ***** 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.org code.
- *
- * 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.
- *
- * Contributor(s):
- *   Dave Townsend <dtownsend@oxymoronical.com>
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either of 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 ***** */
-
-#ifndef nsIDOMInstallTriggerGlobal_h__
-#define nsIDOMInstallTriggerGlobal_h__
-
-#include "nsISupports.h"
-#include "nsString.h"
-#include "nsIScriptContext.h"
-#include "nsXPITriggerInfo.h"
-#include "nsIXPIInstallInfo.h"
-
-
-#define NS_IDOMINSTALLTRIGGERGLOBAL_IID \
- { 0x23bb93a4, 0xdaee, 0x4a47, \
-  {0x87, 0x76, 0xb1, 0x72, 0x35, 0x86, 0x2d, 0xac}}
-
-class nsIDOMInstallTriggerGlobal : public nsISupports {
-public:
-  NS_DECLARE_STATIC_IID_ACCESSOR(NS_IDOMINSTALLTRIGGERGLOBAL_IID)
-  enum {
-    NOT_FOUND = -5,
-    MAJOR_DIFF = 4,
-    MINOR_DIFF = 3,
-    REL_DIFF = 2,
-    BLD_DIFF = 1,
-    EQUAL = 0
-  };
-
-  NS_IMETHOD    GetOriginatingURI(nsIScriptGlobalObject* aGlobalObject, nsIURI * *aUri)=0;
-
-  NS_IMETHOD    UpdateEnabled(nsIScriptGlobalObject* aGlobalObject, bool aUseWhitelist, bool* aReturn)=0;
-
-  NS_IMETHOD    UpdateEnabled(nsIURI* aURI, bool aUseWhitelist, bool* aReturn)=0;
-
-  NS_IMETHOD    StartInstall(nsIXPIInstallInfo* aInstallInfo, bool* aReturn)=0;
-
-};
-
-NS_DEFINE_STATIC_IID_ACCESSOR(nsIDOMInstallTriggerGlobal,
-                              NS_IDOMINSTALLTRIGGERGLOBAL_IID)
-
-extern nsresult NS_InitInstallTriggerGlobalClass(nsIScriptContext *aContext, void **aPrototype);
-
-extern "C" nsresult NS_NewScriptInstallTriggerGlobal(nsIScriptContext *aContext, nsISupports *aSupports, nsISupports *aParent, void **aReturn);
-
-#endif // nsIDOMInstallTriggerGlobal_h__
deleted file mode 100644
--- a/xpinstall/public/nsIXPIDialogService.idl
+++ /dev/null
@@ -1,107 +0,0 @@
-/* ***** 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"
- */
-[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 three strings,
-     *                      a display name, a source URL, and a the name of the
-     *                      organization that signed this install.  Note that the
-     *                      name of the signer is not verified.  Verification
-     *                      happens when the the install has completely downloaded.
-     *                      Your user interface should only suggest that the 
-     *                      install may be signed by this organization name.
-     *                      Note that an unsigned archive is indicated by an 
-     *                      empty string.   
-     *
-     * @param count         The number of strings in the packageList. This
-     *                      will always be three times 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   three 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);
-};
deleted file mode 100644
--- a/xpinstall/public/nsIXPIInstallInfo.idl
+++ /dev/null
@@ -1,74 +0,0 @@
-/* ***** 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
- * Dave Townsend <dtownsend@oxymoronical.com>.
- *
- * Portions created by the Initial Developer are Copyright (C) 2007
- * the Initial Developer. All Rights Reserved.
- *
- * 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
- * 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"
-
-[ptr] native triggerInfoPtr(nsXPITriggerInfo);
-
-interface nsIDOMWindow;
-interface nsIDocShell;
-interface nsIURI;
-
-/**
- * Interface holding information about a triggered install that can be passed
- * to and from script.
- */
-[scriptable, uuid(5a4a775c-e452-4cf2-8ff8-d327ae24aec6)]
-interface nsIXPIInstallInfo : nsISupports
-{
-  /**
-   * The install triggers supplied by the install.
-   */
-  [noscript, notxpcom] attribute triggerInfoPtr triggerInfo;
-  
-  /**
-   * The original window that initiated the install.
-   */
-  readonly attribute nsIDOMWindow originatingWindow;
-  
-  /**
-   * The original URI calling the install. This is the URI that would have been
-   * checked against the whitelist if necessary.
-   */
-  readonly attribute nsIURI originatingURI;
-  
-  /**
-   * The chome type of the install.
-   */
-  readonly attribute PRUint32 chromeType;
-};
deleted file mode 100644
--- a/xpinstall/public/nsIXPIProgressDialog.idl
+++ /dev/null
@@ -1,80 +0,0 @@
-/* ***** 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.
- */
-[scriptable, uuid(ce8f744e-d5a5-41b3-911f-0fee3008b64e)]
-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 long value, in unsigned long long maxValue );
-};
deleted file mode 100644
--- a/xpinstall/public/nsIXPInstallManager.idl
+++ /dev/null
@@ -1,84 +0,0 @@
-/* ***** 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 Ben Goodger.
- * Portions created by the Initial Developer are Copyright (C) 2004
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *      Ben Goodger <ben@mozilla.org>
- *
- * 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 nsIXPIProgressDialog;
-interface nsIXPIInstallInfo;
-
-/**
- * Interface to XPInstallManager - manages download and install operations.
- */
-[scriptable, uuid(83fdd52f-2d34-4e22-981d-cf3c4ae76faa)]
-interface nsIXPInstallManager : nsISupports
-{
-    /** 
-     * Initiates a download and install operation of the supplied URLs
-     * and sends notifications to the supplied listener.
-     * @param aURLs     array of XPI urls to download and install
-     * @param aURLCount number of XPI urls in aURLs
-     * @param aListener a listener to receive status notifications
-     */
-    void initManagerFromChrome([array, size_is(aURLCount)] in wstring aURLs,
-                               in unsigned long aURLCount,
-                               in nsIXPIProgressDialog aListener);
-    /**
-     * Initiates a set of downloads and checks the supplied hashes after
-     * download. Just like initManagerFromChrome() in all other respects
-     * @param aURLs     array of XPI urls to download and install
-     * @param aHashes   array of hash strings to validate. The entire array
-     *                  or individual hashes can be null to indicate no
-     *                  checking. If supplied looks like "type:hash", like
-     *                  "md5:3232bc5624041c507db0965324188024".
-     *                  Supports the types in nsICryptoHash
-     * @param aURLCount number of XPI urls in aURLs and aHashes
-     * @param aListener a listener to receive status notifications
-     */
-    void initManagerWithHashes([array, size_is(aURLCount)] in wstring aURLs,
-                               [array, size_is(aURLCount)] in string aHashes,
-                               in unsigned long aURLCount,
-                               in nsIXPIProgressDialog aListener);
-    
-    /**
-     * Initiates a set of downloads based on an install info object. Will
-     * display confirmation dialog as if the install info had been supplied
-     * by content.
-     * @param aInstallInfo The install info object providing install triggers
-     *                     and script context for the install.
-     */
-    void initManagerWithInstallInfo(in nsIXPIInstallInfo aInstallInfo);
-};
-
deleted file mode 100644
--- a/xpinstall/public/nsPICertNotification.idl
+++ /dev/null
@@ -1,48 +0,0 @@
-/* ***** 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 XPInstall Signing.
- *
- * The Initial Developer of the Original Code is Doug Turner.
- * Portions created by the Initial Developer are Copyright (C) 2002
- * the Initial Developer. All Rights Reserved.
- *
- * 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
- * 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 nsIURI;
-interface nsIPrincipal;
-
-[uuid(42cd7162-ea4a-4088-9888-63ea5095869e)]
-interface nsPICertNotification : nsISupports
-{
-    void onCertAvailable(in nsIURI aURI, 
-                         in nsISupports aContext, 
-                         in PRUint32 aStatus,
-                         in nsIPrincipal aPrincipal);
-};
deleted file mode 100644
--- a/xpinstall/public/nsSoftwareUpdateIIDs.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/* ***** 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 Communicator client code, released
- * March 31, 1998.
- *
- * 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.
- *
- * Contributor(s):
- *   Daniel Veditz <dveditz@netscape.com>
- *   Douglas Turner <dougt@netscape.com>
- *   Dave Townsend <dtownsend@oxymoronical.com>
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either of 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 ***** */
-
-#ifndef nsSoftwareUpdateIIDs_h___
-#define nsSoftwareUpdateIIDs_h___
-
-#define NS_SoftwareUpdateInstallTrigger_CID          \
-{ /* 18c2f98d-b09f-11d2-bcde-00805f0e1353 */         \
-    0x18c2f98d,                                      \
-    0xb09f,                                          \
-    0x11d2,                                          \
-    {0xbc, 0xde, 0x00, 0x80, 0x5f, 0x0e, 0x13, 0x53} \
-}
-
-#define NS_XPInstallManager_CID                      \
-{ /* {6a4d4c1e-a74a-4320-8124-16233a0183d6} */       \
-    0x6a4d4c1e,                                      \
-    0xa74a,                                          \
-    0x4320,                                          \
-    { 0x81, 0x24, 0x16, 0x23, 0x3a, 0x1, 0x83, 0xd6} \
-}
-
-
-#endif /* nsSoftwareUpdateIIDs_h___ */
-
deleted file mode 100644
--- a/xpinstall/public/xpinstall.js
+++ /dev/null
@@ -1,2 +0,0 @@
-pref("xpinstall.enabled",       true);
-pref("xpinstall.whitelist.required", true);
deleted file mode 100644
--- a/xpinstall/src/CertReader.cpp
+++ /dev/null
@@ -1,279 +0,0 @@
-/* ***** 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 XPInstall Signing.
- *
- * The Initial Developer of the Original Code is Doug Turner.
- * Portions created by the Initial Developer are Copyright (C) 2002
- * the Initial Developer. All Rights Reserved.
- *
- * 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
- * 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 "zlib.h"
-#include "zipstruct.h"
-
-#include "CertReader.h"
-
-#include "nsCRT.h"
-#include "nsIServiceManager.h"
-#include "nsISignatureVerifier.h"
-#include "nsIInputStream.h"
-#include "nsIPrincipal.h"
-#include "nsIURI.h"
-#include "nsPICertNotification.h"
-
-
-#include "nsNetUtil.h"
-
-// just a guess at the max size of the cert.
-#define MAX_SIGNATURE_SIZE (32*1024)
-
-
-/*
- *  x t o i n t
- *
- *  Converts a two byte ugly endianed integer
- *  to our platform's integer.
- *
- */
-
-static unsigned int xtoint (unsigned char *ii)
-{
-  return (int) (ii [0]) | ((int) ii [1] << 8);
-}
-
-/*
- *  x t o l o n g
- *
- *  Converts a four byte ugly endianed integer
- *  to our platform's integer.
- *
- */
-
-static unsigned long xtolong (unsigned char *ll)
-{
-  unsigned long ret;
-
-  ret =  ((((unsigned long) ll [0]) <<  0) |
-          (((unsigned long) ll [1]) <<  8) |
-          (((unsigned long) ll [2]) << 16) |
-          (((unsigned long) ll [3]) << 24) );
-
-  return ret;
-}
-
-static int my_inflate(unsigned char* compr, PRUint32 comprLen, unsigned char* uncompr, PRUint32 uncomprLen)
-{
-  int err;
-  z_stream d_stream; /* decompression stream */
-  memset (&d_stream, 0, sizeof (d_stream));
-
-  // buffer is way to small to even deal with.
-  if (uncomprLen < 10)
-    return -1;
-
-  *uncompr = '\0';
-
-  if (inflateInit2 (&d_stream, -MAX_WBITS) != Z_OK)
-    return -1;
-
-  d_stream.next_in  = compr;
-  d_stream.avail_in = (uInt)comprLen;
-
-  d_stream.next_out = uncompr;
-  d_stream.avail_out = (uInt)uncomprLen;
-
-  err = inflate(&d_stream, Z_NO_FLUSH);
-
-  if (err != Z_OK && err != Z_STREAM_END) {
-    inflateEnd(&d_stream);
-    return -1;
-  }
-
-  err = inflateEnd(&d_stream);
-  if (err != Z_OK) {
-    return -1;
-  }
-  return 0;
-}
-
-CertReader::CertReader(nsIURI* aURI, nsISupports* aContext, nsPICertNotification* aObs):
-  mContext(aContext),
-  mURI(aURI),
-  mObserver(aObs)
-{
-}
-
-CertReader::~CertReader()
-{
-}
-
-NS_IMPL_ISUPPORTS2(CertReader, nsIStreamListener, nsIRequestObserver)
-
-NS_IMETHODIMP
-CertReader::OnStartRequest(nsIRequest *request, nsISupports* context)
-{
-  mVerifier = do_GetService(SIGNATURE_VERIFIER_CONTRACTID);
-  if (!mVerifier)
-    return NS_BINDING_ABORTED;
-
-  nsCOMPtr<nsILoadGroup> loadGroup;
-  nsresult rv = request->GetLoadGroup(getter_AddRefs(loadGroup));
-  if (NS_SUCCEEDED(rv) && loadGroup)
-    loadGroup->RemoveRequest(request, nsnull, NS_BINDING_RETARGETED);
-
-  mLeftoverBuffer.Truncate();
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-CertReader::OnDataAvailable(nsIRequest *request,
-                            nsISupports* context,
-                            nsIInputStream *aIStream,
-                            PRUint32 aSourceOffset,
-                            PRUint32 aLength)
-{
-  if (!mVerifier)
-    return NS_BINDING_ABORTED;
-
-  char buf[4096];
-  PRUint32 amt, size;
-  nsresult rv;
-
-  while (aLength)
-  {
-    size = NS_MIN(aLength, sizeof(buf));
-
-    rv = aIStream->Read(buf, size, &amt);
-    if (NS_FAILED(rv))
-      return rv;
-
-    aLength -= amt;
-
-    mLeftoverBuffer.Append(buf, amt);
-
-    if (mLeftoverBuffer.Length() < ZIPLOCAL_SIZE)
-      continue;
-
-    const char* caret = mLeftoverBuffer.get();
-
-    ZipLocal_* ziplocal = (ZipLocal_*) caret;
-
-    if (xtolong(ziplocal->signature) != LOCALSIG)
-      return NS_BINDING_ABORTED;
-
-    // did we read the entire file entry into memory?
-    PRUint32 fileEntryLen = (ZIPLOCAL_SIZE +
-                             xtoint(ziplocal->filename_len) +
-                             xtoint(ziplocal->extrafield_len) +
-                             xtolong(ziplocal->size));
-
-
-    // prevent downloading a huge file on an unsigned cert
-    if (fileEntryLen > MAX_SIGNATURE_SIZE)
-      return NS_BINDING_ABORTED;
-
-    if (mLeftoverBuffer.Length() < fileEntryLen)
-    {
-      // we are just going to buffer and continue.
-      continue;
-    }
-
-    // the assumption here is that we have the fileEntry in mLeftoverBuffer
-
-    int err = 0;
-    unsigned char* orgData = nsnull;
-    unsigned char* sigData = nsnull;
-    const char* data = (caret +
-                        ZIPLOCAL_SIZE +
-                        xtoint(ziplocal->filename_len) +
-                        xtoint(ziplocal->extrafield_len));
-
-    PRUint32 sigSize = 0;
-    PRUint32 orgSize = xtolong ((unsigned char *) ziplocal->orglen);
-    PRUint32 cSize   = xtolong ((unsigned char *) ziplocal->size);
-
-    switch (xtoint(ziplocal->method))
-    {
-      case STORED:
-        // file is uncompressed, can use the data where it is
-        sigSize = cSize;
-        sigData = (unsigned char*)data;
-        break;
-
-      case DEFLATED:
-        if (orgSize == 0 || orgSize > MAX_SIGNATURE_SIZE)
-          return NS_BINDING_ABORTED;
-
-        orgData = (unsigned char*)malloc(orgSize);
-        if (!orgData)
-          return NS_BINDING_ABORTED;
-
-        err = my_inflate((unsigned char*)data,
-                         cSize,
-                         orgData,
-                         orgSize);
-
-        sigSize = orgSize;
-        sigData = orgData;
-        break;
-
-      default:
-        // unsupported compression method
-        err = Z_DATA_ERROR;
-        break;
-    }
-
-    if (err == 0)
-    {
-      PRInt32 verifyError;
-      rv = mVerifier->VerifySignature((char*)sigData, sigSize, nsnull, 0,
-                                 &verifyError, getter_AddRefs(mPrincipal));
-    }
-    if (orgData)
-        free(orgData);
-
-    // Cancel the load now that we've verified the signature
-    return NS_BINDING_ABORTED;
-  }
-
-  return NS_OK; // continue reading
-}
-
-NS_IMETHODIMP
-CertReader::OnStopRequest(nsIRequest *request, nsISupports* context,
-                          nsresult aStatus)
-{
-    mObserver->OnCertAvailable(mURI,
-                               mContext,
-                               aStatus,
-                               mPrincipal);
-
-    return NS_OK;
-}
-
-
deleted file mode 100644
--- a/xpinstall/src/CertReader.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/* ***** 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 XPInstall Signing.
- *
- * The Initial Developer of the Original Code is Doug Turner.
- * Portions created by the Initial Developer are Copyright (C) 2002
- * the Initial Developer. All Rights Reserved.
- *
- * 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
- * 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 "nsCOMPtr.h"
-#include "nsIStreamListener.h"
-#include "nsString.h"
-
-class nsISignatureVerifier;
-class nsIPrincipal;
-class nsIURI;
-class nsPICertNotification;
-
-
-class CertReader : public nsIStreamListener
-{
-public:
-  CertReader(nsIURI* uri, nsISupports* aContext, nsPICertNotification* aObs);
-  virtual ~CertReader();
-
-  NS_DECL_ISUPPORTS
-  NS_DECL_NSIREQUESTOBSERVER
-  NS_DECL_NSISTREAMLISTENER
-
-private:
-  nsCString mLeftoverBuffer;
-  nsCOMPtr<nsIPrincipal> mPrincipal;
-  nsCOMPtr<nsISignatureVerifier> mVerifier;
-
-  nsCOMPtr<nsISupports> mContext;
-  nsCOMPtr<nsIURI> mURI;
-  nsCOMPtr<nsPICertNotification> mObserver;
-};
deleted file mode 100644
--- a/xpinstall/src/Makefile.in
+++ /dev/null
@@ -1,74 +0,0 @@
-#
-# ***** 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 Communicator client code, released
-# March 31, 1998.
-#
-# 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.
-#
-# Contributor(s):
-#   Daniel Veditz <dveditz@netscape.com>
-#   Douglas Turner <dougt@netscape.com>
-#   Dave Townsend <dtownsend@oxymoronical.com>
-#
-# Alternatively, the contents of this file may be used under the terms of
-# either of 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 *****
-
-DEPTH		= ../..
-topsrcdir	= @top_srcdir@
-srcdir		= @srcdir@
-VPATH		= @srcdir@
-
-include $(DEPTH)/config/autoconf.mk
-
-MODULE		= xpinstall
-LIBRARY_NAME	= xpinstall
-
-EXPORT_LIBRARY = 1
-IS_COMPONENT	= 1
-MODULE_NAME	= nsSoftwareUpdate
-GRE_MODULE	= 1
-LIBXUL_LIBRARY	= 1
-
-
-# XXX shouldn't need to export this
-EXPORTS		= nsXPITriggerInfo.h
-
-CPPSRCS		= \
-		CertReader.cpp \
-		nsInstallTrigger.cpp \
-		nsJSInstallTriggerGlobal.cpp \
-		nsSoftwareUpdate.cpp \
-		nsXPITriggerInfo.cpp \
-		nsXPInstallManager.cpp \
-		nsXPIInstallInfo.cpp \
-		$(NULL)
-
-LOCAL_INCLUDES	= -I$(srcdir)/../public
-
-include $(topsrcdir)/config/rules.mk
deleted file mode 100644
--- a/xpinstall/src/nsInstall.h
+++ /dev/null
@@ -1,117 +0,0 @@
-/* ***** 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 Communicator client code, released
- * March 31, 1998.
- *
- * 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.
- *
- * Contributor(s):
- *   Daniel Veditz <dveditz@netscape.com>
- *   Douglas Turner <dougt@netscape.com>
- *   Jens Bannmann <jens.b@web.de>
- *   Dave Townsend <dtownsend@oxymoronical.com>
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either of 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 ***** */
-
-#ifndef __NS_INSTALL_H__
-#define __NS_INSTALL_H__
-
-class nsInstall
-{
-    public:
-
-        enum
-        {
-            BAD_PACKAGE_NAME            = -200,
-            UNEXPECTED_ERROR            = -201,
-            ACCESS_DENIED               = -202,
-            EXECUTION_ERROR             = -203,
-            NO_INSTALL_SCRIPT           = -204,
-            NO_CERTIFICATE              = -205,
-            NO_MATCHING_CERTIFICATE     = -206,
-            CANT_READ_ARCHIVE           = -207,
-            INVALID_ARGUMENTS           = -208,
-            ILLEGAL_RELATIVE_PATH       = -209,
-            USER_CANCELLED              = -210,
-            INSTALL_NOT_STARTED         = -211,
-            SILENT_MODE_DENIED          = -212,
-            NO_SUCH_COMPONENT           = -213,
-            DOES_NOT_EXIST              = -214,
-            READ_ONLY                   = -215,
-            IS_DIRECTORY                = -216,
-            NETWORK_FILE_IS_IN_USE      = -217,
-            APPLE_SINGLE_ERR            = -218,
-            INVALID_PATH_ERR            = -219,
-            PATCH_BAD_DIFF              = -220,
-            PATCH_BAD_CHECKSUM_TARGET   = -221,
-            PATCH_BAD_CHECKSUM_RESULT   = -222,
-            UNINSTALL_FAILED            = -223,
-            PACKAGE_FOLDER_NOT_SET      = -224,
-            EXTRACTION_FAILED           = -225,
-            FILENAME_ALREADY_USED       = -226,
-            INSTALL_CANCELLED           = -227,
-            DOWNLOAD_ERROR              = -228,
-            SCRIPT_ERROR                = -229,
-
-            ALREADY_EXISTS              = -230,
-            IS_FILE                     = -231,
-            SOURCE_DOES_NOT_EXIST       = -232,
-            SOURCE_IS_DIRECTORY         = -233,
-            SOURCE_IS_FILE              = -234,
-            INSUFFICIENT_DISK_SPACE     = -235,
-            FILENAME_TOO_LONG           = -236,
-
-            UNABLE_TO_LOCATE_LIB_FUNCTION = -237,
-            UNABLE_TO_LOAD_LIBRARY        = -238,
-
-            CHROME_REGISTRY_ERROR       = -239,
-
-            MALFORMED_INSTALL           = -240,
-
-            KEY_ACCESS_DENIED           = -241,
-            KEY_DOES_NOT_EXIST          = -242,
-            VALUE_DOES_NOT_EXIST        = -243,
-
-            UNSUPPORTED_TYPE            = -244,
-
-            INVALID_SIGNATURE           = -260,
-            INVALID_HASH                = -261,
-            INVALID_HASH_TYPE           = -262,
-
-            OUT_OF_MEMORY               = -299,
-
-            GESTALT_UNKNOWN_ERR         = -5550,
-            GESTALT_INVALID_ARGUMENT    = -5551,
-
-            SUCCESS                     = 0,
-            REBOOT_NEEDED               = 999
-        };
-};
-
-#endif
deleted file mode 100644
--- a/xpinstall/src/nsInstallTrigger.cpp
+++ /dev/null
@@ -1,453 +0,0 @@
-/* ***** 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 Communicator client code, released
- * March 31, 1998.
- *
- * 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.
- *
- * Contributor(s):
- *   Dave Townsend <dtownsend@oxymoronical.com>
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either of 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 "nsXPInstallManager.h"
-#include "nsInstallTrigger.h"
-#include "nsIDOMInstallTriggerGlobal.h"
-
-#include "nscore.h"
-#include "nsAutoPtr.h"
-#include "netCore.h"
-#include "nsIFactory.h"
-#include "nsISupports.h"
-#include "nsPIDOMWindow.h"
-#include "nsIScriptGlobalObject.h"
-#include "nsIScriptGlobalObjectOwner.h"
-
-#include "nsIPrefBranch.h"
-#include "nsIPrefService.h"
-#include "nsIPermissionManager.h"
-#include "nsIDocShell.h"
-#include "nsNetUtil.h"
-#include "nsIDOMDocument.h"
-#include "nsIDocument.h"
-#include "nsIPrincipal.h"
-#include "nsIObserverService.h"
-#include "nsIPropertyBag2.h"
-
-#include "nsIComponentManager.h"
-#include "nsIServiceManager.h"
-
-#include "nsIContentHandler.h"
-#include "nsIChannel.h"
-#include "nsIURI.h"
-#include "nsXPIInstallInfo.h"
-
-
-nsInstallTrigger::nsInstallTrigger()
-{
-    mScriptObject   = nsnull;
-}
-
-nsInstallTrigger::~nsInstallTrigger()
-{
-}
-
-
-NS_IMPL_THREADSAFE_ISUPPORTS3 (nsInstallTrigger,
-                              nsIScriptObjectOwner,
-                              nsIDOMInstallTriggerGlobal,
-                              nsIContentHandler)
-
-
-NS_IMETHODIMP
-nsInstallTrigger::GetScriptObject(nsIScriptContext *aContext, void** aScriptObject)
-{
-    NS_PRECONDITION(nsnull != aScriptObject, "null arg");
-    nsresult res = NS_OK;
-
-    if (nsnull == mScriptObject)
-    {
-        res = NS_NewScriptInstallTriggerGlobal(aContext,
-                                               (nsIDOMInstallTriggerGlobal*)this,
-                                               aContext->GetGlobalObject(),
-                                               &mScriptObject);
-    }
-
-    *aScriptObject = mScriptObject;
-    return res;
-}
-
-NS_IMETHODIMP
-nsInstallTrigger::SetScriptObject(void *aScriptObject)
-{
-  mScriptObject = aScriptObject;
-  return NS_OK;
-}
-
-
-
-
-NS_IMETHODIMP
-nsInstallTrigger::HandleContent(const char * aContentType,
-                                nsIInterfaceRequestor* aWindowContext,
-                                nsIRequest* aRequest)
-{
-    nsresult rv = NS_OK;
-    if (!aRequest)
-        return NS_ERROR_NULL_POINTER;
-
-    if (nsCRT::strcasecmp(aContentType, "application/x-xpinstall") != 0)
-    {
-        // We only support content-type application/x-xpinstall
-        return NS_ERROR_WONT_HANDLE_CONTENT;
-    }
-
-    // Save the URI so nsXPInstallManager can re-load it later
-    nsCOMPtr<nsIURI> uri;
-    nsCAutoString    urispec;
-    nsCOMPtr<nsIChannel> channel = do_QueryInterface(aRequest);
-    if (channel)
-    {
-        rv = channel->GetURI(getter_AddRefs(uri));
-        if (NS_SUCCEEDED(rv) && uri)
-            rv = uri->GetSpec(urispec);
-    }
-    if (NS_FAILED(rv))
-        return rv;
-    if (urispec.IsEmpty())
-        return NS_ERROR_ILLEGAL_VALUE;
-
-
-    // Save the referrer if any, for permission checks
-    NS_NAMED_LITERAL_STRING(referrerProperty, "docshell.internalReferrer");
-    bool useReferrer = false;
-    nsCOMPtr<nsIURI> referringURI;
-    nsCOMPtr<nsIPropertyBag2> channelprops(do_QueryInterface(channel));
-
-    if (channelprops)
-    {
-        // Get the referrer from the channel properties if we can (not all
-        // channels support our internal-referrer property).
-        //
-        // It's possible docshell explicitly set a null referrer in the case
-        // of typed, pasted, or bookmarked URLs and the like. In such a case
-        // we get a success return value with null pointer.
-        //
-        // A null referrer is automatically whitelisted as an explicit user
-        // action (though they'll still get the confirmation dialog). For a
-        // missing referrer we go to our fall-back plan of using the XPI
-        // location for whitelisting purposes.
-        rv = channelprops->GetPropertyAsInterface(referrerProperty,
-                                                  NS_GET_IID(nsIURI),
-                                                  getter_AddRefs(referringURI));
-        if (NS_SUCCEEDED(rv))
-            useReferrer = true;
-    }
-
-    // Cancel the current request. nsXPInstallManager restarts the download
-    // under its control (shared codepath with InstallTrigger)
-    aRequest->Cancel(NS_BINDING_ABORTED);
-
-
-    // Get the global object of the target window for StartSoftwareUpdate
-    nsCOMPtr<nsIScriptGlobalObjectOwner> globalObjectOwner =
-                                         do_QueryInterface(aWindowContext);
-    nsIScriptGlobalObject* globalObject =
-      globalObjectOwner ? globalObjectOwner->GetScriptGlobalObject() : nsnull;
-    if ( !globalObject )
-        return NS_ERROR_INVALID_ARG;
-
-
-    nsCOMPtr<nsIURI> checkuri;
-
-    if ( useReferrer )
-    {
-        // easiest and most common case: base decision on the page that
-        // contained the link
-        //
-        // NOTE: the XPI itself may be from elsewhere; the user can decide if
-        // they trust the actual source when they get the install confirmation
-        // dialog. The decision we're making here is whether the triggering
-        // site is one which is allowed to annoy the user with modal dialogs.
-
-        checkuri = referringURI;
-    }
-    else
-    {
-        // Now we're stumbing in the dark. In the most likely case the user
-        // simply clicked on an FTP link (no referrer) and it's perfectly
-        // sane to use the current window.
-        //
-        // On the other hand the user might be opening a non-http XPI link
-        // in an unrelated existing window (typed in location bar, bookmark,
-        // dragged link ...) in which case the current window is irrelevant.
-        // If we knew it was one of these explicit user actions we'd like to
-        // allow it, but we have no way of knowing that here.
-        //
-        // But there's no way to distinguish the innocent cases from a clever
-        // malicious site. If we used the target window then evil.com could
-        // embed a presumed allowed site (e.g. mozilla.org) in a frame, then
-        // change the location to the XPI and trigger the install. Or evil.com
-        // could do the same thing in a new window (more work to get around
-        // popup blocking, but possible).
-        //
-        // Our choices appear to be block this type of load entirely or to
-        // trust only the install URI. The former is unacceptably restrictive,
-        // the latter allows malicious sites to pester people with modal
-        // dialogs. As long as the trusted sites don't host bad content that's
-        // no worse than an endless stream of alert()s -- already possible.
-        // If the trusted sites don't even have an ftp server then even this
-        // level of annoyance is not possible.
-        //
-        // If a trusted site hosts an install with an exploitable flaw it
-        // might be possible that a malicious site would attempt to trick
-        // people into installing it, hoping to turn around and exploit it.
-        // This is not entirely far-fetched (it's been done with ActiveX
-        // controls) and will require community policing of the default
-        // trusted sites.
-
-        checkuri = uri;
-    }
-
-    nsAutoPtr<nsXPITriggerInfo> trigger(new nsXPITriggerInfo());
-    nsAutoPtr<nsXPITriggerItem> item(new nsXPITriggerItem(0, NS_ConvertUTF8toUTF16(urispec).get(),
-                                                          nsnull));
-    if (trigger && item)
-    {
-        // trigger will own the item now
-        trigger->Add(item.forget());
-        nsCOMPtr<nsIDOMWindow> win = do_QueryInterface(globalObject);
-        nsCOMPtr<nsIXPIInstallInfo> installInfo =
-                              new nsXPIInstallInfo(win, checkuri, trigger, 0);
-        if (installInfo)
-        {
-            // From here trigger is owned by installInfo until passed on to nsXPInstallManager
-            trigger.forget();
-            if (AllowInstall(checkuri))
-            {
-                return StartInstall(installInfo, nsnull);
-            }
-            else
-            {
-                nsCOMPtr<nsIObserverService> os =
-                  mozilla::services::GetObserverService();
-                if (os)
-                    os->NotifyObservers(installInfo,
-                                        "xpinstall-install-blocked",
-                                        nsnull);
-                return NS_ERROR_ABORT;
-            }
-        }
-    }
-    return NS_ERROR_OUT_OF_MEMORY;
-}
-
-
-// updateWhitelist
-//
-// Helper function called by nsInstallTrigger::AllowInstall().
-// Interprets the pref as a comma-delimited list of hosts and adds each one
-// to the permission manager using the given action. Clear pref when done.
-static void updatePermissions( const char* aPref,
-                               PRUint32 aPermission,
-                               nsIPermissionManager* aPermissionManager,
-                               nsIPrefBranch*        aPrefBranch)
-{
-    NS_PRECONDITION(aPref && aPermissionManager && aPrefBranch, "Null arguments!");
-
-    nsXPIDLCString hostlist;
-    nsresult rv = aPrefBranch->GetCharPref( aPref, getter_Copies(hostlist));
-    if (NS_SUCCEEDED(rv) && !hostlist.IsEmpty())
-    {
-        nsCAutoString host;
-        PRInt32 start=0, match=0;
-        nsresult rv;
-        nsCOMPtr<nsIURI> uri;
-
-        do {
-            match = hostlist.FindChar(',', start);
-
-            host = Substring(hostlist, start, match-start);
-            host.CompressWhitespace();
-            host.Insert("http://", 0);
-
-            rv = NS_NewURI(getter_AddRefs(uri), host);
-            if (NS_SUCCEEDED(rv))
-            {
-                aPermissionManager->Add( uri, XPI_PERMISSION, aPermission, 
-                                         nsIPermissionManager::EXPIRE_NEVER, 0 );
-            }
-            start = match+1;
-        } while ( match > 0 );
-
-        // save empty list, we don't need to do this again
-        aPrefBranch->SetCharPref( aPref, "");
-    }
-}
-
-
-// Check whether an Install is allowed. The launching URI can be null,
-// in which case only the global pref-setting matters.
-bool
-nsInstallTrigger::AllowInstall(nsIURI* aLaunchURI)
-{
-    // Check the global setting.
-    bool xpiEnabled = false;
-    nsCOMPtr<nsIPrefBranch> prefBranch(do_GetService(NS_PREFSERVICE_CONTRACTID));
-    if ( !prefBranch)
-    {
-        return true; // no pref service in native install, it's OK
-    }
-
-    prefBranch->GetBoolPref( XPINSTALL_ENABLE_PREF, &xpiEnabled);
-    if ( !xpiEnabled )
-    {
-        // globally turned off
-        return false;
-    }
-
-
-    // Check permissions for the launching host if we have one
-    nsCOMPtr<nsIPermissionManager> permissionMgr =
-                            do_GetService(NS_PERMISSIONMANAGER_CONTRACTID);
-
-    if ( permissionMgr && aLaunchURI )
-    {
-        bool isChrome = false;
-        bool isFile = false;
-        aLaunchURI->SchemeIs( "chrome", &isChrome );
-        aLaunchURI->SchemeIs( "file", &isFile );
-
-        // file: and chrome: don't need whitelisted hosts
-        if ( !isChrome && !isFile )
-        {
-            // check prefs for permission updates before testing URI
-            updatePermissions( XPINSTALL_WHITELIST_ADD,
-                               nsIPermissionManager::ALLOW_ACTION,
-                               permissionMgr, prefBranch );
-            updatePermissions( XPINSTALL_WHITELIST_ADD_36,
-                               nsIPermissionManager::ALLOW_ACTION,
-                               permissionMgr, prefBranch );
-            updatePermissions( XPINSTALL_BLACKLIST_ADD,
-                               nsIPermissionManager::DENY_ACTION,
-                               permissionMgr, prefBranch );
-
-            bool requireWhitelist = true;
-            prefBranch->GetBoolPref( XPINSTALL_WHITELIST_REQUIRED, &requireWhitelist );
-
-            PRUint32 permission = nsIPermissionManager::UNKNOWN_ACTION;
-            permissionMgr->TestPermission( aLaunchURI, XPI_PERMISSION, &permission );
-
-            if ( permission == nsIPermissionManager::DENY_ACTION )
-            {
-                xpiEnabled = false;
-            }
-            else if ( requireWhitelist &&
-                      permission != nsIPermissionManager::ALLOW_ACTION )
-            {
-                xpiEnabled = false;
-            }
-        }
-    }
-
-    return xpiEnabled;
-}
-
-
-NS_IMETHODIMP
-nsInstallTrigger::GetOriginatingURI(nsIScriptGlobalObject* aGlobalObject, nsIURI * *aUri)
-{
-    NS_ENSURE_ARG_POINTER(aGlobalObject);
-
-    *aUri = nsnull;
-
-    // find the current site
-    nsCOMPtr<nsIDOMDocument> domdoc;
-    nsCOMPtr<nsIDOMWindow> window(do_QueryInterface(aGlobalObject));
-    if ( window )
-    {
-        window->GetDocument(getter_AddRefs(domdoc));
-        nsCOMPtr<nsIDocument> doc(do_QueryInterface(domdoc));
-        if ( doc )
-            NS_ADDREF(*aUri = doc->GetDocumentURI());
-    }
-    return NS_OK;
-}
-
-NS_IMETHODIMP
-nsInstallTrigger::UpdateEnabled(nsIScriptGlobalObject* aGlobalObject, bool aUseWhitelist, bool* aReturn)
-{
-    nsCOMPtr<nsIURI> uri;
-    nsresult rv = GetOriginatingURI(aGlobalObject, getter_AddRefs(uri));
-    NS_ENSURE_SUCCESS(rv, rv);
-    return UpdateEnabled(uri, aUseWhitelist, aReturn);
-}
-
-NS_IMETHODIMP
-nsInstallTrigger::UpdateEnabled(nsIURI* aURI, bool aUseWhitelist, bool* aReturn)
-{
-    // disallow unless we successfully find otherwise
-    *aReturn = false;
-
-    if (!aUseWhitelist)
-    {
-        // simple global pref check
-        nsCOMPtr<nsIPrefBranch> prefBranch(do_GetService(NS_PREFSERVICE_CONTRACTID));
-        if (prefBranch)
-            prefBranch->GetBoolPref( XPINSTALL_ENABLE_PREF, aReturn);
-    }
-    else if (aURI)
-    {
-        *aReturn = AllowInstall(aURI);
-    }
-
-    return NS_OK;
-}
-
-
-NS_IMETHODIMP
-nsInstallTrigger::StartInstall(nsIXPIInstallInfo* aInstallInfo, bool* aReturn)
-{
-    if (aReturn)
-        *aReturn = false;
-
-    nsXPInstallManager *mgr = new nsXPInstallManager();
-    if (mgr)
-    {
-        nsresult rv = mgr->InitManagerWithInstallInfo(aInstallInfo);
-        if (NS_SUCCEEDED(rv) && aReturn)
-            *aReturn = true;
-        return rv;
-    }
-    else
-    {
-        return NS_ERROR_OUT_OF_MEMORY;
-    }
-}
deleted file mode 100644
--- a/xpinstall/src/nsInstallTrigger.h
+++ /dev/null
@@ -1,65 +0,0 @@
-#ifndef __NS_INSTALLTRIGGER_H__
-#define __NS_INSTALLTRIGGER_H__
-
-#include "nscore.h"
-#include "nsString.h"
-#include "nsIFactory.h"
-#include "nsISupports.h"
-#include "nsIScriptObjectOwner.h"
-
-#include "prtypes.h"
-#include "nsHashtable.h"
-
-#include "nsIDOMInstallTriggerGlobal.h"
-#include "nsXPITriggerInfo.h"
-
-#include "nsIContentHandler.h"
-
-#define NOT_CHROME          0
-#define CHROME_SKIN         1
-#define CHROME_LOCALE       2
-#define CHROME_SAFEMAX      CHROME_SKIN
-#define CHROME_CONTENT      4
-#define CHROME_ALL          (CHROME_SKIN | CHROME_LOCALE | CHROME_CONTENT)
-#define CHROME_PROFILE      8
-#define CHROME_DELAYED      0x10
-#define CHROME_SELECT       0x20
-
-#define XPI_PERMISSION      "install"
-
-#define XPI_WHITELIST       true
-#define XPI_GLOBAL          false
-
-#define XPINSTALL_ENABLE_PREF            "xpinstall.enabled"
-#define XPINSTALL_WHITELIST_ADD          "xpinstall.whitelist.add"
-#define XPINSTALL_WHITELIST_ADD_36       "xpinstall.whitelist.add.36"
-#define XPINSTALL_WHITELIST_REQUIRED     "xpinstall.whitelist.required"
-#define XPINSTALL_BLACKLIST_ADD          "xpinstall.blacklist.add"
-
-class nsInstallTrigger: public nsIScriptObjectOwner,
-                        public nsIDOMInstallTriggerGlobal,
-                        public nsIContentHandler
-{
-    public:
-        nsInstallTrigger();
-        virtual ~nsInstallTrigger();
-
-        NS_DECL_ISUPPORTS
-        NS_DECL_NSICONTENTHANDLER
-
-        NS_IMETHOD    GetScriptObject(nsIScriptContext *aContext, void** aScriptObject);
-        NS_IMETHOD    SetScriptObject(void* aScriptObject);
-
-        NS_IMETHOD    GetOriginatingURI(nsIScriptGlobalObject* aGlobalObject, nsIURI * *aUri);
-        NS_IMETHOD    UpdateEnabled(nsIScriptGlobalObject* aGlobalObject, bool aUseWhitelist, bool* aReturn);
-        NS_IMETHOD    UpdateEnabled(nsIURI* aURI, bool aUseWhitelist, bool* aReturn);
-        NS_IMETHOD    StartInstall(nsIXPIInstallInfo* aInstallInfo, bool* aReturn);
-
-
-    private:
-        bool    AllowInstall(nsIURI* aLaunchURI);
-        void *mScriptObject;
-};
-
-#define NS_INSTALLTRIGGERCOMPONENT_CONTRACTID "@mozilla.org/xpinstall/installtrigger;1"
-#endif
deleted file mode 100644
--- a/xpinstall/src/nsJSInstallTriggerGlobal.cpp
+++ /dev/null
@@ -1,834 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* ***** 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.org code.
- *
- * 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.
- *
- * Contributor(s):
- *   Dave Townsend <dtownsend@oxymoronical.com>
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either of 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 "jsapi.h"
-#include "nscore.h"
-#include "nsAutoPtr.h"
-#include "nsIScriptContext.h"
-#include "nsIScriptObjectOwner.h"
-#include "nsIScriptGlobalObject.h"
-#include "nsCRT.h"
-#include "nsString.h"
-#include "nsIDOMInstallTriggerGlobal.h"
-#include "nsPIDOMWindow.h"
-#include "nsIDOMDocument.h"
-#include "nsIDocument.h"
-#include "nsIDocShell.h"
-#include "nsIObserverService.h"
-#include "nsInstallTrigger.h"
-#include "nsXPITriggerInfo.h"
-#include "nsDOMJSUtils.h"
-#include "nsXPIInstallInfo.h"
-
-#include "nsIComponentManager.h"
-#include "nsNetUtil.h"
-#include "nsIScriptSecurityManager.h"
-
-#include "nsSoftwareUpdateIIDs.h"
-
-void ConvertJSValToStr(nsString&  aString,
-                      JSContext* aContext,
-                      jsval      aValue)
-{
-  JSString *jsstring;
-
-  if ( !JSVAL_IS_NULL(aValue) &&
-       (jsstring = JS_ValueToString(aContext, aValue)) != nsnull)
-  {
-    aString.Assign(reinterpret_cast<const PRUnichar*>(JS_GetStringChars(jsstring)));
-  }
-  else
-  {
-    aString.Truncate();
-  }
-}
-
-static void
-FinalizeInstallTriggerGlobal(JSContext *cx, JSObject *obj);
-
-/***********************************************************************/
-//
-// class for InstallTriggerGlobal
-//
-JSClass InstallTriggerGlobalClass = {
-  "InstallTrigger",
-  JSCLASS_HAS_PRIVATE,
-  JS_PropertyStub,
-  JS_PropertyStub,
-  JS_PropertyStub,
-  JS_PropertyStub,
-  JS_EnumerateStub,
-  JS_ResolveStub,
-  JS_ConvertStub,
-  FinalizeInstallTriggerGlobal
-};
-
-
-//
-// InstallTriggerGlobal finalizer
-//
-static void
-FinalizeInstallTriggerGlobal(JSContext *cx, JSObject *obj)
-{
-  nsISupports *nativeThis = (nsISupports*)JS_GetPrivate(cx, obj);
-
-  if (nsnull != nativeThis) {
-    // get the js object
-    nsIScriptObjectOwner *owner = nsnull;
-    if (NS_OK == nativeThis->QueryInterface(NS_GET_IID(nsIScriptObjectOwner),
-                                            (void**)&owner)) {
-      owner->SetScriptObject(nsnull);
-      NS_RELEASE(owner);
-    }
-
-    // The addref was part of JSObject construction
-    NS_RELEASE(nativeThis);
-  }
-}
-
-static JSBool CreateNativeObject(JSContext *cx, JSObject *obj, nsIDOMInstallTriggerGlobal **aResult)
-{
-    nsresult result;
-    nsIScriptObjectOwner *owner = nsnull;
-    nsIDOMInstallTriggerGlobal *nativeThis;
-
-    static NS_DEFINE_CID(kInstallTrigger_CID,
-                         NS_SoftwareUpdateInstallTrigger_CID);
-
-    result = CallCreateInstance(kInstallTrigger_CID, &nativeThis);
-    if (NS_FAILED(result)) return JS_FALSE;
-
-    result = nativeThis->QueryInterface(NS_GET_IID(nsIScriptObjectOwner),
-                                        (void **)&owner);
-
-    if (NS_OK != result)
-    {
-        NS_RELEASE(nativeThis);
-        return JS_FALSE;
-    }
-
-    owner->SetScriptObject((void *)obj);
-    JS_SetPrivate(cx, obj, nativeThis);
-
-    *aResult = nativeThis;
-
-    NS_RELEASE(nativeThis);  // we only want one refcnt. JSUtils cleans us up.
-    return JS_TRUE;
-}
-
-//
-// Helper function for URI verification
-//
-static nsresult
-InstallTriggerCheckLoadURIFromScript(JSContext *cx, const nsAString& uriStr)
-{
-    nsresult rv;
-    nsCOMPtr<nsIScriptSecurityManager> secman(
-        do_GetService(NS_SCRIPTSECURITYMANAGER_CONTRACTID,&rv));
-    NS_ENSURE_SUCCESS(rv, rv);
-
-    // get the script principal
-    nsCOMPtr<nsIPrincipal> principal;
-    rv = secman->GetSubjectPrincipal(getter_AddRefs(principal));
-    NS_ENSURE_SUCCESS(rv, rv);
-    if (!principal)
-        return NS_ERROR_FAILURE;
-
-    // convert the requested URL string to a URI
-    // Note that we use a null base URI here, since that's what we use when we
-    // actually convert the string into a URI to load.
-    nsCOMPtr<nsIURI> uri;
-    rv = NS_NewURI(getter_AddRefs(uri), uriStr);
-    NS_ENSURE_SUCCESS(rv, rv);
-
-    // are we allowed to load this one?
-    rv = secman->CheckLoadURIWithPrincipal(principal, uri,
-                    nsIScriptSecurityManager::DISALLOW_INHERIT_PRINCIPAL);
-    return rv;
-}
-
-//
-// Helper function to get native object
-//
-// This is our own version of JS_GetInstancePrivate() that in addition
-// performs the delayed creation of the native InstallTrigger if necessary
-//
-static nsIDOMInstallTriggerGlobal* getTriggerNative(JSContext *cx, JSObject *obj)
-{
-  if (!JS_InstanceOf(cx, obj, &InstallTriggerGlobalClass, nsnull))
-    return nsnull;
-
-  nsIDOMInstallTriggerGlobal *native = (nsIDOMInstallTriggerGlobal*)JS_GetPrivate(cx, obj);
-  if (!native) {
-    // xpinstall script contexts delay creation of the native.
-    CreateNativeObject(cx, obj, &native);
-  }
-  return native;
-}
-
-//
-// Native method UpdateEnabled
-//
-static JSBool
-InstallTriggerGlobalUpdateEnabled(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
-{
-  nsIDOMInstallTriggerGlobal *nativeThis = getTriggerNative(cx, obj);
-  if (!nativeThis)
-    return JS_FALSE;
-
-  *rval = JSVAL_FALSE;
-
-  nsIScriptGlobalObject *globalObject = nsnull;
-  nsIScriptContext *scriptContext = GetScriptContextFromJSContext(cx);
-  if (scriptContext)
-    globalObject = scriptContext->GetGlobalObject();
-
-  bool nativeRet = false;
-  if (globalObject)
-    nativeThis->UpdateEnabled(globalObject, XPI_GLOBAL, &nativeRet);
-
-  *rval = BOOLEAN_TO_JSVAL(nativeRet);
-  return JS_TRUE;
-}
-
-
-//
-// Native method Install
-//
-static JSBool
-InstallTriggerGlobalInstall(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
-{
-  nsIDOMInstallTriggerGlobal *nativeThis = getTriggerNative(cx, obj);
-  if (!nativeThis)
-    return JS_FALSE;
-
-  *rval = JSVAL_FALSE;
-
-  // make sure XPInstall is enabled, return false if not
-  nsIScriptGlobalObject *globalObject = nsnull;
-  nsIScriptContext *scriptContext = GetScriptContextFromJSContext(cx);
-  if (scriptContext)
-    globalObject = scriptContext->GetGlobalObject();
-
-  if (!globalObject)
-      return JS_TRUE;
-
-  nsCOMPtr<nsIScriptSecurityManager> secman(do_GetService(NS_SCRIPTSECURITYMANAGER_CONTRACTID));
-  if (!secman)
-  {
-    JS_ReportError(cx, "Could not the script security manager service.");
-    return JS_FALSE;
-  }
-  // get the principal.  if it doesn't exist, die.
-  nsCOMPtr<nsIPrincipal> principal;
-  nsresult rv = secman->GetSubjectPrincipal(getter_AddRefs(principal));
-
-  if (NS_FAILED(rv) || !principal)
-  {
-    JS_ReportError(cx, "Could not get the Subject Principal during InstallTrigger.Install()");
-    return JS_FALSE;
-  }
-
-  // get window.location to construct relative URLs
-  nsCOMPtr<nsIURI> baseURL;
-  JSObject* global = JS_GetGlobalObject(cx);
-  if (global)
-  {
-    jsval v;
-    if (JS_GetProperty(cx,global,"location",&v))
-    {
-      nsAutoString location;
-      ConvertJSValToStr( location, cx, v );
-      NS_NewURI(getter_AddRefs(baseURL), location);
-    }
-  }
-
-  bool abortLoad = false;
-
-  // parse associative array of installs
-  if ( argc >= 1 && JSVAL_IS_OBJECT(argv[0]) && JSVAL_TO_OBJECT(argv[0]) )
-  {
-    nsXPITriggerInfo *trigger = new nsXPITriggerInfo();
-    if (!trigger)
-      return JS_FALSE;
-
-    trigger->SetPrincipal(principal);
-
-    JSIdArray *ida = JS_Enumerate( cx, JSVAL_TO_OBJECT(argv[0]) );
-    if ( ida )
-    {
-      jsval v;
-      const PRUnichar *name, *URL;
-      const PRUnichar *iconURL = nsnull;
-
-      for (int i = 0; i < ida->length && !abortLoad; i++ )
-      {
-        JS_IdToValue( cx, ida->vector[i], &v );
-        JSString * str = JS_ValueToString( cx, v );
-        if (!str)
-        {
-          abortLoad = true;
-          break;
-        }
-
-        name = reinterpret_cast<const PRUnichar*>(JS_GetStringChars( str ));
-
-        URL = iconURL = nsnull;
-        JSAutoByteString hash;
-        JS_GetUCProperty( cx, JSVAL_TO_OBJECT(argv[0]), reinterpret_cast<const jschar*>(name), nsCRT::strlen(name), &v );
-        if ( JSVAL_IS_OBJECT(v) && JSVAL_TO_OBJECT(v) )
-        {
-          jsval v2;
-          if (JS_GetProperty( cx, JSVAL_TO_OBJECT(v), "URL", &v2 ) && !JSVAL_IS_VOID(v2)) {
-            JSString *str = JS_ValueToString(cx, v2);
-            if (!str) {
-              abortLoad = true;
-              break;
-            }
-            URL = reinterpret_cast<const PRUnichar*>(JS_GetStringChars(str));
-          }
-
-          if (JS_GetProperty( cx, JSVAL_TO_OBJECT(v), "IconURL", &v2 ) && !JSVAL_IS_VOID(v2)) {
-            JSString *str = JS_ValueToString(cx, v2);
-            if (!str) {
-              abortLoad = true;
-              break;
-            }
-            iconURL = reinterpret_cast<const PRUnichar*>(JS_GetStringChars(str));
-          }
-
-          if (JS_GetProperty( cx, JSVAL_TO_OBJECT(v), "Hash", &v2) && !JSVAL_IS_VOID(v2)) {
-            JSString *str = JS_ValueToString(cx, v2);
-            if (!str || !hash.encode(cx, str)) {
-              abortLoad = true;
-              break;
-            }
-          }
-        }
-        else
-        {
-          JSString *str = JS_ValueToString(cx, v);
-          if (!str) {
-            abortLoad = true;
-            break;
-          }
-          URL = reinterpret_cast<const PRUnichar*>(JS_GetStringChars(str));
-        }
-
-        if ( URL )
-        {
-            // Get relative URL to load
-            nsAutoString xpiURL(URL);
-            if (baseURL)
-            {
-                nsCAutoString resolvedURL;
-                baseURL->Resolve(NS_ConvertUTF16toUTF8(xpiURL), resolvedURL);
-                xpiURL = NS_ConvertUTF8toUTF16(resolvedURL);
-            }
-
-            nsAutoString icon(iconURL);
-            if (iconURL && baseURL)
-            {
-                nsCAutoString resolvedIcon;
-                baseURL->Resolve(NS_ConvertUTF16toUTF8(icon), resolvedIcon);
-                icon = NS_ConvertUTF8toUTF16(resolvedIcon);
-            }
-
-            // Make sure we're allowed to load this URL and the icon URL
-            rv = InstallTriggerCheckLoadURIFromScript(cx, xpiURL);
-            if (NS_FAILED(rv))
-                abortLoad = true;
-
-            if (!abortLoad && iconURL)
-            {
-                rv = InstallTriggerCheckLoadURIFromScript(cx, icon);
-                if (NS_FAILED(rv))
-                    abortLoad = true;
-            }
-
-            if (!abortLoad)
-            {
-                // Add the install item to the trigger collection
-                nsXPITriggerItem *item =
-                    new nsXPITriggerItem( name, xpiURL.get(), icon.get(), hash );
-                if ( item )
-                {
-                    trigger->Add( item );
-                }
-                else
-                    abortLoad = true;
-            }
-        }
-        else
-            abortLoad = true;
-      }
-      JS_DestroyIdArray( cx, ida );
-    }
-
-
-    // pass on only if good stuff found
-    if (!abortLoad && trigger->Size() > 0)
-    {
-        nsCOMPtr<nsIURI> checkuri;
-        rv = nativeThis->GetOriginatingURI(globalObject,
-                                           getter_AddRefs(checkuri));
-        if (NS_SUCCEEDED(rv))
-        {
-            nsCOMPtr<nsIDOMWindow> win = do_QueryInterface(globalObject);
-            nsCOMPtr<nsIXPIInstallInfo> installInfo =
-                new nsXPIInstallInfo(win, checkuri, trigger, 0);
-            if (installInfo)
-            {
-                // installInfo now owns triggers
-                bool enabled = false;
-                nativeThis->UpdateEnabled(checkuri, XPI_WHITELIST, &enabled);
-                if (!enabled)
-                {
-                    nsCOMPtr<nsIObserverService> os =
-                      mozilla::services::GetObserverService();
-                    if (os)
-                        os->NotifyObservers(installInfo,
-                                            "xpinstall-install-blocked",
-                                            nsnull);
-                }
-                else
-                {
-                    // save callback function if any (ignore bad args for now)
-                    if ( argc >= 2 && JS_TypeOfValue(cx,argv[1]) == JSTYPE_FUNCTION )
-                    {
-                        trigger->SaveCallback( cx, argv[1] );
-                    }
-
-                    bool result;
-                    nativeThis->StartInstall(installInfo, &result);
-                    *rval = BOOLEAN_TO_JSVAL(result);
-                }
-                return JS_TRUE;
-            }
-        }
-    }
-    // didn't pass it on so we must delete trigger
-    delete trigger;
-  }
-
-  JS_ReportError(cx, "Incorrect arguments to InstallTrigger.Install()");
-  return JS_FALSE;
-}
-
-
-//
-// Native method InstallChrome
-//
-static JSBool
-InstallTriggerGlobalInstallChrome(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
-{
-  nsIDOMInstallTriggerGlobal *nativeThis = getTriggerNative(cx, obj);
-  if (!nativeThis)
-    return JS_FALSE;
-
-  uint32       chromeType = NOT_CHROME;
-  nsAutoString sourceURL;
-  nsAutoString name;
-
-  *rval = JSVAL_FALSE;
-
-  // get chromeType first, the update enabled check for skins skips whitelisting
-  if (argc >=1)
-  {
-      if (!JS_ValueToECMAUint32(cx, argv[0], &chromeType))
-          return JS_FALSE;
-  }
-
-  // make sure XPInstall is enabled, return if not
-  nsIScriptGlobalObject *globalObject = nsnull;
-  nsIScriptContext *scriptContext = GetScriptContextFromJSContext(cx);
-  if (scriptContext)
-      globalObject = scriptContext->GetGlobalObject();
-
-  if (!globalObject)
-      return JS_TRUE;
-
-  // get window.location to construct relative URLs
-  nsCOMPtr<nsIURI> baseURL;
-  JSObject* global = JS_GetGlobalObject(cx);
-  if (global)
-  {
-    jsval v;
-    if (JS_GetProperty(cx,global,"location",&v))
-    {
-      nsAutoString location;
-      ConvertJSValToStr( location, cx, v );
-      NS_NewURI(getter_AddRefs(baseURL), location);
-    }
-  }
-
-
-  if ( argc >= 3 )
-  {
-    ConvertJSValToStr(sourceURL, cx, argv[1]);
-    ConvertJSValToStr(name, cx, argv[2]);
-
-    if (baseURL)
-    {
-        nsCAutoString resolvedURL;
-        baseURL->Resolve(NS_ConvertUTF16toUTF8(sourceURL), resolvedURL);
-        sourceURL = NS_ConvertUTF8toUTF16(resolvedURL);
-    }
-
-    // Make sure caller is allowed to load this url.
-    nsresult rv = InstallTriggerCheckLoadURIFromScript(cx, sourceURL);
-    if (NS_FAILED(rv))
-        return JS_FALSE;
-
-    if ( chromeType & CHROME_ALL )
-    {
-        // there's at least one known chrome type
-        nsCOMPtr<nsIURI> checkuri;
-        nsresult rv = nativeThis->GetOriginatingURI(globalObject,
-                                                    getter_AddRefs(checkuri));
-        if (NS_SUCCEEDED(rv))
-        {
-            nsAutoPtr<nsXPITriggerInfo> trigger(new nsXPITriggerInfo());
-            nsAutoPtr<nsXPITriggerItem> item(new nsXPITriggerItem(name.get(),
-                                                                  sourceURL.get(),
-                                                                  nsnull));
-            if (trigger && item)
-            {
-                // trigger will free item when complete
-                trigger->Add(item.forget());
-                nsCOMPtr<nsIDOMWindow> win = do_QueryInterface(globalObject);
-                nsCOMPtr<nsIXPIInstallInfo> installInfo =
-                    new nsXPIInstallInfo(win, checkuri, trigger, chromeType);
-                if (installInfo)
-                {
-                    // installInfo owns trigger now
-                    trigger.forget();
-                    bool enabled = false;
-                    nativeThis->UpdateEnabled(checkuri, XPI_WHITELIST,
-                                              &enabled);
-                    if (!enabled)
-                    {
-                        nsCOMPtr<nsIObserverService> os =
-                          mozilla::services::GetObserverService();
-                        if (os)
-                            os->NotifyObservers(installInfo,
-                                                "xpinstall-install-blocked",
-                                                nsnull);
-                    }
-                    else
-                    {
-                        bool nativeRet = false;
-                        nativeThis->StartInstall(installInfo, &nativeRet);
-                        *rval = BOOLEAN_TO_JSVAL(nativeRet);
-                    }
-                }
-            }
-        }
-    }
-  }
-  return JS_TRUE;
-}
-
-
-//
-// Native method StartSoftwareUpdate
-//
-static JSBool
-InstallTriggerGlobalStartSoftwareUpdate(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
-{
-  nsIDOMInstallTriggerGlobal *nativeThis = getTriggerNative(cx, obj);
-  if (!nativeThis)
-    return JS_FALSE;
-
-  bool         nativeRet;
-  PRInt32      flags = 0;
-
-  *rval = JSVAL_FALSE;
-
-  nsIScriptGlobalObject *globalObject = nsnull;
-  nsIScriptContext *scriptContext = GetScriptContextFromJSContext(cx);
-  if (scriptContext)
-      globalObject = scriptContext->GetGlobalObject();
-
-  if (!globalObject)
-      return JS_TRUE;
-
-  // get window.location to construct relative URLs
-  nsCOMPtr<nsIURI> baseURL;
-  JSObject* global = JS_GetGlobalObject(cx);
-  if (global)
-  {
-    jsval v;
-    if (JS_GetProperty(cx,global,"location",&v))
-    {
-      nsAutoString location;
-      ConvertJSValToStr( location, cx, v );
-      NS_NewURI(getter_AddRefs(baseURL), location);
-    }
-  }
-
-
-  if ( argc >= 1 )
-  {
-    nsAutoString xpiURL;
-    ConvertJSValToStr(xpiURL, cx, argv[0]);
-    if (baseURL)
-    {
-        nsCAutoString resolvedURL;
-        baseURL->Resolve(NS_ConvertUTF16toUTF8(xpiURL), resolvedURL);
-        xpiURL = NS_ConvertUTF8toUTF16(resolvedURL);
-    }
-
-    // Make sure caller is allowed to load this url.
-    nsresult rv = InstallTriggerCheckLoadURIFromScript(cx, xpiURL);
-    if (NS_FAILED(rv))
-        return JS_FALSE;
-
-    if (argc >= 2 && !JS_ValueToInt32(cx, argv[1], (int32 *)&flags))
-    {
-        JS_ReportError(cx, "StartSoftwareUpdate() 2nd parameter must be a number");
-        return JS_FALSE;
-    }
-
-    nsCOMPtr<nsIURI> checkuri;
-    rv = nativeThis->GetOriginatingURI(globalObject, getter_AddRefs(checkuri));
-    if (NS_SUCCEEDED(rv))
-    {
-        nsAutoPtr<nsXPITriggerInfo> trigger(new nsXPITriggerInfo());
-        nsAutoPtr<nsXPITriggerItem> item(new nsXPITriggerItem(0,
-                                                              xpiURL.get(),
-                                                              nsnull));
-        if (trigger && item)
-        {
-            // trigger will free item when complete
-            trigger->Add(item.forget());
-            nsCOMPtr<nsIDOMWindow> win = do_QueryInterface(globalObject);
-            nsCOMPtr<nsIXPIInstallInfo> installInfo =
-                                new nsXPIInstallInfo(win, checkuri, trigger, 0);
-            if (installInfo)
-            {
-                // From here trigger is owned by installInfo until passed on to nsXPInstallManager
-                trigger.forget();
-                bool enabled = false;
-                nativeThis->UpdateEnabled(checkuri, XPI_WHITELIST, &enabled);
-                if (!enabled)
-                {
-                    nsCOMPtr<nsIObserverService> os =
-                      mozilla::services::GetObserverService();
-                    if (os)
-                        os->NotifyObservers(installInfo,
-                                            "xpinstall-install-blocked",
-                                            nsnull);
-                }
-                else
-                {
-                    nativeThis->StartInstall(installInfo, &nativeRet);
-                    *rval = BOOLEAN_TO_JSVAL(nativeRet);
-                }
-            }
-        }
-    }
-  }
-  else
-  {
-    JS_ReportError(cx, "Function StartSoftwareUpdate requires 1 parameters");
-    return JS_FALSE;
-  }
-
-  return JS_TRUE;
-}
-
-
-//
-// InstallTriggerGlobal class methods
-//
-static JSFunctionSpec InstallTriggerGlobalMethods[] =
-{
-  {"UpdateEnabled",         InstallTriggerGlobalUpdateEnabled,         0,0,0},
-  {"StartSoftwareUpdate",   InstallTriggerGlobalStartSoftwareUpdate,   2,0,0},
-  {"updateEnabled",         InstallTriggerGlobalUpdateEnabled,         0,0,0},
-  {"enabled",               InstallTriggerGlobalUpdateEnabled,         0,0,0},
-  {"install",               InstallTriggerGlobalInstall,               2,0,0},
-  {"installChrome",         InstallTriggerGlobalInstallChrome,         2,0,0},
-  {"startSoftwareUpdate",   InstallTriggerGlobalStartSoftwareUpdate,   2,0,0},
-  {nsnull,nsnull,0,0,0}
-};
-
-
-static JSConstDoubleSpec diff_constants[] =
-{
-    { nsIDOMInstallTriggerGlobal::MAJOR_DIFF,    "MAJOR_DIFF" },
-    { nsIDOMInstallTriggerGlobal::MINOR_DIFF,    "MINOR_DIFF" },
-    { nsIDOMInstallTriggerGlobal::REL_DIFF,      "REL_DIFF"   },
-    { nsIDOMInstallTriggerGlobal::BLD_DIFF,      "BLD_DIFF"   },
-    { nsIDOMInstallTriggerGlobal::EQUAL,         "EQUAL"      },
-    { nsIDOMInstallTriggerGlobal::NOT_FOUND,     "NOT_FOUND"  },
-    { CHROME_SKIN,                               "SKIN"       },
-    { CHROME_LOCALE,                             "LOCALE"     },
-    { CHROME_CONTENT,                            "CONTENT"    },
-    { CHROME_ALL,                                "PACKAGE"    },
-    {0,nsnull}
-};
-
-
-
-nsresult InitInstallTriggerGlobalClass(JSContext *jscontext, JSObject *global, void** prototype)
-{
-  JSObject *proto = nsnull;
-
-  if (prototype != nsnull)
-    *prototype = nsnull;
-
-    proto = JS_InitClass(jscontext,                       // context
-                         global,                          // global object
-                         nsnull,                          // parent proto
-                         &InstallTriggerGlobalClass,      // JSClass
-                         nsnull,                          // JSNative ctor
-                         nsnull,                          // ctor args
-                         nsnull,                          // proto props
-                         nsnull,                          // proto funcs
-                         nsnull,                          // ctor props (static)
-                         InstallTriggerGlobalMethods);    // ctor funcs (static)
-
-
-    if (nsnull == proto) return NS_ERROR_FAILURE;
-
-    if ( false == JS_DefineConstDoubles(jscontext, proto, diff_constants) )
-            return NS_ERROR_FAILURE;
-
-    if (prototype != nsnull)
-      *prototype = proto;
-
-  return NS_OK;
-}
-
-
-
-//
-// InstallTriggerGlobal class initialization
-//
-nsresult NS_InitInstallTriggerGlobalClass(nsIScriptContext *aContext, void **aPrototype)
-{
-  JSContext *jscontext = aContext->GetNativeContext();
-  JSObject *proto = nsnull;
-  JSObject *constructor = nsnull;
-  JSObject *global = JS_GetGlobalObject(jscontext);
-  jsval vp;
-
-  if ((true != JS_LookupProperty(jscontext, global, "InstallTriggerGlobal", &vp)) ||
-      !JSVAL_IS_OBJECT(vp) ||
-      ((constructor = JSVAL_TO_OBJECT(vp)) == nsnull) ||
-      (true != JS_LookupProperty(jscontext, JSVAL_TO_OBJECT(vp), "prototype", &vp)) ||
-      !JSVAL_IS_OBJECT(vp))
-  {
-    nsresult rv = InitInstallTriggerGlobalClass(jscontext, global, (void**)&proto);
-    if (NS_FAILED(rv)) return rv;
-  }
-  else if ((nsnull != constructor) && JSVAL_IS_OBJECT(vp))
-  {
-    proto = JSVAL_TO_OBJECT(vp);
-  }
-  else
-  {
-    return NS_ERROR_FAILURE;
-  }
-
-  if (aPrototype)
-    *aPrototype = proto;
-
-  return NS_OK;
-}
-
-
-//
-// Method for creating a new InstallTriggerGlobal JavaScript object
-//
-nsresult
-NS_NewScriptInstallTriggerGlobal(nsIScriptContext *aContext,
-                                 nsISupports *aSupports, nsISupports *aParent,
-                                 void **aReturn)
-{
-  NS_PRECONDITION(nsnull != aContext && nsnull != aSupports &&
-                  nsnull != aReturn,
-                  "null argument to NS_NewScriptInstallTriggerGlobal");
-
-  JSObject *proto;
-  JSObject *parent = nsnull;
-  JSContext *jscontext = aContext->GetNativeContext();
-  nsresult result = NS_OK;
-  nsIDOMInstallTriggerGlobal *installTriggerGlobal;
-
-  nsCOMPtr<nsIScriptObjectOwner> owner(do_QueryInterface(aParent));
-
-  if (owner) {
-    if (NS_OK != owner->GetScriptObject(aContext, (void **)&parent)) {
-      return NS_ERROR_FAILURE;
-    }
-  } else {
-    nsCOMPtr<nsIScriptGlobalObject> sgo(do_QueryInterface(aParent));
-
-    if (sgo) {
-      parent = sgo->GetGlobalJSObject();
-    } else {
-      return NS_ERROR_FAILURE;
-    }
-  }
-
-  if (NS_OK != NS_InitInstallTriggerGlobalClass(aContext, (void **)&proto)) {
-    return NS_ERROR_FAILURE;
-  }
-
-  result = CallQueryInterface(aSupports, &installTriggerGlobal);
-  if (NS_OK != result) {
-    return result;
-  }
-
-  // create a js object for this class
-  *aReturn = JS_NewObject(jscontext, &InstallTriggerGlobalClass, proto, parent);
-  if (nsnull != *aReturn) {
-    // connect the native object to the js object
-    JS_SetPrivate(jscontext, (JSObject *)*aReturn, installTriggerGlobal);
-  }
-  else {
-    NS_RELEASE(installTriggerGlobal);
-    return NS_ERROR_FAILURE;
-  }
-
-  return NS_OK;
-}
-
deleted file mode 100644
--- a/xpinstall/src/nsSoftwareUpdate.cpp
+++ /dev/null
@@ -1,112 +0,0 @@
-/* ***** 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 Communicator client code, released
- * March 31, 1998.
- *
- * 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.
- *
- * Contributor(s):
- *   Dave Townsend <dtownsend@oxymoronical.com>
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either of 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 "nscore.h"
-#include "nsIGenericFactory.h"
-#include "nsIFactory.h"
-#include "nsISupports.h"
-#include "nsIComponentManager.h"
-#include "nsIComponentRegistrar.h"
-#include "nsIServiceManager.h"
-#include "nsICategoryManager.h"
-#include "nsIScriptNameSpaceManager.h"
-#include "nsCURILoader.h"
-
-#include "nsSoftwareUpdateIIDs.h"
-
-#include "nsInstallTrigger.h"
-#include "nsXPInstallManager.h"
-
-//----------------------------------------------------------------------
-
-// Functions used to create new instances of a given object by the
-// generic factory.
-
-NS_GENERIC_FACTORY_CONSTRUCTOR(nsInstallTrigger)
-NS_GENERIC_FACTORY_CONSTRUCTOR(nsXPInstallManager)
-
-//----------------------------------------------------------------------
-
-static NS_METHOD
-RegisterInstallTrigger( nsIComponentManager *aCompMgr,
-                        nsIFile *aPath,
-                        const char *registryLocation,
-                        const char *componentType,
-                        const nsModuleComponentInfo *info)
-{
-  nsresult rv = NS_OK;
-
-  nsCOMPtr<nsICategoryManager> catman =
-    do_GetService(NS_CATEGORYMANAGER_CONTRACTID, &rv);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  nsXPIDLCString previous;
-  rv = catman->AddCategoryEntry(JAVASCRIPT_GLOBAL_PROPERTY_CATEGORY,
-                                "InstallTrigger",
-                                NS_INSTALLTRIGGERCOMPONENT_CONTRACTID,
-                                true, true, getter_Copies(previous));
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  return NS_OK;
-}
-
-
-// The list of components we register
-static const nsModuleComponentInfo components[] =
-{
-    { "InstallTrigger Component",
-       NS_SoftwareUpdateInstallTrigger_CID,
-       NS_INSTALLTRIGGERCOMPONENT_CONTRACTID,
-       nsInstallTriggerConstructor,
-       RegisterInstallTrigger
-    },
-
-    { "XPInstall Content Handler",
-      NS_SoftwareUpdateInstallTrigger_CID,
-      NS_CONTENT_HANDLER_CONTRACTID_PREFIX"application/x-xpinstall",
-      nsInstallTriggerConstructor
-    },
-
-    { "XPInstallManager Component",
-      NS_XPInstallManager_CID,
-      NS_XPINSTALLMANAGERCOMPONENT_CONTRACTID,
-      nsXPInstallManagerConstructor
-    }
-};
-
-NS_IMPL_NSGETMODULE(nsSoftwareUpdate, components)
deleted file mode 100644
--- a/xpinstall/src/nsXPIInstallInfo.cpp
+++ /dev/null
@@ -1,94 +0,0 @@
-/* ***** 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
- * Dave Townsend <dtownsend@oxymoronical.com>.
- *
- * Portions created by the Initial Developer are Copyright (C) 2007
- * the Initial Developer. All Rights Reserved.
- *
- * 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
- * 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 "nsXPIInstallInfo.h"
-
-NS_IMPL_ISUPPORTS1(nsXPIInstallInfo, nsIXPIInstallInfo)
-
-nsXPIInstallInfo::nsXPIInstallInfo(nsIDOMWindow *aOriginatingWindow,
-                                   nsIURI *aOriginatingURI,
-                                   nsXPITriggerInfo *aTriggerInfo,
-                                   PRUint32 aChromeType)
-  : mOriginatingWindow(aOriginatingWindow), mOriginatingURI(aOriginatingURI),
-    mTriggerInfo(aTriggerInfo), mChromeType(aChromeType)
-{
-}
-
-nsXPIInstallInfo::~nsXPIInstallInfo()
-{
-    delete mTriggerInfo;
-}
-
-/* [noscript, notxpcom] attribute triggerInfoPtr triggerInfo; */
-NS_IMETHODIMP
-nsXPIInstallInfo::GetTriggerInfo(nsXPITriggerInfo * *aTriggerInfo)
-{
-    *aTriggerInfo = mTriggerInfo;
-    return NS_OK;
-}
-
-NS_IMETHODIMP
-nsXPIInstallInfo::SetTriggerInfo(nsXPITriggerInfo * aTriggerInfo)
-{
-    mTriggerInfo = aTriggerInfo;
-    return NS_OK;
-}
-
-/* readonly attribute nsIDOMWindow originatingWindow; */
-NS_IMETHODIMP
-nsXPIInstallInfo::GetOriginatingWindow(nsIDOMWindow * *aOriginatingWindow)
-{
-    NS_IF_ADDREF(*aOriginatingWindow = mOriginatingWindow);
-    return NS_OK;
-}
-
-/* readonly attribute nsIURI uri; */
-NS_IMETHODIMP
-nsXPIInstallInfo::GetOriginatingURI(nsIURI * *aOriginatingURI)
-{
-    NS_IF_ADDREF(*aOriginatingURI = mOriginatingURI);
-    return NS_OK;
-}
-
-/* readonly attribute PRUint32 type; */
-NS_IMETHODIMP
-nsXPIInstallInfo::GetChromeType(PRUint32 *aChromeType)
-{
-    *aChromeType = mChromeType;
-    return NS_OK;
-}
deleted file mode 100644
--- a/xpinstall/src/nsXPIInstallInfo.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/* ***** 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
- * Dave Townsend <dtownsend@oxymoronical.com>.
- *
- * Portions created by the Initial Developer are Copyright (C) 2007
- * the Initial Developer. All Rights Reserved.
- *
- * 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
- * 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 "nsXPITriggerInfo.h"
-#include "nsIXPIInstallInfo.h"
-#include "nsIDOMWindow.h"
-#include "nsIDocShell.h"
-#include "nsIURI.h"
-
-class nsXPIInstallInfo : public nsIXPIInstallInfo
-{
-public:
-  NS_DECL_ISUPPORTS
-  NS_DECL_NSIXPIINSTALLINFO
-
-  nsXPIInstallInfo(nsIDOMWindow *aOriginatingWindow,
-                   nsIURI *aOriginatingURI, nsXPITriggerInfo *aTriggerInfo,
-                   PRUint32 aChromeType);
-
-private:
-  ~nsXPIInstallInfo();
-
-  nsCOMPtr<nsIDOMWindow> mOriginatingWindow;
-  nsCOMPtr<nsIURI> mOriginatingURI;
-  nsXPITriggerInfo* mTriggerInfo;
-  PRUint32 mChromeType;
-};
deleted file mode 100644
--- a/xpinstall/src/nsXPITriggerInfo.cpp
+++ /dev/null
@@ -1,355 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/* ***** 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 Communicator client code, released
- * March 31, 1998.
- *
- * 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.
- *
- * Contributor(s):
- *   Daniel Veditz <dveditz@netscape.com>
- *   Dave Townsend <dtownsend@oxymoronical.com>
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either of 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 "mozilla/Util.h"
-
-#include "jscntxt.h"
-#include "nscore.h"
-#include "plstr.h"
-#include "nsXPITriggerInfo.h"
-#include "nsNetUtil.h"
-#include "nsDebug.h"
-#include "nsAutoPtr.h"
-#include "nsThreadUtils.h"
-#include "nsIServiceManager.h"
-#include "nsIJSContextStack.h"
-#include "nsIScriptSecurityManager.h"
-#include "nsICryptoHash.h"
-#include "nsIX509Cert.h"
-
-using namespace mozilla;
-
-//
-// nsXPITriggerItem
-//
-
-nsXPITriggerItem::nsXPITriggerItem( const PRUnichar* aName,
-                                    const PRUnichar* aURL,
-                                    const PRUnichar* aIconURL,
-                                    const char* aHash,
-                                    PRInt32 aFlags)
-    : mName(aName), mURL(aURL), mIconURL(aIconURL), mHashFound(false), mFlags(aFlags)
-{
-    MOZ_COUNT_CTOR(nsXPITriggerItem);
-
-    // check for arguments
-    PRInt32 qmark = mURL.FindChar('?');
-    if ( qmark != kNotFound )
-    {
-        mArguments = Substring( mURL, qmark+1, mURL.Length() );
-    }
-
-    // construct name if not passed in
-    if ( mName.IsEmpty() )
-    {
-        // 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 offset for
-        // RFindChar() starts at the end, so we can use qmark in all cases.
-
-        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)
-            length =  mURL.Length();      // no '?', slurp up rest of URL
-        else
-            length = (qmark - namestart); // filename stops at the '?'
-
-        mName = Substring( mURL, namestart, length );
-    }
-
-    // parse optional hash into its parts
-    if (aHash)
-    {
-        mHashFound = true;
-
-        char * colon = PL_strchr(aHash, ':');
-        if (colon)
-        {
-            mHasher = do_CreateInstance("@mozilla.org/security/hash;1");
-            if (!mHasher) return;
-
-            *colon = '\0'; // null the colon so that aHash is just the type.
-            nsresult rv = mHasher->InitWithString(nsDependentCString(aHash));
-            *colon = ':';  // restore the colon
-
-            if (NS_SUCCEEDED(rv))
-                mHash = colon+1;
-        }
-    }
-}
-
-nsXPITriggerItem::~nsXPITriggerItem()
-{
-    MOZ_COUNT_DTOR(nsXPITriggerItem);
-}
-
-const PRUnichar*
-nsXPITriggerItem::GetSafeURLString()
-{
-    // create the safe url string the first time
-    if (mSafeURL.IsEmpty() && !mURL.IsEmpty())
-    {
-        nsCOMPtr<nsIURI> uri;
-        NS_NewURI(getter_AddRefs(uri), mURL);
-        if (uri)
-        {
-            nsCAutoString spec;
-            uri->SetUserPass(EmptyCString());
-            uri->GetSpec(spec);
-            mSafeURL = NS_ConvertUTF8toUTF16(spec);
-        }
-    }
-
-    return mSafeURL.get();
-}
-
-void
-nsXPITriggerItem::SetPrincipal(nsIPrincipal* aPrincipal)
-{
-    mPrincipal = aPrincipal;
-
-    // aPrincipal can be null for various failure cases.
-    // see bug 213894 for an example.
-    // nsXPInstallManager::OnCertAvailable can be called with a null principal
-    // and it can also force a null principal.
-    if (!aPrincipal)
-        return;
-
-    bool hasCert;
-    aPrincipal->GetHasCertificate(&hasCert);
-    if (hasCert) {
-        nsCOMPtr<nsISupports> certificate;
-        aPrincipal->GetCertificate(getter_AddRefs(certificate));
-
-        nsCOMPtr<nsIX509Cert> x509 = do_QueryInterface(certificate);
-        if (x509) {
-            x509->GetCommonName(mCertName);
-            if (mCertName.Length() > 0)
-                return;
-        }
-
-        nsCAutoString prettyName;
-        aPrincipal->GetPrettyName(prettyName);
-        CopyUTF8toUTF16(prettyName, mCertName);
-    }
-}
-
-//
-// nsXPITriggerInfo
-//
-
-nsXPITriggerInfo::nsXPITriggerInfo()
-  : mCx(0), mCbval(JSVAL_NULL)
-{
-    MOZ_COUNT_CTOR(nsXPITriggerInfo);
-}
-
-nsXPITriggerInfo::~nsXPITriggerInfo()
-{
-    nsXPITriggerItem* item;
-
-    for(PRUint32 i=0; i < Size(); i++)
-    {
-        item = Get(i);
-        delete item;
-    }
-    mItems.Clear();
-
-    if ( mCx && !JSVAL_IS_NULL(mCbval) ) {
-        JS_BeginRequest(mCx);
-        JS_RemoveValueRoot(mCx, &mCbval );
-        JS_EndRequest(mCx);
-    }
-
-    MOZ_COUNT_DTOR(nsXPITriggerInfo);
-}
-
-void nsXPITriggerInfo::SaveCallback( JSContext *aCx, jsval aVal )
-{
-    NS_ASSERTION( mCx == 0, "callback set twice, memory leak" );
-    // We'll only retain the callback if we can get a strong reference to the
-    // context.
-    if (!(JS_GetOptions(aCx) & JSOPTION_PRIVATE_IS_NSISUPPORTS))
-        return;
-    mContextWrapper = static_cast<nsISupports *>(JS_GetContextPrivate(aCx));
-    if (!mContextWrapper)
-        return;
-
-    mCx = aCx;
-    mCbval = aVal;
-    mThread = do_GetCurrentThread();
-
-    if ( !JSVAL_IS_NULL(mCbval) ) {
-        JS_BeginRequest(mCx);
-        JS_AddValueRoot(mCx, &mCbval );
-        JS_EndRequest(mCx);
-    }
-}
-
-XPITriggerEvent::~XPITriggerEvent()
-{
-    JS_BeginRequest(cx);
-    JS_RemoveValueRoot(cx, &cbval);
-    JS_EndRequest(cx);
-}
-
-NS_IMETHODIMP
-XPITriggerEvent::Run()
-{
-    JSAutoRequest ar(cx);
-
-    // If Components doesn't exist in the global object then XPConnect has
-    // been torn down, probably because the page was closed. Bail out if that
-    // is the case.
-    JSObject* innerGlobal = JS_GetGlobalForObject(cx, JSVAL_TO_OBJECT(cbval));
-    jsval components;
-    if (!JS_LookupProperty(cx, innerGlobal, "Components", &components) ||
-        !JSVAL_IS_OBJECT(components))
-        return 0;
-
-    // Build arguments into rooted jsval array
-    jsval args[2] = { JSVAL_NULL, JSVAL_NULL };
-    js::AutoArrayRooter tvr(cx, ArrayLength(args), args);
-
-    // args[0] is the URL
-    JSString *str = JS_NewUCStringCopyZ(cx, reinterpret_cast<const jschar*>(URL.get()));
-    if (!str)
-        return 0;
-    args[0] = STRING_TO_JSVAL(str);
-
-    // args[1] is the status
-    if (!JS_NewNumberValue(cx, status, &args[1]))
-        return 0;
-
-    class StackPushGuard {
-        nsCOMPtr<nsIJSContextStack> mStack;
-    public:
-        StackPushGuard(JSContext *cx)
-          : mStack(do_GetService("@mozilla.org/js/xpc/ContextStack;1"))
-        {
-            if (mStack)
-                mStack->Push(cx);
-        }
-
-        ~StackPushGuard()
-        {
-            if (mStack)
-                mStack->Pop(nsnull);
-        }
-    } stackPushGuard(cx);
-
-    nsCOMPtr<nsIScriptSecurityManager> secman =
-        do_GetService(NS_SCRIPTSECURITYMANAGER_CONTRACTID);
-    if (!secman)
-    {
-        JS_ReportError(cx, "Could not get script security manager service");
-        return 0;
-    }
-
-    nsCOMPtr<nsIPrincipal> principal;
-    nsresult rv = secman->GetSubjectPrincipal(getter_AddRefs(principal));
-
-    if (NS_FAILED(rv) || !principal)
-    {
-         JS_ReportError(cx, "Could not get principal from script security manager");
-         return 0;
-    }
-
-    bool equals = false;
-    principal->Equals(princ, &equals);
-    if (!equals)
-    {
-        JS_ReportError(cx, "Principal of callback context is different than InstallTriggers");
-        return 0;
-    }
-
-    jsval ret;
-    JS_CallFunctionValue(cx,
-                         JS_GetGlobalObject(cx),
-                         cbval,
-                         2,
-                         args,
-                         &ret);
-    return 0;
-}
-
-
-void nsXPITriggerInfo::SendStatus(const PRUnichar* URL, PRInt32 status)
-{
-    nsresult rv;
-
-    if ( mCx && mContextWrapper && !JSVAL_IS_NULL(mCbval) )
-    {
-        // create event and post it
-        nsRefPtr<XPITriggerEvent> event = new XPITriggerEvent();
-        if (event)
-        {
-            event->URL      = URL;
-            event->status   = status;
-            event->cx       = mCx;
-            event->princ    = mPrincipal;
-
-            event->cbval    = mCbval;
-            JS_BeginRequest(event->cx);
-            JS_AddNamedValueRoot(event->cx, &event->cbval,
-                            "XPITriggerEvent::cbval" );
-            JS_EndRequest(event->cx);
-
-            // Hold a strong reference to keep the underlying
-            // JSContext from dying before we handle this event.
-            event->ref      = mContextWrapper;
-
-            rv = mThread->Dispatch(event, NS_DISPATCH_NORMAL);
-        }
-        else
-            rv = NS_ERROR_OUT_OF_MEMORY;
-
-        if ( NS_FAILED( rv ) )
-        {
-            // couldn't get event queue -- maybe window is gone or
-            // some similarly catastrophic occurrence
-            NS_WARNING("failed to dispatch XPITriggerEvent");
-        }
-    }
-}
deleted file mode 100644
--- a/xpinstall/src/nsXPITriggerInfo.h
+++ /dev/null
@@ -1,144 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* ***** 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 Communicator client code, released
- * March 31, 1998.
- *
- * 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.
- *
- * Contributor(s):
- *   Daniel Veditz <dveditz@netscape.com>
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either of 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 ***** */
-
-#ifndef nsXPITriggerInfo_h
-#define nsXPITriggerInfo_h
-
-#include "nsString.h"
-#include "nsVoidArray.h"
-#include "nsCOMPtr.h"
-#include "nsISupportsUtils.h"
-#include "nsILocalFile.h"
-#include "nsIOutputStream.h"
-#include "jsapi.h"
-#include "prthread.h"
-#include "nsIXPConnect.h"
-#include "nsICryptoHash.h"
-#include "nsIPrincipal.h"
-#include "nsThreadUtils.h"
-
-struct XPITriggerEvent : public nsRunnable {
-    nsString    URL;
-    PRInt32     status;
-    JSContext*  cx;
-    jsval       cbval;
-    nsCOMPtr<nsISupports> ref;
-    nsCOMPtr<nsIPrincipal> princ;
-
-    virtual ~XPITriggerEvent();
-    NS_IMETHOD Run();
-};
-
-class nsXPITriggerItem
-{
-  public:
-    nsXPITriggerItem( const PRUnichar* name,
-                      const PRUnichar* URL,
-                      const PRUnichar* iconURL,
-                      const char* hash = nsnull,
-                      PRInt32 flags = 0);
-    ~nsXPITriggerItem();
-
-    nsString    mName;
-    nsString    mURL;
-    nsString    mIconURL;
-    nsString    mArguments;
-    nsString    mCertName;
-
-    bool        mHashFound; // this flag indicates that we found _some_ hash info in the trigger
-    nsCString   mHash;
-    nsCOMPtr<nsICryptoHash> mHasher;
-    PRInt32     mFlags;
-
-    nsCOMPtr<nsILocalFile>      mFile;
-    nsCOMPtr<nsIOutputStream>   mOutStream;
-    nsCOMPtr<nsIPrincipal>      mPrincipal;
-
-    void    SetPrincipal(nsIPrincipal* aPrincipal);
-
-    bool    IsFileURL() { return StringBeginsWith(mURL, NS_LITERAL_STRING("file:/")); }
-
-    const PRUnichar* GetSafeURLString();
-
-  private:
-    //-- prevent inadvertent copies and assignments
-    nsXPITriggerItem& operator=(const nsXPITriggerItem& rhs);
-    nsXPITriggerItem(const nsXPITriggerItem& rhs);
-
-    nsString    mSafeURL;
-};
-
-
-
-class nsXPITriggerInfo
-{
-  public:
-    nsXPITriggerInfo();
-    ~nsXPITriggerInfo();
-
-    void                Add( nsXPITriggerItem *aItem )
-                        { if ( aItem ) mItems.AppendElement( (void*)aItem ); }
-
-    nsXPITriggerItem*   Get( PRUint32 aIndex )
-                        { return (nsXPITriggerItem*)mItems.ElementAt(aIndex);}
-
-    void                SaveCallback( JSContext *aCx, jsval aVal );
-
-    PRUint32            Size() { return mItems.Count(); }
-
-    void                SendStatus(const PRUnichar* URL, PRInt32 status);
-
-    void                SetPrincipal(nsIPrincipal* aPrinc) { mPrincipal = aPrinc; }
-
-
-  private:
-    nsVoidArray mItems;
-    JSContext   *mCx;
-    nsCOMPtr<nsISupports> mContextWrapper;
-    jsval       mCbval;
-    nsCOMPtr<nsIThread> mThread;
-
-    nsCOMPtr<nsIPrincipal>      mPrincipal;
-
-    //-- prevent inadvertent copies and assignments
-    nsXPITriggerInfo& operator=(const nsXPITriggerInfo& rhs);
-    nsXPITriggerInfo(const nsXPITriggerInfo& rhs);
-};
-
-#endif /* nsXPITriggerInfo_h */
deleted file mode 100644
--- a/xpinstall/src/nsXPInstallManager.cpp
+++ /dev/null
@@ -1,1414 +0,0 @@
-/* ***** 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 Communicator client code, released
- * March 31, 1998.
- *
- * 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.
- *
- * Contributor(s):
- *   Daniel Veditz <dveditz@netscape.com>
- *   Dave Townsend <dtownsend@oxymoronical.com>
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either of 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 "nscore.h"
-#include "prprf.h"
-#include "plstr.h"
-
-#include "nsISupports.h"
-#include "nsIServiceManager.h"
-
-#include "nsIURL.h"
-#include "nsIFileURL.h"
-
-#include "nsITransport.h"
-#include "nsIOutputStream.h"
-#include "nsNetUtil.h"
-#include "nsIInputStream.h"
-#include "nsIFileStreams.h"
-#include "nsIStreamListener.h"
-#include "nsICryptoHash.h"
-
-#include "nsIExtensionManager.h"
-#include "nsSoftwareUpdateIIDs.h"
-
-#include "nsIStringEnumerator.h"
-#include "nsXPITriggerInfo.h"
-#include "nsXPInstallManager.h"
-#include "nsInstallTrigger.h"
-#include "nsIWindowWatcher.h"
-#include "nsIAuthPrompt.h"
-#include "nsIWindowMediator.h"
-#include "nsIDocument.h"
-#include "nsIDOMDocument.h"
-#include "nsIDOMWindow.h"
-#include "nsDirectoryService.h"
-#include "nsDirectoryServiceDefs.h"
-#include "nsAppDirectoryServiceDefs.h"
-
-#include "nsReadableUtils.h"
-#include "nsIPromptService.h"
-#include "nsIScriptGlobalObject.h"
-#include "nsXPCOM.h"
-#include "nsISupportsPrimitives.h"
-#include "nsIObserverService.h"
-
-#include "nsISSLStatusProvider.h"
-#include "nsISSLStatus.h"
-#include "nsIX509Cert.h"
-#include "nsIX509Cert3.h"
-
-#include "nsIPrefService.h"
-#include "nsIPrefBranch.h"
-
-#include "CertReader.h"
-
-#include "nsEmbedCID.h"
-#include "nsIAsyncVerifyRedirectCallback.h"
-
-#define PREF_XPINSTALL_ENABLED                "xpinstall.enabled"
-#define PREF_XPINSTALL_CONFIRM_DLG            "xpinstall.dialog.confirm"
-#define PREF_XPINSTALL_STATUS_DLG_SKIN        "xpinstall.dialog.progress.skin"
-#define PREF_XPINSTALL_STATUS_DLG_CHROME      "xpinstall.dialog.progress.chrome"
-#define PREF_XPINSTALL_STATUS_DLG_TYPE_SKIN   "xpinstall.dialog.progress.type.skin"
-#define PREF_XPINSTALL_STATUS_DLG_TYPE_CHROME "xpinstall.dialog.progress.type.chrome"
-
-static NS_DEFINE_IID(kZipReaderCID,  NS_ZIPREADER_CID);
-
-
-nsXPInstallManager::nsXPInstallManager()
-  : mTriggers(0), mItem(0), mNextItem(0), mChromeType(NOT_CHROME),
-    mContentLength(0), mDialogOpen(false), mCancelled(false),
-    mNeedsShutdown(false), mFromChrome(false)
-{
-    // we need to own ourself because we have a longer
-    // lifetime than the scriptlet that created us.
-    NS_ADDREF_THIS();
-}
-
-
-nsXPInstallManager::~nsXPInstallManager()
-{
-    NS_ASSERT_OWNINGTHREAD(nsXPInstallManager);
-    NS_ASSERTION(!mTriggers, "Shutdown not called, triggers still alive");
-}
-
-
-NS_INTERFACE_MAP_BEGIN(nsXPInstallManager)
-  NS_INTERFACE_MAP_ENTRY(nsIXPIDialogService)
-  NS_INTERFACE_MAP_ENTRY(nsIXPInstallManager)
-  NS_INTERFACE_MAP_ENTRY(nsIObserver)
-  NS_INTERFACE_MAP_ENTRY(nsIStreamListener)
-  NS_INTERFACE_MAP_ENTRY(nsIRequestObserver)
-  NS_INTERFACE_MAP_ENTRY(nsIProgressEventSink)
-  NS_INTERFACE_MAP_ENTRY(nsIInterfaceRequestor)
-  NS_INTERFACE_MAP_ENTRY(nsPICertNotification)
-  NS_INTERFACE_MAP_ENTRY(nsIBadCertListener2)
-  NS_INTERFACE_MAP_ENTRY(nsISSLErrorListener)
-  NS_INTERFACE_MAP_ENTRY(nsIChannelEventSink)
-  NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
-  NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsISupportsWeakReference)
-NS_INTERFACE_MAP_END
-
-NS_IMPL_THREADSAFE_ADDREF(nsXPInstallManager)
-NS_IMPL_THREADSAFE_RELEASE(nsXPInstallManager)
-
-NS_IMETHODIMP
-nsXPInstallManager::InitManagerFromChrome(const PRUnichar **aURLs,
-                                          PRUint32 aURLCount,
-                                          nsIXPIProgressDialog* aListener)
-{
-    return InitManagerWithHashes(aURLs, nsnull, aURLCount, aListener);
-}
-
-NS_IMETHODIMP
-nsXPInstallManager::InitManagerWithHashes(const PRUnichar **aURLs,
-                                          const char **aHashes,
-                                          PRUint32 aURLCount,
-                                          nsIXPIProgressDialog* aListener)
-{
-    // If Software Installation is not enabled, we don't want to proceed with
-    // update.
-    bool xpinstallEnabled = true;
-    nsCOMPtr<nsIPrefBranch> pref(do_GetService(NS_PREFSERVICE_CONTRACTID));
-    if (pref)
-        pref->GetBoolPref(PREF_XPINSTALL_ENABLED, &xpinstallEnabled);
-
-    if (!xpinstallEnabled)
-        return NS_OK;
-
-    mTriggers = new nsXPITriggerInfo();
-    if (!mTriggers)
-        return NS_ERROR_OUT_OF_MEMORY;
-
-    mNeedsShutdown = true;
-
-    for (PRUint32 i = 0; i < aURLCount; ++i)
-    {
-        nsXPITriggerItem* item = new nsXPITriggerItem(0, aURLs[i], nsnull,
-                                                      aHashes ? aHashes[i] : nsnull);
-        if (!item)
-        {
-            delete mTriggers; // nsXPITriggerInfo frees any alloc'ed nsXPITriggerItems
-            mTriggers = nsnull;
-            Shutdown();
-            return NS_ERROR_OUT_OF_MEMORY;
-        }
-        mTriggers->Add(item);
-    }
-
-    mFromChrome = true;
-
-    nsresult rv = Observe(aListener, XPI_PROGRESS_TOPIC, NS_LITERAL_STRING("open").get());
-    if (NS_FAILED(rv))
-        Shutdown();
-    return rv;
-}
-
-NS_IMETHODIMP
-nsXPInstallManager::InitManagerWithInstallInfo(nsIXPIInstallInfo* aInstallInfo)
-{
-    nsXPITriggerInfo* triggers;
-    nsresult rv = aInstallInfo->GetTriggerInfo(&triggers);
-    NS_ENSURE_SUCCESS(rv, rv);
-
-    nsCOMPtr<nsIDOMWindow> win;
-    rv = aInstallInfo->GetOriginatingWindow(getter_AddRefs(win));
-    if (NS_SUCCEEDED(rv))
-    {
-        PRUint32 type;
-        rv = aInstallInfo->GetChromeType(&type);
-        if (NS_SUCCEEDED(rv))
-        {
-            // Passing ownership onto InitManager which will free when necessary
-            aInstallInfo->SetTriggerInfo(nsnull);
-            return InitManager(win, triggers, type);
-        }
-    }
-
-    NS_RELEASE_THIS();
-    return rv;
-}
-
-NS_IMETHODIMP
-nsXPInstallManager::InitManager(nsIDOMWindow* aParentWindow, nsXPITriggerInfo* aTriggers, PRUint32 aChromeType)
-{
-    if ( !aTriggers || aTriggers->Size() == 0 )
-    {
-        NS_WARNING("XPInstallManager called with no trigger info!");
-        delete aTriggers;
-        NS_RELEASE_THIS();
-        return NS_ERROR_INVALID_POINTER;
-    }
-
-    nsresult rv = NS_OK;
-
-    mNeedsShutdown = true;
-    mTriggers = aTriggers;
-    mChromeType = aChromeType;
-
-    mParentWindow = aParentWindow;
-
-    // Attempt to find a load group, continue if we can't find one though
-    if (aParentWindow) {
-        nsCOMPtr<nsIDOMDocument> domdoc;
-        rv = aParentWindow->GetDocument(getter_AddRefs(domdoc));
-        if (NS_SUCCEEDED(rv) && domdoc) {
-            nsCOMPtr<nsIDocument> doc = do_QueryInterface(domdoc);
-            if (doc)
-                mLoadGroup = doc->GetDocumentLoadGroup();
-        }
-    }
-
-    // Start downloading initial chunks looking for signatures,
-    mOutstandingCertLoads = mTriggers->Size();
-
-    nsXPITriggerItem *item = mTriggers->Get(--mOutstandingCertLoads);
-
-    nsCOMPtr<nsIURI> uri;
-    NS_NewURI(getter_AddRefs(uri), NS_ConvertUTF16toUTF8(item->mURL));
-    nsCOMPtr<nsIStreamListener> listener = new CertReader(uri, nsnull, this);
-    if (listener)
-        rv = NS_OpenURI(listener, nsnull, uri, nsnull, mLoadGroup);
-    else
-        rv = NS_ERROR_OUT_OF_MEMORY;
-
-    if (NS_FAILED(rv)) {
-        Shutdown();
-    }
-    return rv;
-}
-
-
-nsresult
-nsXPInstallManager::InitManagerInternal()
-{
-    nsresult rv;
-    bool OKtoInstall = false; // initialize to secure state
-
-    //-----------------------------------------------------
-    // *** Do not return early after this point ***
-    //
-    // We have to clean up the triggers in case of error
-    //-----------------------------------------------------
-
-    // --- use embedding dialogs if any registered
-    nsCOMPtr<nsIXPIDialogService> dlgSvc(do_CreateInstance(NS_XPIDIALOGSERVICE_CONTRACTID));
-    if ( !dlgSvc )
-        dlgSvc = this; // provide our own dialogs
-
-    // --- prepare dialog params
-    PRUint32 numTriggers = mTriggers->Size();
-    PRUint32 numStrings = 4 * numTriggers;
-    const PRUnichar** packageList =
-        (const PRUnichar**)malloc( sizeof(PRUnichar*) * numStrings );
-
-    if ( packageList )
-    {
-        // populate the list. The list doesn't own the strings
-        for ( PRUint32 i=0, j=0; i < numTriggers; i++ )
-        {
-            nsXPITriggerItem *item = mTriggers->Get(i);
-            packageList[j++] = item->mName.get();
-            packageList[j++] = item->GetSafeURLString();
-            packageList[j++] = item->mIconURL.get();
-            packageList[j++] = item->mCertName.get();
-        }
-
-        //-----------------------------------------------------
-        // Get permission to install
-        //-----------------------------------------------------
-
-#ifdef ENABLE_SKIN_SIMPLE_INSTALLATION_UI
-        if ( mChromeType == CHROME_SKIN )
-        {
-            // We may want to enable the simple installation UI once
-            // bug 343037 is fixed
-
-            // skins get a simpler/friendlier dialog
-            // XXX currently not embeddable
-            OKtoInstall = ConfirmChromeInstall( mParentWindow, packageList );
-        }
-        else
-        {
-#endif
-            rv = dlgSvc->ConfirmInstall( mParentWindow,
-                                         packageList,
-                                         numStrings,
-                                         &OKtoInstall );
-            if (NS_FAILED(rv))
-                OKtoInstall = false;
-#ifdef ENABLE_SKIN_SIMPLE_INSTALLATION_UI
-        }
-#endif
-
-        if (OKtoInstall)
-        {
-            //-----------------------------------------------------
-            // Open the progress dialog
-            //-----------------------------------------------------
-
-            rv = dlgSvc->OpenProgressDialog( packageList, numStrings, this );
-        }
-    }
-    else
-        rv = NS_ERROR_OUT_OF_MEMORY;
-
-    //-----------------------------------------------------
-    // cleanup and signal callbacks if there were errors
-    //-----------------------------------------------------
-
-    if (packageList)
-        free(packageList);
-
-    PRInt32 cbstatus = 0;  // callback status
-    if (NS_FAILED(rv))
-        cbstatus = nsInstall::UNEXPECTED_ERROR;
-    else if (!OKtoInstall)
-        cbstatus = nsInstall::USER_CANCELLED;
-
-    if ( cbstatus != 0 )
-    {
-        // --- must shutdown if not continuing
-        Shutdown( cbstatus );
-    }
-
-    return rv;
-}
-
-
-NS_IMETHODIMP
-nsXPInstallManager::ConfirmInstall(nsIDOMWindow *aParent, const PRUnichar **aPackageList, PRUint32 aCount, bool *aRetval)
-{
-    *aRetval = false;
-
-    nsCOMPtr<nsIDOMWindow> parentWindow = aParent;
-    nsCOMPtr<nsIDialogParamBlock> params;
-    nsresult rv = LoadParams( aCount, aPackageList, getter_AddRefs(params) );
-
-    if ( NS_SUCCEEDED(rv) && parentWindow && params)
-    {
-        nsCOMPtr<nsIDOMWindow> newWindow;
-
-        nsCOMPtr<nsISupportsInterfacePointer> ifptr =
-            do_CreateInstance(NS_SUPPORTS_INTERFACE_POINTER_CONTRACTID, &rv);
-        NS_ENSURE_SUCCESS(rv, rv);
-
-        ifptr->SetData(params);
-        ifptr->SetDataIID(&NS_GET_IID(nsIDialogParamBlock));
-
-        char* confirmDialogURL;
-        nsCOMPtr<nsIPrefBranch> pref(do_GetService(NS_PREFSERVICE_CONTRACTID, &rv));
-        if (!pref)
-          return rv;
-
-        rv = pref->GetCharPref(PREF_XPINSTALL_CONFIRM_DLG, &confirmDialogURL);
-        NS_ASSERTION(NS_SUCCEEDED(rv), "Can't invoke XPInstall FE without a FE URL! Set xpinstall.dialog.confirm");
-        if (NS_FAILED(rv))
-          return rv;
-
-        rv = parentWindow->OpenDialog(NS_ConvertASCIItoUTF16(confirmDialogURL),
-                                      NS_LITERAL_STRING("_blank"),
-                                      NS_LITERAL_STRING("chrome,centerscreen,modal,titlebar"),
-                                      ifptr,
-                                      getter_AddRefs(newWindow));
-
-        if (NS_SUCCEEDED(rv))
-        {
-            //Now get which button was pressed from the ParamBlock
-            PRInt32 buttonPressed = 0;
-            params->GetInt( 0, &buttonPressed );
-            *aRetval = buttonPressed ? false : true;
-        }
-    }
-
-    return rv;
-}
-
-#ifdef ENABLE_SKIN_SIMPLE_INSTALLATION_UI
-bool nsXPInstallManager::ConfirmChromeInstall(nsIDOMWindow* aParentWindow, const PRUnichar **aPackage)
-{
-    // get the dialog strings
-    nsXPIDLString applyNowText;
-    nsXPIDLString confirmText;
-    nsCOMPtr<nsIStringBundleService> bundleSvc =
-             do_GetService(NS_STRINGBUNDLE_CONTRACTID);
-    if (!bundleSvc)
-        return false;
-
-    nsCOMPtr<nsIStringBundle> xpiBundle;
-    bundleSvc->CreateBundle( XPINSTALL_BUNDLE_URL,
-                             getter_AddRefs(xpiBundle) );
-    if (!xpiBundle)
-        return false;
-
-    const PRUnichar *formatStrings[2] = { aPackage[0], aPackage[1] };
-    if ( mChromeType == CHROME_LOCALE )
-    {
-        xpiBundle->GetStringFromName(
-            NS_LITERAL_STRING("ApplyNowLocale").get(),
-            getter_Copies(applyNowText));
-        xpiBundle->FormatStringFromName(
-            NS_LITERAL_STRING("ConfirmLocale").get(),
-            formatStrings,
-            2,
-            getter_Copies(confirmText));
-    }
-    else
-    {
-        xpiBundle->GetStringFromName(
-            NS_LITERAL_STRING("ApplyNowSkin").get(),
-            getter_Copies(applyNowText));
-        xpiBundle->FormatStringFromName(
-            NS_LITERAL_STRING("ConfirmSkin").get(),
-            formatStrings,
-            2,
-            getter_Copies(confirmText));
-    }
-
-    if (confirmText.IsEmpty())
-        return false;
-
-    // confirmation dialog
-    bool bInstall = false;
-    nsCOMPtr<nsIPromptService> dlgService(do_GetService(NS_PROMPTSERVICE_CONTRACTID));
-    if (dlgService)
-    {
-        dlgService->Confirm(
-            aParentWindow,
-            nsnull,
-            confirmText,
-            &bInstall );
-    }
-
-    return bInstall;
-}
-#endif
-
-NS_IMETHODIMP
-nsXPInstallManager::OpenProgressDialog(const PRUnichar **aPackageList, PRUint32 aCount, nsIObserver *aObserver)
-{
-    // --- convert parameters into nsISupportArray members
-    nsCOMPtr<nsIDialogParamBlock> list;
-    nsresult rv = LoadParams( aCount, aPackageList, getter_AddRefs(list) );
-    if (NS_FAILED(rv))
-        return rv;
-
-    nsCOMPtr<nsISupportsInterfacePointer> listwrap(do_CreateInstance(NS_SUPPORTS_INTERFACE_POINTER_CONTRACTID));
-    if (listwrap) {
-        listwrap->SetData(list);
-        listwrap->SetDataIID(&NS_GET_IID(nsIDialogParamBlock));
-    }
-
-    nsCOMPtr<nsISupportsInterfacePointer> callbackwrap(do_CreateInstance(NS_SUPPORTS_INTERFACE_POINTER_CONTRACTID));
-    if (callbackwrap) {
-        callbackwrap->SetData(aObserver);
-        callbackwrap->SetDataIID(&NS_GET_IID(nsIObserver));
-    }
-
-    nsCOMPtr<nsISupportsArray> params(do_CreateInstance(NS_SUPPORTSARRAY_CONTRACTID));
-
-    if ( !params || !listwrap || !callbackwrap )
-        return NS_ERROR_FAILURE;
-
-    params->AppendElement(listwrap);
-    params->AppendElement(callbackwrap);
-
-    // --- open the window
-    nsCOMPtr<nsIWindowWatcher> wwatch(do_GetService(NS_WINDOWWATCHER_CONTRACTID, &rv));
-    if (!wwatch)
-        return rv;
-
-    char *statusDialogURL, *statusDialogType;
-    nsCOMPtr<nsIPrefBranch> pref(do_GetService(NS_PREFSERVICE_CONTRACTID, &rv));
-    if (!pref)
-        return rv;
-	const char* statusDlg = mChromeType == CHROME_SKIN ? PREF_XPINSTALL_STATUS_DLG_SKIN
-                                                         : PREF_XPINSTALL_STATUS_DLG_CHROME;
-	rv = pref->GetCharPref(statusDlg, &statusDialogURL);
-	NS_ASSERTION(NS_SUCCEEDED(rv), "Can't invoke XPInstall FE without a FE URL! Set xpinstall.dialog.status");
-	if (NS_FAILED(rv))
-		return rv;
-
-    const char* statusType = mChromeType == CHROME_SKIN ? PREF_XPINSTALL_STATUS_DLG_TYPE_SKIN
-                                                        : PREF_XPINSTALL_STATUS_DLG_TYPE_CHROME;
-    rv = pref->GetCharPref(statusType, &statusDialogType);
-    nsAutoString type;
-    type.AssignWithConversion(statusDialogType);
-    if (NS_SUCCEEDED(rv) && !type.IsEmpty()) {
-        nsCOMPtr<nsIWindowMediator> wm = do_GetService(NS_WINDOWMEDIATOR_CONTRACTID);
-
-        nsCOMPtr<nsIDOMWindow> recentWindow;
-        wm->GetMostRecentWindow(type.get(), getter_AddRefs(recentWindow));
-        if (recentWindow) {
-            nsCOMPtr<nsIObserverService> os =
-              mozilla::services::GetObserverService();
-            os->NotifyObservers(params, "xpinstall-download-started", nsnull);
-
-            recentWindow->Focus();
-            return NS_OK;
-        }
-    }
-
-    nsCOMPtr<nsIDOMWindow> newWindow;
-    rv = wwatch->OpenWindow(0,
-                            statusDialogURL,
-                            "_blank",
-                            "chrome,menubar,extra-chrome,toolbar,dialog=no,resizable",
-                            params,
-                            getter_AddRefs(newWindow));
-
-    return rv;
-}
-
-
-NS_IMETHODIMP nsXPInstallManager::Observe( nsISupports *aSubject,
-                                           const char *aTopic,
-                                           const PRUnichar *aData )
-{
-    nsresult rv = NS_ERROR_ILLEGAL_VALUE;
-
-    if ( !aTopic || !aData )
-        return rv;
-
-    nsDependentCString topic( aTopic );
-    if ( topic.Equals( XPI_PROGRESS_TOPIC ) )
-    {
-        //------------------------------------------------------
-        // Communication from the XPInstall Progress Dialog
-        //------------------------------------------------------
-
-        nsDependentString data( aData );
-
-        if ( data.Equals( NS_LITERAL_STRING("open") ) )
-        {
-            // -- The dialog has been opened
-            if (mDialogOpen)
-                return NS_OK; // We've already been opened, nothing more to do
-
-            mDialogOpen = true;
-            rv = NS_OK;
-
-            nsCOMPtr<nsIObserverService> os =
-              mozilla::services::GetObserverService();
-            if (os)
-            {
-                os->AddObserver(this, NS_IOSERVICE_GOING_OFFLINE_TOPIC, true);
-                os->AddObserver(this, "quit-application", true);
-            }
-
-            mDlg = do_QueryInterface(aSubject);
-
-            // -- get the ball rolling
-            DownloadNext();
-        }
-
-        else if ( data.Equals( NS_LITERAL_STRING("cancel") ) )
-        {
-            // -- The dialog/user wants us to cancel the download
-            mCancelled = true;
-            if ( !mDialogOpen )
-            {
-                // if we've never been opened then we can shutdown right here,
-                // otherwise we need to let mCancelled get discovered elsewhere
-                Shutdown();
-            }
-            rv = NS_OK;
-        }
-    }
-    else if ( topic.Equals( NS_IOSERVICE_GOING_OFFLINE_TOPIC ) ||
-              topic.Equals( "quit-application" ) )
-    {
-        mCancelled = true;
-        rv = NS_OK;
-    }
-
-    return rv;
-}
-
-
-///////////////////////////////////////////////////////////////////////////////////////////////
-// Function name    : VerifySigning
-// Description      : Verify that the entire zip file is signed by the certificate displayed to
-//                    the user during download
-// Return type      : PRInt32
-// Argument         : nsIZipReader* hZip       - the zip reader
-// Argument         : nsIPrincipal* aPrincipal - a principal, if any, displayed to the user
-//                    during download. Would have been retrieved from the first file in the zip
-///////////////////////////////////////////////////////////////////////////////////////////////
-
-static nsresult
-VerifySigning(nsIZipReader* hZip, nsIPrincipal* aPrincipal)
-{
-    // If we didn't detect a principal from the zip file during download then
-    // we didn't suggest it was signed to the user, so just carry on.
-    if (!aPrincipal)
-        return NS_OK;
-
-    bool hasCert;
-    aPrincipal->GetHasCertificate(&hasCert);
-    if (!hasCert)
-        return NS_ERROR_FAILURE;
-
-    // See if the archive is signed at all first
-    nsCOMPtr<nsIPrincipal> principal;
-    nsresult rv = hZip->GetCertificatePrincipal(EmptyCString(), getter_AddRefs(principal));
-    if (NS_FAILED(rv) || !principal)
-        return NS_ERROR_FAILURE;
-
-    PRUint32 entryCount = 0;
-
-    // first verify all files in the jar are also in the manifest.
-    nsCOMPtr<nsIUTF8StringEnumerator> entries;
-    rv = hZip->FindEntries(EmptyCString(), getter_AddRefs(entries));
-    if (NS_FAILED(rv))
-        return rv;
-
-    bool more;
-    nsCAutoString name;
-    while (NS_SUCCEEDED(entries->HasMore(&more)) && more)
-    {
-        rv = entries->GetNext(name);
-        if (NS_FAILED(rv)) return rv;
-
-        // Do not verify the directory entries or
-        // entries which are in the meta-inf directory
-        if ((name.Last() == '/') ||
-            (PL_strncasecmp("META-INF/", name.get(), 9) == 0))
-            continue;
-
-        // Count the entries to be verified
-        entryCount++;
-
-        // Each entry must be signed
-        rv = hZip->GetCertificatePrincipal(name, getter_AddRefs(principal));
-        if (NS_FAILED(rv) || !principal) return NS_ERROR_FAILURE;
-
-        bool equal;
-        rv = principal->Equals(aPrincipal, &equal);
-        if (NS_FAILED(rv) || !equal) return NS_ERROR_FAILURE;
-    }
-
-    // next verify all files in the manifest are in the archive.
-    PRUint32 manifestEntryCount;
-    rv = hZip->GetManifestEntriesCount(&manifestEntryCount);
-    if (NS_FAILED(rv))
-        return rv;
-
-    if (entryCount != manifestEntryCount)
-        return NS_ERROR_FAILURE;  // some files were deleted from archive
-
-    return NS_OK;
-}
-
-
-///////////////////////////////////////////////////////////////////////////////////////////////
-// Function name    : OpenAndValidateArchive
-// Description      : Opens install archive and validates contents
-// Return type      : PRInt32
-// Argument         : nsIZipReader* hZip       - the zip reader
-// Argument         : nsIFile* jarFile         - the .xpi file
-// Argument         : nsIPrincipal* aPrincipal - a principal, if any, displayed to the user
-//                    regarding the cert used to sign this install
-///////////////////////////////////////////////////////////////////////////////////////////////
-
-static PRInt32
-OpenAndValidateArchive(nsIZipReader* hZip, nsIFile* jarFile, nsIPrincipal* aPrincipal)
-{
-    if (!jarFile)
-        return nsInstall::DOWNLOAD_ERROR;
-
-    nsCOMPtr<nsIFile> jFile;
-    nsresult rv =jarFile->Clone(getter_AddRefs(jFile));
-    if (NS_SUCCEEDED(rv))
-        rv = hZip->Open(jFile);
-
-    if (NS_FAILED(rv))
-        return nsInstall::CANT_READ_ARCHIVE;
-
-    // CRC check the integrity of all items in this archive
-    rv = hZip->Test(EmptyCString());
-    if (NS_FAILED(rv))
-    {
-        NS_WARNING("CRC check of archive failed!");
-        return nsInstall::CANT_READ_ARCHIVE;
-    }
-
-    rv = VerifySigning(hZip, aPrincipal);
-    if (NS_FAILED(rv))
-    {
-        NS_WARNING("Signing check of archive failed!");
-        return nsInstall::INVALID_SIGNATURE;
-    }
-
-    if (NS_FAILED(hZip->Test(nsDependentCString("install.rdf"))))
-    {
-        NS_WARNING("Archive did not contain an install manifest!");
-        return nsInstall::NO_INSTALL_SCRIPT;
-    }
-
-    return nsInstall::SUCCESS;
-}
-
-
-nsresult nsXPInstallManager::InstallItems()
-{
-    nsresult rv;
-    nsCOMPtr<nsIZipReader> hZip = do_CreateInstance(kZipReaderCID, &rv);
-    NS_ENSURE_SUCCESS(rv, rv);
-    nsCOMPtr<nsIExtensionManager> em = do_GetService("@mozilla.org/extensions/manager;1", &rv);
-    NS_ENSURE_SUCCESS(rv, rv);
-
-    // can't cancel from here on cause we can't undo installs in a multitrigger
-    for (PRUint32 i = 0; i < mTriggers->Size(); ++i)
-    {
-        mItem = (nsXPITriggerItem*)mTriggers->Get(i);
-        if ( !mItem || !mItem->mFile )
-        {
-            // notification for these errors already handled
-            continue;
-        }
-
-        // If there was hash info in the trigger, but
-        // there wasn't a hash object created, then the
-        // algorithm used isn't known.
-
-        if (mItem->mHashFound && !mItem->mHasher)
-        {
-            // report failure
-            mTriggers->SendStatus( mItem->mURL.get(), nsInstall::INVALID_HASH_TYPE );
-            if (mDlg)
-                mDlg->OnStateChange( i, nsIXPIProgressDialog::INSTALL_DONE,
-                                     nsInstall::INVALID_HASH_TYPE );
-            continue;
-        }
-
-        // Don't install if we can't verify the hash (if specified)
-        if (mItem->mHasher && !VerifyHash(mItem))
-        {
-            // report failure
-            mTriggers->SendStatus( mItem->mURL.get(), nsInstall::INVALID_HASH );
-            if (mDlg)
-                mDlg->OnStateChange( i, nsIXPIProgressDialog::INSTALL_DONE,
-                                     nsInstall::INVALID_HASH );
-            continue;
-        }
-
-        if (mDlg)
-            mDlg->OnStateChange( i, nsIXPIProgressDialog::INSTALL_START, 0 );
-
-        PRInt32 finalStatus = OpenAndValidateArchive( hZip,
-                                                      mItem->mFile,
-                                                      mItem->mPrincipal);
-        hZip->Close();
-
-        if (finalStatus == nsInstall::SUCCESS)
-        {
-            rv = em->InstallItemFromFile( mItem->mFile,
-                                          NS_INSTALL_LOCATION_APPPROFILE);
-            if (NS_FAILED(rv))
-                finalStatus = nsInstall::EXECUTION_ERROR;
-        }
-
-        mTriggers->SendStatus( mItem->mURL.get(), finalStatus );
-        if (mDlg)
-            mDlg->OnStateChange( i, nsIXPIProgressDialog::INSTALL_DONE,
-                                 finalStatus );
-    }
-    return NS_OK;
-}
-
-NS_IMETHODIMP nsXPInstallManager::DownloadNext()
-{
-    nsresult rv = NS_OK;
-    mContentLength = 0;
-
-    if (mCancelled)
-    {
-        // Don't download any more if we were cancelled
-        Shutdown();
-        return NS_OK;
-    }
-
-    if ( mNextItem < mTriggers->Size() )
-    {
-        //-------------------------------------------------
-        // There are items to download, get the next one
-        //-------------------------------------------------
-        mItem = (nsXPITriggerItem*)mTriggers->Get(mNextItem++);
-
-        NS_ASSERTION( mItem, "bogus Trigger slipped through" );
-        NS_ASSERTION( !mItem->mURL.IsEmpty(), "bogus trigger");
-        if ( !mItem || mItem->mURL.IsEmpty() )
-        {
-            // serious problem with trigger! Can't notify anyone of the
-            // error without the URL, just try to carry on.
-            return DownloadNext();
-        }
-
-        // --- Tell the dialog we're starting a download
-        if (mDlg)
-            mDlg->OnStateChange( mNextItem-1, nsIXPIProgressDialog::DOWNLOAD_START, 0 );
-
-        if ( mItem->IsFileURL() && mChromeType == NOT_CHROME )
-        {
-            //--------------------------------------------------
-            // Already local, we can open it where it is
-            //--------------------------------------------------
-            nsCOMPtr<nsIURI> pURL;
-            rv = NS_NewURI(getter_AddRefs(pURL), mItem->mURL);
-
-            if (NS_SUCCEEDED(rv))
-            {
-                nsCOMPtr<nsIFileURL> fileURL = do_QueryInterface(pURL,&rv);
-                if (fileURL)
-                {
-                    nsCOMPtr<nsIFile> localFile;
-                    rv = fileURL->GetFile(getter_AddRefs(localFile));
-                    if (NS_SUCCEEDED(rv))
-                    {
-                        mItem->mFile = do_QueryInterface(localFile,&rv);
-                    }
-                }
-            }
-
-            if ( NS_FAILED(rv) || !mItem->mFile )
-            {
-                // send error status back
-                if (mDlg)
-                    mDlg->OnStateChange( mNextItem-1,
-                                         nsIXPIProgressDialog::INSTALL_DONE,
-                                         nsInstall::UNEXPECTED_ERROR );
-                mTriggers->SendStatus( mItem->mURL.get(),
-                                       nsInstall::UNEXPECTED_ERROR );
-                mItem->mFile = 0;
-            }
-            else if (mDlg)
-            {
-                mDlg->OnStateChange( mNextItem-1,
-                                     nsIXPIProgressDialog::DOWNLOAD_DONE, 0);
-            }
-
-            // --- on to the next one
-            return DownloadNext();
-        }
-        else
-        {
-            //--------------------------------------------------
-            // We have one to download
-            //--------------------------------------------------
-            rv = GetDestinationFile(mItem->mURL, getter_AddRefs(mItem->mFile));
-            if (NS_SUCCEEDED(rv))
-            {
-                nsCOMPtr<nsIURI> pURL;
-                rv = NS_NewURI(getter_AddRefs(pURL), mItem->mURL);
-                if (NS_SUCCEEDED(rv))
-                {
-                    nsCOMPtr<nsIChannel> channel;
-
-                    rv = NS_NewChannel(getter_AddRefs(channel), pURL, nsnull, mLoadGroup, this);
-                    if (NS_SUCCEEDED(rv))
-                    {
-                        rv = channel->AsyncOpen(this, nsnull);
-                    }
-                }
-            }
-
-            if (NS_FAILED(rv))
-            {
-                // announce failure
-                if (mDlg)
-                    mDlg->OnStateChange( mNextItem-1,
-                                         nsIXPIProgressDialog::INSTALL_DONE,
-                                         nsInstall::DOWNLOAD_ERROR );
-                mTriggers->SendStatus( mItem->mURL.get(),
-                                       nsInstall::DOWNLOAD_ERROR );
-                mItem->mFile = 0;
-
-                // We won't get Necko callbacks so start the next one now
-                return DownloadNext();
-            }
-        }
-    }
-    else
-    {
-        //------------------------------------------------------
-        // all downloaded, install them
-        //------------------------------------------------------
-        InstallItems();
-        Shutdown();
-    }
-
-    return rv;
-}
-
-
-//-------------------------------------------------------------------
-// VerifyHash
-//
-// Returns true if the file hash matches the expected value (or if
-// the item has no hash value). False if we can't verify the hash
-// for any reason
-//
-bool nsXPInstallManager::VerifyHash(nsXPITriggerItem* aItem)
-{
-    NS_ASSERTION(aItem, "Null nsXPITriggerItem passed to VerifyHash");
-
-    nsresult rv;
-    if (!aItem->mHasher)
-      return false;
-
-    nsCOMPtr<nsIInputStream> stream;
-    rv = NS_NewLocalFileInputStream(getter_AddRefs(stream), aItem->mFile);
-    if (NS_FAILED(rv)) return false;
-
-    rv = aItem->mHasher->UpdateFromStream(stream, PR_UINT32_MAX);
-    if (NS_FAILED(rv)) return false;
-
-    nsCAutoString binaryHash;
-    rv = aItem->mHasher->Finish(false, binaryHash);
-    if (NS_FAILED(rv)) return false;
-
-    char* hash = nsnull;
-    for (PRUint32 i=0; i < binaryHash.Length(); ++i)
-    {
-        hash = PR_sprintf_append(hash,"%.2x", (PRUint8)binaryHash[i]);
-    }
-
-    bool result = aItem->mHash.EqualsIgnoreCase(hash);
-
-    PR_smprintf_free(hash);
-    return result;
-}
-
-
-void nsXPInstallManager::Shutdown(PRInt32 status)
-{
-    if (mDlg)
-    {
-        // tell the dialog it can go away
-        mDlg->OnStateChange(0, nsIXPIProgressDialog::DIALOG_CLOSE, 0 );
-        mDlg = nsnull;
-    }
-
-    if (mNeedsShutdown)
-    {
-        mNeedsShutdown = false;
-
-        // Send remaining status notifications if we were cancelled early
-        nsXPITriggerItem* item;
-        while ( mNextItem < mTriggers->Size() )
-        {
-            item = (nsXPITriggerItem*)mTriggers->Get(mNextItem++);
-            if ( item && !item->mURL.IsEmpty() )
-            {
-                mTriggers->SendStatus( item->mURL.get(), status );
-            }
-        }
-
-        // Clean up downloaded files (regular install only, not chrome installs)
-        for (PRUint32 i = 0; i < mTriggers->Size(); i++ )
-        {
-            item = static_cast<nsXPITriggerItem*>(mTriggers->Get(i));
-            if ( item && item->mFile && !item->IsFileURL() )
-                item->mFile->Remove(false);
-        }
-
-        nsCOMPtr<nsIObserverService> os =
-          mozilla::services::GetObserverService();
-        if (os)
-        {
-            os->RemoveObserver(this, NS_IOSERVICE_GOING_OFFLINE_TOPIC);
-            os->RemoveObserver(this, "quit-application");
-        }
-
-        if (mTriggers)
-        {
-            delete mTriggers;
-            mTriggers = nsnull;
-        }
-
-        NS_RELEASE_THIS();
-    }
-}
-
-NS_IMETHODIMP
-nsXPInstallManager::LoadParams(PRUint32 aCount, const PRUnichar** aPackageList, nsIDialogParamBlock** aParams)
-{
-    nsresult rv;
-    nsCOMPtr<nsIDialogParamBlock> paramBlock = do_CreateInstance(NS_DIALOGPARAMBLOCK_CONTRACTID, &rv);
-    if (NS_SUCCEEDED(rv))
-    {
-        // set OK and Cancel buttons
-        paramBlock->SetInt( 0, 2 );
-        // pass in number of strings
-        paramBlock->SetInt( 1, aCount );
-        // add strings
-        paramBlock->SetNumberStrings( aCount );
-        for (PRUint32 i = 0; i < aCount; i++)
-            paramBlock->SetString( i, aPackageList[i] );
-    }
-
-    NS_IF_ADDREF(*aParams = paramBlock);
-    return rv;
-}
-
-
-NS_IMETHODIMP
-nsXPInstallManager::GetDestinationFile(nsString& url, nsILocalFile* *file)
-{
-    NS_ENSURE_ARG_POINTER(file);
-    nsresult rv;
-
-    nsCOMPtr<nsIProperties> directoryService =
-             do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID, &rv);
-    NS_ENSURE_SUCCESS(rv, rv);
-
-    nsCOMPtr<nsILocalFile> temp;
-    rv = directoryService->Get(NS_OS_TEMP_DIR,
-                               NS_GET_IID(nsIFile),
-                               getter_AddRefs(temp));
-    NS_ENSURE_SUCCESS(rv, rv);
-
-    temp->AppendNative(NS_LITERAL_CSTRING("tmp.xpi"));
-    temp->CreateUnique(nsIFile::NORMAL_FILE_TYPE, 0600);
-    *file = temp;
-    NS_IF_ADDREF(*file);
-
-    return NS_OK;
-}
-
-nsresult
-nsXPInstallManager::CheckCert(nsIChannel* aChannel)
-{
-    nsCOMPtr<nsIURI> uri;
-    nsresult rv = aChannel->GetOriginalURI(getter_AddRefs(uri));
-    NS_ENSURE_SUCCESS(rv, rv);
-    nsCAutoString scheme;
-    rv = uri->GetScheme(scheme);
-    NS_ENSURE_SUCCESS(rv, rv);
-    if (!scheme.Equals(NS_LITERAL_CSTRING("https")))
-        return NS_OK;
-
-    nsCOMPtr<nsISupports> security;
-    rv = aChannel->GetSecurityInfo(getter_AddRefs(security));
-    NS_ENSURE_SUCCESS(rv, rv);
-    nsCOMPtr<nsISSLStatusProvider> statusProvider(do_QueryInterface(security));
-    NS_ENSURE_TRUE(statusProvider, NS_ERROR_FAILURE);
-
-    rv = statusProvider->GetSSLStatus(getter_AddRefs(security));
-    NS_ENSURE_SUCCESS(rv, rv);
-    nsCOMPtr<nsISSLStatus> status(do_QueryInterface(security));
-    NS_ENSURE_TRUE(status, NS_ERROR_FAILURE);
-    nsCOMPtr<nsIX509Cert> cert;
-    rv = status->GetServerCert(getter_AddRefs(cert));
-    NS_ENSURE_SUCCESS(rv, rv);
-
-    nsCOMPtr<nsIX509Cert> issuer;
-    rv = cert->GetIssuer(getter_AddRefs(issuer));
-    NS_ENSURE_SUCCESS(rv, rv);
-    bool equal;
-    while (issuer && NS_SUCCEEDED(cert->Equals(issuer, &equal)) && !equal) {
-        cert = issuer;
-        rv = cert->GetIssuer(getter_AddRefs(issuer));
-        NS_ENSURE_SUCCESS(rv, rv);
-    }
-
-    if (issuer) {
-        PRUint32 length;
-        PRUnichar** tokenNames;
-        nsCOMPtr<nsIX509Cert3> issuer2(do_QueryInterface(issuer));
-        NS_ENSURE_TRUE(status, NS_ERROR_FAILURE);
-        rv = issuer2->GetAllTokenNames(&length, &tokenNames);
-        NS_ENSURE_SUCCESS(rv ,rv);
-        for (PRUint32 i = 0; i < length; i++) {
-            if (nsDependentString(tokenNames[i]).Equals(NS_LITERAL_STRING("Builtin Object Token")))
-                return NS_OK;
-        }
-    }
-    return NS_ERROR_FAILURE;
-}
-
-NS_IMETHODIMP
-nsXPInstallManager::OnStartRequest(nsIRequest* request, nsISupports *ctxt)
-{
-    nsresult rv = NS_ERROR_FAILURE;
-
-    // If we are dealing with a HTTP request, then treat HTTP error pages as
-    // download failures.
-    nsCOMPtr<nsIHttpChannel> httpChan = do_QueryInterface(request);
-    if (httpChan) {
-        // If we were chrome lauched check the certificate on the request
-        if (mFromChrome && NS_FAILED(CheckCert(httpChan))) {
-            request->Cancel(NS_BINDING_ABORTED);
-            return NS_OK;
-        }
-        bool succeeded;
-        if (NS_SUCCEEDED(httpChan->GetRequestSucceeded(&succeeded)) && !succeeded) {
-            // HTTP response is not a 2xx!
-            request->Cancel(NS_BINDING_ABORTED);
-            return NS_OK;
-        }
-    }
-
-    if (mLoadGroup)
-        mLoadGroup->RemoveRequest(request, nsnull, NS_BINDING_RETARGETED);
-
-    NS_ASSERTION( mItem && mItem->mFile, "XPIMgr::OnStartRequest bad state");
-    if ( mItem && mItem->mFile )
-    {
-        NS_ASSERTION( !mItem->mOutStream, "Received double OnStartRequest from Necko");
-
-        rv = NS_NewLocalFileOutputStream(getter_AddRefs(mItem->mOutStream),
-                                         mItem->mFile,
-                                         PR_WRONLY | PR_CREATE_FILE | PR_TRUNCATE,
-                                         0600);
-    }
-    return rv;
-}
-
-
-NS_IMETHODIMP
-nsXPInstallManager::OnStopRequest(nsIRequest *request, nsISupports *ctxt,
-                                  nsresult status)
-{
-    nsresult rv;
-
-    switch( status )
-    {
-
-        case NS_BINDING_SUCCEEDED:
-            NS_ASSERTION( mItem->mOutStream, "XPIManager: output stream doesn't exist");
-            rv = NS_OK;
-            break;
-
-        case NS_BINDING_FAILED:
-        case NS_BINDING_ABORTED:
-            rv = status;
-            // XXX need to note failure, both to send back status
-            // to the callback, and also so we don't try to install
-            // this probably corrupt file.
-            break;
-
-        default:
-            rv = NS_ERROR_ILLEGAL_VALUE;
-    }
-
-    NS_ASSERTION( mItem, "Bad state in XPIManager");
-    if ( mItem && mItem->mOutStream )
-    {
-        mItem->mOutStream->Close();
-        mItem->mOutStream = nsnull;
-    }
-
-    if (NS_FAILED(rv) || mCancelled)
-    {
-        // Download error!
-        // -- first clean up partially downloaded file
-        if ( mItem && mItem->mFile )
-        {
-            bool flagExists;
-            nsresult rv2 ;
-            rv2 = mItem->mFile->Exists(&flagExists);
-            if (NS_SUCCEEDED(rv2) && flagExists)
-                mItem->mFile->Remove(false);
-
-            mItem->mFile = 0;
-        }
-
-        // -- then notify interested parties
-        PRInt32 errorcode = mCancelled ? nsInstall::USER_CANCELLED
-                                       : nsInstall::DOWNLOAD_ERROR;
-        if (mDlg)
-            mDlg->OnStateChange( mNextItem-1,
-                                 nsIXPIProgressDialog::INSTALL_DONE,
-                                 errorcode );
-        if (mItem)
-            mTriggers->SendStatus( mItem->mURL.get(), errorcode );
-    }
-    else if (mDlg)
-    {
-        mDlg->OnStateChange( mNextItem-1, nsIXPIProgressDialog::DOWNLOAD_DONE, 0);
-    }
-
-    DownloadNext();
-    return rv;
-}
-
-
-NS_IMETHODIMP
-nsXPInstallManager::OnDataAvailable(nsIRequest* request, nsISupports *ctxt,
-                                    nsIInputStream *pIStream,
-                                    PRUint32 sourceOffset,
-                                    PRUint32 length)
-{
-#define XPI_ODA_BUFFER_SIZE 8*1024
-    PRUint32 amt = NS_MIN(XPI_ODA_BUFFER_SIZE, length);
-    nsresult err;
-    char buffer[XPI_ODA_BUFFER_SIZE];
-    PRUint32 writeCount;
-
-    if (mCancelled)
-    {
-        // We must cancel this download in progress. We may get extra
-        // OnData calls if they were already queued so beware
-        request->Cancel(NS_BINDING_ABORTED);
-        return NS_ERROR_FAILURE;
-    }
-
-    do
-    {
-        err = pIStream->Read(buffer, amt, &amt);
-
-        if (amt == 0) break;
-        if (NS_FAILED(err)) return err;
-
-        err = mItem->mOutStream->Write( buffer, amt, &writeCount);
-        if (NS_FAILED(err) || writeCount != amt)
-        {
-            return NS_ERROR_FAILURE;
-        }
-        length -= amt;
-
-        amt = NS_MIN(XPI_ODA_BUFFER_SIZE, length);
-
-    } while (length > 0);
-
-    return NS_OK;
-}
-
-
-NS_IMETHODIMP
-nsXPInstallManager::OnProgress(nsIRequest* request, nsISupports *ctxt, PRUint64 aProgress, PRUint64 aProgressMax)
-{
-    nsresult rv = NS_OK;
-
-    if (mDlg && !mCancelled)
-    {
-        if (mContentLength < 1) {
-            nsCOMPtr<nsIChannel> channel = do_QueryInterface(request,&rv);
-            NS_ASSERTION(channel, "should have a channel");
-            if (NS_FAILED(rv)) return rv;
-            rv = channel->GetContentLength(&mContentLength);
-            if (NS_FAILED(rv)) return rv;
-        }
-        // XXX once channels support that, use 64-bit contentlength
-        rv = mDlg->OnProgress( mNextItem-1, aProgress, PRUint64(mContentLength) );
-    }
-
-    return rv;
-}
-
-NS_IMETHODIMP
-nsXPInstallManager::OnStatus(nsIRequest* request, nsISupports *ctxt,
-                             nsresult aStatus, const PRUnichar *aStatusArg)
-{
-    // don't need to do anything
-    return NS_OK;
-}
-
-// nsIInterfaceRequestor method
-NS_IMETHODIMP
-nsXPInstallManager::GetInterface(const nsIID & eventSinkIID, void* *_retval)
-{
-    if (eventSinkIID.Equals(NS_GET_IID(nsIAuthPrompt))) {
-        *_retval = nsnull;
-
-        nsresult rv;
-        nsCOMPtr<nsIWindowWatcher> ww(do_GetService(NS_WINDOWWATCHER_CONTRACTID, &rv));
-        NS_ENSURE_SUCCESS(rv, rv);
-
-        nsCOMPtr<nsIAuthPrompt> prompt;
-        rv = ww->GetNewAuthPrompter(nsnull, getter_AddRefs(prompt));
-        NS_ENSURE_SUCCESS(rv, rv);
-
-        nsIAuthPrompt *p = prompt.get();
-        NS_ADDREF(p);
-        *_retval = p;
-        return NS_OK;
-    }
-    else if (eventSinkIID.Equals(NS_GET_IID(nsIBadCertListener2))) {
-        // If we aren't chrome triggered fall back to the default dialogs
-        if (!mFromChrome)
-            return NS_ERROR_NO_INTERFACE;
-    }
-    return QueryInterface(eventSinkIID, (void**)_retval);
-}
-
-// nsIChannelEventSink method
-NS_IMETHODIMP
-nsXPInstallManager::AsyncOnChannelRedirect(nsIChannel *oldChannel,
-                                           nsIChannel *newChannel,
-                                           PRUint32 flags,
-                                           nsIAsyncVerifyRedirectCallback *callback)
-{
-    // Chrome triggered installs need to have their certificates checked
-    if (mFromChrome) {
-        nsresult rv = CheckCert(oldChannel);
-        if (NS_FAILED(rv()))
-            return rv;
-    }
-
-    callback->OnRedirectVerifyCallback(NS_OK);
-    return NS_OK;
-}
-
-// nsIBadCertListener2 methods
-NS_IMETHODIMP
-nsXPInstallManager::NotifyCertProblem(nsIInterfaceRequestor *socketInfo,
-                                      nsISSLStatus *status,
-                                      const nsACString &targetSite,
-                                      bool *_retval)
-{
-    *_retval = true;
-    return NS_OK;
-}
-
-// nsISSLErrorListener methods
-NS_IMETHODIMP
-nsXPInstallManager::NotifySSLError(nsIInterfaceRequestor *socketInfo, 
-                                    PRInt32 error, 
-                                    const nsACString &targetSite, 
-                                    bool *_retval)
-{
-    *_retval = true;
-    return NS_OK;
-}
-
-NS_IMETHODIMP
-nsXPInstallManager::OnCertAvailable(nsIURI *aURI,
-                                    nsISupports* context,
-                                    nsresult aStatus,
-                                    nsIPrincipal *aPrincipal)
-{
-    if (NS_FAILED(aStatus) && aStatus != NS_BINDING_ABORTED) {
-        // Check for a bad status.  The only acceptable failure status code we accept
-        // is NS_BINDING_ABORTED.  For all others we want to ensure that the
-        // nsIPrincipal is nsnull.
-
-        NS_ASSERTION(aPrincipal == nsnull, "There has been an error, but we have a principal!");
-        aPrincipal = nsnull;
-    }
-
-    // get the current one and assign the cert name
-    nsXPITriggerItem *item = mTriggers->Get(mOutstandingCertLoads);
-    item->SetPrincipal(aPrincipal);
-
-    if (mOutstandingCertLoads == 0) {
-        InitManagerInternal();
-        return NS_OK;
-    }
-
-    // get the next one to load.  If there is any failure, we just go on to the
-    // next trigger.  When all triggers items are handled, we call into InitManagerInternal
-
-    item = mTriggers->Get(--mOutstandingCertLoads);
-
-    nsCOMPtr<nsIURI> uri;
-    NS_NewURI(getter_AddRefs(uri), NS_ConvertUTF16toUTF8(item->mURL.get()).get());
-
-    if (!uri || mChromeType != NOT_CHROME)
-        return OnCertAvailable(uri, context, NS_ERROR_FAILURE, nsnull);
-
-    nsIStreamListener* listener = new CertReader(uri, nsnull, this);
-    if (!listener)
-        return OnCertAvailable(uri, context, NS_ERROR_FAILURE, nsnull);
-
-    NS_ADDREF(listener);
-    nsresult rv = NS_OpenURI(listener, nsnull, uri, nsnull, mLoadGroup);
-
-    NS_ASSERTION(NS_SUCCEEDED(rv), "OpenURI failed");
-    NS_RELEASE(listener);
-
-    if (NS_FAILED(rv))
-        return OnCertAvailable(uri, context, NS_ERROR_FAILURE, nsnull);
-
-    return NS_OK;
-}
-
deleted file mode 100644
--- a/xpinstall/src/nsXPInstallManager.h
+++ /dev/null
@@ -1,144 +0,0 @@
-/* ***** 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 Communicator client code, released
- * March 31, 1998.
- *
- * 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.
- *
- * Contributor(s):
- *   Daniel Veditz <dveditz@netscape.com>
- *   Dave Townsend <dtownsend@oxymoronical.com>
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either of 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 ***** */
-
-#ifndef _NS_XPINSTALLMANAGER_H
-#define _NS_XPINSTALLMANAGER_H
-
-#include "nsInstall.h"
-
-#include "nscore.h"
-#include "nsISupports.h"
-#include "nsString.h"
-
-#include "nsIURL.h"
-#include "nsIInputStream.h"
-#include "nsIStreamListener.h"
-#include "nsIXPInstallManager.h"
-#include "nsIXPIDialogService.h"
-#include "nsXPITriggerInfo.h"
-#include "nsIXPIProgressDialog.h"
-#include "nsIChromeRegistry.h"
-#include "nsIDOMWindow.h"
-#include "nsIObserver.h"
-#include "nsIBadCertListener2.h"
-#include "nsISSLErrorListener.h"
-#include "nsIChannelEventSink.h"
-#include "nsIZipReader.h"
-#include "nsIXPIInstallInfo.h"
-#include "nsILoadGroup.h"
-
-#include "nsCOMPtr.h"
-
-#include "nsIProgressEventSink.h"
-#include "nsIInterfaceRequestor.h"
-#include "nsIInterfaceRequestorUtils.h"
-
-#include "nsIDialogParamBlock.h"
-
-#include "nsPICertNotification.h"
-
-#include "nsWeakReference.h"
-
-#define NS_XPIDIALOGSERVICE_CONTRACTID "@mozilla.org/embedui/xpinstall-dialog-service;1"
-#define NS_XPINSTALLMANAGERCOMPONENT_CONTRACTID "@mozilla.org/xpinstall/install-manager;1"
-#define XPI_PROGRESS_TOPIC "xpinstall-progress"
-
-class nsXPInstallManager : public nsIXPIDialogService,
-                           public nsIXPInstallManager,
-                           public nsIObserver,
-                           public nsIStreamListener,
-                           public nsIProgressEventSink,
-                           public nsIInterfaceRequestor,
-                           public nsPICertNotification,
-                           public nsIBadCertListener2,
-                           public nsISSLErrorListener,
-                           public nsIChannelEventSink,
-                           public nsSupportsWeakReference
-{
-    public:
-        nsXPInstallManager();
-        virtual ~nsXPInstallManager();
-
-        NS_DECL_ISUPPORTS
-        NS_DECL_NSIXPIDIALOGSERVICE
-        NS_DECL_NSIXPINSTALLMANAGER
-        NS_DECL_NSIOBSERVER
-        NS_DECL_NSISTREAMLISTENER
-        NS_DECL_NSIPROGRESSEVENTSINK
-        NS_DECL_NSIREQUESTOBSERVER
-        NS_DECL_NSIINTERFACEREQUESTOR
-        NS_DECL_NSPICERTNOTIFICATION
-        NS_DECL_NSIBADCERTLISTENER2
-        NS_DECL_NSISSLERRORLISTENER
-        NS_DECL_NSICHANNELEVENTSINK
-
-        NS_IMETHOD InitManager(nsIDOMWindow* aParentWindow, nsXPITriggerInfo* aTrigger, PRUint32 aChromeType );
-
-    private:
-        nsresult    InitManagerInternal();
-        nsresult    InstallItems();
-        NS_IMETHOD  DownloadNext();
-        void        Shutdown(PRInt32 status = nsInstall::USER_CANCELLED);
-        NS_IMETHOD  GetDestinationFile(nsString& url, nsILocalFile* *file);
-        NS_IMETHOD  LoadParams(PRUint32 aCount, const PRUnichar** aPackageList, nsIDialogParamBlock** aParams);
-#ifdef ENABLE_SKIN_SIMPLE_INSTALLATION_UI
-        bool        ConfirmChromeInstall(nsIDOMWindow* aParentWindow, const PRUnichar** aPackage);
-#endif
-        bool        VerifyHash(nsXPITriggerItem* aItem);
-        PRInt32     GetIndexFromURL(const PRUnichar* aUrl);
-        nsresult    CheckCert(nsIChannel* aChannel);
-
-        nsXPITriggerInfo*   mTriggers;
-        nsXPITriggerItem*   mItem;
-        PRUint32            mNextItem;
-        PRUint32            mChromeType;
-        PRInt32             mContentLength;
-        PRInt32             mOutstandingCertLoads;
-        bool                mDialogOpen;
-        bool                mCancelled;
-        bool                mNeedsShutdown;
-        bool                mFromChrome;
-
-        nsCOMPtr<nsIXPIProgressDialog>  mDlg;
-
-        nsCOMPtr<nsIDOMWindow>          mParentWindow;
-        nsCOMPtr<nsILoadGroup>          mLoadGroup;
-};
-
-#endif
deleted file mode 100644
index ca333944cb5797e387b9dca07777ac1f1d73cf62..0000000000000000000000000000000000000000
GIT binary patch
literal 0
Hc$@<O00001
deleted file mode 100644
--- a/xpinstall/test/pre_checkin_trigger.html
+++ /dev/null
@@ -1,74 +0,0 @@
-<HTML>
-<!-- ***** 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 Communicator client code, released March
-   - 31, 1998.
-   -
-   - 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.
-   -
-   - Contributor(s):
-   -        Samir Gehani <sgehani@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 LGPL or the GPL. 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 ***** -->
-<HEAD>
-<TITLE>XPInstall Pre-Checkin Trigger Test</TITLE>
-
-<SCRIPT>
-
-function xpinstallCallback(url, status)
-{
-  if (status == 0)
-    msg = "XPInstall Test:   PASSED\n";
-  else
-    msg = "XPInstall Test:   FAILED\n";
-
-  dump(msg);
-  alert(msg);
-}
-
-</SCRIPT>
-</HEAD>
-
-<BODY>
-
-<H3>XPInstall Pre-Checkin Trigger Test</H3>
-<HR>
-Click on the link below to execute the XPInstall pre-checkin test. <BR>
-The test result (PASS or FAIL) will pop up in an alert after the test completes. <P>
-
-<A HREF="javascript:
-
-  xpi={'XPInstall Pre-Checkin Test':'pre_checkin.xpi'};
-  InstallTrigger.install(xpi,xpinstallCallback);
-
-">Test XPInstall</A>
-
-
-</BODY>
-</HTML>
deleted file mode 100644
--- a/xpinstall/test/testXPIDialogService.js
+++ /dev/null
@@ -1,170 +0,0 @@
-/* ***** 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))
-            return this;
-
-        throw Components.results.NS_ERROR_NO_INTERFACE;
-    },
-
-    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();
-    }
-};
deleted file mode 100644
--- a/xpinstall/tests/Makefile.in
+++ /dev/null
@@ -1,108 +0,0 @@
-# ***** 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.org code.
-#
-# The Initial Developer of the Original Code is
-# Mozilla Foundation.
-# Portions created by the Initial Developer are Copyright (C) 2008
-# the Initial Developer. All Rights Reserved.
-#
-# Contributor(s):
-#
-# Alternatively, the contents of this file may be used under the terms of
-# either of 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 *****
-
-DEPTH		= ../..
-topsrcdir	= @top_srcdir@
-srcdir		= @srcdir@
-VPATH		= @srcdir@
-relativesrcdir  = xpinstall/tests
-
-include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
-
-ifneq (mobile,$(MOZ_BUILD_APP))
-_BROWSER_FILES = harness.js \
-                 browser_unsigned_url.js \
-                 browser_unsigned_trigger.js \
-                 browser_whitelist.js \
-                 browser_whitelist2.js \
-                 browser_whitelist3.js \
-                 browser_whitelist4.js \
-                 browser_whitelist5.js \
-                 browser_whitelist6.js \
-                 browser_hash.js \
-                 browser_badhash.js \
-                 browser_badhashtype.js \
-                 browser_signed_url.js \
-                 browser_signed_trigger.js \
-                 browser_signed_untrusted.js \
-                 browser_signed_tampered.js \
-                 browser_signed_multiple.js \
-                 browser_signed_naming.js \
-                 browser_empty.js \
-                 browser_corrupt.js \
-                 browser_cookies.js \
-                 browser_cookies2.js \
-                 browser_cookies3.js \
-                 browser_cookies4.js \
-                 browser_enabled.js \
-                 browser_enabled2.js \
-                 browser_enabled3.js \
-                 browser_softwareupdate.js \
-                 browser_installchrome.js \
-                 browser_opendialog.js \
-                 browser_localfile.js \
-                 browser_localfile2.js \
-                 browser_auth.js \
-                 browser_auth2.js \
-                 browser_auth3.js \
-                 browser_offline.js \
-                 browser_chrome.js \
-                 browser_cancel.js \
-                 browser_navigateaway.js \
-                 browser_navigateaway2.js \
-                 browser_bug540558.js \
-                 unsigned.xpi \
-                 signed.xpi \
-                 signed2.xpi \
-                 signed-no-o.xpi \
-                 signed-no-cn.xpi \
-                 signed-untrusted.xpi \
-                 signed-tampered.xpi \
-                 empty.xpi \
-                 corrupt.xpi \
-                 enabled.html \
-                 installtrigger.html \
-                 startsoftwareupdate.html \
-                 installchrome.html \
-                 authRedirect.sjs \
-                 cookieRedirect.sjs \
-                 bug540558.html \
-                 $(NULL)
-
-libs::	$(_BROWSER_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/browser/$(relativesrcdir)
-endif
deleted file mode 100644
--- a/xpinstall/tests/authRedirect.sjs
+++ /dev/null
@@ -1,21 +0,0 @@
-// Simple script redirects to the query part of the uri if the browser
-// authenticates with username "testuser" password "testpass"
-
-function handleRequest(request, response) {
-  if (request.hasHeader("Authorization")) {
-    if (request.getHeader("Authorization") == "Basic dGVzdHVzZXI6dGVzdHBhc3M=") {
-      response.setStatusLine(request.httpVersion, 302, "Found");
-      response.setHeader("Location", request.queryString);
-      response.write("See " + request.queryString);
-    }
-    else {
-      response.setStatusLine(request.httpVersion, 403, "Forbidden");
-      response.write("Invalid credentials");
-    }
-  }
-  else {
-    response.setStatusLine(request.httpVersion, 401, "Authentication required");
-    response.setHeader("WWW-Authenticate", "basic realm=\"XPInstall\"", false);
-    response.write("Unauthenticed request");
-  }
-}
deleted file mode 100644
--- a/xpinstall/tests/browser_auth.js
+++ /dev/null
@@ -1,49 +0,0 @@
-// Load in the test harness
-var scriptLoader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"]
-                             .getService(Components.interfaces.mozIJSSubScriptLoader);
-
-var rootDir = getRootDirectory(window.location.href);
-scriptLoader.loadSubScript(rootDir + "harness.js", this);
-
-// ----------------------------------------------------------------------------
-// Test whether an install succeeds when authentication is required
-// This verifies bug 312473
-function test() {
-  Harness.authenticationCallback = get_auth_info;
-  Harness.installEndedCallback = check_xpi_install;
-  Harness.installsCompletedCallback = finish_test;
-  Harness.setup();
-
-  var pm = Services.perms;
-  pm.add(makeURI("http://example.com/"), "install", pm.ALLOW_ACTION);
-
-  var triggers = encodeURIComponent(JSON.stringify({
-    "Unsigned XPI": TESTROOT + "authRedirect.sjs?" + TESTROOT + "unsigned.xpi"
-  }));
-  gBrowser.selectedTab = gBrowser.addTab();
-  gBrowser.loadURI(TESTROOT + "installtrigger.html?" + triggers);
-}
-
-function get_auth_info() {
-  return [ "testuser", "testpass" ];
-}
-
-function check_xpi_install(addon, status) {
-  is(status, 0, "Install should succeed");
-}
-
-function finish_test() {
-  var authMgr = Components.classes['@mozilla.org/network/http-auth-manager;1']
-                          .getService(Components.interfaces.nsIHttpAuthManager);
-  authMgr.clearAll();
-
-  var em = Components.classes["@mozilla.org/extensions/manager;1"]
-                     .getService(Components.interfaces.nsIExtensionManager);
-  em.cancelInstallItem("unsigned-xpi@tests.mozilla.org");
-
-
-  Services.perms.remove("example.com", "install");
-
-  gBrowser.removeCurrentTab();
-  Harness.finish();
-}
deleted file mode 100644
--- a/xpinstall/tests/browser_auth2.js
+++ /dev/null
@@ -1,45 +0,0 @@
-// Load in the test harness
-var scriptLoader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"]
-                             .getService(Components.interfaces.mozIJSSubScriptLoader);
-
-var rootDir = getRootDirectory(window.location.href);
-scriptLoader.loadSubScript(rootDir + "harness.js", this);
-
-// ----------------------------------------------------------------------------
-// Test whether an install fails when authentication is required and bad
-// credentials are given
-// This verifies bug 312473
-function test() {
-  Harness.authenticationCallback = get_auth_info;
-  Harness.installEndedCallback = check_xpi_install;
-  Harness.installsCompletedCallback = finish_test;
-  Harness.setup();
-
-  var pm = Services.perms;
-  pm.add(makeURI("http://example.com/"), "install", pm.ALLOW_ACTION);
-
-  var triggers = encodeURIComponent(JSON.stringify({
-    "Unsigned XPI": TESTROOT + "authRedirect.sjs?" + TESTROOT + "unsigned.xpi"
-  }));
-  gBrowser.selectedTab = gBrowser.addTab();
-  gBrowser.loadURI(TESTROOT + "installtrigger.html?" + triggers);
-}
-
-function get_auth_info() {
-  return [ "baduser", "badpass" ];
-}
-
-function check_xpi_install(addon, status) {
-  is(status, -228, "Install should fail");
-}
-
-function finish_test() {
-  var authMgr = Components.classes['@mozilla.org/network/http-auth-manager;1']
-                          .getService(Components.interfaces.nsIHttpAuthManager);
-  authMgr.clearAll();
-
-  Services.perms.remove("example.com", "install");
-
-  gBrowser.removeCurrentTab();
-  Harness.finish();
-}
deleted file mode 100644
--- a/xpinstall/tests/browser_auth3.js
+++ /dev/null
@@ -1,45 +0,0 @@
-// Load in the test harness
-var scriptLoader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"]
-                             .getService(Components.interfaces.mozIJSSubScriptLoader);
-
-var rootDir = getRootDirectory(window.location.href);
-scriptLoader.loadSubScript(rootDir + "harness.js", this);
-
-// ----------------------------------------------------------------------------
-// Test whether an install fails when authentication is required and it is
-// canceled
-// This verifies bug 312473
-function test() {
-  Harness.authenticationCallback = get_auth_info;
-  Harness.installEndedCallback = check_xpi_install;
-  Harness.installsCompletedCallback = finish_test;
-  Harness.setup();
-
-  var pm = Services.perms;
-  pm.add(makeURI("http://example.com/"), "install", pm.ALLOW_ACTION);
-
-  var triggers = encodeURIComponent(JSON.stringify({
-    "Unsigned XPI": TESTROOT + "authRedirect.sjs?" + TESTROOT + "unsigned.xpi"
-  }));
-  gBrowser.selectedTab = gBrowser.addTab();
-  gBrowser.loadURI(TESTROOT + "installtrigger.html?" + triggers);
-}
-
-function get_auth_info() {
-  return null;
-}
-
-function check_xpi_install(addon, status) {
-  is(status, -228, "Install should fail");
-}
-
-function finish_test() {
-  var authMgr = Components.classes['@mozilla.org/network/http-auth-manager;1']
-                          .getService(Components.interfaces.nsIHttpAuthManager);
-  authMgr.clearAll();
-
-  Services.perms.remove("example.com", "install");
-
-  gBrowser.removeCurrentTab();
-  Harness.finish();
-}
deleted file mode 100644
--- a/xpinstall/tests/browser_badhash.js
+++ /dev/null
@@ -1,39 +0,0 @@
-// Load in the test harness
-var scriptLoader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"]
-                             .getService(Components.interfaces.mozIJSSubScriptLoader);
-
-var rootDir = getRootDirectory(window.location.href);
-scriptLoader.loadSubScript(rootDir + "harness.js", this);
-
-// ----------------------------------------------------------------------------
-// Test whether an install fails when an invalid hash is included
-// This verifies bug 302284
-function test() {
-  Harness.installEndedCallback = check_xpi_install;
-  Harness.installsCompletedCallback = finish_test;
-  Harness.setup();
-
-  var pm = Services.perms;
-  pm.add(makeURI("http://example.com/"), "install", pm.ALLOW_ACTION);
-
-  var triggers = encodeURIComponent(JSON.stringify({
-    "Unsigned XPI": {
-      URL: TESTROOT + "unsigned.xpi",
-      Hash: "sha1:643b08418599ddbd1ea8a511c90696578fb844b9",
-      toString: function() { return this.URL; }
-    }
-  }));
-  gBrowser.selectedTab = gBrowser.addTab();
-  gBrowser.loadURI(TESTROOT + "installtrigger.html?" + triggers);
-}
-
-function check_xpi_install(addon, status) {
-  is(status, -261, "Install should fail");
-}
-
-function finish_test() {
-  Services.perms.remove("example.com", "install");
-
-  gBrowser.removeCurrentTab();
-  Harness.finish();
-}
deleted file mode 100644
--- a/xpinstall/tests/browser_badhashtype.js
+++ /dev/null
@@ -1,39 +0,0 @@
-// Load in the test harness
-var scriptLoader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"]
-                             .getService(Components.interfaces.mozIJSSubScriptLoader);
-
-var rootDir = getRootDirectory(window.location.href);
-scriptLoader.loadSubScript(rootDir + "harness.js", this);
-
-// ----------------------------------------------------------------------------
-// Test whether an install fails when an unknown hash type is included
-// This verifies bug 302284
-function test() {
-  Harness.installEndedCallback = check_xpi_install;
-  Harness.installsCompletedCallback = finish_test;
-  Harness.setup();
-
-  var pm = Services.perms;
-  pm.add(makeURI("http://example.com/"), "install", pm.ALLOW_ACTION);
-
-  var triggers = encodeURIComponent(JSON.stringify({
-    "Unsigned XPI": {
-      URL: TESTROOT + "unsigned.xpi",
-      Hash: "foo:3d0dc22e1f394e159b08aaf5f0f97de4d5c65f4f",
-      toString: function() { return this.URL; }
-    }
-  }));
-  gBrowser.selectedTab = gBrowser.addTab();
-  gBrowser.loadURI(TESTROOT + "installtrigger.html?" + triggers);
-}
-
-function check_xpi_install(addon, status) {
-  is(status, -261, "Install should fail");
-}
-
-function finish_test() {
-  Services.perms.remove("example.com", "install");
-
-  gBrowser.removeCurrentTab();
-  Harness.finish();
-}
deleted file mode 100644
--- a/xpinstall/tests/browser_bug540558.js
+++ /dev/null
@@ -1,35 +0,0 @@
-// Load in the test harness
-var scriptLoader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"]
-                             .getService(Components.interfaces.mozIJSSubScriptLoader);
-
-var rootDir = getRootDirectory(window.location.href);
-scriptLoader.loadSubScript(rootDir + "harness.js", this);
-
-// ----------------------------------------------------------------------------
-// Tests that calling InstallTrigger.installChrome works
-function test() {
-  Harness.installEndedCallback = check_xpi_install;
-  Harness.installsCompletedCallback = finish_test;
-  Harness.setup();
-
-  var pm = Services.perms;
-  pm.add(makeURI("http://example.com/"), "install", pm.ALLOW_ACTION);
-
-  gBrowser.selectedTab = gBrowser.addTab();
-  gBrowser.loadURI(TESTROOT + "bug540558.html");
-}
-
-function check_xpi_install(addon, status) {
-  is(status, 0, "Install should succeed");
-}
-
-function finish_test() {
-  Services.perms.remove("example.com", "install");
-
-  var em = Components.classes["@mozilla.org/extensions/manager;1"]
-                     .getService(Components.interfaces.nsIExtensionManager);
-  em.cancelInstallItem("unsigned-xpi@tests.mozilla.org");
-
-  gBrowser.removeCurrentTab();
-  Harness.finish();
-}
deleted file mode 100644
--- a/xpinstall/tests/browser_cancel.js
+++ /dev/null
@@ -1,47 +0,0 @@
-// Load in the test harness
-var scriptLoader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"]
-                             .getService(Components.interfaces.mozIJSSubScriptLoader);
-
-var rootDir = getRootDirectory(window.location.href);
-scriptLoader.loadSubScript(rootDir + "harness.js", this);
-
-// ----------------------------------------------------------------------------
-// Tests that cancelling an in progress download works.
-var gManager = null;
-
-function test() {
-  waitForExplicitFinish();
-  gManager = Components.classes["@mozilla.org/xpinstall/install-manager;1"]
-                       .createInstance(Components.interfaces.nsIXPInstallManager);
-  gManager.initManagerFromChrome([ TESTROOT + "unsigned.xpi" ],
-                                 1, listener);
-}
-
-function finish_test() {
-  finish();
-}
-
-var listener = {
-  onStateChange: function(index, state, value) {
-    is(index, 0, "There is only one download");
-    if (state == Components.interfaces.nsIXPIProgressDialog.INSTALL_DONE)
-      is(value, -210, "Install should have been cancelled");
-    else if (state == Components.interfaces.nsIXPIProgressDialog.DIALOG_CLOSE)
-      finish_test();
-  },
-
-  onProgress: function(index, value, maxValue) {
-    is(index, 0, "There is only one download");
-    gManager.QueryInterface(Components.interfaces.nsIObserver);
-    gManager.observe(null, "xpinstall-progress", "cancel");
-  },
-
-  QueryInterface: function(iid) {
-    if (iid.equals(Components.interfaces.nsIXPIProgressDialog) ||
-        iid.equals(Components.interfaces.nsISupports))
-      return this;
-
-    throw Components.results.NS_ERROR_NO_INTERFACE;
-  }
-};
-// ----------------------------------------------------------------------------
deleted file mode 100644
--- a/xpinstall/tests/browser_chrome.js
+++ /dev/null
@@ -1,47 +0,0 @@
-// Load in the test harness
-var scriptLoader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"]
-                             .getService(Components.interfaces.mozIJSSubScriptLoader);
-
-var rootDir = getRootDirectory(window.location.href);
-scriptLoader.loadSubScript(rootDir + "harness.js", this);
-
-// ----------------------------------------------------------------------------
-// Tests that starting a download from chrome works and bypasses the whitelist
-function test() {
-  waitForExplicitFinish();
-  var xpimgr = Components.classes["@mozilla.org/xpinstall/install-manager;1"]
-                         .createInstance(Components.interfaces.nsIXPInstallManager);
-  xpimgr.initManagerFromChrome([ TESTROOT + "unsigned.xpi" ],
-                               1, listener);
-}
-
-function finish_test() {
-  var em = Components.classes["@mozilla.org/extensions/manager;1"]
-                     .getService(Components.interfaces.nsIExtensionManager);
-  em.cancelInstallItem("unsigned-xpi@tests.mozilla.org");
-
-  finish();
-}
-
-var listener = {
-  onStateChange: function(index, state, value) {
-    is(index, 0, "There is only one download");
-    if (state == Components.interfaces.nsIXPIProgressDialog.INSTALL_DONE)
-      is(value, 0, "Install should have succeeded");
-    else if (state == Components.interfaces.nsIXPIProgressDialog.DIALOG_CLOSE)
-      finish_test();
-  },
-
-  onProgress: function(index, value, maxValue) {
-    is(index, 0, "There is only one download");
-  },
-
-  QueryInterface: function(iid) {
-    if (iid.equals(Components.interfaces.nsIXPIProgressDialog) ||
-        iid.equals(Components.interfaces.nsISupports))
-      return this;
-
-    throw Components.results.NS_ERROR_NO_INTERFACE;
-  }
-};
-// ----------------------------------------------------------------------------
deleted file mode 100644
--- a/xpinstall/tests/browser_cookies.js
+++ /dev/null
@@ -1,37 +0,0 @@
-// Load in the test harness
-var scriptLoader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"]
-                             .getService(Components.interfaces.mozIJSSubScriptLoader);
-
-
-var rootDir = getRootDirectory(window.location.href);
-scriptLoader.loadSubScript(rootDir + "harness.js", this);
-
-// ----------------------------------------------------------------------------
-// Test that an install that requires cookies to be sent fails when no cookies
-// are set
-// This verifies bug 462739
-function test() {
-  Harness.installEndedCallback = check_xpi_install;
-  Harness.installsCompletedCallback = finish_test;
-  Harness.setup();
-
-  var pm = Services.perms;
-  pm.add(makeURI("http://example.com/"), "install", pm.ALLOW_ACTION);
-
-  var triggers = encodeURIComponent(JSON.stringify({
-    "Cookie check": TESTROOT + "cookieRedirect.sjs?" + TESTROOT + "unsigned.xpi"
-  }));
-  gBrowser.selectedTab = gBrowser.addTab();
-  gBrowser.loadURI(TESTROOT + "installtrigger.html?" + triggers);
-}
-
-function check_xpi_install(addon, status) {
-  is(status, -228, "Install should fail");
-}
-
-function finish_test() {
-  Services.perms.remove("example.com", "install");
-
-  gBrowser.removeCurrentTab();
-  Harness.finish();
-}
deleted file mode 100644
--- a/xpinstall/tests/browser_cookies2.js
+++ /dev/null
@@ -1,50 +0,0 @@
-// Load in the test harness
-var scriptLoader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"]
-                             .getService(Components.interfaces.mozIJSSubScriptLoader);
-
-
-var rootDir = getRootDirectory(window.location.href);
-scriptLoader.loadSubScript(rootDir + "harness.js", this);
-
-// ----------------------------------------------------------------------------
-// Test that an install that requires cookies to be sent succeeds when cookies
-// are set
-// This verifies bug 462739
-function test() {
-  Harness.installEndedCallback = check_xpi_install;
-  Harness.installsCompletedCallback = finish_test;
-  Harness.setup();
-
-  var cm = Components.classes["@mozilla.org/cookiemanager;1"]
-                     .getService(Components.interfaces.nsICookieManager2);
-  cm.add("example.com", "/browser/xpinstall/tests", "xpinstall", "true", false,
-         false, true, (Date.now() / 1000) + 60);
-
-  var pm = Services.perms;
-  pm.add(makeURI("http://example.com/"), "install", pm.ALLOW_ACTION);
-
-  var triggers = encodeURIComponent(JSON.stringify({
-    "Cookie check": TESTROOT + "cookieRedirect.sjs?" + TESTROOT + "unsigned.xpi"
-  }));
-  gBrowser.selectedTab = gBrowser.addTab();
-  gBrowser.loadURI(TESTROOT + "installtrigger.html?" + triggers);
-}
-
-function check_xpi_install(addon, status) {
-  is(status, 0, "Install should succeed");
-}
-
-function finish_test() {
-  var em = Components.classes["@mozilla.org/extensions/manager;1"]
-                     .getService(Components.interfaces.nsIExtensionManager);
-  em.cancelInstallItem("unsigned-xpi@tests.mozilla.org");
-
-  var cm = Components.classes["@mozilla.org/cookiemanager;1"]
-                     .getService(Components.interfaces.nsICookieManager2);
-  cm.remove("example.com", "xpinstall", "/browser/xpinstall/tests", false);
-
-  Services.perms.remove("example.com", "install");
-
-  gBrowser.removeCurrentTab();
-  Harness.finish();
-}
deleted file mode 100644
--- a/xpinstall/tests/browser_cookies3.js
+++ /dev/null
@@ -1,53 +0,0 @@
-// Load in the test harness
-var scriptLoader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"]
-                             .getService(Components.interfaces.mozIJSSubScriptLoader);
-
-var rootDir = getRootDirectory(window.location.href);
-scriptLoader.loadSubScript(rootDir + "harness.js", this);
-
-// ----------------------------------------------------------------------------
-// Test that an install that requires cookies to be sent succeeds when cookies
-// are set and third party cookies are disabled.
-// This verifies bug 462739
-function test() {
-  Harness.installEndedCallback = check_xpi_install;
-  Harness.installsCompletedCallback = finish_test;
-  Harness.setup();
-
-  var cm = Components.classes["@mozilla.org/cookiemanager;1"]
-                     .getService(Components.interfaces.nsICookieManager2);
-  cm.add("example.com", "/browser/xpinstall/tests", "xpinstall", "true", false,
-         false, true, (Date.now() / 1000) + 60);
-
-  var pm = Services.perms;
-  pm.add(makeURI("http://example.com/"), "install", pm.ALLOW_ACTION);
-
-  Services.prefs.setIntPref("network.cookie.cookieBehavior", 1);
-
-  var triggers = encodeURIComponent(JSON.stringify({
-    "Cookie check": TESTROOT + "cookieRedirect.sjs?" + TESTROOT + "unsigned.xpi"
-  }));
-  gBrowser.selectedTab = gBrowser.addTab();
-  gBrowser.loadURI(TESTROOT + "installtrigger.html?" + triggers);
-}
-
-function check_xpi_install(addon, status) {
-  is(status, 0, "Install should succeed");
-}
-
-function finish_test() {
-  var em = Components.classes["@mozilla.org/extensions/manager;1"]
-                     .getService(Components.interfaces.nsIExtensionManager);
-  em.cancelInstallItem("unsigned-xpi@tests.mozilla.org");
-
-  var cm = Components.classes["@mozilla.org/cookiemanager;1"]
-                     .getService(Components.interfaces.nsICookieManager2);
-  cm.remove("example.com", "xpinstall", "/browser/xpinstall/tests", false);
-
-  Services.prefs.clearUserPref("network.cookie.cookieBehavior");
-
-  Services.perms.remove("example.com", "install");
-
-  gBrowser.removeCurrentTab();
-  Harness.finish();
-}
deleted file mode 100644
--- a/xpinstall/tests/browser_cookies4.js
+++ /dev/null
@@ -1,49 +0,0 @@
-// Load in the test harness
-var scriptLoader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"]
-                             .getService(Components.interfaces.mozIJSSubScriptLoader);
-
-var rootDir = getRootDirectory(window.location.href);
-scriptLoader.loadSubScript(rootDir + "harness.js", this);
-
-// ----------------------------------------------------------------------------
-// Test that an install that requires cookies to be sent fails when cookies
-// are set and third party cookies are disabled and the request is to a third
-// party.
-// This verifies bug 462739
-function test() {
-  Harness.installEndedCallback = check_xpi_install;
-  Harness.installsCompletedCallback = finish_test;
-  Harness.setup();
-
-  var cm = Components.classes["@mozilla.org/cookiemanager;1"]
-                     .getService(Components.interfaces.nsICookieManager2);
-  cm.add("example.com", "/browser/xpinstall/tests", "xpinstall", "true", false,
-         false, true, (Date.now() / 1000) + 60);
-
-  var pm = Services.perms;
-  pm.add(makeURI("http://example.com/"), "install", pm.ALLOW_ACTION);
-
-  Services.prefs.setIntPref("network.cookie.cookieBehavior", 1);
-
-  var triggers = encodeURIComponent(JSON.stringify({
-    "Cookie check": TESTROOT2 + "cookieRedirect.sjs?" + TESTROOT + "unsigned.xpi"
-  }));
-  gBrowser.selectedTab = gBrowser.addTab();
-  gBrowser.loadURI(TESTROOT + "installtrigger.html?" + triggers);
-}
-
-function check_xpi_install(addon, status) {
-  is(status, -228, "Install should fail");
-}
-
-function finish_test() {
-  var cm = Components.classes["@mozilla.org/cookiemanager;1"]
-                     .getService(Components.interfaces.nsICookieManager2);
-  cm.remove("example.com", "xpinstall", "/browser/xpinstall/tests", false);
-
-  Services.prefs.clearUserPref("network.cookie.cookieBehavior");
-  Services.perms.remove("example.com", "install");
-
-  gBrowser.removeCurrentTab();
-  Harness.finish();
-}
deleted file mode 100644
--- a/xpinstall/tests/browser_corrupt.js
+++ /dev/null
@@ -1,37 +0,0 @@
-// Load in the test harness
-var scriptLoader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"]
-                             .getService(Components.interfaces.mozIJSSubScriptLoader);
-
-var rootDir = getRootDirectory(window.location.href);
-scriptLoader.loadSubScript(rootDir + "harness.js", this);
-
-// ----------------------------------------------------------------------------
-// Test whether an install fails when the xpi is corrupt.
-function test() {
-  Harness.installEndedCallback = check_xpi_install;
-  Harness.installsCompletedCallback = finish_test;
-  Harness.setup();
-
-  var pm = Services.perms;
-  pm.add(makeURI("http://example.com/"), "install", pm.ALLOW_ACTION);
-
-  var triggers = encodeURIComponent(JSON.stringify({
-    "Corrupt XPI": TESTROOT + "corrupt.xpi"
-  }));
-  gBrowser.selectedTab = gBrowser.addTab();
-  gBrowser.loadURI(TESTROOT + "installtrigger.html?" + triggers);
-}
-
-function check_xpi_install(addon, status) {
-  is(status, -207, "Install should fail");
-}
-
-function finish_test() {
-  Services.perms.remove("example.com", "install");
-
-  var doc = gBrowser.contentDocument;
-  is(doc.getElementById("status").textContent, "-207", "Callback should have seen the failure");
-
-  gBrowser.removeCurrentTab();
-  Harness.finish();
-}
deleted file mode 100644
--- a/xpinstall/tests/browser_empty.js
+++ /dev/null
@@ -1,34 +0,0 @@
-// Load in the test harness
-var scriptLoader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"]
-                             .getService(Components.interfaces.mozIJSSubScriptLoader);
-
-var rootDir = getRootDirectory(window.location.href);
-scriptLoader.loadSubScript(rootDir + "harness.js", this);
-
-// ----------------------------------------------------------------------------
-// Test whether an install fails when there is no install script present.
-function test() {
-  Harness.installEndedCallback = check_xpi_install;
-  Harness.installsCompletedCallback = finish_test;
-  Harness.setup();
-
-  var pm = Services.perms;
-  pm.add(makeURI("http://example.com/"), "install", pm.ALLOW_ACTION);
-
-  var triggers = encodeURIComponent(JSON.stringify({
-    "Empty XPI": TESTROOT + "empty.xpi"
-  }));
-  gBrowser.selectedTab = gBrowser.addTab();
-  gBrowser.loadURI(TESTROOT + "installtrigger.html?" + triggers);
-}
-
-function check_xpi_install(addon, status) {
-  is(status, -204, "Install should fail");
-}
-
-function finish_test() {
-  Services.perms.remove("example.com", "install");
-
-  gBrowser.removeCurrentTab();
-  Harness.finish();
-}
deleted file mode 100644
--- a/xpinstall/tests/browser_enabled.js
+++ /dev/null
@@ -1,27 +0,0 @@
-// Load in the test harness
-var scriptLoader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"]
-                             .getService(Components.interfaces.mozIJSSubScriptLoader);
-
-var rootDir = getRootDirectory(window.location.href);
-scriptLoader.loadSubScript(rootDir + "harness.js", this);
-
-// ----------------------------------------------------------------------------
-// Test whether an InstallTrigger.enabled is working
-function test() {
-  waitForExplicitFinish();
-
-  gBrowser.selectedTab = gBrowser.addTab();
-  gBrowser.selectedBrowser.addEventListener("load", function() {
-    gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
-    // Allow the in-page load handler to run first
-    executeSoon(page_loaded);
-  }, true);
-  gBrowser.loadURI(TESTROOT + "enabled.html");
-}
-
-function page_loaded() {
-  var doc = gBrowser.contentDocument;
-  is(doc.getElementById("enabled").textContent, "true", "installTrigger should have been enabled");
-  gBrowser.removeCurrentTab();
-  finish();
-}
deleted file mode 100644
--- a/xpinstall/tests/browser_enabled2.js
+++ /dev/null
@@ -1,31 +0,0 @@
-// Load in the test harness
-var scriptLoader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"]
-                             .getService(Components.interfaces.mozIJSSubScriptLoader);
-
-var rootDir = getRootDirectory(window.location.href);
-scriptLoader.loadSubScript(rootDir + "harness.js", this);
-
-// ----------------------------------------------------------------------------
-// Test whether an InstallTrigger.enabled is working
-function test() {
-  waitForExplicitFinish();
-
-  Services.prefs.setBoolPref("xpinstall.enabled", false);
-
-  gBrowser.selectedTab = gBrowser.addTab();
-  gBrowser.selectedBrowser.addEventListener("load", function() {
-    gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
-    // Allow the in-page load handler to run first
-    executeSoon(page_loaded);
-  }, true);
-  gBrowser.loadURI(TESTROOT + "enabled.html");
-}
-
-function page_loaded() {
-  Services.prefs.clearUserPref("xpinstall.enabled");
-
-  var doc = gBrowser.contentDocument;
-  is(doc.getElementById("enabled").textContent, "false", "installTrigger should have not been enabled");
-  gBrowser.removeCurrentTab();
-  finish();
-}
deleted file mode 100644
--- a/xpinstall/tests/browser_enabled3.js
+++ /dev/null
@@ -1,35 +0,0 @@
-// Load in the test harness
-var scriptLoader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"]
-                             .getService(Components.interfaces.mozIJSSubScriptLoader);
-
-var rootDir = getRootDirectory(window.location.href);
-scriptLoader.loadSubScript(rootDir + "harness.js", this);
-
-// ----------------------------------------------------------------------------
-// Test whether an InstallTrigger.install call fails when xpinstall is disabled
-function test() {
-  waitForExplicitFinish();
-
-  Services.prefs.setBoolPref("xpinstall.enabled", false);
-
-  var triggers = encodeURIComponent(JSON.stringify({
-    "Unsigned XPI": TESTROOT + "unsigned.xpi"
-  }));
-  gBrowser.selectedTab = gBrowser.addTab();
-  gBrowser.selectedBrowser.addEventListener("load", function() {
-    gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
-    // Allow the in-page load handler to run first
-    executeSoon(page_loaded);
-  }, true);
-  gBrowser.loadURI(TESTROOT + "installtrigger.html?" + triggers);
-}
-
-function page_loaded() {
-  Services.prefs.clearUserPref("xpinstall.enabled");
-
-  var doc = gBrowser.contentDocument;
-  is(doc.getElementById("return").textContent, "false", "installTrigger should have not been enabled");
-  gBrowser.removeCurrentTab();
-  finish();
-}
-// ----------------------------------------------------------------------------
deleted file mode 100644
--- a/xpinstall/tests/browser_hash.js
+++ /dev/null
@@ -1,43 +0,0 @@
-// Load in the test harness
-var scriptLoader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"]
-                             .getService(Components.interfaces.mozIJSSubScriptLoader);
-
-var rootDir = getRootDirectory(window.location.href);
-scriptLoader.loadSubScript(rootDir + "harness.js", this);
-
-// ----------------------------------------------------------------------------
-// Test whether an install succeeds when a valid hash is included
-// This verifies bug 302284
-function test() {
-  Harness.installEndedCallback = check_xpi_install;
-  Harness.installsCompletedCallback = finish_test;
-  Harness.setup();
-
-  var pm = Services.perms;
-  pm.add(makeURI("http://example.com/"), "install", pm.ALLOW_ACTION);
-
-  var triggers = encodeURIComponent(JSON.stringify({
-    "Unsigned XPI": {
-      URL: TESTROOT + "unsigned.xpi",
-      Hash: "sha1:3d0dc22e1f394e159b08aaf5f0f97de4d5c65f4f",
-      toString: function() { return this.URL; }
-    }
-  }));
-  gBrowser.selectedTab = gBrowser.addTab();
-  gBrowser.loadURI(TESTROOT + "installtrigger.html?" + triggers);
-}
-
-function check_xpi_install(addon, status) {
-  is(status, 0, "Install should succeed");
-}
-
-function finish_test() {
-  var em = Components.classes["@mozilla.org/extensions/manager;1"]
-                     .getService(Components.interfaces.nsIExtensionManager);
-  em.cancelInstallItem("unsigned-xpi@tests.mozilla.org");
-
-  Services.perms.remove("example.com", "install");
-
-  gBrowser.removeCurrentTab();
-  Harness.finish();
-}
deleted file mode 100644
--- a/xpinstall/tests/browser_installchrome.js
+++ /dev/null
@@ -1,35 +0,0 @@
-// Load in the test harness
-var scriptLoader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"]
-                             .getService(Components.interfaces.mozIJSSubScriptLoader);
-
-var rootDir = getRootDirectory(window.location.href);
-scriptLoader.loadSubScript(rootDir + "harness.js", this);
-
-// ----------------------------------------------------------------------------
-// Tests that calling InstallTrigger.installChrome works
-function test() {
-  Harness.installEndedCallback = check_xpi_install;
-  Harness.installsCompletedCallback = finish_test;
-  Harness.setup();
-
-  var pm = Services.perms;
-  pm.add(makeURI("http://example.com/"), "install", pm.ALLOW_ACTION);
-
-  gBrowser.selectedTab = gBrowser.addTab();
-  gBrowser.loadURI(TESTROOT + "installchrome.html? " + encodeURIComponent(TESTROOT + "unsigned.xpi"));
-}
-
-function check_xpi_install(addon, status) {
-  is(status, 0, "Install should succeed");
-}
-
-function finish_test() {
-  Services.perms.remove("example.com", "install");
-
-  var em = Components.classes["@mozilla.org/extensions/manager;1"]
-                     .getService(Components.interfaces.nsIExtensionManager);
-  em.cancelInstallItem("unsigned-xpi@tests.mozilla.org");
-
-  gBrowser.removeCurrentTab();
-  Harness.finish();
-}
deleted file mode 100644
--- a/xpinstall/tests/browser_localfile.js
+++ /dev/null
@@ -1,35 +0,0 @@
-// Load in the test harness
-var scriptLoader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"]
-                             .getService(Components.interfaces.mozIJSSubScriptLoader);
-
-var rootDir = getRootDirectory(window.location.href);
-scriptLoader.loadSubScript(rootDir + "harness.js", this);
-
-// ----------------------------------------------------------------------------
-// Tests installing an local file works when loading the url
-function test() {
-  Harness.installEndedCallback = check_xpi_install;
-  Harness.installsCompletedCallback = finish_test;
-  Harness.setup();
-
-  var cr = Components.classes["@mozilla.org/chrome/chrome-registry;1"]
-                     .getService(Components.interfaces.nsIChromeRegistry);
-  var path = cr.convertChromeURL(makeURI(CHROMEROOT + "unsigned.xpi")).spec;
-
-  gBrowser.selectedTab = gBrowser.addTab();
-  gBrowser.loadURI(path);
-}
-
-function check_xpi_install(addon, status) {
-  is(status, 0, "Install should succeed");
-}
-
-function finish_test() {
-  var em = Components.classes["@mozilla.org/extensions/manager;1"]
-                     .getService(Components.interfaces.nsIExtensionManager);
-  em.cancelInstallItem("unsigned-xpi@tests.mozilla.org");
-
-  gBrowser.removeCurrentTab();
-  Harness.finish();
-}
-// ----------------------------------------------------------------------------
deleted file mode 100644
--- a/xpinstall/tests/browser_localfile2.js
+++ /dev/null
@@ -1,36 +0,0 @@
-// Load in the test harness
-var scriptLoader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"]
-                             .getService(Components.interfaces.mozIJSSubScriptLoader);
-
-var rootDir = getRootDirectory(window.location.href);
-scriptLoader.loadSubScript(rootDir + "harness.js", this);
-
-// ----------------------------------------------------------------------------
-// Test whether an install fails if the url is a local file when requested from
-// web content
-function test() {
-  waitForExplicitFinish();
-
-  var cr = Components.classes["@mozilla.org/chrome/chrome-registry;1"]
-                     .getService(Components.interfaces.nsIChromeRegistry);
-  var path = cr.convertChromeURL(makeURI(CHROMEROOT + "unsigned.xpi")).spec;
-
-  var triggers = encodeURIComponent(JSON.stringify({
-    "Unsigned XPI": path
-  }));
-  gBrowser.selectedTab = gBrowser.addTab();
-  gBrowser.selectedBrowser.addEventListener("load", function() {
-    gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
-    // Allow the in-page load handler to run first
-    executeSoon(page_loaded);
-  }, true);
-  gBrowser.loadURI(TESTROOT + "installtrigger.html?" + triggers);
-}
-
-function page_loaded() {
-  var doc = gBrowser.contentDocument;
-  is(doc.getElementById("return").textContent, "exception", "installTrigger should have failed");
-  gBrowser.removeCurrentTab();
-  finish();
-}
-// ----------------------------------------------------------------------------
deleted file mode 100644
--- a/xpinstall/tests/browser_navigateaway.js
+++ /dev/null
@@ -1,45 +0,0 @@
-// Load in the test harness
-var scriptLoader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"]
-                             .getService(Components.interfaces.mozIJSSubScriptLoader);
-
-var rootDir = getRootDirectory(window.location.href);
-scriptLoader.loadSubScript(rootDir + "harness.js", this);
-
-// ----------------------------------------------------------------------------
-// Tests that navigating away from the initiating page during the install
-// doesn't break the install.
-// This verifies bug 473060
-function test() {
-  Harness.downloadProgressCallback = download_progress;
-  Harness.installEndedCallback = check_xpi_install;
-  Harness.installsCompletedCallback = finish_test;
-  Harness.setup();
-
-  var pm = Services.perms;
-  pm.add(makeURI("http://example.com/"), "install", pm.ALLOW_ACTION);
-
-  var triggers = encodeURIComponent(JSON.stringify({
-    "Unsigned XPI": TESTROOT + "unsigned.xpi"
-  }));
-  gBrowser.selectedTab = gBrowser.addTab();
-  gBrowser.loadURI(TESTROOT + "installtrigger.html?" + triggers);
-}
-
-function download_progress(addon, value, maxValue) {
-  gBrowser.loadURI("about:blank");
-}
-
-function check_xpi_install(addon, status) {
-  is(status, 0, "Install should succeed");
-}
-
-function finish_test() {
-  var em = Components.classes["@mozilla.org/extensions/manager;1"]
-                     .getService(Components.interfaces.nsIExtensionManager);
-  em.cancelInstallItem("unsigned-xpi@tests.mozilla.org");
-
-  Services.perms.remove("example.com", "install");
-
-  gBrowser.removeCurrentTab();
-  Harness.finish();
-}
deleted file mode 100644
--- a/xpinstall/tests/browser_navigateaway2.js
+++ /dev/null
@@ -1,44 +0,0 @@
-// Load in the test harness
-var scriptLoader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"]
-                             .getService(Components.interfaces.mozIJSSubScriptLoader);
-
-var rootDir = getRootDirectory(window.location.href);
-scriptLoader.loadSubScript(rootDir + "harness.js", this);
-
-// ----------------------------------------------------------------------------
-// Tests that closing the initiating page during the install doesn't break the
-// install.
-// This verifies bugs 473060 and 475347
-function test() {
-  Harness.downloadProgressCallback = download_progress;
-  Harness.installEndedCallback = check_xpi_install;
-  Harness.installsCompletedCallback = finish_test;
-  Harness.setup();
-
-  var pm = Services.perms;
-  pm.add(makeURI("http://example.com/"), "install", pm.ALLOW_ACTION);
-
-  var triggers = encodeURIComponent(JSON.stringify({
-    "Unsigned XPI": TESTROOT + "unsigned.xpi"
-  }));
-  gBrowser.selectedTab = gBrowser.addTab();
-  gBrowser.loadURI(TESTROOT + "installtrigger.html?" + triggers);
-}
-
-function download_progress(addon, value, maxValue) {
-  gBrowser.removeCurrentTab();
-}
-
-function check_xpi_install(addon, status) {
-  is(status, 0, "Install should succeed");
-}
-
-function finish_test() {
-  var em = Components.classes["@mozilla.org/extensions/manager;1"]
-                     .getService(Components.interfaces.nsIExtensionManager);
-  em.cancelInstallItem("unsigned-xpi@tests.mozilla.org");
-
-  Services.perms.remove("example.com", "install");
-
-  Harness.finish();
-}
deleted file mode 100644
--- a/xpinstall/tests/browser_offline.js
+++ /dev/null
@@ -1,50 +0,0 @@
-// Load in the test harness
-var scriptLoader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"]
-                             .getService(Components.interfaces.mozIJSSubScriptLoader);
-
-var rootDir = getRootDirectory(window.location.href);
-scriptLoader.loadSubScript(rootDir + "harness.js", this);
-
-// ----------------------------------------------------------------------------
-// Tests that going offline cancels an in progress download.
-function test() {
-  Harness.downloadProgressCallback = download_progress;
-  Harness.installEndedCallback = check_xpi_install;
-  Harness.installsCompletedCallback = finish_test;
-  Harness.setup();
-
-  var pm = Services.perms;
-  pm.add(makeURI("http://example.com/"), "install", pm.ALLOW_ACTION);
-
-  var triggers = encodeURIComponent(JSON.stringify({
-    "Unsigned XPI": TESTROOT + "unsigned.xpi"
-  }));
-  gBrowser.selectedTab = gBrowser.addTab();
-  gBrowser.loadURI(TESTROOT + "installtrigger.html?" + triggers);
-}
-
-function download_progress(addon, value, maxValue) {
-  try {
-    Services.io.manageOfflineStatus = false;
-    Services.prefs.setBoolPref("browser.offline", true);
-    Services.io.offline = true;
-  } catch (ex) {
-  }
-}
-
-function check_xpi_install(addon, status) {
-  is(status, -210, "Install should be cancelled");
-}
-
-function finish_test() {
-  try {
-    Services.prefs.setBoolPref("browser.offline", false);
-    Services.io.offline = false;
-  } catch (ex) {
-  }
-
-  Services.perms.remove("example.com", "install");
-
-  gBrowser.removeCurrentTab();
-  Harness.finish();
-}
deleted file mode 100644
--- a/xpinstall/tests/browser_opendialog.js
+++ /dev/null
@@ -1,41 +0,0 @@
-// Load in the test harness
-var scriptLoader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"]
-                             .getService(Components.interfaces.mozIJSSubScriptLoader);
-
-var rootDir = getRootDirectory(window.location.href);
-scriptLoader.loadSubScript(rootDir + "harness.js", this);
-
-// ----------------------------------------------------------------------------
-// Test whether an install succeeds when the progress dialog is already open.
-function test() {
-  Harness.installEndedCallback = check_xpi_install;
-  Harness.installsCompletedCallback = finish_test;
-  Harness.setup();
-
-  window.openDialog("chrome://mozapps/content/extensions/extensions.xul", "",
-                    "chrome,menubar,extra-chrome,toolbar,dialog=no,resizable");
-
-  var pm = Services.perms;
-  pm.add(makeURI("http://example.com/"), "install", pm.ALLOW_ACTION);
-
-  var triggers = encodeURIComponent(JSON.stringify({
-    "Unsigned XPI": TESTROOT + "unsigned.xpi"
-  }));
-  gBrowser.selectedTab = gBrowser.addTab();
-  gBrowser.loadURI(TESTROOT + "installtrigger.html?" + triggers);
-}
-
-function check_xpi_install(addon, status) {
-  is(status, 0, "Install should succeed");
-}
-
-function finish_test() {
-  var em = Components.classes["@mozilla.org/extensions/manager;1"]
-                     .getService(Components.interfaces.nsIExtensionManager);
-  em.cancelInstallItem("unsigned-xpi@tests.mozilla.org");
-
-  Services.perms.remove("example.com", "install");
-
-  gBrowser.removeCurrentTab();
-  Harness.finish();
-}
deleted file mode 100644
--- a/xpinstall/tests/browser_signed_multiple.js
+++ /dev/null
@@ -1,56 +0,0 @@
-// Load in the test harness
-var scriptLoader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"]
-                             .getService(Components.interfaces.mozIJSSubScriptLoader);
-
-var rootDir = getRootDirectory(window.location.href);
-scriptLoader.loadSubScript(rootDir + "harness.js", this);
-
-// ----------------------------------------------------------------------------
-// Tests installing two signed add-ons in the same trigger works.
-// This verifies bug 453545
-function test() {
-  Harness.installConfirmCallback = confirm_install;
-  Harness.installEndedCallback = check_xpi_install;
-  Harness.installsCompletedCallback = finish_test;
-  Harness.setup();
-
-  var pm = Services.perms;
-  pm.add(makeURI("http://example.com/"), "install", pm.ALLOW_ACTION);
-
-  var triggers = encodeURIComponent(JSON.stringify({
-    "Signed XPI": TESTROOT + "signed.xpi",
-    "Signed XPI 2": TESTROOT + "signed2.xpi",
-  }));
-  gBrowser.selectedTab = gBrowser.addTab();
-  gBrowser.loadURI(TESTROOT + "installtrigger.html?" + triggers);
-}
-
-function confirm_install(window) {
-  items = window.document.getElementById("itemList").childNodes;
-  is(items.length, 2, "Should be 2 items listed in the confirmation dialog");
-  is(items[0].name, "Signed XPI", "Should have seen the name from the trigger list");
-  is(items[0].url, TESTROOT + "signed.xpi", "Should have listed the correct url for the item");
-  is(items[0].cert, "(Object Signer)", "Should have seen the signer");
-  is(items[0].signed, "true", "Should have listed the item as signed");
-  is(items[1].name, "Signed XPI 2", "Should have seen the name from the trigger list");
-  is(items[1].url, TESTROOT + "signed2.xpi", "Should have listed the correct url for the item");
-  is(items[1].cert, "(Object Signer)", "Should have seen the signer");
-  is(items[1].signed, "true", "Should have listed the item as signed");
-  return true;
-}
-
-function check_xpi_install(addon, status) {
-  is(status, 0, "Installs should succeed");
-}
-
-function finish_test() {
-  var em = Components.classes["@mozilla.org/extensions/manager;1"]
-                     .getService(Components.interfaces.nsIExtensionManager);
-  em.cancelInstallItem("signed-xpi@tests.mozilla.org");
-  em.cancelInstallItem("signed-xpi2@tests.mozilla.org");
-
-  Services.perms.remove("example.com", "install");
-
-  gBrowser.removeCurrentTab();
-  Harness.finish();
-}
deleted file mode 100644
--- a/xpinstall/tests/browser_signed_naming.js
+++ /dev/null
@@ -1,63 +0,0 @@
-// Load in the test harness
-var scriptLoader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"]
-                             .getService(Components.interfaces.mozIJSSubScriptLoader);
-
-var rootDir = getRootDirectory(window.location.href);
-scriptLoader.loadSubScript(rootDir + "harness.js", this);
-
-// ----------------------------------------------------------------------------
-// Tests that the correct signer is presented for combinations of O and CN present.
-// The signed files have (when present) O=Mozilla Testing, CN=Object Signer
-// This verifies bug 372980
-function test() {
-  Harness.installConfirmCallback = confirm_install;
-  Harness.installEndedCallback = check_xpi_install;
-  Harness.installsCompletedCallback = finish_test;
-  Harness.setup();
-
-  var pm = Services.perms;
-  pm.add(makeURI("http://example.com/"), "install", pm.ALLOW_ACTION);
-
-  var triggers = encodeURIComponent(JSON.stringify({
-    "Signed XPI (O and CN)": TESTROOT + "signed.xpi",
-    "Signed XPI (CN)": TESTROOT + "signed-no-o.xpi",
-    "Signed XPI (O)": TESTROOT + "signed-no-cn.xpi",
-  }));
-  gBrowser.selectedTab = gBrowser.addTab();
-  gBrowser.loadURI(TESTROOT + "installtrigger.html?" + triggers);
-}
-
-function confirm_install(window) {
-  items = window.document.getElementById("itemList").childNodes;
-  is(items.length, 3, "Should be 3 items listed in the confirmation dialog");
-  is(items[0].name, "Signed XPI (O and CN)", "Should have seen the name from the trigger list");
-  is(items[0].url, TESTROOT + "signed.xpi", "Should have listed the correct url for the item");
-  is(items[0].cert, "(Object Signer)", "Should have seen the signer");
-  is(items[0].signed, "true", "Should have listed the item as signed");
-  is(items[1].name, "Signed XPI (CN)", "Should have seen the name from the trigger list");
-  is(items[1].url, TESTROOT + "signed-no-o.xpi", "Should have listed the correct url for the item");
-  is(items[1].cert, "(Object Signer)", "Should have seen the signer");
-  is(items[1].signed, "true", "Should have listed the item as signed");
-  is(items[2].name, "Signed XPI (O)", "Should have seen the name from the trigger list");
-  is(items[2].url, TESTROOT + "signed-no-cn.xpi", "Should have listed the correct url for the item");
-  is(items[2].cert, "(Mozilla Testing)", "Should have seen the signer");
-  is(items[2].signed, "true", "Should have listed the item as signed");
-  return true;
-}
-
-function check_xpi_install(addon, status) {
-  is(status, 0, "Installs should succeed");
-}
-
-function finish_test() {
-  var em = Components.classes["@mozilla.org/extensions/manager;1"]
-                     .getService(Components.interfaces.nsIExtensionManager);
-  em.cancelInstallItem("signed-xpi@tests.mozilla.org");
-  em.cancelInstallItem("signed-xpi-no-o@tests.mozilla.org");
-  em.cancelInstallItem("signed-xpi-no-cn@tests.mozilla.org");
-
-  Services.perms.remove("example.com", "install");
-
-  gBrowser.removeCurrentTab();
-  Harness.finish();
-}
deleted file mode 100644
--- a/xpinstall/tests/browser_signed_tampered.js
+++ /dev/null
@@ -1,45 +0,0 @@
-// Load in the test harness
-var scriptLoader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"]
-                             .getService(Components.interfaces.mozIJSSubScriptLoader);
-
-var rootDir = getRootDirectory(window.location.href);
-scriptLoader.loadSubScript(rootDir + "harness.js", this);
-
-// ----------------------------------------------------------------------------
-// Tests installing a signed add-on that has been tampered with after signing.
-function test() {
-  Harness.installConfirmCallback = confirm_install;
-  Harness.installEndedCallback = check_xpi_install;
-  Harness.installsCompletedCallback = finish_test;
-  Harness.setup();
-
-  var pm = Services.perms;
-  pm.add(makeURI("http://example.com/"), "install", pm.ALLOW_ACTION);
-
-  var triggers = encodeURIComponent(JSON.stringify({
-    "Tampered Signed XPI": TESTROOT + "signed-tampered.xpi"
-  }));
-  gBrowser.selectedTab = gBrowser.addTab();
-  gBrowser.loadURI(TESTROOT + "installtrigger.html?" + triggers);
-}
-
-function confirm_install(window) {
-  items = window.document.getElementById("itemList").childNodes;
-  is(items.length, 1, "Should only be 1 item listed in the confirmation dialog");
-  is(items[0].name, "Tampered Signed XPI", "Should have seen the name from the trigger list");
-  is(items[0].url, TESTROOT + "signed-tampered.xpi", "Should have listed the correct url for the item");
-  is(items[0].cert, "(Object Signer)", "Should have seen the signer");
-  is(items[0].signed, "true", "Should have listed the item as signed");
-  return true;
-}
-
-function check_xpi_install(addon, status) {
-  is(status, -260, "Install should fail");
-}
-
-function finish_test() {
-  Services.perms.remove("example.com", "install");
-
-  gBrowser.removeCurrentTab();
-  Harness.finish();
-}
deleted file mode 100644
--- a/xpinstall/tests/browser_signed_trigger.js
+++ /dev/null
@@ -1,50 +0,0 @@
-// Load in the test harness
-var scriptLoader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"]
-                             .getService(Components.interfaces.mozIJSSubScriptLoader);
-
-var rootDir = getRootDirectory(window.location.href);
-scriptLoader.loadSubScript(rootDir + "harness.js", this);
-
-// ----------------------------------------------------------------------------
-// Tests installing an signed add-on through an InstallTrigger call in web
-// content.
-function test() {
-  Harness.installConfirmCallback = confirm_install;
-  Harness.installEndedCallback = check_xpi_install;
-  Harness.installsCompletedCallback = finish_test;
-  Harness.setup();
-
-  var pm = Services.perms;
-  pm.add(makeURI("http://example.com/"), "install", pm.ALLOW_ACTION);
-
-  var triggers = encodeURIComponent(JSON.stringify({
-    "Signed XPI": TESTROOT + "signed.xpi"
-  }));
-  gBrowser.selectedTab = gBrowser.addTab();
-  gBrowser.loadURI(TESTROOT + "installtrigger.html?" + triggers);
-}
-
-function confirm_install(window) {
-  items = window.document.getElementById("itemList").childNodes;
-  is(items.length, 1, "Should only be 1 item listed in the confirmation dialog");
-  is(items[0].name, "Signed XPI", "Should have seen the name from the trigger list");
-  is(items[0].url, TESTROOT + "signed.xpi", "Should have listed the correct url for the item");
-  is(items[0].cert, "(Object Signer)", "Should have seen the signer");
-  is(items[0].signed, "true", "Should have listed the item as signed");
-  return true;
-}
-
-function check_xpi_install(addon, status) {
-  is(status, 0, "Install should succeed");
-}
-
-function finish_test() {
-  var em = Components.classes["@mozilla.org/extensions/manager;1"]
-                     .getService(Components.interfaces.nsIExtensionManager);
-  em.cancelInstallItem("signed-xpi@tests.mozilla.org");
-
-  Services.perms.remove("example.com", "install");
-
-  gBrowser.removeCurrentTab();
-  Harness.finish();
-}
deleted file mode 100644
--- a/xpinstall/tests/browser_signed_untrusted.js
+++ /dev/null
@@ -1,47 +0,0 @@
-// Load in the test harness
-var scriptLoader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"]
-                             .getService(Components.interfaces.mozIJSSubScriptLoader);
-
-var rootDir = getRootDirectory(window.location.href);
-scriptLoader.loadSubScript(rootDir + "harness.js", this);
-
-// ----------------------------------------------------------------------------
-// Tests installing an add-on signed by an untrusted certificate through an
-// InstallTrigger call in web content.
-function test() {
-  Harness.installConfirmCallback = confirm_install;
-  Harness.installEndedCallback = check_xpi_install;
-  Harness.installsCompletedCallback = finish_test;
-  Harness.setup();
-
-  var pm = Services.perms;
-  pm.add(makeURI("http://example.com/"), "install", pm.ALLOW_ACTION);
-
-  var triggers = encodeURIComponent(JSON.stringify({
-    "Untrusted Signed XPI": TESTROOT + "signed-untrusted.xpi"
-  }));
-  gBrowser.selectedTab = gBrowser.addTab();
-  gBrowser.loadURI(TESTROOT + "installtrigger.html?" + triggers);
-}
-
-function confirm_install(window) {
-  items = window.document.getElementById("itemList").childNodes;
-  is(items.length, 1, "Should only be 1 item listed in the confirmation dialog");
-  is(items[0].name, "Untrusted Signed XPI", "Should have seen the name from the trigger list");
-  is(items[0].url, TESTROOT + "signed-untrusted.xpi", "Should have listed the correct url for the item");
-  is(items[0].cert, "(Unknown Signer)", "Should have seen the supposed signer");
-  is(items[0].signed, "true", "Should have listed the item as signed");
-  return true;
-}
-
-function check_xpi_install(addon, status) {
-  is(status, -260, "Install should fail");
-}
-
-function finish_test() {
-  Services.perms.remove("example.com", "install");
-
-  gBrowser.removeCurrentTab();
-  Harness.finish();
-}
-// ----------------------------------------------------------------------------
deleted file mode 100644
--- a/xpinstall/tests/browser_signed_url.js
+++ /dev/null
@@ -1,42 +0,0 @@
-// Load in the test harness
-var scriptLoader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"]
-                             .getService(Components.interfaces.mozIJSSubScriptLoader);
-
-var rootDir = getRootDirectory(window.location.href);
-scriptLoader.loadSubScript(rootDir + "harness.js", this);
-
-// ----------------------------------------------------------------------------
-// Tests installing an signed add-on by navigating directly to the url
-function test() {
-  Harness.installConfirmCallback = confirm_install;
-  Harness.installEndedCallback = check_xpi_install;
-  Harness.installsCompletedCallback = finish_test;
-  Harness.setup();
-
-  gBrowser.selectedTab = gBrowser.addTab();
-  gBrowser.loadURI(TESTROOT + "signed.xpi");
-}
-
-function confirm_install(window) {
-  items = window.document.getElementById("itemList").childNodes;
-  is(items.length, 1, "Should only be 1 item listed in the confirmation dialog");
-  is(items[0].name, "signed.xpi", "Should have had the filename for the item name");
-  is(items[0].url, TESTROOT + "signed.xpi", "Should have listed the correct url for the item");
-  is(items[0].cert, "(Object Signer)", "Should have seen the signer");
-  is(items[0].signed, "true", "Should have listed the item as signed");
-  return true;
-}
-
-function check_xpi_install(addon, status) {
-  is(status, 0, "Install should succeed");
-}
-
-function finish_test() {
-  var em = Components.classes["@mozilla.org/extensions/manager;1"]
-                     .getService(Components.interfaces.nsIExtensionManager);
-  em.cancelInstallItem("signed-xpi@tests.mozilla.org");
-
-  gBrowser.removeCurrentTab();
-  Harness.finish();
-}
-// ----------------------------------------------------------------------------
deleted file mode 100644
--- a/xpinstall/tests/browser_softwareupdate.js
+++ /dev/null
@@ -1,35 +0,0 @@
-// Load in the test harness
-var scriptLoader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"]
-                             .getService(Components.interfaces.mozIJSSubScriptLoader);
-
-var rootDir = getRootDirectory(window.location.href);
-scriptLoader.loadSubScript(rootDir + "harness.js", this);
-
-// ----------------------------------------------------------------------------
-// Tests that calling InstallTrigger.startSoftwareUpdate works
-function test() {
-  Harness.installEndedCallback = check_xpi_install;
-  Harness.installsCompletedCallback = finish_test;
-  Harness.setup();
-
-  var pm = Services.perms;
-  pm.add(makeURI("http://example.com/"), "install", pm.ALLOW_ACTION);
-
-  gBrowser.selectedTab = gBrowser.addTab();
-  gBrowser.loadURI(TESTROOT + "startsoftwareupdate.html? " + encodeURIComponent(TESTROOT + "unsigned.xpi"));
-}
-
-function check_xpi_install(addon, status) {
-  is(status, 0, "Install should succeed");
-}
-
-function finish_test() {
-  Services.perms.remove("example.com", "install");
-
-  var em = Components.classes["@mozilla.org/extensions/manager;1"]
-                     .getService(Components.interfaces.nsIExtensionManager);
-  em.cancelInstallItem("unsigned-xpi@tests.mozilla.org");
-
-  gBrowser.removeCurrentTab();
-  Harness.finish();
-}
deleted file mode 100644
--- a/xpinstall/tests/browser_unsigned_trigger.js
+++ /dev/null
@@ -1,58 +0,0 @@
-// Load in the test harness
-var scriptLoader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"]
-                             .getService(Components.interfaces.mozIJSSubScriptLoader);
-
-var rootDir = getRootDirectory(window.location.href);
-scriptLoader.loadSubScript(rootDir + "harness.js", this);
-
-// ----------------------------------------------------------------------------
-// Tests installing an unsigned add-on through an InstallTrigger call in web
-// content.
-function test() {
-  Harness.installConfirmCallback = confirm_install;
-  Harness.installEndedCallback = check_xpi_install;
-  Harness.installsCompletedCallback = finish_test;
-  Harness.setup();
-
-  var pm = Services.perms;
-  pm.add(makeURI("http://example.com/"), "install", pm.ALLOW_ACTION);
-
-  var triggers = encodeURIComponent(JSON.stringify({
-    "Unsigned XPI": {
-      URL: TESTROOT + "unsigned.xpi",
-      IconURL: TESTROOT + "icon.png",
-      toString: function() { return this.URL; }
-    }
-  }));
-  gBrowser.selectedTab = gBrowser.addTab();
-  gBrowser.loadURI(TESTROOT + "installtrigger.html?" + triggers);
-}
-
-function confirm_install(window) {
-  items = window.document.getElementById("itemList").childNodes;
-  is(items.length, 1, "Should only be 1 item listed in the confirmation dialog");
-  is(items[0].name, "Unsigned XPI", "Should have seen the name from the trigger list");
-  is(items[0].url, TESTROOT + "unsigned.xpi", "Should have listed the correct url for the item");
-  is(items[0].icon, TESTROOT + "icon.png", "Should have listed the correct icon for the item");
-  is(items[0].signed, "false", "Should have listed the item as unsigned");
-  return true;
-}
-
-function check_xpi_install(addon, status) {
-  is(status, 0, "Install should succeed");
-}
-
-function finish_test() {
-  var em = Components.classes["@mozilla.org/extensions/manager;1"]
-                     .getService(Components.interfaces.nsIExtensionManager);
-  em.cancelInstallItem("unsigned-xpi@tests.mozilla.org");
-
-  Services.perms.remove("example.com", "install");
-
-  var doc = gBrowser.contentDocument;
-  is(doc.getElementById("return").textContent, "true", "installTrigger should have claimed success");
-  is(doc.getElementById("status").textContent, "0", "Callback should have seen a success");
-
-  gBrowser.removeCurrentTab();
-  Harness.finish();
-}
deleted file mode 100644
--- a/xpinstall/tests/browser_unsigned_url.js
+++ /dev/null
@@ -1,42 +0,0 @@
-// Load in the test harness
-var scriptLoader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"]
-                             .getService(Components.interfaces.mozIJSSubScriptLoader);
-
-var rootDir = getRootDirectory(window.location.href);
-scriptLoader.loadSubScript(rootDir + "harness.js", this);
-
-// ----------------------------------------------------------------------------
-// Tests installing an unsigned add-on by navigating directly to the url
-function test() {
-  Harness.installConfirmCallback = confirm_install;
-  Harness.installEndedCallback = check_xpi_install;
-  Harness.installsCompletedCallback = finish_test;
-  Harness.setup();
-
-  gBrowser.selectedTab = gBrowser.addTab();
-  gBrowser.loadURI(TESTROOT + "unsigned.xpi");
-}
-
-function confirm_install(window) {
-  items = window.document.getElementById("itemList").childNodes;
-  is(items.length, 1, "Should only be 1 item listed in the confirmation dialog");
-  is(items[0].name, "unsigned.xpi", "Should have had the filename for the item name");
-  is(items[0].url, TESTROOT + "unsigned.xpi", "Should have listed the correct url for the item");
-  is(items[0].icon, "", "Should have listed no icon for the item");
-  is(items[0].signed, "false", "Should have listed the item as unsigned");
-  return true;
-}
-
-function check_xpi_install(addon, status) {
-  is(status, 0, "Install should succeed");
-}
-
-function finish_test() {
-  var em = Components.classes["@mozilla.org/extensions/manager;1"]
-                     .getService(Components.interfaces.nsIExtensionManager);
-  em.cancelInstallItem("unsigned-xpi@tests.mozilla.org");
-
-  gBrowser.removeCurrentTab();
-  Harness.finish();
-}
-// ----------------------------------------------------------------------------
deleted file mode 100644
--- a/xpinstall/tests/browser_whitelist.js
+++ /dev/null
@@ -1,53 +0,0 @@
-// Load in the test harness
-var scriptLoader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"]
-                             .getService(Components.interfaces.mozIJSSubScriptLoader);
-
-var rootDir = getRootDirectory(window.location.href);
-scriptLoader.loadSubScript(rootDir + "harness.js", this);
-
-// ----------------------------------------------------------------------------
-// Tests installing an unsigned add-on through an InstallTrigger call in web
-// content. This should be blocked by the whitelist check.
-// This verifies bug 252830
-function test() {
-  Harness.installConfirmCallback = confirm_install;
-  Harness.installBlockedCallback = allow_blocked;
-  Harness.installEndedCallback = check_xpi_install;
-  Harness.installsCompletedCallback = finish_test;
-  Harness.setup();
-
-  var triggers = encodeURIComponent(JSON.stringify({
-    "Unsigned XPI": TESTROOT + "unsigned.xpi"
-  }));
-  gBrowser.selectedTab = gBrowser.addTab();
-  gBrowser.loadURI(TESTROOT + "installtrigger.html?" + triggers);
-}
-
-function allow_blocked(installInfo) {
-  is(installInfo.originatingWindow, gBrowser.contentWindow, "Install should have been triggered by the right window");
-  is(installInfo.originatingURI.spec, gBrowser.currentURI.spec, "Install should have been triggered by the right uri");
-  return true;
-}
-
-function confirm_install(window) {
-  items = window.document.getElementById("itemList").childNodes;
-  is(items.length, 1, "Should only be 1 item listed in the confirmation dialog");
-  is(items[0].name, "Unsigned XPI", "Should have seen the name from the trigger list");
-  is(items[0].url, TESTROOT + "unsigned.xpi", "Should have listed the correct url for the item");
-  is(items[0].signed, "false", "Should have listed the item as unsigned");
-  return true;
-}
-
-function check_xpi_install(addon, status) {
-  is(status, 0, "Install should succeed");
-}
-
-function finish_test() {
-  var em = Components.classes["@mozilla.org/extensions/manager;1"]
-                     .getService(Components.interfaces.nsIExtensionManager);
-  em.cancelInstallItem("unsigned-xpi@tests.mozilla.org");
-
-  gBrowser.removeCurrentTab();
-  Harness.finish();
-}
-// ----------------------------------------------------------------------------
deleted file mode 100644
--- a/xpinstall/tests/browser_whitelist2.js
+++ /dev/null
@@ -1,38 +0,0 @@
-// Load in the test harness
-var scriptLoader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"]
-                             .getService(Components.interfaces.mozIJSSubScriptLoader);
-
-var rootDir = getRootDirectory(window.location.href);
-scriptLoader.loadSubScript(rootDir + "harness.js", this);
-
-// ----------------------------------------------------------------------------
-// Tests installing an unsigned add-on through an InstallTrigger call in web
-// content. This should be blocked by the whitelist check because the source
-// is not whitelisted, even though the target is.
-function test() {
-  Harness.installBlockedCallback = allow_blocked;
-  Harness.installsCompletedCallback = finish_test;
-  Harness.setup();
-
-  var pm = Services.perms;
-  pm.add(makeURI("http://example.org/"), "install", pm.ALLOW_ACTION);
-
-  var triggers = encodeURIComponent(JSON.stringify({
-    "Unsigned XPI": TESTROOT2 + "unsigned.xpi"
-  }));
-  gBrowser.selectedTab = gBrowser.addTab();
-  gBrowser.loadURI(TESTROOT + "installtrigger.html?" + triggers);
-}
-
-function allow_blocked(installInfo) {
-  is(installInfo.originatingWindow, gBrowser.contentWindow, "Install should have been triggered by the right window");
-  is(installInfo.originatingURI.spec, gBrowser.currentURI.spec, "Install should have been triggered by the right uri");
-  return false;
-}
-
-function finish_test() {
-  Services.perms.remove("example.org", "install");
-
-  gBrowser.removeCurrentTab();
-  Harness.finish();
-}
deleted file mode 100644
--- a/xpinstall/tests/browser_whitelist3.js
+++ /dev/null
@@ -1,35 +0,0 @@
-// Load in the test harness
-var scriptLoader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"]
-                             .getService(Components.interfaces.mozIJSSubScriptLoader);
-
-var rootDir = getRootDirectory(window.location.href);
-scriptLoader.loadSubScript(rootDir + "harness.js", this);
-
-// ----------------------------------------------------------------------------
-// Tests installing an unsigned add-on through a navigation. Should not be
-// blocked since the referer is whitelisted.
-function test() {
-  Harness.installConfirmCallback = confirm_install;
-  Harness.installsCompletedCallback = finish_test;
-  Harness.setup();
-
-  var pm = Services.perms;
-  pm.add(makeURI("http://example.org/"), "install", pm.ALLOW_ACTION);
-
-  var triggers = encodeURIComponent(JSON.stringify({
-    "Unsigned XPI": TESTROOT2 + "unsigned.xpi"
-  }));
-  gBrowser.selectedTab = gBrowser.addTab();
-  gBrowser.loadURI(TESTROOT + "unsigned.xpi", makeURI(TESTROOT2 + "test.html"));
-}
-
-function confirm_install(window) {
-  return false;
-}
-
-function finish_test() {
-  Services.perms.remove("example.org", "install");
-
-  gBrowser.removeCurrentTab();
-  Harness.finish();
-}
deleted file mode 100644
--- a/xpinstall/tests/browser_whitelist4.js
+++ /dev/null
@@ -1,37 +0,0 @@
-// Load in the test harness
-var scriptLoader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"]
-                             .getService(Components.interfaces.mozIJSSubScriptLoader);
-
-var rootDir = getRootDirectory(window.location.href);
-scriptLoader.loadSubScript(rootDir + "harness.js", this);
-
-// ----------------------------------------------------------------------------
-// Tests installing an unsigned add-on through a navigation. Should be
-// blocked since the referer is not whitelisted even though the target is.
-function test() {
-  Harness.installBlockedCallback = allow_blocked;
-  Harness.installsCompletedCallback = finish_test;
-  Harness.setup();
-
-  var pm = Services.perms;
-  pm.add(makeURI("http://example.com/"), "install", pm.ALLOW_ACTION);
-
-  var triggers = encodeURIComponent(JSON.stringify({
-    "Unsigned XPI": TESTROOT2 + "unsigned.xpi"
-  }));
-  gBrowser.selectedTab = gBrowser.addTab();
-  gBrowser.loadURI(TESTROOT + "unsigned.xpi", makeURI(TESTROOT2 + "test.html"));
-}
-
-function allow_blocked(installInfo) {
-  is(installInfo.originatingWindow, gBrowser.contentWindow, "Install should have been triggered by the right window");
-  is(installInfo.originatingURI.spec, TESTROOT2 + "test.html", "Install should have been triggered by the right uri");
-  return false;
-}
-
-function finish_test() {
-  Services.perms.remove("example.com", "install");
-
-  gBrowser.removeCurrentTab();
-  Harness.finish();
-}
deleted file mode 100644
--- a/xpinstall/tests/browser_whitelist5.js
+++ /dev/null
@@ -1,31 +0,0 @@
-// Load in the test harness
-var scriptLoader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"]
-                             .getService(Components.interfaces.mozIJSSubScriptLoader);
-
-var rootDir = getRootDirectory(window.location.href);
-scriptLoader.loadSubScript(rootDir + "harness.js", this);
-
-// ----------------------------------------------------------------------------
-// Tests installing an unsigned add-on through a startSoftwareUpdate call in web
-// content. This should be blocked by the whitelist check.
-// This verifies bug 252830
-function test() {
-  Harness.installBlockedCallback = allow_blocked;
-  Harness.installsCompletedCallback = finish_test;
-  Harness.setup();
-
-  gBrowser.selectedTab = gBrowser.addTab();
-  gBrowser.loadURI(TESTROOT + "startsoftwareupdate.html? " + encodeURIComponent(TESTROOT + "unsigned.xpi"));
-}
-
-function allow_blocked(installInfo) {
-  is(installInfo.originatingWindow, gBrowser.contentWindow, "Install should have been triggered by the right window");
-  is(installInfo.originatingURI.spec, gBrowser.currentURI.spec, "Install should have been triggered by the right uri");
-  return false;
-}
-
-function finish_test() {
-  gBrowser.removeCurrentTab();
-  Harness.finish();
-}
-// ----------------------------------------------------------------------------
deleted file mode 100644
--- a/xpinstall/tests/browser_whitelist6.js
+++ /dev/null
@@ -1,31 +0,0 @@
-// Load in the test harness
-var scriptLoader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"]
-                             .getService(Components.interfaces.mozIJSSubScriptLoader);
-
-var rootDir = getRootDirectory(window.location.href);
-scriptLoader.loadSubScript(rootDir + "harness.js", this);
-
-// ----------------------------------------------------------------------------
-// Tests installing an unsigned add-on through an installChrome call in web
-// content. This should be blocked by the whitelist check.
-// This verifies bug 252830
-function test() {
-  Harness.installBlockedCallback = allow_blocked;
-  Harness.installsCompletedCallback = finish_test;
-  Harness.setup();
-
-  gBrowser.selectedTab = gBrowser.addTab();
-  gBrowser.loadURI(TESTROOT + "installchrome.html? " + encodeURIComponent(TESTROOT + "unsigned.xpi"));
-}
-
-function allow_blocked(installInfo) {
-  is(installInfo.originatingWindow, gBrowser.contentWindow, "Install should have been triggered by the right window");
-  is(installInfo.originatingURI.spec, gBrowser.currentURI.spec, "Install should have been triggered by the right uri");
-  return false;
-}
-
-function finish_test() {
-  gBrowser.removeCurrentTab();
-  Harness.finish();
-}
-// ----------------------------------------------------------------------------
deleted file mode 100644
--- a/xpinstall/tests/bug540558.html
+++ /dev/null
@@ -1,23 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
-          "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-
-<html>
-
-<!-- This page tests that window.InstallTrigger.install works -->
-
-<head>
-<title>InstallTrigger tests</title>
-<script type="text/javascript">
-function startInstall() {
-  window.InstallTrigger.install({
-    "Unsigned XPI": "http://example.com/browser/xpinstall/tests/unsigned.xpi"
-  });
-}
-</script>
-</head>
-<body onload="startInstall()">
-<p>InstallTrigger tests</p>
-<p id="return"></p>
-<p id="status"></p>
-</body>
-</html>
deleted file mode 100644
--- a/xpinstall/tests/cookieRedirect.sjs
+++ /dev/null
@@ -1,24 +0,0 @@
-// Simple script redirects to the query part of the uri if the cookie "xpinstall"
-// has the value "true", otherwise gives a 500 error.
-
-function handleRequest(request, response)
-{
-  let cookie = null;
-  if (request.hasHeader("Cookie")) {
-    let cookies = request.getHeader("Cookie").split(";");
-    for (let i = 0; i < cookies.length; i++) {
-      if (cookies[i].substring(0, 10) == "xpinstall=")
-        cookie = cookies[i].substring(10);
-    }
-  }
-
-  if (cookie == "true") {
-    response.setStatusLine(request.httpVersion, 302, "Found");
-    response.setHeader("Location", request.queryString);
-    response.write("See " + request.queryString);
-  }
-  else {
-    response.setStatusLine(request.httpVersion, 500, "Internal Server Error");
-    response.write("Invalid request");
-  }
-}
deleted file mode 100644
--- a/xpinstall/tests/corrupt.xpi
+++ /dev/null
@@ -1,1 +0,0 @@
-This is a corrupt zip file
deleted file mode 100644
index 74ed2b817426d02c0bf2313ed0f2ac728d354800..0000000000000000000000000000000000000000
GIT binary patch
literal 0
Hc$@<O00001
deleted file mode 100644
--- a/xpinstall/tests/enabled.html
+++ /dev/null
@@ -1,20 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
-          "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-
-<html>
-
-<!-- This page will test if InstallTrigger seems to be enabled -->
-
-<head>
-<title>InstallTrigger tests</title>
-<script type="text/javascript">
-function init() {
-  document.getElementById("enabled").textContent = InstallTrigger.enabled() ? "true" : "false";
-}
-</script>
-</head>
-<body onload="init()">
-<p>InstallTrigger tests</p>
-<p id="enabled"></p>
-</body>
-</html>
deleted file mode 100644
--- a/xpinstall/tests/harness.js
+++ /dev/null
@@ -1,246 +0,0 @@
-const TESTROOT = "http://example.com/browser/xpinstall/tests/";
-const TESTROOT2 = "http://example.org/browser/xpinstall/tests/";
-const XPINSTALL_URL = "chrome://mozapps/content/xpinstall/xpinstallConfirm.xul";
-const PROMPT_URL = "chrome://global/content/commonDialog.xul";
-const ADDONS_URL = "chrome://mozapps/content/extensions/extensions.xul";
-
-var rootDir = getRootDirectory(gTestPath);
-var path = rootDir.split('/');
-var chromeName = path[0] + '//' + path[2];
-var croot = chromeName + "/content/browser/xpinstall/tests/";
-var jar = getJar(croot);
-if (jar) {
-  var tmpdir = extractJarToTmp(jar);
-  croot = 'file://' + tmpdir.path + '/';
-}
-const CHROMEROOT = croot;
-
-/**
- * This is a test harness designed to handle responding to UI during the process
- * of installing an XPI. A test can set callbacks to hear about specific parts
- * of the sequence.
- * Before use setup must be called and finish must be called afterwards.
- */
-var Harness = {
-  // If set then the install is expected to be blocked by the whitelist. The
-  // callback should return true to continue with the install anyway.
-  installBlockedCallback: null,
-  // If set will be called in the event of authentication being needed to get
-  // the xpi. Should return a 2 element array of username and password, or
-  // null to not authenticate.
-  authenticationCallback: null,
-  // If set this will be called to allow checking the contents of the xpinstall
-  // confirmation dialog. The callback should return true to continue the install.
-  installConfirmCallback: null,
-  // If set will be called when downloading of an item has begun.
-  downloadStartedCallback: null,
-  // If set will be called during the download of an item.
-  downloadProgressCallback: null,
-  // If set will be called when downloading of an item has ended.
-  downloadEndedCallback: null,
-  // If set will be called when installation by the extension manager of an xpi
-  // item starts
-  installStartedCallback: null,
-  // If set will be called when each xpi item to be installed completes
-  // installation.
-  installEndedCallback: null,
-  // If set will be called when all triggered items are installed or the install
-  // is canceled.
-  installsCompletedCallback: null,
-
-  listenerIndex: null,
-
-  // Setup and tear down functions
-  setup: function() {
-    waitForExplicitFinish();
-
-    var os = Components.classes["@mozilla.org/observer-service;1"]
-                       .getService(Components.interfaces.nsIObserverService);
-    os.addObserver(this, "xpinstall-install-blocked", false);
-
-    var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"]
-                       .getService(Components.interfaces.nsIWindowMediator);
-    wm.addListener(this);
-
-    var em = Components.classes["@mozilla.org/extensions/manager;1"]
-                       .getService(Components.interfaces.nsIExtensionManager);
-    this.listenerIndex = em.addInstallListener(this);
-  },
-
-  finish: function() {
-    var os = Components.classes["@mozilla.org/observer-service;1"]
-                       .getService(Components.interfaces.nsIObserverService);
-    os.removeObserver(this, "xpinstall-install-blocked");
-
-    var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"]
-                       .getService(Components.interfaces.nsIWindowMediator);
-    wm.removeListener(this);
-    var win = wm.getMostRecentWindow("Extension:Manager");
-    if (win)
-      win.close();
-
-    var em = Components.classes["@mozilla.org/extensions/manager;1"]
-                       .getService(Components.interfaces.nsIExtensionManager);
-    em.removeInstallListenerAt(this.listenerIndex);
-    finish();
-  },
-
-  endTest: function() {
-    // Defer the final notification to allow things like the InstallTrigger
-    // callback to complete
-    executeSoon(this.installsCompletedCallback);
-
-    this.installBlockedCallback = null;
-    this.authenticationCallback = null;
-    this.installConfirmCallback = null;
-    this.downloadStartedCallback = null;
-    this.downloadProgressCallback = null;
-    this.downloadEndedCallback = null;
-    this.installStartedCallback = null;
-    this.installEndedCallback = null;
-    this.installsCompletedCallback = null;
-  },
-
-  // Window open handling
-  windowLoad: function(window) {
-    // Allow any other load handlers to execute
-    var self = this;
-    executeSoon(function() { self.windowReady(window); } );
-  },
-
-  windowReady: function(window) {
-    if (window.document.location.href == XPINSTALL_URL) {
-      if (this.installBlockedCallback)
-        ok(false, "Should have been blocked by the whitelist");
-
-      // If there is a confirm callback then its return status determines whether
-      // to install the items or not. If not the test is over.
-      if (this.installConfirmCallback && !this.installConfirmCallback(window)) {
-        window.document.documentElement.cancelDialog();
-        this.endTest();
-      }
-      else {
-        // Initially the accept button is disabled on a countdown timer
-        var button = window.document.documentElement.getButton("accept");
-        button.disabled = false;
-        window.document.documentElement.acceptDialog();
-      }
-    }
-    else if (window.document.location.href == PROMPT_URL) {
-      switch (window.args.promptType) {
-        default:
-                if (window.opener.document.location.href == ADDONS_URL) {
-                  // A prompt opened by the add-ons manager is liable to be an
-                  // xpinstall error, just close it, we'll see the error in
-                  // onInstallEnded anyway.
-                  window.document.documentElement.acceptDialog();
-                }
-                break;
-        case "promptUserAndPass":
-                  // This is a login dialog, hopefully an authentication prompt
-                  // for the xpi.
-                  if (this.authenticationCallback) {
-                    var auth = this.authenticationCallback();
-                    if (auth && auth.length == 2) {
-                      window.document.getElementById("loginTextbox").value = auth[0];
-                      window.document.getElementById("password1Textbox").value = auth[1];
-                      window.document.documentElement.acceptDialog();
-                    }
-                    else {
-                      window.document.documentElement.cancelDialog();
-                    }
-                  }
-                  else {
-                    window.document.documentElement.cancelDialog();
-                  }
-                break;
-      }
-    }
-  },
-
-  // Install blocked handling
-
-  installBlocked: function(installInfo) {
-    ok(!!this.installBlockedCallback, "Shouldn't have been blocked by the whitelist");
-    if (this.installBlockedCallback && this.installBlockedCallback(installInfo)) {
-      this.installBlockedCallback = null;
-      var mgr = Components.classes["@mozilla.org/xpinstall/install-manager;1"]
-                          .createInstance(Components.interfaces.nsIXPInstallManager);
-      mgr.initManagerWithInstallInfo(installInfo);
-    }
-    else {
-      this.endTest();
-    }
-  },
-
-  // nsIWindowMediatorListener
-
-  onWindowTitleChange: function(window, title) {
-  },
-
-  onOpenWindow: function(window) {
-    var domwindow = window.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
-                          .getInterface(Components.interfaces.nsIDOMWindow);
-    var self = this;
-    domwindow.addEventListener("load", function() {
-      self.windowLoad(domwindow);
-    }, false);
-  },
-
-  onCloseWindow: function(window) {
-  },
-
-  // nsIAddonInstallListener
-
-  onDownloadStarted: function(addon) {
-    if (this.downloadStartedCallback)
-      this.downloadStartedCallback(addon);
-  },
-
-  onDownloadProgress: function(addon, value, maxValue) {
-    if (this.downloadProgressCallback)
-      this.downloadProgressCallback(addon, value, maxValue);
-  },
-
-  onDownloadEnded: function(addon) {
-    if (this.downloadEndedCallback)
-      this.downloadEndedCallback(addon);
-  },
-
-  onInstallStarted: function(addon) {
-    if (this.installStartedCallback)
-      this.installStartedCallback(addon);
-  },
-
-  onCompatibilityCheckStarted: function(addon) {
-  },
-
-  onCompatibilityCheckEnded: function(addon, status) {
-  },
-
-  onInstallEnded: function(addon, status) {
-    if (this.installEndedCallback)
-      this.installEndedCallback(addon, status);
-  },
-
-  onInstallsCompleted: function() {
-    this.endTest();
-  },
-
-  // nsIObserver
-
-  observe: function(subject, topic, data) {
-    var installInfo = subject.QueryInterface(Components.interfaces.nsIXPIInstallInfo);
-    this.installBlocked(installInfo);
-  },
-
-  QueryInterface: function(iid) {
-    if (iid.equals(Components.interfaces.nsIObserver) ||
-        iid.equals(Components.interfaces.nsIAddonInstallListener) ||
-        iid.equals(Components.interfaces.nsIWindowMediatorListener) ||
-        iid.equals(Components.interfaces.nsISupports))
-      return this;
-
-    throw Components.results.NS_ERROR_NO_INTERFACE;
-  }
-}
deleted file mode 100644
--- a/xpinstall/tests/installchrome.html
+++ /dev/null
@@ -1,21 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
-          "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-
-<html>
-
-<!-- This page will accept a url as the uri query and pass it to InstallTrigger.installChrome -->
-
-<head>
-<title>InstallTrigger tests</title>
-<script type="text/javascript">
-function startInstall() {
-  InstallTrigger.installChrome(InstallTrigger.SKIN,
-                               decodeURIComponent(document.location.search.substring(1)),
-                               "test");
-}
-</script>
-</head>
-<body onload="startInstall()">
-<p>InstallTrigger tests</p>
-</body>
-</html>
deleted file mode 100644
--- a/xpinstall/tests/installtrigger.html
+++ /dev/null
@@ -1,32 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
-          "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-
-<html>
-
-<!-- This page will accept some json as the uri query and pass it to InstallTrigger.install -->
-
-<head>
-<title>InstallTrigger tests</title>
-<script type="text/javascript">
-function installCallback(url, status) {
-  document.getElementById("status").textContent = status;
-}
-
-function startInstall() {
-  var text = decodeURIComponent(document.location.search.substring(1));
-  var triggers = JSON.parse(text);
-  try {
-    document.getElementById("return").textContent = InstallTrigger.install(triggers, installCallback);
-  }
-  catch (e) {
-    document.getElementById("return").textContent = "exception";
-  }
-}
-</script>
-</head>
-<body onload="startInstall()">
-<p>InstallTrigger tests</p>
-<p id="return"></p>
-<p id="status"></p>
-</body>
-</html>
deleted file mode 100644
index 90d3a3ce66692496ee625b2ae1725785193079a5..0000000000000000000000000000000000000000
GIT binary patch
literal 0
Hc$@<O00001
deleted file mode 100644
index 19b754038008ed3043a7178aa8c42da83747bf8e..0000000000000000000000000000000000000000
GIT binary patch
literal 0
Hc$@<O00001
deleted file mode 100644
index 8c951881e5fbe10504eee8280dd9a3d995b5c881..0000000000000000000000000000000000000000
GIT binary patch
literal 0
Hc$@<O00001
deleted file mode 100644
index 09789d1897ccd3c6e0d30c94dc658f5cda732771..0000000000000000000000000000000000000000
GIT binary patch
literal 0
Hc$@<O00001
deleted file mode 100644
index bd7f78b7c7712c0aca18776e08541e87898da119..0000000000000000000000000000000000000000
GIT binary patch
literal 0
Hc$@<O00001
deleted file mode 100644
index 085efbbf7fdd8f9cf475e903b16552e614f9139c..0000000000000000000000000000000000000000
GIT binary patch
literal 0
Hc$@<O00001
deleted file mode 100644
--- a/xpinstall/tests/startsoftwareupdate.html
+++ /dev/null
@@ -1,19 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
-          "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-
-<html>
-
-<!-- This page will accept a url as the uri query and pass it to InstallTrigger.startSoftwareUpdate -->
-
-<head>
-<title>InstallTrigger tests</title>
-<script type="text/javascript">
-function startInstall() {
-  InstallTrigger.startSoftwareUpdate(decodeURIComponent(document.location.search.substring(1)));
-}
-</script>
-</head>
-<body onload="startInstall()">
-<p>InstallTrigger tests</p>
-</body>
-</html>
deleted file mode 100644
index 51b00475a9641ea9d608874a3ab7679da3a4374b..0000000000000000000000000000000000000000
GIT binary patch
literal 0
Hc$@<O00001