Remove Carbon Apple Event code, replaced with standard Cocoa suite and some custom Cocoa handlers. b=363747 r=smorgan sr=roc
authorJosh Aas <joshmoz@gmail.com>
Mon, 02 Mar 2009 09:24:31 -0500
changeset 25668 3304d08b9dc3ffab68b989d59ba11404ce6cfc60
parent 25667 af782d5ec3627a72f20f1ce0f2db137ac3053834
child 25669 9baf6f1175db2bc2f9d370b04faecc8a5c81f305
push id1
push userroot
push dateTue, 26 Apr 2011 22:38:44 +0000
treeherdermozilla-beta@bfdb6e623a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmorgan, roc
bugs363747
milestone1.9.2a1pre
Remove Carbon Apple Event code, replaced with standard Cocoa suite and some custom Cocoa handlers. b=363747 r=smorgan sr=roc
browser/app/Makefile.in
toolkit/toolkit-makefiles.sh
toolkit/toolkit-tiers.mk
toolkit/xre/MacApplicationDelegate.mm
toolkit/xre/Makefile.in
toolkit/xre/nsCommandLineServiceMac.cpp
toolkit/xre/nsCommandLineServiceMac.h
xpfe/bootstrap/appleevents/Makefile.in
xpfe/bootstrap/appleevents/PatriciaTree.cpp
xpfe/bootstrap/appleevents/PatriciaTree.h
xpfe/bootstrap/appleevents/mozilla.sdef
xpfe/bootstrap/appleevents/nsAEApplicationClass.cpp
xpfe/bootstrap/appleevents/nsAEApplicationClass.h
xpfe/bootstrap/appleevents/nsAEClassDispatcher.cpp
xpfe/bootstrap/appleevents/nsAEClassDispatcher.h
xpfe/bootstrap/appleevents/nsAEClassIterator.cpp
xpfe/bootstrap/appleevents/nsAEClassIterator.h
xpfe/bootstrap/appleevents/nsAEClassTypes.h
xpfe/bootstrap/appleevents/nsAECoercionHandlers.cpp
xpfe/bootstrap/appleevents/nsAECoercionHandlers.h
xpfe/bootstrap/appleevents/nsAECompare.cpp
xpfe/bootstrap/appleevents/nsAECompare.h
xpfe/bootstrap/appleevents/nsAECoreClass.cpp
xpfe/bootstrap/appleevents/nsAECoreClass.h
xpfe/bootstrap/appleevents/nsAEDefs.h
xpfe/bootstrap/appleevents/nsAEDocumentClass.cpp
xpfe/bootstrap/appleevents/nsAEDocumentClass.h
xpfe/bootstrap/appleevents/nsAEEventHandling.cpp
xpfe/bootstrap/appleevents/nsAEEventHandling.h
xpfe/bootstrap/appleevents/nsAEGenericClass.cpp
xpfe/bootstrap/appleevents/nsAEGenericClass.h
xpfe/bootstrap/appleevents/nsAEGetURLSuiteHandler.cpp
xpfe/bootstrap/appleevents/nsAEGetURLSuiteHandler.h
xpfe/bootstrap/appleevents/nsAEMozillaSuiteHandler.cpp
xpfe/bootstrap/appleevents/nsAEMozillaSuiteHandler.h
xpfe/bootstrap/appleevents/nsAESpyglassSuiteHandler.cpp
xpfe/bootstrap/appleevents/nsAESpyglassSuiteHandler.h
xpfe/bootstrap/appleevents/nsAETokens.cpp
xpfe/bootstrap/appleevents/nsAETokens.h
xpfe/bootstrap/appleevents/nsAEUtils.cpp
xpfe/bootstrap/appleevents/nsAEUtils.h
xpfe/bootstrap/appleevents/nsAEWindowClass.cpp
xpfe/bootstrap/appleevents/nsAEWindowClass.h
xpfe/bootstrap/appleevents/nsAEWordClass.cpp
xpfe/bootstrap/appleevents/nsAEWordClass.h
xpfe/bootstrap/appleevents/nsAppleEvents.h
xpfe/bootstrap/appleevents/nsAppleEvents.r
xpfe/bootstrap/appleevents/nsAppleEvents.rsrc
xpfe/bootstrap/appleevents/nsAppleEventsService.cpp
xpfe/bootstrap/appleevents/nsAppleEventsService.h
xpfe/bootstrap/appleevents/nsDocLoadObserver.cpp
xpfe/bootstrap/appleevents/nsDocLoadObserver.h
xpfe/bootstrap/appleevents/nsMacUtils.cpp
xpfe/bootstrap/appleevents/nsMacUtils.h
xpfe/bootstrap/appleevents/nsWindowUtils.cpp
xpfe/bootstrap/appleevents/nsWindowUtils.h
xpfe/bootstrap/appleevents/patricia.c
xpfe/bootstrap/appleevents/patricia.h
--- a/browser/app/Makefile.in
+++ b/browser/app/Makefile.in
@@ -398,17 +398,16 @@ else
 	rm -f $(DIST)/$(APP_NAME).app/Contents/MacOS/$(PROGRAM)
 	rsync -aL $(PROGRAM) $(DIST)/$(APP_NAME).app/Contents/MacOS
 endif
 	mkdir -p $(DIST)/$(APP_NAME).app/Contents/Plug-Ins
 	rsync -a --copy-unsafe-links $(LIBXUL_DIST)/package/PrintPDE.plugin $(DIST)/$(APP_NAME).app/Contents/Plug-Ins
 	-cp -L $(DIST)/bin/mangle $(DIST)/bin/shlibsign $(DIST)/$(APP_NAME).app/Contents/$(APPFILES)
 	cp -RL $(DIST)/branding/firefox.icns $(DIST)/$(APP_NAME).app/Contents/Resources/firefox.icns
 	cp -RL $(DIST)/branding/document.icns $(DIST)/$(APP_NAME).app/Contents/Resources/document.icns
-	cp -RL $(LIBXUL_DIST)/package/mozillaSuite.rsrc $(DIST)/$(APP_NAME).app/Contents/Resources/firefox-bin.rsrc
 	echo -n APPLMOZB > $(DIST)/$(APP_NAME).app/Contents/PkgInfo
 #       remove CVS dirs from packaged app
 	find $(DIST)/$(APP_NAME).app -type d -name "CVS" -prune -exec rm -rf {} \;
 
 else
 ifdef LIBXUL_SDK
 libs::
 	cp $(LIBXUL_DIST)/bin/xulrunner-stub$(BIN_SUFFIX) $(DIST)/bin/firefox$(BIN_SUFFIX)
--- a/toolkit/toolkit-makefiles.sh
+++ b/toolkit/toolkit-makefiles.sh
@@ -581,17 +581,16 @@ MAKEFILES_xpfe="
   xpfe/components/autocomplete/Makefile
   xpfe/components/autocomplete/public/Makefile
   xpfe/components/autocomplete/src/Makefile
   xpfe/components/windowds/Makefile
   xpfe/components/build/Makefile
   xpfe/appshell/Makefile
   xpfe/appshell/src/Makefile
   xpfe/appshell/public/Makefile
-  xpfe/bootstrap/appleevents/Makefile
   extensions/spellcheck/Makefile
   extensions/spellcheck/hunspell/Makefile
   extensions/spellcheck/idl/Makefile
   extensions/spellcheck/locales/Makefile
   extensions/spellcheck/src/Makefile
 "
 
 MAKEFILES_embedding="
--- a/toolkit/toolkit-tiers.mk
+++ b/toolkit/toolkit-tiers.mk
@@ -190,20 +190,16 @@ endif
 
 tier_toolkit_dirs += chrome profile
 
 # This must preceed xpfe
 ifdef MOZ_JPROF
 tier_toolkit_dirs        += tools/jprof
 endif
 
-ifneq (,$(filter mac cocoa,$(MOZ_WIDGET_TOOLKIT)))
-tier_toolkit_dirs       += xpfe/bootstrap/appleevents
-endif
-
 tier_toolkit_dirs	+= \
 	xpfe \
 	toolkit/components \
 	$(NULL)
 
 ifdef MOZ_ENABLE_XREMOTE
 tier_toolkit_dirs += widget/src/xremoteclient
 endif
@@ -268,9 +264,9 @@ tier_toolkit_dirs	+= tools/codesighs
 endif
 
 ifdef ENABLE_TESTS
 tier_toolkit_dirs	+= testing/mochitest
 endif
 
 ifdef MOZ_TREE_FREETYPE
 tier_external_dirs	+= modules/freetype2
-endif
\ No newline at end of file
+endif
--- a/toolkit/xre/MacApplicationDelegate.mm
+++ b/toolkit/xre/MacApplicationDelegate.mm
@@ -39,30 +39,35 @@
 // NSApplication delegate for Mac OS X Cocoa API.
 
 // As of 10.4 Tiger, the system can send six kinds of Apple Events to an application;
 // a well-behaved XUL app should have some kind of handling for all of them.
 //
 // See http://developer.apple.com/documentation/Cocoa/Conceptual/ScriptableCocoaApplications/SApps_handle_AEs/chapter_11_section_3.html for details.
 
 #import <Cocoa/Cocoa.h>
+#import <Carbon/Carbon.h>
 
 #include "nsCOMPtr.h"
 #include "nsIBaseWindow.h"
 #include "nsINativeAppSupport.h"
 #include "nsIWidget.h"
 #include "nsIWindowMediator.h"
 #include "nsAppRunner.h"
 #include "nsComponentManagerUtils.h"
 #include "nsCommandLineServiceMac.h"
+#include "nsIServiceManager.h"
 #include "nsServiceManagerUtils.h"
 #include "nsIAppStartup.h"
 #include "nsIObserverService.h"
 #include "nsISupportsPrimitives.h"
 #include "nsObjCExceptions.h"
+#include "nsIFile.h"
+#include "nsDirectoryServiceDefs.h"
+#include "nsICommandLineRunner.h"
 
 @interface MacApplicationDelegate : NSObject
 {
 }
 
 @end
 
 // Something to call from non-objective code.
@@ -94,16 +99,41 @@ SetupMacApplicationDelegate()
   MacApplicationDelegate *delegate = [[MacApplicationDelegate alloc] init];
   [[NSApplication sharedApplication] setDelegate:delegate];
 
   NS_OBJC_END_TRY_ABORT_BLOCK;
 }
 
 @implementation MacApplicationDelegate
 
+- (id)init
+{
+  NS_OBJC_BEGIN_TRY_ABORT_BLOCK_RETURN;
+
+  if ((self = [super init])) {
+    [[NSAppleEventManager sharedAppleEventManager] setEventHandler:self
+                                                       andSelector:@selector(handleAppleEvent:withReplyEvent:)
+                                                     forEventClass:kInternetEventClass
+                                                        andEventID:kAEGetURL];
+  }
+  return self;
+
+  NS_OBJC_END_TRY_ABORT_BLOCK_RETURN(nil);
+}
+
+- (void)dealloc
+{
+  NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
+
+  [[NSAppleEventManager sharedAppleEventManager] removeEventHandlerForEventClass:kInternetEventClass andEventID:kAEGetURL];
+  [super dealloc];
+
+  NS_OBJC_END_TRY_ABORT_BLOCK;
+}
+
 // Opening the application is handled specially elsewhere,
 // don't define applicationOpenUntitledFile: .
 
 // The method that NSApplication calls upon a request to reopen, such as when
 // the Dock icon is clicked and no windows are open.
 
 // A "visible" window may be miniaturized, so we can't skip
 // nsCocoaNativeReOpen() if 'flag' is 'true'.
@@ -275,19 +305,16 @@ static NSWindow* GetCocoaWindowForXULWin
 
   // Our represented object is an NSWindow
   [[sender representedObject] makeKeyAndOrderFront:nil];
   [NSApp activateIgnoringOtherApps:YES];
 
   NS_OBJC_END_TRY_ABORT_BLOCK;
 }
 
-// The open contents Apple Event 'ocon' (new in 10.4) does not have a delegate method
-// associated with it; it would need Carbon event code to handle.
-
 // If we don't handle applicationShouldTerminate:, a call to [NSApp terminate:]
 // (from the browser or from the OS) can result in an unclean shutdown.
 - (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender
 {
   nsCOMPtr<nsIObserverService> obsServ =
            do_GetService("@mozilla.org/observer-service;1");
   if (!obsServ)
     return NSTerminateNow;
@@ -308,10 +335,43 @@ static NSWindow* GetCocoaWindowForXULWin
   nsCOMPtr<nsIAppStartup> appService =
            do_GetService("@mozilla.org/toolkit/app-startup;1");
   if (appService)
     appService->Quit(nsIAppStartup::eForceQuit);
 
   return NSTerminateNow;
 }
 
+- (void)handleAppleEvent:(NSAppleEventDescriptor*)event withReplyEvent:(NSAppleEventDescriptor*)replyEvent
+{
+  if (!event)
+    return;
+
+  if ([event eventClass] == kInternetEventClass && [event eventID] == kAEGetURL) {
+    NSString* urlString = [[event paramDescriptorForKeyword:keyDirectObject] stringValue];
+
+    // don't open chrome URLs
+    NSString* schemeString = [[NSURL URLWithString:urlString] scheme];
+    if (!schemeString ||
+        [schemeString compare:@"chrome"
+                      options:NSCaseInsensitiveSearch
+                        range:NSMakeRange(0, [schemeString length])] == NSOrderedSame) {
+      return;
+    }
+
+    nsCOMPtr<nsICommandLineRunner> cmdLine(do_CreateInstance("@mozilla.org/toolkit/command-line;1"));
+    if (!cmdLine) {
+      NS_ERROR("Couldn't create command line!");
+      return;
+    }
+    nsCOMPtr<nsIFile> workingDir;
+    nsresult rv = NS_GetSpecialDirectory(NS_OS_CURRENT_WORKING_DIR, getter_AddRefs(workingDir));
+    if (NS_FAILED(rv))
+      return;
+    const char *argv[3] = {nsnull, "-url", [urlString UTF8String]};
+    rv = cmdLine->Init(3, const_cast<char**>(argv), workingDir, nsICommandLine::STATE_REMOTE_EXPLICIT);
+    if (NS_FAILED(rv))
+      return;
+    rv = cmdLine->Run();
+  }
+}
+
 @end
-
--- a/toolkit/xre/Makefile.in
+++ b/toolkit/xre/Makefile.in
@@ -140,19 +140,17 @@ endif
 endif
 endif
 endif
 endif
 
 ifeq ($(MOZ_WIDGET_TOOLKIT),cocoa)
 CMMSRCS += MacLaunchHelper.mm
 CPPSRCS += nsCommandLineServiceMac.cpp
-LOCAL_INCLUDES += -I$(topsrcdir)/xpfe/bootstrap/appleevents
 OS_CXXFLAGS += -fexceptions
-SHARED_LIBRARY_LIBS += $(DEPTH)/xpfe/bootstrap/appleevents/$(LIB_PREFIX)appleevents_s.$(LIB_SUFFIX)
 endif
 ifeq ($(MOZ_WIDGET_TOOLKIT),cocoa)
 CMMSRCS += MacApplicationDelegate.mm
 endif
 
 ifneq (,$(filter-out OS2 WINNT,$(OS_ARCH)))
 CPPSRCS	  += nsSigHandlers.cpp
 endif
--- a/toolkit/xre/nsCommandLineServiceMac.cpp
+++ b/toolkit/xre/nsCommandLineServiceMac.cpp
@@ -60,19 +60,16 @@
 #include "nsIWindowWatcher.h"
 #include "jsapi.h"
 #include "nsReadableUtils.h"
 #include "nsIObserverService.h"
 #include "nsIPrefService.h"
 #include "nsICommandLineRunner.h"
 #include "nsDirectoryServiceDefs.h"
 
-#include "nsAEEventHandling.h"
-#include "nsXPFEComponentsCID.h"
-
 // NSPR
 #include "prmem.h"
 #include "plstr.h"
 #include "prenv.h"
 
 // the static instance
 nsMacCommandLine nsMacCommandLine::sMacCommandLine;
 
@@ -99,59 +96,32 @@ static PRInt32 ReadLine(FILE* inStream, 
       break;
     buf[charsRead++] = c;
   }
   buf[charsRead] = '\0';
   
   return (c == EOF && !charsRead) ? -1 : charsRead; 
 }
 
-static PRUint32
-ProcessAppleEvents()
-{
-  // Dispatch all of the Apple Events waiting in the event queue.
-
-  PRUint32 processed = 0;
-
-  const EventTypeSpec kAppleEventList[] = {
-    { kEventClassAppleEvent, kEventAppleEvent },
-  };
-
-  EventRef carbonEvent;
-  while (::ReceiveNextEvent(GetEventTypeCount(kAppleEventList),
-                            kAppleEventList,
-                            kEventDurationNoWait,
-                            PR_TRUE,
-                            &carbonEvent) == noErr) {
-    EventRecord eventRecord;
-    ::ConvertEventRefToEventRecord(carbonEvent, &eventRecord);
-    ::AEProcessAppleEvent(&eventRecord);
-    ::ReleaseEvent(carbonEvent);
-    processed++;
-  }
-
-  return processed;
-}
 
 //----------------------------------------------------------------------------------------
 nsMacCommandLine::nsMacCommandLine()
 : mArgs(NULL)
 , mArgsAllocated(0)
 , mArgsUsed(0)
 , mStartedUp(PR_FALSE)
 //----------------------------------------------------------------------------------------
 {
 }
 
 
 //----------------------------------------------------------------------------------------
 nsMacCommandLine::~nsMacCommandLine()
 //----------------------------------------------------------------------------------------
 {
-  ShutdownAEHandlerClasses();
   if (mArgs) {
     for (PRUint32 i = 0; i < mArgsUsed; i++)
       free(mArgs[i]);
     free(mArgs);
   }
 }
 
 
@@ -170,32 +140,16 @@ nsresult nsMacCommandLine::Initialize(in
   // Copy them first to mArgv.
   for (int arg = 0; arg < argc; arg++) {
     char* flag = argv[arg];
     // don't pass on the psn (Process Serial Number) flag from the OS
     if (strncmp(flag, "-psn_", 5) != 0)
       AddToCommandLine(flag);
   }
 
-  // Set up AppleEvent handling.
-  OSErr err = CreateAEHandlerClasses(false);
-  if (err != noErr) return NS_ERROR_FAILURE;
-
-  // Snarf all the odoc and pdoc apple-events.
-  //
-  // 1. If they are odoc for 'CMDL' documents, read them into the buffer ready for
-  //    parsing (concatenating multiple files).
-  //
-  // 2. If they are any other kind of document, convert them into -url command-line
-  //    parameters or -print parameters, with file URLs.
-
-  // Spin a native event loop to allow AE handlers for waiting events to be
-  // called
-  ProcessAppleEvents();
-
   // we've started up now
   mStartedUp = PR_TRUE;
   
   argc = mArgsUsed;
   argv = mArgs;
   
   return NS_OK;
 }
@@ -412,53 +366,16 @@ OSErr nsMacCommandLine::DispatchURLToNew
   OSErr err = errAEEventNotHandled;
   err = AddToCommandLine("-url");
   if (err == noErr)
     err = AddToCommandLine(url);
   
   return err;
 }
 
-//----------------------------------------------------------------------------------------
-OSErr nsMacCommandLine::Quit(TAskSave askSave)
-//----------------------------------------------------------------------------------------
-{
-  nsresult rv;
-  
-  nsCOMPtr<nsIObserverService> obsServ =
-           do_GetService("@mozilla.org/observer-service;1", &rv);
-  if (NS_FAILED(rv))
-    return errAEEventNotHandled;
-
-  nsCOMPtr<nsISupportsPRBool> cancelQuit =
-           do_CreateInstance(NS_SUPPORTS_PRBOOL_CONTRACTID, &rv);
-  if (NS_FAILED(rv))
-    return errAEEventNotHandled;
-
-  cancelQuit->SetData(PR_FALSE);
-  if (askSave != eSaveNo) {
-    rv = obsServ->NotifyObservers(cancelQuit, "quit-application-requested", nsnull);
-    if (NS_FAILED(rv))
-      return errAEEventNotHandled;
-  }
-
-  PRBool abortQuit;
-  cancelQuit->GetData(&abortQuit);
-  if (abortQuit)
-    return userCanceledErr;
-
-  nsCOMPtr<nsIAppStartup> appStartup =
-           do_GetService(NS_APPSTARTUP_CONTRACTID, &rv);
-  if (NS_FAILED(rv))
-    return errAEEventNotHandled;
-
-  appStartup->Quit(nsIAppStartup::eAttemptQuit);
-  return noErr;
-}
-
 #pragma mark -
 
 //----------------------------------------------------------------------------------------
 void SetupMacCommandLine(int& argc, char**& argv)
 //----------------------------------------------------------------------------------------
 {
   nsMacCommandLine& cmdLine = nsMacCommandLine::GetMacCommandLine();
   return cmdLine.SetupCommandLine(argc, argv);
--- a/toolkit/xre/nsCommandLineServiceMac.h
+++ b/toolkit/xre/nsCommandLineServiceMac.h
@@ -35,24 +35,22 @@
  *
  * ***** END LICENSE BLOCK ***** */
 
 // Special stuff for the Macintosh implementation of command-line service.
 
 #ifndef nsCommandLineServiceMac_h_
 #define nsCommandLineServiceMac_h_
 
-#include <Files.h>
+#include <Carbon/Carbon.h>
 
 #include "nscore.h"
 #include "nsError.h"
 #include "nsString.h"
 
-#include "nsAEDefs.h"
-
 #ifdef __cplusplus
 
 class nsMacCommandLine
 {
 public:
 
 
   enum
@@ -69,19 +67,17 @@ public:
   nsresult        AddToCommandLine(const char* inArgText);
   nsresult        AddToCommandLine(const char* inOptionString, const FSSpec& inFileSpec);
   nsresult        AddToEnvironmentVars(const char* inArgText);
 
   OSErr           HandleOpenOneDoc(const FSSpec& inFileSpec, OSType inFileType);
   OSErr           HandlePrintOneDoc(const FSSpec& inFileSpec, OSType fileType);
 
 	OSErr						DispatchURLToNewBrowser(const char* url);
-	  
-  OSErr						Quit(TAskSave askSave);
-  
+
 protected:
 
   OSErr           OpenURL(const char* aURL);
 
   nsresult        OpenWindow(const char *chrome, const PRUnichar *url);
     
   char**          mArgs;              // array of arg pointers (augmented argv)
   PRUint32        mArgsAllocated;     // number of slots available in mArgs
deleted file mode 100644
--- a/xpfe/bootstrap/appleevents/Makefile.in
+++ /dev/null
@@ -1,128 +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
-# Netscape Communications Corporation.
-# Portions created by the Initial Developer are Copyright (C) 1998
-# 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@
-
-include $(DEPTH)/config/autoconf.mk
-
-MODULE		= appleevents
-LIBRARY_NAME	= appleevents_s
-REQUIRES	= xpcom \
-		  string \
-		  dom \
-		  content \
-		  layout \
-		  gfx \
-		  widget \
-		  necko \
-		  docshell \
-		  appshell \
-		  appcomps \
-		  xulapp \
-		  $(NULL)
-
-#    PatriciaTree.cpp \
-#    nsAppleEventsService.cpp \
-
-CSRCS = \
-	patricia.c \
-	$(NULL)
-
-CPPSRCS		= \
-    nsAEApplicationClass.cpp \
-    nsAEClassDispatcher.cpp \
-    nsAEClassIterator.cpp \
-    nsAECoercionHandlers.cpp \
-    nsAECompare.cpp \
-    nsAECoreClass.cpp \
-    nsAEDocumentClass.cpp \
-    nsAEEventHandling.cpp \
-    nsAEGenericClass.cpp \
-    nsAEGetURLSuiteHandler.cpp \
-    nsAEMozillaSuiteHandler.cpp \
-    nsAESpyglassSuiteHandler.cpp \
-    nsAETokens.cpp \
-    nsAEUtils.cpp \
-    nsAEWindowClass.cpp \
-    nsMacUtils.cpp \
-    nsWindowUtils.cpp \
-    nsDocLoadObserver.cpp \
-    $(NULL)
-
-
-# we don't want the shared lib, but we want to force the creation of a static lib.
-FORCE_STATIC_LIB = 1
-LIBXUL_LIBRARY = 1
-
-LOCAL_INCLUDES	= \
-	-I$(srcdir) \
-	$(NULL)
-
-LOCAL_INCLUDES += \
-	-I$(topsrcdir)/toolkit/xre \
-	-I$(topsrcdir)/toolkit/components/startup/src \
-	$(NULL)
-
-include $(topsrcdir)/config/rules.mk
-
-
-# convert AppleScript dictionary .sdef file into .r format, and thence to .rsrc
-SDP_TOOL = $(SDP)
-REZ_TOOL = /Developer/Tools/Rez
-SDEF_SRC = $(srcdir)/mozilla.sdef
-RES_DEST = mozillaSuite.r
-RSRC_DEST = mozillaSuite.rsrc
-PACKAGE_DIR = $(DIST)/package
-
-$(RSRC_DEST): $(SDEF_SRC) $(PACKAGE_DIR)
-	NEXT_ROOT= $(SDP_TOOL) -fa -o $(RES_DEST) $(SDEF_SRC) 
-	$(REZ_TOOL) -useDF -o $(RSRC_DEST) $(RES_DEST) 
-	cp $(RSRC_DEST) $(PACKAGE_DIR)
-	rm -f $(RES_DEST)
-
-$(PACKAGE_DIR):
-	mkdir $(PACKAGE_DIR)
-
-libs:: $(RSRC_DEST)
-
-GARBAGE += $(RES_DEST) $(RSRC_DEST) \
-	$(NULL)
-
-OS_CXXFLAGS += -fexceptions
deleted file mode 100644
--- a/xpfe/bootstrap/appleevents/PatriciaTree.cpp
+++ /dev/null
@@ -1,173 +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.
- *
- * 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):
- *   Simon Fraser <sfraser@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 ***** */
-
-
-#include <AEUtils.h>
-
-#include "PatriciaTree.h"
-
-
-/*----------------------------------------------------------------------------
-	CPatriciaTree
-	
-----------------------------------------------------------------------------*/
-CPatriciaTree::CPatriciaTree(long keyBitsLen)
-:	mTree(nil)
-,	mKeyBits(keyBitsLen)
-{
-
-	mTree = PatriciaInitTree(mKeyBits);
-	ThrowErrIfNil(mTree, paramErr);
-}
-
-/*----------------------------------------------------------------------------
-	~CPatriciaTree
-	
-----------------------------------------------------------------------------*/
-CPatriciaTree::~CPatriciaTree()
-{
-	if (mTree)
-	{
-		PatriciaFreeTree(mTree, NodeFreeCallback, (void *)this);
-	}
-}
-
-
-#pragma mark -
-
-/*----------------------------------------------------------------------------
-	InsertNode
-	
-	Insert a node. Call the class's replace function by default.
-	
-	Returns true if replaced
-----------------------------------------------------------------------------*/
-Boolean CPatriciaTree::InsertNode(TPatriciaKey key, CPatriciaNode* nodeData)
-{
-	int	result = PatriciaInsert(mTree, NodeReplaceCallback, key, (void *)nodeData, (void *)this);
-	return (result == 1);
-}
-
-/*----------------------------------------------------------------------------
-	SeekNode
-	
-	Look for the node with the given key. Returns true if found
-----------------------------------------------------------------------------*/
-Boolean CPatriciaTree::SeekNode(TPatriciaKey key, CPatriciaNode**outNodeData)
-{
-	int	result = PatriciaSearch(mTree, key, (void **)outNodeData);
-	return (result == 1);
-}
-
-/*----------------------------------------------------------------------------
-	Traverse
-	
-	Traverse over every node in the tree. Returns true if traversed the entire
-	tree without halting.
-----------------------------------------------------------------------------*/
-Boolean CPatriciaTree::Traverse(NodeTraverseFunction traverseFcn, void *arg, void *refCon)
-{
-	int	result = PatriciaTraverse(mTree, traverseFcn, arg, refCon);
-	return (result == 0);
-}
-
-
-/*----------------------------------------------------------------------------
-	GetNumNodes
-	
-	Get the number of entries in the tree
-----------------------------------------------------------------------------*/
-long CPatriciaTree::GetNumNodes()
-{
-	return (mTree) ? PatriciaGetNumNodes(mTree) : 0;
-}
-
-
-#pragma mark -
-
-/*----------------------------------------------------------------------------
-	ReplaceNode
-	
-	Detault replace node implementation. Does nothing.
-	
-----------------------------------------------------------------------------*/
-int CPatriciaTree::ReplaceNode(CPatriciaNode**nodeDataPtr, TPatriciaKey key, CPatriciaNode *replaceData)
-{
-	return 0;
-}
-
-/*----------------------------------------------------------------------------
-	FreeNode
-	
-	Detault free node implementation. Does nothing.
-	
-----------------------------------------------------------------------------*/
-int CPatriciaTree::FreeNode(CPatriciaNode *nodeData, TPatriciaKey key)
-{
-	return 0;
-}
-
-
-#pragma mark -
-
-/*----------------------------------------------------------------------------
-	NodeReplaceCallback
-	
-	[static]
-	
-----------------------------------------------------------------------------*/
-int CPatriciaTree::NodeReplaceCallback(void**nodeDataPtr, unsigned char *key, void *replaceData, void *refCon)
-{
-	CPatriciaTree*		theTree = reinterpret_cast<CPatriciaTree *>(refCon);
-	Assert(theTree);
-	return theTree->ReplaceNode((CPatriciaNode**)nodeDataPtr, key, static_cast<CPatriciaNode *>(replaceData));
-}
-
-/*----------------------------------------------------------------------------
-	NodeTraverseCallback
-	
-	[static]
-	
-----------------------------------------------------------------------------*/
-int CPatriciaTree::NodeFreeCallback(void *nodeData, unsigned char *key, void *refCon)
-{
-	CPatriciaTree*		theTree = reinterpret_cast<CPatriciaTree *>(refCon);
-	Assert(theTree);
-	return theTree->FreeNode(static_cast<CPatriciaNode *>(nodeData), key);
-}
-
deleted file mode 100644
--- a/xpfe/bootstrap/appleevents/PatriciaTree.h
+++ /dev/null
@@ -1,101 +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.
- *
- * 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):
- *   Simon Fraser <sfraser@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 PatricaTree_h_
-#define PatricaTree_h_
-
-#include "patricia.h"
-
-// node base class. Subclass for your nodes.
-
-class CPatriciaNode
-{
-public:
-						CPatriciaNode()		{}
-	virtual				~CPatriciaNode()	{}
-};
-
-
-// tree base class. Subclass for your tree.
-
-class CPatriciaTree
-{
-public:
-	
-	typedef	const unsigned char*		TPatriciaKey;	
-	
-						CPatriciaTree(long keyBitsLen);
-	virtual				~CPatriciaTree();
-				
-	// override if you want variable replace functionality
-	// returns true if replaced
-	virtual Boolean			InsertNode(TPatriciaKey key, CPatriciaNode* nodeData);
-	
-	// returns true if found
-	Boolean				SeekNode(TPatriciaKey key, CPatriciaNode**outNodeData);
-	
-	// returns true if entire tree traversed
-	Boolean				Traverse(NodeTraverseFunction traverseFcn, void *arg, void *refCon);
-	
-	long					GetNumNodes();
-	
-protected:
-
-	// your implementation should override these.
-	virtual int				ReplaceNode(CPatriciaNode**nodeDataPtr, TPatriciaKey key, CPatriciaNode *replaceData);
-	virtual int				FreeNode(CPatriciaNode *nodeData, TPatriciaKey key);
-
-private:
-
-	// static callbacks.
-	static int				NodeReplaceCallback(void**nodeDataPtr, unsigned char *key, void *replaceData, void *refCon);
-	static int				NodeFreeCallback(void *nodeData, unsigned char *key, void *refCon);
-
-protected:
-
-	PatriciaTreeRef		mTree;
-	long					mKeyBits;
-
-};
-
-
-
-
-#endif // PatricaTree_h_
-
deleted file mode 100644
--- a/xpfe/bootstrap/appleevents/mozilla.sdef
+++ /dev/null
@@ -1,46 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE dictionary SYSTEM "file://localhost/System/Library/DTDs/sdef.dtd">
-
-<!--
-This file describes Mozilla's AppleScript dictionary. It's compiled into a .r file
-like this:
-/Developer/Tools/sdp -f a mozilla.sdef
--->
-
-<dictionary title="">
-	<suite name="SeaMonkey" code="MOZZ">
-
-	</suite>
-
-	<suite name="Spyglass" code="WWW!">
-
-		<commands>
-			<command name="OpenURL" code="WWW!OURL" description="Load a URL">
-				<direct-parameter type="string" description="URL to load"/>
-			</command>
-
-			<command name="register URL echo" code="WWW!RGUE" description="Register a URL echo handler. The handler will get called whenever a new URL is loaded">
-				<direct-parameter type="type" description="signature of listener"/>
-			</command>
-
-			<command name="unregister URL echo" code="WWW!UNRU" description="Cancels URL echo">
-				<direct-parameter type="type" description="signature of listener"/>
-			</command>
-
-		</commands>
-
-	</suite>
-
-
-	<suite name="Get URL" code="GURL">
-
-		<commands>
-			<command name="Get URL" code="GURLGURL" description="Load a URL">
-				<direct-parameter type="string" description="URL to load"/>
-				<parameter name="inside" code="HWIN" optional="optional" type="object" description="the window to load the URL in"/>
-			</command>
-		</commands>
-
-	</suite>
-
-</dictionary>
deleted file mode 100644
--- a/xpfe/bootstrap/appleevents/nsAEApplicationClass.cpp
+++ /dev/null
@@ -1,925 +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.
- *
- * 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):
- *   Simon Fraser <sfraser@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 ***** */
-
-
-#include <Sound.h>
-#include <Scrap.h>
-
-#include "nsAEUtils.h"
-#include "nsAETokens.h"
-#include "nsAECoreClass.h"
-#include "nsAEDocumentClass.h"
-#include "nsAEWindowClass.h"
-
-#include "nsAEApplicationClass.h"
-
-#include "nsINativeAppSupport.h"
-#include "nsCommandLineServiceMac.h"
-#include "nsCOMPtr.h"
-#include "nsIAppStartup.h"
-#include "nsXPFEComponentsCID.h"
-
-#include "nsComponentManagerUtils.h"
-#include "nsServiceManagerUtils.h"
-#include "nsAppRunner.h"
-
-/*----------------------------------------------------------------------------
-	AEApplicationClass 
-	
-----------------------------------------------------------------------------*/
-AEApplicationClass::AEApplicationClass()
-:	AEGenericClass(cApplication, typeNull)
-{
-}
-
-/*----------------------------------------------------------------------------
-	~AEApplicationClass 
-	
-----------------------------------------------------------------------------*/
-AEApplicationClass::~AEApplicationClass()
-{
-}
-
-#pragma mark -
-
-
-
-/*----------------------------------------------------------------------------
-	GetPropertyFromApp 
-	
-	Override default to customize behaviour.
-----------------------------------------------------------------------------*/
-void	AEApplicationClass::GetProperty(			DescType			desiredClass,
-										const AEDesc*		containerToken,
-										DescType			containerClass,
-										DescType			keyForm,
-										const AEDesc*		keyData,
-										AEDesc*			resultToken)
-{
-	OSErr			err;
-	CoreTokenRecord 	token;
-	DescType			requestedProperty = **(DescType**)keyData->dataHandle;
-	
-	token.dispatchClass	= GetClass();
-	token.objectClass    	= GetClass();
-	token.propertyCode 	= requestedProperty;
-
-	if (CanGetProperty(requestedProperty) || CanSetProperty(requestedProperty))
-	{
-		err = AECreateDesc(cProperty, (Ptr)&token, sizeof(CoreTokenRecord), resultToken);
-		ThrowIfOSErr(err);
-	}
-	else
-	{
-		ThrowIfOSErr(errAEEventNotHandled);
-	}
-}
-
-
-
-/*----------------------------------------------------------------------------
-	GetItemFromContainer 
-	
-	Not appropriate for the application
-----------------------------------------------------------------------------*/
-void AEApplicationClass::GetItemFromContainer(	DescType			desiredClass,
-										const AEDesc*		containerToken,
-										DescType			containerClass, 
-										DescType			keyForm,
-										const AEDesc*		keyData,
-										AEDesc*			resultToken)
-{
-	ThrowIfOSErr(errAEEventNotHandled);
-}
-
-
-#pragma mark -
-
-/*----------------------------------------------------------------------------
-	HandleClose 
-	
-----------------------------------------------------------------------------*/
-void AEApplicationClass::HandleClose(AEDesc *token, const AppleEvent *appleEvent, AppleEvent *reply)
-{
-	OSErr 	err 	= noErr;
-
-	StAEDesc	saving;
-	StAEDesc	savingIn;
-		
-	// Extract the [saving yes/no/ask] optional parameter, if present
-	err = AEGetParamDesc(appleEvent, 
-								  keyAESaveOptions, 
-								  typeWildCard, 
-								  &saving);
-								  
-	if (err != errAEDescNotFound)
-		ThrowIfOSErr(err);
-		
-	// Extract the [saving in <alias>] optional parameter, if present
-	err = AEGetParamDesc(appleEvent, 
-								  keyAEFile, 
-								  typeWildCard, 
-								  &savingIn);
-								  
-	if (err != errAEDescNotFound)
-		ThrowIfOSErr(err);
-			
-	// Check for any required parameters we may have missed
-	err = CheckForUnusedParameters(appleEvent);
-	ThrowIfOSErr(err);
-		
-	// Now, do the application-related work
-	SysBeep(2);
-		
-
-}
-
-/*----------------------------------------------------------------------------
-	HandleCount 
-	
-----------------------------------------------------------------------------*/
-void AEApplicationClass::HandleCount(AEDesc *token, const AppleEvent *appleEvent, AppleEvent *reply)
-{
-	OSErr	err 				= noErr;
-	long 		numberOfObjects 	= 0L;
-
-	DescType	objectClass;
-
-	if (!reply->dataHandle)
-		return;
-	
-	// Get the class of object that we will count
-	err = GetObjectClassFromAppleEvent(appleEvent, &objectClass);
-	ThrowIfOSErr(err);
-
-	// Make sure we got & handled all of the required parameters
-	err = CheckForUnusedParameters(appleEvent);
-	ThrowIfOSErr(err);
-	
-	// Send back the results
-	numberOfObjects = CountApplicationObjects(token, objectClass);
-	err = AEPutParamPtr(reply, keyAEResult, typeLongInteger, (Ptr)&numberOfObjects, sizeof(long));
-	ThrowIfOSErr(err);
-}
-
-
-/*----------------------------------------------------------------------------
-	HandleDataSize 
-	
-----------------------------------------------------------------------------*/
-void AEApplicationClass::HandleDataSize(AEDesc *token, const AppleEvent *appleEvent, AppleEvent *reply)
-{
-	OSErr 	err = noErr;
-	StAEDesc	data;
-	long		size  = 0L;
-	
-	// First, get the data
-	HandleGetData(token, appleEvent, reply);
-	
-	// now, extract it from the reply
-	err = AEGetKeyDesc(reply, keyDirectObject, typeWildCard, &data);
-	ThrowIfOSErr(err);
-	
-	size = data.GetDataSize();
-	
-	// do we leak all the data here?
-	err = AEPutParamPtr(reply, 
-								 keyAEResult, 
-								 typeLongInteger, 
-								 (Ptr)&size, 
-								 sizeof(long));
-	ThrowIfOSErr(err);
-}
-
-
-/*----------------------------------------------------------------------------
-	HandleDelete 
-
-	All attempts to delete an empty list are handled here
-	Application contains documents and windows, and they can't be deleted
-	
-----------------------------------------------------------------------------*/
-void AEApplicationClass::HandleDelete(AEDesc *token, const AppleEvent *appleEvent, AppleEvent *reply)
-{
-	OSErr	err = noErr;
-		
-	if (AEListUtils::TokenContainsTokenList(token))
-	{
-		long 			numItems;
-		
-		AECountItems(token, &numItems);
-
-		if (numItems > 0)
-			err = errAEEventNotHandled;
-	}
-
-	ThrowIfOSErr(err);
-}
-
-/*----------------------------------------------------------------------------
-	HandleDuplicate 
-	
-----------------------------------------------------------------------------*/
-void AEApplicationClass::HandleDuplicate(AEDesc *token, const AppleEvent *appleEvent, AppleEvent *reply)
-{
-	ThrowIfOSErr(errAEEventNotHandled);
-}
-
-/*----------------------------------------------------------------------------
-	HandleExists 
-
-	If <referenceToObject> exists...
-	The AEResolve() function in AERCoreSuite.c will already have filtered
-	out all cases where the object did not exist, so this function should
-	always return TRUE.
-	
-----------------------------------------------------------------------------*/
-void AEApplicationClass::HandleExists(AEDesc *token, const AppleEvent *appleEvent, AppleEvent *reply)
-{
-	OSErr	err 		= noErr;
-	Boolean	foundIt	= true;
-
-	err = AEPutParamPtr(reply, 
-					 keyAEResult, 
-					 typeBoolean, 
-					 (Ptr)&foundIt, 
-					 sizeof(Boolean));
-		
-	ThrowIfOSErr(err);
-}
-
-
-/*----------------------------------------------------------------------------
-	HandleMake 
-
-	
-----------------------------------------------------------------------------*/
-void AEApplicationClass::HandleMake(AEDesc *token, const AppleEvent *appleEvent, AppleEvent *reply)
-{
-	ThrowIfOSErr(errAEEventNotHandled);
-}
-
-/*----------------------------------------------------------------------------
-	HandleMove 
-
-	
-----------------------------------------------------------------------------*/
-void AEApplicationClass::HandleMove(AEDesc *token, const AppleEvent *appleEvent, AppleEvent *reply)
-{
-	ThrowIfOSErr(errAEEventNotHandled);
-}
-
-/*----------------------------------------------------------------------------
-	HandleRun 
-
-	
-----------------------------------------------------------------------------*/
-void AEApplicationClass::HandleRun(AEDesc *token, const AppleEvent *appleEvent, AppleEvent *reply)
-{
-	OSErr	err = noErr;
-
-        // do stuff on startup that we want to do
-        
-	err = CheckForUnusedParameters(appleEvent);
-	ThrowIfOSErr(err);
-}
-
-/*----------------------------------------------------------------------------
-	HandleReOpen 
-
-	
-----------------------------------------------------------------------------*/
-void AEApplicationClass::HandleReOpen(AEDesc *token, const AppleEvent *appleEvent, AppleEvent *reply)
-{
-  OSErr	err = noErr;
-  nsresult rv = NS_OK;
-  nsCOMPtr<nsINativeAppSupport> nas;
-
-  nas = do_CreateInstance(NS_NATIVEAPPSUPPORT_CONTRACTID);
-  if (!nas) ThrowIfOSErr(errAEEventNotHandled);
-
-  rv = nas->ReOpen();
-  if(NS_FAILED(rv)) ThrowIfOSErr(errAEEventNotHandled);    
-
-	err = CheckForUnusedParameters(appleEvent);
-	ThrowIfOSErr(err);
-}
-
-/*----------------------------------------------------------------------------
-	HandleOpen 
-
-	
-----------------------------------------------------------------------------*/
-void AEApplicationClass::HandleOpen(AEDesc *token, const AppleEvent *appleEvent, AppleEvent *reply)
-{
-	OSErr	err;
-	
-	err = CheckForUnusedParameters(appleEvent);
-	ThrowIfOSErr(err);
-
-	long 			numItems, i;
-	Boolean		openedGroups = false;
-
-	err = ::AECountItems(token, &numItems);
-	ThrowIfOSErr(err);
-	
-	for (i = 1; i <= numItems; i++)
-	{
-		FSSpec 		fSpec;
-		FInfo 		fndrInfo;
-		AEKeyword 	keywd;
-		DescType 		returnedType;
-		Size 			actualSize;
-
-		err = ::AEGetNthPtr(token, i, typeFSS, &keywd, &returnedType, (Ptr)&fSpec, sizeof(fSpec), &actualSize);
-		ThrowIfOSErr(err);
-		
-		err = ::FSpGetFInfo(&fSpec, &fndrInfo);
-		ThrowIfOSErr(err);
-
-		nsMacCommandLine&  cmdLine = nsMacCommandLine::GetMacCommandLine();
-		cmdLine.HandleOpenOneDoc(fSpec, fndrInfo.fdType);
-	}
-}
-
-
-/*----------------------------------------------------------------------------
-	HandlePrint 
-
-	
-----------------------------------------------------------------------------*/
-void AEApplicationClass::HandlePrint(AEDesc *token, const AppleEvent *appleEvent, AppleEvent *reply)
-{
-	OSErr	err=noErr;
-	
-	err = CheckForUnusedParameters(appleEvent);
-	ThrowIfOSErr(err);
-
-	long 			numItems, i;
-	Boolean		openedGroups = false;
-
-	err = ::AECountItems(token, &numItems);
-	ThrowIfOSErr(err);
-	
-	for (i = 1; i <= numItems; i++)
-	{
-		FSSpec 		fSpec;
-		FInfo 		fndrInfo;
-		AEKeyword 	keywd;
-		DescType 		returnedType;
-		Size 			actualSize;
-
-		err = ::AEGetNthPtr(token, i, typeFSS, &keywd, &returnedType, (Ptr)&fSpec, sizeof(fSpec), &actualSize);
-		ThrowIfOSErr(err);
-		
-		err = ::FSpGetFInfo(&fSpec, &fndrInfo);
-		ThrowIfOSErr(err);
-
-		nsMacCommandLine&  cmdLine = nsMacCommandLine::GetMacCommandLine();
-		cmdLine.HandlePrintOneDoc(fSpec, fndrInfo.fdType);
-	}
-}
-
-/*----------------------------------------------------------------------------
-	HandleQuit 
-
-	
-----------------------------------------------------------------------------*/
-void AEApplicationClass::HandleQuit(AEDesc *token, const AppleEvent *appleEvent, AppleEvent *reply)
-{
-	// get optional saving param
-	StAEDesc		savingParam;
-	TAskSave		askSave = eSaveUnspecified;
-	
-	OSErr	err = ::AEGetKeyDesc(appleEvent, keyAESaveOptions, typeEnumeration, &savingParam);
-	if (err != errAEDescNotFound)
-	{
-		DescType		enumValue = savingParam.GetEnumType();
-		
-		switch (enumValue)
-		{
-			case 'yes ':		askSave = eSaveYes;		break;
-			case 'no  ':		askSave = eSaveNo;			break;
-			case 'ask ':		askSave = eSaveAsk;		break;
-		}
-	}
-	
-	err = CheckForUnusedParameters(appleEvent);
-	ThrowIfOSErr(err);
-
-	nsMacCommandLine&  cmdLine = nsMacCommandLine::GetMacCommandLine();
-	err = cmdLine.Quit(askSave);
-	ThrowIfOSErr(err);
-}
-
-/*----------------------------------------------------------------------------
-	HandleSave 
-
-	
-----------------------------------------------------------------------------*/
-void AEApplicationClass::HandleSave(AEDesc *token, const AppleEvent *appleEvent, AppleEvent *reply)
-{
-	ThrowIfOSErr(errAEEventNotHandled);
-}
-
-#if 0
-/*----------------------------------------------------------------------------
-	HandleSetData 
-
-	
-----------------------------------------------------------------------------*/
-void AEApplicationClass::HandleSetData(AEDesc *token, const AppleEvent *appleEvent, AppleEvent *reply)
-{
-	OSErr 			err 		= noErr;	
-	StAEDesc			tokenData;
-	AETokenDesc		tokenDesc(token);
-	DescType		 	propertyCode;
-			
-	if (token->descriptorType == cProperty)
-	{
-		propertyCode = tokenDesc.GetPropertyCode();
-
-		if (CanSetProperty(propertyCode))
-		{
-			// only the clipboard property is writeable
-			// the clipboard data should be in a list, so we extract that list
-			switch (propertyCode)
-			{
-				case pClipboard:
-					err = AEGetKeyDesc(appleEvent, keyAEData, typeAEList, &tokenData);
-					ThrowIfOSErr(err);
-					
-					SetDataForObject(token, &tokenData);		// may throw
-
-					err = AEPutKeyDesc(reply, keyDirectObject, &tokenData);	// return the requested data
-					ThrowIfOSErr(err);
-					break;
-					
-				default:
-					ThrowIfOSErr(errAENotModifiable);  // "Can't set xxx to nnn"
-					break;
-			}
-		}
-		else
-		{
-			ThrowIfOSErr(errAENotModifiable);
-		}
-	}
-	else
-	{
-		ThrowIfOSErr(errAEEventNotHandled);
-	}
-	
-}
-#endif
-
-#pragma mark -
-
-/*----------------------------------------------------------------------------
-	CountObjects 
-	
-----------------------------------------------------------------------------*/
-void AEApplicationClass::CountObjects(				DescType 		 	desiredType,
-											DescType 		 	containerClass,
-											const AEDesc *		container,
-							   				long *			result)
-{
-	long		numberOfObjects = CountApplicationObjects(container, desiredType);
-	*result = numberOfObjects;
-}
-
-#pragma mark -
-
-/*----------------------------------------------------------------------------
-	GetDataFromObject 
-	
-----------------------------------------------------------------------------*/
-void AEApplicationClass::GetDataFromObject(const AEDesc *token, AEDesc *desiredTypes, AEDesc *data)
-{
-	OSErr					err	= noErr;
-	
-	Str255					applicationName = "\p";
-	Str255					versionString;
-	
-	ConstAETokenDesc				tokenDesc(token);
-	
-	ProcessSerialNumber		applicationProcessNumber;
-	ProcessInfoRec				applicationInfo;
-	FSSpec					appFSSpec;
-
-	Boolean           				isFrontProcess 		= true;	// еее !gInBackground;
-	
-	DescType					aDescType		= cApplication;
-	
-	long						documentNumber	= 0L;
-	unsigned long				elementNumber		= 0L;
-		
-	Boolean					usePropertyCode	= tokenDesc.UsePropertyCode();
-	DescType					propertyCode;
-	
-	long 						free;
-	long 						contiguous;
-	unsigned long 				ticks;
-
-	err = GetCurrentProcess(&applicationProcessNumber);	
-	
-	if (err == noErr)
-	{
-		applicationInfo.processInfoLength 	= sizeof(ProcessInfoRec);
-		applicationInfo.processName 		= applicationName;
-		applicationInfo.processAppSpec 	= &appFSSpec;
-		err = GetProcessInformation(&applicationProcessNumber, &applicationInfo);
-	}
-				
-	GetShortVersionString(2, versionString);
-	PurgeSpace(&free, &contiguous);
-				
-	ticks = TickCount();
-
-	propertyCode = tokenDesc.GetPropertyCode();
-	
-	switch (propertyCode)
-	{
-		case pProperties:
-			err = AECreateList(nil, 0, true, data);
-			ThrowIfOSErr(err);
-
-			err = AEPutKeyPtr(data, pObjectType, 		typeType, 		&aDescType, sizeof(DescType));
-			err = AEPutKeyPtr(data, pName,       		typeChar, 		&applicationName[1], applicationName[0]);
-			err = AEPutKeyPtr(data, pVersion,    		typeChar, 		&versionString[1], versionString[0]);
-			err = AEPutKeyPtr(data, pIsFrontProcess,	typeBoolean, 		&isFrontProcess, sizeof(Boolean));
-			err = AEPutKeyPtr(data, pFreeMemory,		typeLongInteger, 	&free, sizeof(long));
-			err = AEPutKeyPtr(data, pLargestFreeBlock,	typeLongInteger, 	&contiguous, sizeof(long));
-			err = AEPutKeyPtr(data, pTicks,			typeLongInteger, 	&ticks, sizeof(long));
-			break;
-			
-		case pBestType:
-		case pClass:
-		case pDefaultType:
-		case pObjectType:
-			err = AECreateDesc(typeType, &aDescType, sizeof(DescType), data);
-			break;
-			
-		case pName:	
-			err = AECreateDesc(typeChar, &applicationName[1], applicationName[0], data);
-			break;
-
-		case pVersion:
-			err = AECreateDesc(typeChar, &versionString[1], versionString[0], data);
-			break;
-
-		case pIsFrontProcess:
-			err = AECreateDesc(typeBoolean, &isFrontProcess, sizeof(Boolean), data);
-			break;
-
-		case pFreeMemory:
-			err = AECreateDesc(typeLongInteger, &free, sizeof(long), data);
-			break;
-			
-		case pLargestFreeBlock:
-			err = AECreateDesc(typeLongInteger, &contiguous, sizeof(long), data);
-			break;
-			
-		case pTicks:
-			err = AECreateDesc(typeLongInteger, &ticks, sizeof(long), data);
-			break;
-			
-		case pClipboard:
-#if !TARGET_CARBON		
-			{
-				//	Return all of the items currently on the clipboard.
-				//	The returned information is an AEList, and each data type
-				//	on the scrap gets its own entry in the list
-				//	Since the OS doesn't supply the tools for getting all
-				//	of the types in the scrap, we have to scan the scrap ourselves
-
-				char			*scrapPtr;
-				char			*scrapEnd;
-				PScrapStuff	 scrapInfo;
-				OSType		 itemType;
-				long			 itemLength;
-				long			 index;
-				
-				err = AECreateList(NULL, 0, false, data);
-				ThrowIfOSErr(err);
-				
-				err = LoadScrap();										//	Make sure the scrap is in memory, not on disk.
-				ThrowIfOSErr(err);
-				
-				scrapInfo = InfoScrap();								//	Get the base address of the scrap in RAM
-				MoveHHi(scrapInfo->scrapHandle);
-				HLock  (scrapInfo->scrapHandle);						// ...and lock it
-				
-				scrapPtr = (char *)*scrapInfo->scrapHandle;
-				scrapEnd = scrapPtr + scrapInfo->scrapSize;
-				
-				// scan the scrap in memory and extract each scrap type
-				
-				index = 1;
-				while (scrapPtr < scrapEnd) 
-				{
-					itemType = *(OSType *)scrapPtr;
-					scrapPtr += sizeof(itemType);
-					itemLength = *(long *)scrapPtr;
-					scrapPtr += sizeof(itemLength);
-					
-					// Move this information into the next entry on the list
-					err = AEPutPtr(data, index, itemType, scrapPtr, itemLength);
-					ThrowIfOSErr(err);
-						
-					index++;
-					
-					// Adjust the pointer to the start of the next item
-					
-					if (itemLength & 1) 
-						itemLength++; 										// If it's odd, make it even
-						
-					scrapPtr += itemLength;
-				}
-				HUnlock  (scrapInfo->scrapHandle);
-			}
-#endif
-			break;
-
-		default:
-			Inherited::GetDataFromObject(token, desiredTypes, data);
-			break;
-	}
-
-	ThrowIfOSErr(err);
-}
-
-/*----------------------------------------------------------------------------
-	SetDataForObject 
-	
-	Assumption: HandleSetData() has already filtered out all attempts
-	to write to a read-only property.
-	
-----------------------------------------------------------------------------*/
-void AEApplicationClass::SetDataForObject(const AEDesc *token, AEDesc *data)
-{
-	OSErr				err			= noErr;
-	ConstAETokenDesc			tokenDesc(token);
-	Boolean				usePropertyCode     = tokenDesc.UsePropertyCode();
-	DescType				propertyCode;
-	
-	if (usePropertyCode)
-	{
-		propertyCode = tokenDesc.GetPropertyCode();
-		
-#if !TARGET_CARBON
-		long			numItems;
-#endif
-		switch (propertyCode)
-		{
-			// the clipboard is the only writeable property for the application object
-			case pClipboard:
-				//	The data should be an AE list containing a series of things to be placed on the
-				//	clipboard. The data type of each item is also the clipboard type for that data
-#if !TARGET_CARBON
-				err = ZeroScrap();
-				ThrowIfOSErr(err);
-				
-				AECountItems(data, &numItems);
-				
-				//  Copy each item onto the clipboard
-				
-				for (long index = 1; index <= numItems; index++) 
-				{
-					StAEDesc		currentItemDesc;
-					AEKeyword 		theAEKeyword;
-					err = AEGetNthDesc(data, index, typeWildCard, &theAEKeyword, &currentItemDesc);
-					ThrowIfOSErr(err);
-						
-					HLock(currentItemDesc.dataHandle);
-					err = PutScrap(GetHandleSize(currentItemDesc.dataHandle), 
-										  currentItemDesc.descriptorType,
-								   	 	*currentItemDesc.dataHandle);
-					ThrowIfOSErr(err);
-				}
-#endif
-				break;
-				
-			default:
-				ThrowIfOSErr(errAENotModifiable);
-		}
-	}
-	
-}
-
-
-/*----------------------------------------------------------------------------
-	GetKeyEventDataAs 
-
-----------------------------------------------------------------------------*/
-DescType AEApplicationClass::GetKeyEventDataAs(DescType propertyCode)
-{
-	DescType		returnType;
-
-	switch (propertyCode)
-	{
-		case pClipboard:
-			returnType = typeAEList;
-			break;
-			
-		default:
-			returnType = typeWildCard;
-	
-	}
-	return returnType;
-}
-
-
-#pragma mark -
-
-/*----------------------------------------------------------------------------
-	CanSetProperty 
-		
-----------------------------------------------------------------------------*/
-Boolean AEApplicationClass::CanSetProperty(DescType propertyCode)
-{
-	Boolean result = false;
-	
-	switch (propertyCode)
-	{
-		// Properties we can set:
-		
-		case pClipboard:
-			result = true;
-			break;
-			
-		// Properties we should be able to set, but they're not implemented yet:
-		
-					
-		// Properties that are read-only
-
-		case pBestType:
-		case pClass:
-		case pDefaultType:
-		case pObjectType:
-		
-		case pProperties:
-		
-		case pFreeMemory:
-		case pLargestFreeBlock:
-		case pTicks:
-
-		case pIsFrontProcess:
-		case pName:
-		case pVersion:
-		case pInsertionLoc:
-		case pSelection:
-		case pUserSelection:
-			result = false;
-			break;
-		
-		default:
-			result = Inherited::CanSetProperty(propertyCode);
-			break;
-	}
-	
-	return result;
-}
-
-
-/*----------------------------------------------------------------------------
-	CanGetProperty 
-	
-----------------------------------------------------------------------------*/
-Boolean AEApplicationClass::CanGetProperty(DescType propertyCode)
-{
-	Boolean result = false;
-	
-	switch (propertyCode)
-	{
-		// Properties we can get:
-
-		case pBestType:
-		case pClass:
-		case pDefaultType:
-		case pObjectType:
-			
-		case pProperties:
-		
-		case pFreeMemory:
-		case pLargestFreeBlock:
-		case pTicks:
-
-		case pIsFrontProcess:
-		case pName:
-		case pVersion:
-		case pInsertionLoc:
-		case pSelection:
-		case pUserSelection:
-			result = true;
-			break;
-			
-		// Properties we should be able to get, but they're not implemented yet:
-					
-		// Properties we should not be able to get:
-		
-		default:
-			result = Inherited::CanGetProperty(propertyCode);
-			break;
-	}
-	
-	return result;
-}
-
-
-#pragma mark -
-
-/*----------------------------------------------------------------------------
-	CreateSelfSpecifier 
-
-----------------------------------------------------------------------------*/
-void AEApplicationClass::CreateSelfSpecifier(const AEDesc *token, AEDesc *outSpecifier)
-{
-	OSErr	err = ::AECreateDesc(typeNull, nil, 0, outSpecifier);
-	ThrowIfOSErr(err);
-}
-
-#pragma mark -
-
-/*----------------------------------------------------------------------------
-	CountApplicationObjects 
-	
-----------------------------------------------------------------------------*/
-long AEApplicationClass::CountApplicationObjects(const AEDesc *token, DescType desiredType)
-{
-	long		numberOfObjects = 0;
-	OSErr	err = noErr;
-	
-	if (AEListUtils::TokenContainsTokenList(token))
-	{
-		err = AECountItems(token, &numberOfObjects);
-	}
-	else
-	{
-		AEDispatchHandler*	countHandler = AECoreClass::sAECoreHandler->GetDispatchHandler(desiredType);
-		if (countHandler == nil)
-			ThrowOSErr(errAEEventNotHandled);
-		
-		countHandler->CountObjects(desiredType, typeNull, token, &numberOfObjects);
-		/*
-		switch (desiredType)
-		{
-			case cDocument:
-				numberOfObjects = AEDocumentClass::CountDocuments();
-				break;
-
-			case cWindow:
-				numberOfObjects = AEWindowClass::CountWindows(kAnyWindowKind);
-				break;
-			
-			// application specific classes
-			case cGroupWindow:
-				numberOfObjects = AEWindowClass::CountWindows(kUserGroupWindowKind);
-				break;
-			
-			
-			default:
-				err = errAEEventNotHandled;
-				break;
-		}
-		*/
-	}
-
-	ThrowIfOSErr(err);
-	return numberOfObjects;
-}
deleted file mode 100644
--- a/xpfe/bootstrap/appleevents/nsAEApplicationClass.h
+++ /dev/null
@@ -1,119 +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.
- *
- * 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):
- *   Simon Fraser <sfraser@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 __AEAPPLICATIONCLASS__
-#define __AEAPPLICATIONCLASS__
-
-#include "nsAEGenericClass.h"
-#include "nsAEDocumentClass.h"		// for document typedef
-
-class AEApplicationClass : public AEGenericClass
-{
-	friend class AECoreClass;
-	friend class AEDocumentClass;
-
-private:
-	typedef AEGenericClass	Inherited;
-	
-protected:
-	// only the AECoreClass can instantiate us
-						AEApplicationClass();
-						~AEApplicationClass();
-
-protected:
-
-	// Accessors
-	virtual void			GetProperty(				DescType			desiredClass,
-												const AEDesc*		containerToken,
-												DescType			containerClass,
-												DescType			keyForm,
-												const AEDesc*		keyData,
-												AEDesc*			resultToken);
-
-	virtual void			GetItemFromContainer(		DescType			desiredClass,
-												const AEDesc*		containerToken,
-												DescType			containerClass, 
-												DescType			keyForm,
-												const AEDesc*		keyData,
-												AEDesc*			resultToken);
-			
-	void 					CountObjects(				DescType 		 	desiredType,
-												DescType 		 	containerClass,
-												const AEDesc *		container,
-								   				long *			result);
-
-protected:
-
-	// ----------------------------------------------------------------------------
-	//	Core Suite Object Event handlers
-	// ----------------------------------------------------------------------------
-	virtual void			HandleClose(AEDesc *token, const AppleEvent *appleEvent, AppleEvent *reply);
-	virtual void			HandleCount(AEDesc *token, const AppleEvent *appleEvent, AppleEvent *reply);
-	//virtual void			HandleSetData(AEDesc *token, const AppleEvent *appleEvent, AppleEvent *reply);
-	virtual void			HandleDataSize(AEDesc *token, const AppleEvent *appleEvent, AppleEvent *reply);
-	virtual void			HandleDelete(AEDesc *token, const AppleEvent *appleEvent, AppleEvent *reply);
-	virtual void			HandleDuplicate(AEDesc *token, const AppleEvent *appleEvent, AppleEvent *reply);
-	virtual void			HandleExists(AEDesc *token, const AppleEvent *appleEvent, AppleEvent *reply);
-	virtual void			HandleMake(AEDesc *token, const AppleEvent *appleEvent, AppleEvent *reply);
-	virtual void			HandleMove(AEDesc *token, const AppleEvent *appleEvent, AppleEvent *reply);
-	virtual void			HandleRun(AEDesc *token, const AppleEvent *appleEvent, AppleEvent *reply);
-	virtual void			HandleReOpen(AEDesc *token, const AppleEvent *appleEvent, AppleEvent *reply);
-	virtual void			HandleOpen(AEDesc *token, const AppleEvent *appleEvent, AppleEvent *reply);
-	virtual void			HandlePrint(AEDesc *token, const AppleEvent *appleEvent, AppleEvent *reply);
-	virtual void			HandleQuit(AEDesc *token, const AppleEvent *appleEvent, AppleEvent *reply);
-	virtual void			HandleSave(AEDesc *token, const AppleEvent *appleEvent, AppleEvent *reply);
-	
-	virtual void			CreateSelfSpecifier(const AEDesc *token, AEDesc *outSpecifier);
-
-	virtual void			GetDataFromObject(const AEDesc *token, AEDesc *desiredTypes, AEDesc *data);
-	virtual void			SetDataForObject(const AEDesc *token, AEDesc *data);
-	
-	virtual Boolean			CanSetProperty(DescType propertyCode);
-	virtual Boolean			CanGetProperty(DescType propertyCode);
-
-	virtual DescType		GetKeyEventDataAs(DescType propertyCode);
-
-protected:
-	long					CountApplicationObjects(const AEDesc *token, DescType desiredType);
-	
-};
-
-
-
-
-#endif /* __AEAPPLICATIONCLASS__ */
deleted file mode 100644
--- a/xpfe/bootstrap/appleevents/nsAEClassDispatcher.cpp
+++ /dev/null
@@ -1,263 +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.
- *
- * 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):
- *   Simon Fraser <sfraser@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 ***** */
-
-
-#include "nsAEUtils.h"
-
-#include "nsAEGenericClass.h"
-#include "nsAEClassDispatcher.h"
-
-
-/*----------------------------------------------------------------------------
-	AEDispatchHandler 
-	
-	Ownership of the handler passes to this object
-----------------------------------------------------------------------------*/
-
-AEDispatchHandler::AEDispatchHandler(DescType handlerClass, AEGenericClass* handler, Boolean deleteOnRemove /* = true*/ )
-:	mDeleteHandler(deleteOnRemove)
-,	mHandlerClass(handlerClass)
-,	mHandler(handler)
-{
-	AE_ASSERT(mHandler, "No handler");
-}
-
-
-/*----------------------------------------------------------------------------
-	AEDispatchHandler 
-	
-----------------------------------------------------------------------------*/
-AEDispatchHandler::~AEDispatchHandler()
-{
-	if (mDeleteHandler)
-		delete mHandler;
-}
-
-
-/*----------------------------------------------------------------------------
-	DispatchEvent 
-	
-----------------------------------------------------------------------------*/
-void AEDispatchHandler::DispatchEvent(				AEDesc *			token,
-											const AppleEvent *	appleEvent,
-											AppleEvent *		reply)
-{
-	AE_ASSERT(mHandler, "No handler");
-	mHandler->DispatchEvent(token, appleEvent, reply);
-}
-
-/*----------------------------------------------------------------------------
-	GetProperty 
-	
-----------------------------------------------------------------------------*/
-void AEDispatchHandler::GetProperty(				DescType			desiredClass,
-											const AEDesc*		containerToken,
-											DescType			containerClass,
-											DescType			keyForm,
-											const AEDesc*		keyData,
-											AEDesc*			resultToken)
-{
-	AE_ASSERT(mHandler, "No handler");
-	mHandler->GetProperty(desiredClass, containerToken, containerClass, keyForm, keyData, resultToken);
-}
-
-/*----------------------------------------------------------------------------
-	GetDataFromListOrObject 
-	
-----------------------------------------------------------------------------*/
-void	AEDispatchHandler::GetDataFromListOrObject(		const AEDesc *		tokenOrTokenList,
-											AEDesc *			desiredTypes,
-											AEDesc *			data)
-{
-	AE_ASSERT(mHandler, "No handler");
-	mHandler->GetDataFromListOrObject(tokenOrTokenList, desiredTypes, data);
-}
-
-
-/*----------------------------------------------------------------------------
-	GetItemFromContainer 
-	
-----------------------------------------------------------------------------*/
-void	AEDispatchHandler::GetItemFromContainer(			DescType			desiredClass,
-												const AEDesc*		containerToken,
-												DescType			containerClass, 
-												DescType			keyForm,
-												const AEDesc*		keyData,
-												AEDesc*			resultToken)
-{
-	AE_ASSERT(mHandler, "No handler");
-	mHandler->GetItemFromContainer(desiredClass, containerToken, containerClass, keyForm, keyData, resultToken);
-}
-
-
-/*----------------------------------------------------------------------------
-	CompareObjects 
-	
-----------------------------------------------------------------------------*/
-void AEDispatchHandler::CompareObjects(					DescType			comparisonOperator,
-												const AEDesc *		object,
-												const AEDesc *		descriptorOrObject,
-												Boolean *			result)
-{
-	AE_ASSERT(mHandler, "No handler");
-	mHandler->CompareObjects(comparisonOperator, object, descriptorOrObject, result);
-}
-
-
-
-/*----------------------------------------------------------------------------
-	CountObjects 
-	
-----------------------------------------------------------------------------*/
-void AEDispatchHandler::CountObjects(					DescType 		 	desiredType,
-												DescType 		 	containerClass,
-												const AEDesc *		container,
-								   				long *			result)
-{
-	AE_ASSERT(mHandler, "No handler");
-	mHandler->CountObjects(desiredType, containerClass, container, result);
-}
-
-
-/*----------------------------------------------------------------------------
-	CreateSelfSpecifier 
-	
-----------------------------------------------------------------------------*/
-void AEDispatchHandler::CreateSelfSpecifier(				const AEDesc *		token,
-												AEDesc *			outSpecifier)
-{
-	AE_ASSERT(mHandler, "No handler");
-	mHandler->CreateSelfSpecifier(token, outSpecifier);
-}
-
-#pragma mark -
-
-
-/*----------------------------------------------------------------------------
-	AEDispatchTree 
-	
-----------------------------------------------------------------------------*/
-AEDispatchTree::AEDispatchTree()
-:	mTree(nil)
-{
-	
-	mTree = PatriciaInitTree(8 * sizeof(DescType));
-	ThrowIfNil(mTree);
-}
-
-
-/*----------------------------------------------------------------------------
-	~AEDispatchTree 
-	
-----------------------------------------------------------------------------*/
-AEDispatchTree::~AEDispatchTree()
-{
-	if (mTree)
-		PatriciaFreeTree(mTree, FreeDispatchTreeNodeData, this);
-}
-
-
-/*----------------------------------------------------------------------------
-	InsertHandler 
-	
-----------------------------------------------------------------------------*/
-void AEDispatchTree::InsertHandler(DescType handlerClass, AEGenericClass *handler, Boolean isDuplicate /* = false */)
-{
-	AEDispatchHandler	*newHandler = new AEDispatchHandler(handlerClass, handler, !isDuplicate);
-	unsigned char		key[5] = {0};				
-	int				result;
-	
-	*(DescType *)key = handlerClass;
-	
-	result = PatriciaInsert(mTree, nil, key, newHandler, nil);
-	if (result == kDuplicateKeyError || result == 1)
-	{
-		ThrowIfOSErr(kDuplicateKeyError);
-	}
-	else if (result != 0)
-	{
-		ThrowIfOSErr(result);
-	}
-}
-
-
-/*----------------------------------------------------------------------------
-	FindHandler 
-	
-
-----------------------------------------------------------------------------*/
-AEDispatchHandler* AEDispatchTree::FindHandler(DescType handlerClass)
-{
-	AEDispatchHandler*	foundClass = nil;
-	unsigned char		key[5] = {0};				
-	
-	*(DescType *)key = handlerClass;
-
-	(void)PatriciaSearch(mTree, key, (void**)&foundClass);
-	
-	return foundClass;
-}
-
-/*----------------------------------------------------------------------------
-	ReplaceDispatchTreeNode 
-	
-	static
-	
-	if this ever gets called, it means we tried to insert a node for a duplicate class,
-	which is an error. So return an error. We don't want to throw because the
-	patricia code may not be exception-safe.
-----------------------------------------------------------------------------*/
-int AEDispatchTree::ReplaceDispatchTreeNode(void *nodeData, unsigned char *key, void *replaceData)
-{
-	return kDuplicateKeyError;
-}
-
-/*----------------------------------------------------------------------------
-	FreeDispatchTreeNodeData 
-	
-	static
-----------------------------------------------------------------------------*/
-int AEDispatchTree::FreeDispatchTreeNodeData(void *nodeData, unsigned char *key, void *refCon)
-{
-	AEDispatchTree*	dispatchTree = reinterpret_cast<AEDispatchTree *>(refCon);
-	AEDispatchHandler*	handler = reinterpret_cast<AEDispatchHandler *>(nodeData);
-	
-	delete handler;
-	return 0;
-}
-
deleted file mode 100644
--- a/xpfe/bootstrap/appleevents/nsAEClassDispatcher.h
+++ /dev/null
@@ -1,130 +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.
- *
- * 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):
- *   Simon Fraser <sfraser@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 __AECLASSDISPATCHER__
-#define __AECLASSDISPATCHER__
-
-
-#include "patricia.h"
-
-// this class is used to dispatch calls to handlers on the basis of their class. It avoids
-// us having to switch on the class in the code.
-
-class AEGenericClass;
-
-class AEDispatchHandler
-{
-public:
-						AEDispatchHandler(DescType handlerClass, AEGenericClass* handler, Boolean deleteOnRemove = true);
-						~AEDispatchHandler();
-						
-						
-	void					DispatchEvent(					AEDesc *			token,
-													const AppleEvent *	appleEvent,
-													AppleEvent *		reply);
-
-	void					GetProperty(					DescType			desiredClass,
-													const AEDesc*		containerToken,
-													DescType			containerClass,
-													DescType			keyForm,
-													const AEDesc*		keyData,
-													AEDesc*			resultToken);
-													
-	void					GetDataFromListOrObject(			const AEDesc *		tokenOrTokenList,
-													AEDesc *			desiredTypes,
-													AEDesc *			data);
-
-	void					GetItemFromContainer(			DescType			desiredClass,
-													const AEDesc*		containerToken,
-													DescType			containerClass, 
-													DescType			keyForm,
-													const AEDesc*		keyData,
-													AEDesc*			resultToken);
-
-	void					CompareObjects(				DescType			comparisonOperator,
-													const AEDesc *		object,
-													const AEDesc *		descriptorOrObject,
-													Boolean *			result);
-
-
-	void					CountObjects(					DescType 		 	desiredType,
-													DescType 		 	containerClass,
-													const AEDesc *		container,
-									   				long *			result);
-
-	void					CreateSelfSpecifier(				const AEDesc *		token,
-													AEDesc *			outSpecifier);
-													
-protected:
-	
-	Boolean				mDeleteHandler;
-	DescType				mHandlerClass;
-	AEGenericClass*		mHandler;
-};
-
-
-
-class AEDispatchTree
-{
-public:
-						AEDispatchTree();
-						~AEDispatchTree();
-						
-	void					InsertHandler(DescType handlerClass, AEGenericClass *handler, Boolean isDuplicate = false);
-	AEDispatchHandler*		FindHandler(DescType handlerClass);
-	
-protected:
-
-	enum {
-		kDuplicateKeyError = 750
-	};
-	
-	static int 				FreeDispatchTreeNodeData(void *nodeData, unsigned char *key, void *refCon);
-	static int 				ReplaceDispatchTreeNode(void *nodeData, unsigned char *key, void *replaceData);
-	
-	
-protected:
-
-	PatriciaTreeRef		mTree;
-};
-
-
-
-#endif /* __AECLASSDISPATCHER__ */
-
deleted file mode 100644
--- a/xpfe/bootstrap/appleevents/nsAEClassIterator.cpp
+++ /dev/null
@@ -1,472 +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.
- *
- * 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):
- *   Simon Fraser <sfraser@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 ***** */
-
-
-#include "nsAEUtils.h"
-#include "nsAETokens.h"
-
-#include "nsAEClassIterator.h"
-
-
-const AEClassIterator::ItemRef		AEClassIterator::kNoItemRef = -1;
-const AEClassIterator::ItemID		AEClassIterator::kNoItemID = -1;
-
-/*----------------------------------------------------------------------------
-	GetItemFromContainer 
-	
-----------------------------------------------------------------------------*/
-void AEClassIterator::GetItemFromContainer(		DescType			desiredClass,
-										const AEDesc*		containerToken,
-										DescType			containerClass, 
-										DescType			keyForm,
-										const AEDesc*		keyData,
-										AEDesc*			resultToken)
-{
-	OSErr				err	= noErr;
-	
-	CStr255				itemName;
-	ItemRef				itemRef = kNoItemRef;
-	ItemID				itemID = kNoItemID;
-	DescType				keyDataType 	= keyData->descriptorType;
-
-	Boolean				wantsAllItems	= false;
-
-	StAEDesc 				startObject;	// These are used to resolve formRange
-	StAEDesc 				stopObject;
-		
-	CoreTokenRecord		token;
-	
-	long					numItems = GetNumItems(containerToken);
-	TAEListIndex			itemIndex;
-	
-	CheckKeyFormSupport(keyForm);		// throws on error
-	
-	switch (keyForm)
-	{
-		case formName:																// item by name
-			if (DescToCString(keyData, itemName, 255) != noErr)
-				ThrowIfOSErr(errAECoercionFail);
-
-			itemRef = GetNamedItemReference(containerToken, itemName);
-			if (itemRef == kNoItemRef)
-				ThrowIfOSErr(errAENoSuchObject);
-			break;
-		
-		case formAbsolutePosition:														// item by number
-			itemIndex = NormalizeAbsoluteIndex(keyData, numItems, &wantsAllItems);
-			if (wantsAllItems == false)
-			{
-				if (itemIndex == 0 || itemIndex > numItems)
-					ThrowOSErr(errAEIllegalIndex);
-			}
-			itemRef = GetIndexedItemReference(containerToken, itemIndex);
-			if (itemRef == kNoItemRef)
-				ThrowOSErr(errAENoSuchObject);
-			break;	
-		
-		case formRelativePosition:
-			itemRef = ProcessFormRelativePostition(containerToken, keyData);
-			break;	
-		
-		case formRange:
-			switch (keyDataType)
-			{		
-				case typeRangeDescriptor:
-					{
-						ProcessFormRange((AEDesc *)keyData, &startObject, &stopObject);
-						
-						ConstAETokenDesc	startToken(&startObject);
-						ConstAETokenDesc	stopToken(&stopObject);
-						DescType 		startType = startToken.GetDispatchClass();
-						DescType 		stopType  = stopToken.GetDispatchClass();
-	 
-						if (startType != mClass || stopType != mClass)
-							ThrowOSErr(errAEWrongDataType);
-					}
-					break;
-
-				default:
-					ThrowOSErr(errAEWrongDataType);
-					break;	
-			}
-			break;	
-		
-		default:
-			ThrowIfOSErr(errAEEventNotHandled);
-	}
-	
-	// if user asked for all items, and there aren't any,
-	// we'll be kind and return an empty list.
-
-	if (wantsAllItems && (err == errAENoSuchObject || err == errAEIllegalIndex))
-	{
-		err = AECreateList(nil, 0, false, (AEDescList*)resultToken);
-		ThrowIfOSErr(err);
-		return;
-	}
-
-	ThrowIfOSErr(err);
-
-	// fill in the result token
-	token.dispatchClass 	= GetClass();
-	token.objectClass	= GetClass();
-	token.propertyCode 	= typeNull;
-	
-	if (wantsAllItems)
-	{
-		err = AECreateList(NULL, 0, false, (AEDescList*)resultToken);
-		ThrowIfOSErr(err);
-		
-		for (TAEListIndex index = 1; index <= numItems; index++)
-		{
-			ItemID		itemID = GetIndexedItemID(containerToken, index);
-			if (itemID != kNoItemID)
-			{
-				SetItemIDInCoreToken(containerToken, &token, itemID);
-				err = AEPutPtr(resultToken, 0, desiredClass, &token, sizeof(token));
-				ThrowIfOSErr(err);
-			}
-		}
-	}
-	else if (keyForm == formRange)
-	{
-		ConstAETokenDesc		startToken(&startObject);
-		ConstAETokenDesc		stopToken(&stopObject);
-		
-		ItemID			beginItemID 	= GetItemIDFromToken(&startObject);
-		ItemID			endItemID	 	= GetItemIDFromToken(&stopObject);
-		
-		TAEListIndex		beginIndex		= GetIndexFromItemID(containerToken, beginItemID);
-		TAEListIndex		endIndex		= GetIndexFromItemID(containerToken, endItemID);
-										
-		err = AECreateList(nil, 0, false, (AEDescList*)resultToken);
-		ThrowIfOSErr(err);
-			
-		if (beginIndex > endIndex) // swap elements
-		{
-			TAEListIndex	temp = beginIndex;
-			beginIndex		= endIndex;
-			endIndex   	= temp;
-		}
-		
-		for (TAEListIndex i = beginIndex; i <= endIndex; i ++)
-		{
-			ItemID		itemID = GetIndexedItemID(containerToken, i);
-			if (itemID != kNoItemID)
-			{
-				SetItemIDInCoreToken(containerToken, &token, itemID);
-				err = AEPutPtr(resultToken, 0, desiredClass, &token, sizeof(token));
-				ThrowIfOSErr(err);
-			}
-		}
-	}
-	else
-	{
-		SetItemIDInCoreToken(containerToken, &token, GetIDFromReference(containerToken, itemRef));
-		err = AECreateDesc(desiredClass, &token, sizeof(token), resultToken);
-		ThrowIfOSErr(err);
-	}
-}
-
-
-/*----------------------------------------------------------------------------
-	ProcessFormRelativePostition 
-	
-----------------------------------------------------------------------------*/
-
-AEClassIterator::ItemRef AEClassIterator::ProcessFormRelativePostition(const AEDesc* anchorToken, const AEDesc *keyData)
-{
-	OSErr		err = noErr;
-	ItemID		anchorItemID = GetItemIDFromToken(anchorToken);
-	TAEListIndex	anchorListIndex = GetIndexFromItemID(anchorToken, anchorItemID);
-	TAEListIndex	wantedListIndex = 0;
-	long			numItems = GetNumItems(anchorToken);
-	ItemRef		returnRef = kNoItemRef;
-
-	if (anchorListIndex != 0)
-	{
-		switch (keyData->descriptorType)
-		{
-		   case typeEnumerated:
-			   	DescType		positionEnum;	
-				if (DescToDescType((AEDesc*)keyData, &positionEnum) != noErr)
-					ThrowIfOSErr(errAECoercionFail);
-
-				switch (positionEnum)
-				{
-					case kAENext:						// get the window behind the anchor
-						wantedListIndex = anchorListIndex + 1;
-						if (wantedListIndex > numItems)
-							err = errAENoSuchObject;
-						break;
-						
-					case kAEPrevious:					// get the document in front of the anchor
-						wantedListIndex = anchorListIndex - 1;
-						if (wantedListIndex < 1)
-							err = errAENoSuchObject;
-						break;
-						
-					default:
-						err = errAEEventNotHandled;
-						break;
-				}
-				ThrowIfOSErr(err);
-				break;
-				
-			default:
-				err = errAECoercionFail;
-				break;
-		}
-	}
-	
-	ThrowIfOSErr(err);
-	return GetIndexedItemReference(anchorToken, wantedListIndex);
-}
-
-
-/*----------------------------------------------------------------------------
-	NormalizeAbsoluteIndex 
-	
-	 Handles formAbsolutePosition resolution
-	
----------------------------------------------------------------------------*/
-TAEListIndex AEClassIterator::NormalizeAbsoluteIndex(const AEDesc *keyData, TAEListIndex maxIndex, Boolean *isAllItems)
-{
-	TAEListIndex	index;
-	*isAllItems = false;								// set to true if we receive kAEAll constant
-	
-	// Extract the formAbsolutePosition data, either a integer or a literal constant
-	
-	switch (keyData->descriptorType)
-	{
-		case typeLongInteger:						// positive or negative index
-			if (DescToLong(keyData, &index) != noErr)
-				ThrowOSErr(errAECoercionFail);
-				
-			if (index < 0)							// convert a negative index from end of list to a positive index from beginning of list
-				index = maxIndex + index + 1;
-			break;
-			
-	   case typeAbsoluteOrdinal:										// 'abso'
-	   		DescType		ordinalDesc;
-			if (DescToDescType((AEDesc*)keyData, &ordinalDesc) != noErr)
-				ThrowOSErr(errAECoercionFail);
-			
-			switch (ordinalDesc)
-			{
-			   	case kAEFirst:
-			   		index = 1;
-					break;
-					
-				case kAEMiddle:
-					index = (maxIndex >> 1) + (maxIndex % 2);
-					break;
-						
-			   	case kAELast:
-			   		index = maxIndex;
-					break;
-						
-			   	case kAEAny:
-					index = (TickCount() % maxIndex) + 1;		// poor man's random
-					break;
-						
-			   	case kAEAll:
-			   		index = 1;
-			   		*isAllItems = true;
-					break;
-			}
-			break;
-
-		default:
-			ThrowOSErr(errAEWrongDataType);
-	}
-
-	// range-check the new index number
-	if ((index < 1) || (index > maxIndex))
-		ThrowOSErr(errAEIllegalIndex);
-		
-	return index;
-}
-
-
-/*----------------------------------------------------------------------------
-	ProcessFormRange 
-	
-	Handles formRange resolution of boundary objects
-----------------------------------------------------------------------------*/
-
-void AEClassIterator::ProcessFormRange(AEDesc *keyData, AEDesc *start, AEDesc *stop)
-{
-	OSErr 		err = noErr;
-	StAEDesc 		rangeRecord;
-	StAEDesc		ospec;
-	
-	// coerce the range record data into an AERecord 
-	
- 	err = AECoerceDesc(keyData, typeAERecord, &rangeRecord);
- 	ThrowIfOSErr(err);
-	 
-	// object specifier for first object in the range
-	err = AEGetKeyDesc(&rangeRecord, keyAERangeStart, typeWildCard, &ospec);
- 	if (err == noErr && ospec.descriptorType == typeObjectSpecifier)
- 		err = AEResolve(&ospec, kAEIDoMinimum, start);
- 		
- 	ThrowIfOSErr(err);
- 		
-	ospec.Clear();
-		
-	// object specifier for last object in the range
-	
-	err = AEGetKeyDesc(&rangeRecord, keyAERangeStop, typeWildCard, &ospec);
-  	if (err == noErr && ospec.descriptorType == typeObjectSpecifier)
- 		err = AEResolve(&ospec, kAEIDoMinimum, stop);
-
-	ThrowIfOSErr(err);
-}
-
-
-/*----------------------------------------------------------------------------
-	CheckKeyFormSupport
-	
-	throws if unsupported key form
-----------------------------------------------------------------------------*/
-void AEClassIterator::CheckKeyFormSupport(DescType keyForm)
-{
-	UInt16			testMask;
-	switch (keyForm)
-	{
-		case formAbsolutePosition:		testMask = eHasFormAbsolutePosition;		break;
-		case formRelativePosition:		testMask = eHasFormRelativePosition;		break;
-		case formTest:					testMask = eHasFormTest;				break;
-		case formRange:				testMask = eHasFormRange;				break;
-		case formPropertyID:			testMask = eHasFormPropertyID;			break;
-		case formName:				testMask = eHasFormName;				break;
-		default:
-			AE_ASSERT(false, "Unknown key form");
-	}
-	if ((mKeyFormSupport & testMask) == 0)
-		ThrowOSErr(errAEBadKeyForm);
-}
-
-#pragma mark -
-
-
-/*----------------------------------------------------------------------------
-	GetItemFromContainer 
-	
-----------------------------------------------------------------------------*/
-void AENamedClassIterator::GetItemFromContainer(	DescType			desiredClass,
-										const AEDesc*		containerToken,
-										DescType			containerClass, 
-										DescType			keyForm,
-										const AEDesc*		keyData,
-										AEDesc*			resultToken)
-{
-	OSErr				err	= noErr;
-	
-	CStr255				itemName;
-	DescType				keyDataType 	= keyData->descriptorType;
-
-	Boolean				wantsAllItems	= false;
-
-	StAEDesc 				startObject;	// These are used to resolve formRange
-	StAEDesc 				stopObject;
-		
-	CoreTokenRecord		token;
-	
-	long					numItems = GetNumItems(containerToken);
-	
-	CheckKeyFormSupport(keyForm);		// throws on error
-	
-	switch (keyForm)
-	{
-		case formName:																// item by name
-			if (DescToCString(keyData, itemName, 255) != noErr)
-				ThrowIfOSErr(errAECoercionFail);
-
-			if (!NamedItemExists(containerToken, itemName))
-				ThrowIfOSErr(errAENoSuchObject);
-			break;
-		
-/*
-		case formAbsolutePosition:														// item by number
-	   		DescType		ordinalDesc;
-			if (DescToDescType((AEDesc*)keyData, &ordinalDesc) != noErr)
-				ThrowOSErr(errAECoercionFail);
-
-			if (ordinalDesc != kAEAll)
-				ThrowOSErr(errAEWrongDataType);
-
-			wantsAllItems = true;
-			break;	
-*/		
-		default:
-			ThrowIfOSErr(errAEEventNotHandled);
-	}
-	
-	ThrowIfOSErr(err);
-
-	// fill in the result token
-	token.dispatchClass 	= GetClass();
-	token.objectClass	= GetClass();
-	token.propertyCode 	= typeNull;
-	
-	if (wantsAllItems)
-	{
-		err = AECreateList(NULL, 0, false, (AEDescList*)resultToken);
-		ThrowIfOSErr(err);
-		
-		for (TAEListIndex index = 1; index <= numItems; index++)
-		{
-			ItemID		itemID = GetIndexedItemID(containerToken, index);
-			if (itemID != kNoItemID)
-			{
-				SetItemIDInCoreToken(containerToken, &token, itemID);
-				err = AEPutPtr(resultToken, 0, desiredClass, &token, sizeof(token));
-				ThrowIfOSErr(err);
-			}
-		}
-	}
-	else
-	{
-		SetNamedItemIDInCoreToken(containerToken, &token, itemName);
-		err = AECreateDesc(desiredClass, &token, sizeof(token), resultToken);
-		ThrowIfOSErr(err);
-	}
-}
-
deleted file mode 100644
--- a/xpfe/bootstrap/appleevents/nsAEClassIterator.h
+++ /dev/null
@@ -1,207 +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.
- *
- * 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):
- *   Simon Fraser <sfraser@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 __AECLASSITERATOR__
-#define __AECLASSITERATOR__
-
-
-#include "nsAETokens.h"
-
-class AEClassIterator
-{
-
-protected:
-
-	enum
-	{
-		eFormAbsolutePositionBit		= 0,
-		eFormRelativePositionBit,
-		eFormTestBit,
-		eFormRangeBit,
-		eFormPropertyIDBit,
-		eFormNameBit
-	};
-	
-	
-public:
-
-	enum
-	{
-		eHasFormAbsolutePosition		= (1 << eFormAbsolutePositionBit),
-		eHasFormRelativePosition		= (1 << eFormRelativePositionBit),
-		eHasFormTest				= (1 << eFormTestBit),
-		eHasFormRange				= (1 << eFormPropertyIDBit),
-		eHasFormPropertyID			= (1 << eFormRangeBit),
-		eHasFormName				= (1 << eFormNameBit),
-		
-		eStandardKeyFormSupport = (eHasFormAbsolutePosition | eHasFormRelativePosition | eHasFormRange | eHasFormName)
-	};
-	
-	
-						AEClassIterator(DescType classType, UInt16 keyFormSupport = eStandardKeyFormSupport)
-						:	mClass(classType)
-						,	mKeyFormSupport(keyFormSupport)
-						{}
-						
-	virtual 				~AEClassIterator() {}
-	
-	virtual void			GetItemFromContainer(		DescType			desiredClass,
-												const AEDesc*		containerToken,
-												DescType			containerClass, 
-												DescType			keyForm,
-												const AEDesc*		keyData,
-												AEDesc*			resultToken);
-
-	virtual UInt32			GetNumItems(const AEDesc* containerToken) = 0;			// get the number of items
-
-	typedef UInt32			ItemRef;				// runtime, optimized reference to an object
-	typedef UInt32			ItemID;				// persistent reference, used for storage
-
-protected:
-	
-	static const ItemRef		kNoItemRef;			// value for a nonexistent item reference (usu. -1)
-	static const ItemID		kNoItemID;			// value for a nonexistent item ID (usu -1)
-
-
-	virtual ItemRef			GetNamedItemReference(const AEDesc* containerToken, const char *itemName) = 0;
-	virtual ItemRef			GetIndexedItemReference(const AEDesc* containerToken, TAEListIndex itemIndex) = 0;
-	
-	virtual TAEListIndex		GetIndexFromItemID(const AEDesc* containerToken, ItemID itemID) = 0;
-	
-	virtual ItemID			GetNamedItemID(const AEDesc* containerToken, const char *itemName) = 0;
-	virtual ItemID			GetIndexedItemID(const AEDesc* containerToken, TAEListIndex itemIndex) = 0;
-
-	// index to name
-	virtual void			GetIndexedItemName(const AEDesc* containerToken, TAEListIndex itemIndex, char *outName, long maxLen) = 0;
-
-	// conversion routines.
-	virtual ItemID			GetIDFromReference(const AEDesc* containerToken, ItemRef itemRef) = 0;
-	virtual ItemRef			GetReferenceFromID(const AEDesc* containerToken, ItemID itemID) = 0;
-
-	virtual ItemID			GetItemIDFromToken(const AEDesc* token) = 0;
-	virtual void			SetItemIDInCoreToken(const AEDesc* containerToken, CoreTokenRecord* tokenRecord, ItemID itemID) = 0;
-	
-	// Range and index processing routines.
-	virtual ItemRef			ProcessFormRelativePostition(const AEDesc* anchorToken, const AEDesc *keyData);
-	TAEListIndex			NormalizeAbsoluteIndex(const AEDesc *keyData, TAEListIndex maxIndex, Boolean *isAllItems);
-	void					ProcessFormRange(AEDesc *keyData, AEDesc *start, AEDesc *stop);
-
-	void					CheckKeyFormSupport(DescType keyForm);		// throws if unsupported key form
-	
-	DescType				GetClass() { return mClass; }
-	
-
-	DescType				mClass;
-	UInt16				mKeyFormSupport;
-};
-
-
-class AENamedClassIterator : public AEClassIterator
-{
-public:
-						AENamedClassIterator(DescType classType)
-						: AEClassIterator(classType, eHasFormName)
-						{}
-						
-						~AENamedClassIterator() {}
-
-	virtual void			GetItemFromContainer(		DescType			desiredClass,
-												const AEDesc*		containerToken,
-												DescType			containerClass, 
-												DescType			keyForm,
-												const AEDesc*		keyData,
-												AEDesc*			resultToken);
-
-protected:
-
-	
-	// stubs for those pure virtual functions that we can't use with named items
-	virtual UInt32			GetNumItems(const AEDesc* containerToken) { return 0; }
-
-	virtual ItemRef			GetNamedItemReference(const AEDesc* containerToken, const char *itemName) { return kNoItemRef; }
-	virtual ItemRef			GetIndexedItemReference(const AEDesc* containerToken, TAEListIndex itemIndex) { return kNoItemRef; }
-	
-	virtual TAEListIndex		GetIndexFromItemID(const AEDesc* containerToken, ItemID itemID) { return 0; }
-	
-	virtual Boolean			NamedItemExists(const AEDesc* containerToken, const char *itemName) = 0;
-
-	virtual ItemID			GetNamedItemID(const AEDesc* containerToken, const char *itemName) { return kNoItemID; }
-	virtual ItemID			GetIndexedItemID(const AEDesc* containerToken, TAEListIndex itemIndex) { return kNoItemID; }
-
-	// index to name
-	virtual void			GetIndexedItemName(const AEDesc* containerToken, TAEListIndex itemIndex, char *outName, long maxLen) {}
-
-	// conversion routines.
-	virtual ItemID			GetIDFromReference(const AEDesc* containerToken, ItemRef itemRef) { return kNoItemID; }
-	virtual ItemRef			GetReferenceFromID(const AEDesc* containerToken, ItemID itemID) { return kNoItemRef; }
-
-	virtual ItemID			GetItemIDFromToken(const AEDesc* token) { return kNoItemID; }
-	virtual void			SetItemIDInCoreToken(const AEDesc* containerToken, CoreTokenRecord* tokenRecord, ItemID itemID) {}
-	virtual void			SetNamedItemIDInCoreToken(const AEDesc* containerToken, CoreTokenRecord* token, const char *itemName) = 0;
-
-};
-
-
-// base class for items that cannot be referred to by name
-class AEUnnamedClassIterator : public AEClassIterator
-{
-public:
-
-	enum
-	{
-		eNoNameKeyFormSupport = (eHasFormAbsolutePosition | eHasFormRelativePosition | eHasFormRange)
-	};
-	
-
-						AEUnnamedClassIterator(DescType classType)
-						: AEClassIterator(classType, eNoNameKeyFormSupport)
-						{}
-						
-						~AEUnnamedClassIterator() {}
-
-protected:
-
-	virtual ItemRef			GetNamedItemReference(const AEDesc* containerToken, const char *itemName) { ThrowOSErr(errAEEventNotHandled); return 0; }
-	virtual ItemID			GetNamedItemID(const AEDesc* containerToken, const char *itemName) { ThrowOSErr(errAEEventNotHandled); return 0; }
-	virtual void			GetIndexedItemName(const AEDesc* containerToken, TAEListIndex itemIndex, char *outName, long maxLen) { ThrowOSErr(errAEEventNotHandled); }
-
-};
-
-
-#endif /* __AECLASSITERATOR__ */
deleted file mode 100644
--- a/xpfe/bootstrap/appleevents/nsAEClassTypes.h
+++ /dev/null
@@ -1,84 +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.
- *
- * 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):
- *   Simon Fraser <sfraser@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 __AECLASSTYPES__
-#define __AECLASSTYPES__
-
-
-/* Verbs */
-enum {
-
-	kAEUnselect				= 'uslt'
-};
-
-
-/* Classes */
-enum {
-	kPrefsClassID				= 'PREF'
-};
-
-/* Prefs class properties */
-enum {
-	pPrefsUserName			= 'UNAM',
-	pPrefsEmail				= 'EMIL',
-	
-	pWindowName				= 'NAME'			// not sure why this isn't in the headers
-};
-
-
-/* Classes */
-enum {
-	
-	cMailServer				= 'SMTP',
-	
-	cMessageWindow			= 'MWIN',
-	cNewGroupsWindow			= 'NWIN',
-	cFullGroupsWindow			= 'FWIN'
-	
-};
-
-/* Classes for coercion */
-enum {
-	cWrappedText				= 'cWtx'
-};
-
-
-
-
-#endif /* __AECLASSTYPES__ */
deleted file mode 100644
--- a/xpfe/bootstrap/appleevents/nsAECoercionHandlers.cpp
+++ /dev/null
@@ -1,227 +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.
- *
- * 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):
- *   Simon Fraser <sfraser@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 ***** */
-
-
-
-#include "nsAEUtils.h"
-
-#include "nsAECoercionHandlers.h"
-
-
-
-AECoercionHandlers*	AECoercionHandlers::sAECoercionHandlers = nil;
-
-
-/*----------------------------------------------------------------------------
-	AECoercionHandlers 
-	
-----------------------------------------------------------------------------*/
-
-AECoercionHandlers::AECoercionHandlers()
-:	mTextDescToPascalString(nil)
-,	mPascalStringDescToText(nil)
-{
-	OSErr	err;
-	
-	// XXX: Note inconsistent type between NewAECoerceDescProc and AEInstallCoercionHandler. Buggy headers when using Carbon?
-	mTextDescToPascalString = NewAECoerceDescUPP(TextToPascalStringCoercion);
-	ThrowIfNil(mTextDescToPascalString);
-
-	err = ::AEInstallCoercionHandler(typeChar, typePascalString,
-								(AECoercionHandlerUPP) mTextDescToPascalString,
-								(long)this,
-								true,			/* Pass a pointer not a descriptor */
-								false );		/* Application table, not System */
-	ThrowIfOSErr(err);
-
-	mPascalStringDescToText = NewAECoerceDescUPP(PascalStringToTextCoercion);
-	ThrowIfNil(mPascalStringDescToText);
-
-	err = ::AEInstallCoercionHandler(typePascalString, typeChar,
-								(AECoercionHandlerUPP) mPascalStringDescToText,
-								(long)this,
-								true,			/* Pass a pointer not a descriptor */
-								false );		/* Application table, not System */
-	ThrowIfOSErr(err);
-}
-
-
-
-/*----------------------------------------------------------------------------
-	~AECoercionHandlers 
-	
-----------------------------------------------------------------------------*/
-
-AECoercionHandlers::~AECoercionHandlers()
-{
-	if (mTextDescToPascalString)
-	{
-		AERemoveCoercionHandler(typeChar, typePascalString, (AECoercionHandlerUPP) mTextDescToPascalString, false);
-		DisposeAECoerceDescUPP(mTextDescToPascalString);
-	}
-
-	if (mPascalStringDescToText)
-	{
-		AERemoveCoercionHandler(typePascalString, typeChar, (AECoercionHandlerUPP) mPascalStringDescToText, false);
-		DisposeAECoerceDescUPP(mPascalStringDescToText);
-	}
-}
-
-
-#pragma mark -
-
-/*----------------------------------------------------------------------------
-	TextToPascalStringCoercion 
-	
-----------------------------------------------------------------------------*/
-pascal OSErr AECoercionHandlers::TextToPascalStringCoercion(const AEDesc *fromDesc, DescType toType, long handlerRefcon, AEDesc *toDesc)
-{
-	OSErr	err = noErr;
-	
-	if (toType != typePascalString)
-		return errAECoercionFail;
-
-	switch (fromDesc->descriptorType)
-	{
-		case typeChar:
-			Str255		pString;
-			DescToPString(fromDesc, pString, 255);
-			err = AECreateDesc(typePascalString, pString, pString[0] + 1, toDesc);
-			break;
-			
-		default:
-			err = errAECoercionFail;
-			break;
-	}
-
-	return err;
-}
-
-/*----------------------------------------------------------------------------
-	PascalStringToTextCoercion 
-	
-----------------------------------------------------------------------------*/
-
-pascal OSErr AECoercionHandlers::PascalStringToTextCoercion(const AEDesc *fromDesc, DescType toType, long handlerRefcon, AEDesc *toDesc)
-{
-	OSErr	err = noErr;
-	
-	if (toType != typeChar)
-		return errAECoercionFail;
-
-	switch (fromDesc->descriptorType)
-	{
-		case typePascalString:
-			{
-				long stringLen = AEGetDescDataSize(fromDesc);
-				if (stringLen > 255)
-				{
-					err = errAECoercionFail;
-					break;
-				}
-				Str255 str;
-				AEGetDescData(fromDesc, str, sizeof(str) - 1);
-				err = AECreateDesc(typeChar, str + 1, str[0], toDesc);
-			}
-			break;
-			
-		default:
-			err = errAECoercionFail;
-			break;
-	}
-
-	return err;
-}
-
-
-
-#pragma mark -
-
-/*----------------------------------------------------------------------------
-	CreateCoercionHandlers 
-	
-----------------------------------------------------------------------------*/
-
-OSErr CreateCoercionHandlers()
-{
-	OSErr	err = noErr;
-	
-	if (AECoercionHandlers::sAECoercionHandlers)
-		return noErr;
-	
-	try
-	{
-		AECoercionHandlers::sAECoercionHandlers = new AECoercionHandlers;
-	}
-	catch(OSErr catchErr)
-	{
-		err = catchErr;
-	}
-	catch( ... )
-	{
-		err = paramErr;
-	}
-	
-	return err;
-
-}
-
-
-
-/*----------------------------------------------------------------------------
-	ShutdownCoercionHandlers 
-	
-----------------------------------------------------------------------------*/
-
-OSErr ShutdownCoercionHandlers()
-{
-	if (!AECoercionHandlers::sAECoercionHandlers)
-		return noErr;
-	
-	try
-	{
-		delete AECoercionHandlers::sAECoercionHandlers;
-	}
-	catch(...)
-	{
-	}
-	
-	AECoercionHandlers::sAECoercionHandlers = nil;
-	return noErr;
-}
-
deleted file mode 100644
--- a/xpfe/bootstrap/appleevents/nsAECoercionHandlers.h
+++ /dev/null
@@ -1,89 +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.
- *
- * 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):
- *   Simon Fraser <sfraser@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 AECoercionHandlers_h_
-#define AECoercionHandlers_h_
-
-#ifdef __cplusplus
-
-class AECoercionHandlers
-{
-public:
-			
-						AECoercionHandlers();
-						~AECoercionHandlers();
-				
-	enum {
-		typePascalString = 'PStr'		/* Descriptor type for a pascal string */
-	};
-
-
-protected:
-
-	static pascal OSErr TextToPascalStringCoercion(const AEDesc *fromDesc, DescType toType, long handlerRefcon, AEDesc *toDesc);
-	static pascal OSErr PascalStringToTextCoercion(const AEDesc *fromDesc, DescType toType, long handlerRefcon, AEDesc *toDesc);
-	
-	
-protected:
-
-	AECoerceDescUPP		mTextDescToPascalString;
-	AECoerceDescUPP		mPascalStringDescToText;
-
-public:
-
-	static AECoercionHandlers*		GetAECoercionHandlers() { return sAECoercionHandlers; }
-	static AECoercionHandlers*		sAECoercionHandlers;
-
-};
-
-#endif	//__cplusplus
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-OSErr CreateCoercionHandlers();
-OSErr ShutdownCoercionHandlers();
-
-#ifdef __cplusplus
-}
-#endif
-
-
-#endif // AECoercionHandlers_h_
deleted file mode 100644
--- a/xpfe/bootstrap/appleevents/nsAECompare.cpp
+++ /dev/null
@@ -1,532 +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.
- *
- * 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):
- *   Simon Fraser <sfraser@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 ***** */
-
-
-
-#include <StringCompare.h>
-
-#include "nsAEUtils.h"
-#include "nsAECompare.h"
-
-// ----------------------------------------------------------------------------------------
-
-Boolean AEComparisons::CompareTexts(DescType oper, const AEDesc *desc1, const AEDesc *desc2)
-{
-	Boolean	result = false;
-	
-	short	compareResult;
-	Handle  lhsHandle = 0, rhsHandle = 0;
-	char  	*lhs;
-	char  	*rhs;
-	long		lhsSize;
-	long		rhsSize;
-	
-	// FIXME:  this can leak lhsHandle if second conversion fails.
-	if (DescToTextHandle(desc1, &lhsHandle) != noErr || DescToTextHandle(desc2, &rhsHandle) != noErr)
-	    goto fail;
-	
-	lhsSize = GetHandleSize(lhsHandle);
-	HLock(lhsHandle);
-	lhs = *(lhsHandle);
-	
-	rhsSize = GetHandleSize(rhsHandle);
-	HLock(rhsHandle);
-	rhs = *(rhsHandle);
-
-	compareResult = ::CompareText(lhs, rhs, lhsSize, rhsSize, nil);
-
-	switch (oper) 
-	{
-		case kAEEquals:
-			result = (compareResult == 0);
-			break;
-		
-		case kAELessThan:
-			result = (compareResult < 0);
-			break;
-		
-		case kAELessThanEquals:
-			result = (compareResult <= 0);
-			break;
-		
-		case kAEGreaterThan:
-			result = (compareResult > 0);
-			break;
-		
-		case kAEGreaterThanEquals:
-			result = (compareResult >= 0);
-			break;
-		
-		case kAEBeginsWith:
-			if (rhsSize > lhsSize)
-			{
-				result = false;
-			}
-			else
-			{
-				// compare only the number of characters in rhs
-				// begin comparing at the beginning of lhs
-				compareResult = CompareText(lhs, rhs, rhsSize, rhsSize, nil);
-				result = (compareResult == 0);
-			}
-			break;
-			
-		case kAEEndsWith:
-			if (rhsSize > lhsSize)
-			{
-				result = false;
-			}
-			else
-			{
-				// compare only the number of characters in rhs
-				// begin comparing rhsSize characters from the end of lhs
-				// start 
-				
-				lhs += (lhsSize - rhsSize);
-				compareResult = CompareText(lhs, rhs, rhsSize, rhsSize, nil);
-				result = (compareResult == 0);
-			}
-			break;
-
-		case kAEContains:
-			// Here I use an inefficient search strategy, but we're dealing with small amounts
-			// of text and by using CompareText(), we're doing the same style of comparison
-			// as in the other cases above.
-			
-			result = false;
-			while (lhsSize >= rhsSize)
-			{
-				compareResult = CompareText(lhs, rhs, rhsSize, rhsSize, nil);
-				if (compareResult == 0)
-				{
-					result = true;
-					break;
-				}
-				lhs++;
-				lhsSize--;
-			}
-			break;
-
-		default:
-			ThrowOSErr(errAEBadTestKey);
-	}
-
-fail:
-    if (lhsHandle) DisposeHandle(lhsHandle);
-    if (rhsHandle) DisposeHandle(rhsHandle);
-	
-	return result;
-}
-
-// ----------------------------------------------------------------------------------------
-
-Boolean AEComparisons::CompareEnumeration(DescType oper, const AEDesc *desc1, const AEDesc *desc2)
-{
-	OSErr		err	= noErr;
-	Boolean		result = false;
-	long	 		lhs;
-	long   		rhs;
-	StAEDesc 		charDesc;
-	
-	// Make each number is a long integer (in case it's a short integer or other integer type) 
-	// before extracting the data */
-	
-	err = AECoerceDesc(desc1, typeChar, &charDesc);
-	ThrowIfOSErr(err);
-
-	lhs = **(long **)(charDesc.dataHandle);
-	AEDisposeDesc(&charDesc);
-	
-	err = AECoerceDesc(desc2, typeChar, &charDesc);
-	ThrowIfOSErr(err);
-
-	rhs = **(long **)charDesc.dataHandle;
-	AEDisposeDesc(&charDesc);
-	
-	switch (oper) 
-	{
-		case kAEEquals:
-			result = (lhs == rhs);	// equality is the only test that makes sense for enumerators
-			break;
-		
-		default:
-			ThrowOSErr(errAEBadTestKey);
-	}
-
-	return result;
-}
-
-// ----------------------------------------------------------------------------------------
-
-Boolean AEComparisons::CompareInteger(DescType oper, const AEDesc *desc1, const AEDesc *desc2)
-{
-	OSErr		err	= noErr;
-	Boolean		result = false;
-	long	 		lhs;
-	long   		rhs;
-	StAEDesc 		longDesc;
-	
-	// Make each number is a long integer (in case it's a short integer or other integer type) 
-	// before extracting the data */
-	
-	err = AECoerceDesc(desc1, typeLongInteger, &longDesc);
-	ThrowIfOSErr(err);
-
-	lhs = **(long **)(longDesc.dataHandle);
-	AEDisposeDesc(&longDesc);
-	
-	err = AECoerceDesc(desc2, typeLongInteger, &longDesc);
-	ThrowIfOSErr(err);
-
-	rhs = **(long **)longDesc.dataHandle;
-	AEDisposeDesc(&longDesc);
-	
-	switch (oper) 
-	{
-		case kAEEquals:
-			result = (lhs == rhs);
-			break;
-		
-		case kAELessThan:
-			result = (lhs < rhs);
-			break;
-		
-		case kAELessThanEquals:
-			result = (lhs <= rhs);
-			break;
-		
-		case kAEGreaterThan:
-			result = (lhs > rhs);
-			break;
-		
-		case kAEGreaterThanEquals:
-			result = (lhs >= rhs);
-			break;
-		
-		default:
-			ThrowOSErr(errAEBadTestKey);
-	}
-
-	return result;
-}
-
-// ----------------------------------------------------------------------------------------
-
-Boolean AEComparisons::CompareFixed(DescType oper, const AEDesc *desc1, const AEDesc *desc2)
-{
-	OSErr		err	= noErr;
-	Boolean		result = false;
-	Fixed		lhs;
-	Fixed 		rhs;
-	
-	err = DescToFixed(desc1, &lhs);
-	ThrowIfOSErr(err);
-		
-	err = DescToFixed(desc2, &rhs);
-	ThrowIfOSErr(err);
-	
-	switch (oper) 
-	{
-		case kAEEquals:
-			result = (lhs == rhs);
-			break;
-		
-		case kAELessThan:
-			result = (lhs < rhs);
-			break;
-		
-		case kAELessThanEquals:
-			result = (lhs <= rhs);
-			break;
-		
-		case kAEGreaterThan:
-			result = (lhs > rhs);
-			break;
-		
-			case kAEGreaterThanEquals:
-			result = (lhs >= rhs);
-			break;
-		
-		default:
-			ThrowOSErr(errAEBadTestKey);
-	}
-	
-	return result;
-}
-
-// ----------------------------------------------------------------------------------------
-
-Boolean AEComparisons::CompareFloat(DescType oper, const AEDesc *desc1, const AEDesc *desc2)
-{
-	OSErr	err	= noErr;
-	Boolean	result = false;
-	float		 lhs;
-	float 	 rhs;
-	
-	err = DescToFloat(desc1, &lhs);
-	ThrowIfOSErr(err);
-		
-	err = DescToFloat(desc2, &rhs);
-	ThrowIfOSErr(err);
-	
-	switch (oper) 
-	{
-		case kAEEquals:
-			result = (lhs == rhs);
-			break;
-		
-		case kAELessThan:
-			result = (lhs < rhs);
-			break;
-		
-		case kAELessThanEquals:
-			result = (lhs <= rhs);
-			break;
-		
-		case kAEGreaterThan:
-			result = (lhs > rhs);
-			break;
-		
-			case kAEGreaterThanEquals:
-			result = (lhs >= rhs);
-			break;
-		
-		default:
-			ThrowOSErr(errAEBadTestKey);
-	}
-	
-	return result;
-}
-
-// ----------------------------------------------------------------------------------------
-// Apple events defines a boolean as a 1-byte value containing 1 for TRUE and 0 for FALSE
-
-Boolean AEComparisons::CompareBoolean(DescType oper, const AEDesc *desc1, const AEDesc *desc2)
-{
-	Boolean	result = false;
-	
-	Boolean 	bool1	= ((**(char **)desc1->dataHandle) != 0);
-	Boolean 	bool2	= ((**(char **)desc2->dataHandle) != 0);
-		
-	if (oper == kAEEquals) 
-		result = (bool1 == bool2);
-	else
-		ThrowOSErr(errAEBadTestKey);		// No other tests make sense
-
-	return result;
-}
-
-// ----------------------------------------------------------------------------------------
-
-Boolean AEComparisons::CompareRGBColor(DescType oper, const AEDesc *desc1, const AEDesc *desc2)
-{
-	OSErr	err = noErr;
-	Boolean	result = false;
-	
-	RGBColor lhs;
-	RGBColor rhs;
-	
-	err = DescToRGBColor(desc1, &lhs);
-	ThrowIfOSErr(err);
-		
-	err = DescToRGBColor(desc2, &rhs);
-	ThrowIfOSErr(err);
-
-	if (oper == kAEEquals) 
-		result = EqualRGB(lhs, rhs);
-	else
-		ThrowOSErr(errAEBadTestKey);		// No other tests make sense
-
-	return result;
-}
-
-// ----------------------------------------------------------------------------------------
-
-Boolean AEComparisons::ComparePoint(DescType oper, const AEDesc *desc1, const AEDesc *desc2)
-{
-	OSErr	err = noErr;
-	Boolean	result = false;
-	
-	Point		lhs;
-	Point		rhs;
-	
-	err = DescToPoint(desc1, &lhs);
-	ThrowIfOSErr(err);
-		
-	err = DescToPoint(desc2, &rhs);
-	ThrowIfOSErr(err);
-		
-	switch (oper)
-	{
-		case kAEEquals:
-			result = (lhs.h = rhs.h && lhs.v == rhs.v);
-			break;
-			
-		case kAELessThan:
-			result = (lhs.h < rhs.h && lhs.v < rhs.v);
-			break;
-		
-		case kAELessThanEquals:
-			result = (lhs.h <= rhs.h && lhs.v <= rhs.v);
-			break;
-		
-		case kAEGreaterThan:
-			result = (lhs.h > rhs.h && lhs.v > rhs.v);
-			break;
-		
-		case kAEGreaterThanEquals:
-			result = (lhs.h >= rhs.h && lhs.v >= rhs.v);
-			break;
-		
-		default:
-			ThrowOSErr(errAEBadTestKey);		// No other tests make sense
-	}
-
-	return result;
-}
-
-// ----------------------------------------------------------------------------------------
-
-Boolean AEComparisons::CompareRect(DescType oper, const AEDesc *desc1, const AEDesc *desc2)
-{
-	OSErr	err = noErr;
-	Boolean	result = false;
-	Rect		lhs;
-	Rect		rhs;
-	
-	err = DescToRect(desc1, &lhs);
-	ThrowIfOSErr(err);
-		
-	err = DescToRect(desc2, &rhs);
-	ThrowIfOSErr(err);
-		
-	switch (oper)
-	{
-		// compare size AND location
-		case kAEEquals:	
-			result = ((lhs.top == rhs.top) && (lhs.left == rhs.left) && (lhs.bottom == rhs.bottom) && (lhs.right == rhs.right));
-			break;
-			
-		// compare size only on the rest of the tests
-		case kAELessThan:	
-			result = (((lhs.bottom - lhs.top) < (rhs.bottom - rhs.top)) && ((lhs.right - lhs.left) < (lhs.right - rhs.left)));
-			break;
-		
-		case kAELessThanEquals:
-			result = (((lhs.bottom - lhs.top) < (rhs.bottom - rhs.top)) && ((lhs.right - lhs.left) < (lhs.right - rhs.left)));
-			break;
-		
-		case kAEGreaterThan:
-			result = (((lhs.bottom - lhs.top) < (rhs.bottom - rhs.top)) && ((lhs.right - lhs.left) < (lhs.right - rhs.left)));
-			break;
-		
-		case kAEGreaterThanEquals:
-			result = (((lhs.bottom - lhs.top) < (rhs.bottom - rhs.top)) && ((lhs.right - lhs.left) < (lhs.right - rhs.left)));
-			break;
-		
-		case kAEContains:
-			// Note: two identical Rects contain each other, according to this test:
-			result = ((lhs.top <= rhs.top) && (lhs.left <= rhs.left) && (lhs.bottom >= rhs.bottom) && (lhs.right >= rhs.right));
-			break;
-			
-		default:
-			ThrowOSErr(errAEBadTestKey);		// No other tests make sense
-	}
-
-	return result;
-}
-
-#pragma mark -
-
-/*----------------------------------------------------------------------------
-	TryPrimitiveComparison 
-	
-----------------------------------------------------------------------------*/
-
-Boolean AEComparisons::TryPrimitiveComparison(DescType comparisonOperator, const AEDesc *desc1, const AEDesc *desc2)
-{
-	Boolean 	result = false;
-	
-	// This has to handle all the data types used in the application's
-	// object model implementation.
-	switch (desc1->descriptorType) 
-	{
-		case typeChar:
-			result = CompareTexts(comparisonOperator, desc1, desc2);
-			break;
-		
-		case typeShortInteger:		// also covers typeSMInt		'shor'
-		case typeLongInteger:		// also covers typeInteger	'long'
-		case typeMagnitude:			//						'magn'
-			result = CompareInteger(comparisonOperator, desc1, desc2);
-			break;
-
-		case typeEnumerated:
-			result = CompareEnumeration(comparisonOperator, desc1, desc2);
-			break;
-		
-		case typeFixed:
-			result = CompareFixed(comparisonOperator, desc1, desc2);
-			break;
-
-		case typeFloat:
-			result = CompareFloat(comparisonOperator, desc1, desc2);
-			break;
-		
-		case typeBoolean:
-			result = CompareBoolean(comparisonOperator, desc1, desc2);
-			break;
-				
-		case typeRGBColor:
-			result = CompareRGBColor(comparisonOperator, desc1, desc2);
-			break;
-				
-		case typeQDRectangle:
-			result = CompareRect(comparisonOperator, desc1, desc2);
-			break;
-				
-		case typeQDPoint:
-			result = ComparePoint(comparisonOperator, desc1, desc2);
-			break;
-				
-		default:
-			ThrowOSErr(errAEWrongDataType);
-	}
-
-	return result;
-}
deleted file mode 100644
--- a/xpfe/bootstrap/appleevents/nsAECompare.h
+++ /dev/null
@@ -1,63 +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.
- *
- * 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):
- *   Simon Fraser <sfraser@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 ***** */
-
-
-
-class AEComparisons
-{
-public:
-
-	static Boolean	CompareTexts(DescType oper, const AEDesc *desc1, const AEDesc *desc2);
-	static Boolean	CompareEnumeration(DescType oper, const AEDesc *desc1, const AEDesc *desc2);
-	static Boolean 	CompareInteger(DescType oper, const AEDesc *desc1, const AEDesc *desc2);
-	static Boolean 	CompareFixed(DescType oper, const AEDesc *desc1, const AEDesc *desc2);
-	static Boolean 	CompareFloat(DescType oper, const AEDesc *desc1, const AEDesc *desc2);
-	static Boolean 	CompareBoolean(DescType oper, const AEDesc *desc1, const AEDesc *desc2);
-	static Boolean 	CompareRGBColor(DescType oper, const AEDesc *desc1, const AEDesc *desc2);
-	static Boolean	ComparePoint(DescType oper, const AEDesc *desc1, const AEDesc *desc2);
-	static Boolean 	CompareRect(DescType oper, const AEDesc *desc1, const AEDesc *desc2);
-	
-	static Boolean 	TryPrimitiveComparison(DescType comparisonOperator, const AEDesc *desc1, const AEDesc *desc2);
-	
-protected:
-	static Boolean EqualRGB(RGBColor colorA, RGBColor colorB)
-	{
-		return((colorA.red == colorB.red) && (colorA.green == colorB.green) && (colorA.blue == colorB.blue));
-	}
-};
-
deleted file mode 100644
--- a/xpfe/bootstrap/appleevents/nsAECoreClass.cpp
+++ /dev/null
@@ -1,1099 +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.
- *
- * 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):
- *   Simon Fraser <sfraser@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 ***** */
-
-#include "nsAEClassTypes.h"
-#include "nsAEUtils.h"
-#include "nsAETokens.h"
-#include "nsAECompare.h"
-
-#include "nsAEApplicationClass.h"
-#include "nsAEDocumentClass.h"
-#include "nsAEWindowClass.h"
-
-/*
-#include "nsAETextClass.h"
-#include "nsAEWordClass.h"
-#include "nsAECharacterClass.h"
-*/
-
-#include "nsAECoreClass.h"
-
-AECoreClass*		AECoreClass::sAECoreHandler = nil;
-
-/*----------------------------------------------------------------------------
-	AECoreClass 
-	
-----------------------------------------------------------------------------*/
-
-AECoreClass::AECoreClass(Boolean suspendEvents)
-:	mSuspendEventHandlerUPP(nil)
-,	mStandardSuiteHandlerUPP(nil)
-,	mRequiredSuiteHandlerUPP(nil)
-,	mCreateElementHandlerUPP(nil)
-,	mMozillaSuiteHandlerUPP(nil)
-,	mGetURLSuiteHandlerUPP(nil)
-,	mSpyGlassSuiteHandlerUPP(nil)
-,	mPropertyFromListAccessor(nil)
-,	mAnythingFromAppAccessor(nil)
-,	mCountItemsCallback(nil)
-,	mCompareItemsCallback(nil)
-{
-	mSuspendedEvent.descriptorType = typeNull;
-	mSuspendedEvent.dataHandle = nil;
-
-	mReplyToSuspendedEvent.descriptorType = typeNull;
-	mReplyToSuspendedEvent.dataHandle = nil;
-	
-	OSErr	err = ::AEObjectInit();
-	ThrowIfOSErr(err);
-	
-	mSuspendEventHandlerUPP = NewAEEventHandlerUPP(AECoreClass::SuspendEventHandler);
-	ThrowIfNil(mSuspendEventHandlerUPP);
-
-	mRequiredSuiteHandlerUPP = NewAEEventHandlerUPP(AECoreClass::RequiredSuiteHandler);
-	ThrowIfNil(mRequiredSuiteHandlerUPP);
-
-	mStandardSuiteHandlerUPP = NewAEEventHandlerUPP(AECoreClass::CoreSuiteHandler);
-	ThrowIfNil(mStandardSuiteHandlerUPP);
-
-	mMozillaSuiteHandlerUPP = NewAEEventHandlerUPP(AECoreClass::MozillaSuiteHandler);
-	ThrowIfNil(mMozillaSuiteHandlerUPP);
-
-	mGetURLSuiteHandlerUPP = NewAEEventHandlerUPP(AECoreClass::GetURLSuiteHandler);
-	ThrowIfNil(mGetURLSuiteHandlerUPP);
-
-	mSpyGlassSuiteHandlerUPP = NewAEEventHandlerUPP(AECoreClass::SpyglassSuiteHandler);
-	ThrowIfNil(mSpyGlassSuiteHandlerUPP);
-
-	InstallSuiteHandlers(suspendEvents);
-
-	mCreateElementHandlerUPP = NewAEEventHandlerUPP(AECoreClass::CreateElementHandler);
-	ThrowIfNil(mCreateElementHandlerUPP);
-	
-	// Special handler for StandardSuite Make (CreateElement) event
-	// Make (CreateElement) is different than the other events processed above
-	// because it passes its ospec in the insertionLoc parameter instead of
-	// in the direct object parameter.
-
-	err = ::AEInstallEventHandler(kAECoreSuite, 	kAECreateElement, 
-										mCreateElementHandlerUPP, 
-										(long)this, 
-										false);
-	ThrowIfOSErr(err);
-
-	/*	We'd like to be able to install a generic handler that is used to get anything from null.
-		Unfortunately, some formRelative requests require a handler for getting an item from
-		another of the same type (e.g. "get the window after window 'foo'" requires a cWindow
-		from cWindow handler).
-	*/
-	// Install a generic handler to get an item from the app
-	mAnythingFromAppAccessor = NewOSLAccessorUPP(AECoreClass::AnythingFromAppAccessor);
-	ThrowIfNil(mAnythingFromAppAccessor);
-	
-	// Install a handler to get properties from anything.
-	err = ::AEInstallObjectAccessor(typeWildCard, typeWildCard, mAnythingFromAppAccessor, (long)this, false);
-	ThrowIfOSErr(err);
-	
-	// Install a generic handler to get a property from a typeAEList of tokens
-	mPropertyFromListAccessor = NewOSLAccessorUPP(AECoreClass::PropertyTokenFromAnything);
-	ThrowIfNil(mPropertyFromListAccessor);
-	
-	// Install a handler to get properties from anything.
-	err = ::AEInstallObjectAccessor(cProperty, typeWildCard, mPropertyFromListAccessor, (long)this, false);
-	ThrowIfOSErr(err);
-
-	// Install the OSL object callbacks, use for compare and count
-	mCountItemsCallback = NewOSLCountUPP(AECoreClass::CountObjectsCallback);
-	ThrowIfNil(mCountItemsCallback);
-
-	mCompareItemsCallback = NewOSLCompareUPP(AECoreClass::CompareObjectsCallback);
-	ThrowIfNil(mCompareItemsCallback);
-	
-	err = ::AESetObjectCallbacks(
-						mCompareItemsCallback,
-						mCountItemsCallback,
-						(OSLDisposeTokenUPP)	nil, 
-						(OSLGetMarkTokenUPP)	nil, 
-						(OSLMarkUPP)			nil, 
-						(OSLAdjustMarksUPP)	nil, 
-						(OSLGetErrDescUPP)  	nil);
-	ThrowIfOSErr(err);
-
-	// create the dispatchers for various object types. This should be the only place
-	// that new classes have to be added
-	AEApplicationClass*		appDispatcher = new AEApplicationClass;
-	RegisterClassHandler(cApplication, appDispatcher);
-	RegisterClassHandler(typeNull, appDispatcher, true);
-
-	AEDocumentClass*		docDispatcher = new AEDocumentClass;
-	RegisterClassHandler(cDocument, docDispatcher);
-
-	AEWindowClass*		windowDispatcher = new AEWindowClass(cWindow, kAnyWindowKind);
-	RegisterClassHandler(cWindow, windowDispatcher);
-
-/*	
-	AETextClass*		textDispatcher = new AETextClass;
-	RegisterClassHandler(AETextClass::cTEText, textDispatcher);
-	
-	AEWordClass*		wordDispatcher = new AEWordClass;
-	RegisterClassHandler(cWord, wordDispatcher);
-	
-	AECharacterClass*	charDispatcher = new AECharacterClass;
-	RegisterClassHandler(cChar, charDispatcher);
-*/
-}
-
-
-/*----------------------------------------------------------------------------
-	~AECoreClass 
-	
-----------------------------------------------------------------------------*/
-
-AECoreClass::~AECoreClass()
-{
-	if (mSuspendEventHandlerUPP)
-		DisposeAEEventHandlerUPP(mSuspendEventHandlerUPP);
-
-	if (mStandardSuiteHandlerUPP)
-		DisposeAEEventHandlerUPP(mStandardSuiteHandlerUPP);
-		
-	if (mRequiredSuiteHandlerUPP)
-		DisposeAEEventHandlerUPP(mRequiredSuiteHandlerUPP);
-			
-	if (mMozillaSuiteHandlerUPP)
-		DisposeAEEventHandlerUPP(mMozillaSuiteHandlerUPP);
-
-	if (mGetURLSuiteHandlerUPP)
-		DisposeAEEventHandlerUPP(mGetURLSuiteHandlerUPP);
-
-	if (mSpyGlassSuiteHandlerUPP)
-		DisposeAEEventHandlerUPP(mSpyGlassSuiteHandlerUPP);	
-	
-	if (mCreateElementHandlerUPP)
-		DisposeAEEventHandlerUPP(mCreateElementHandlerUPP);
-		
-	if (mPropertyFromListAccessor)
-		DisposeOSLAccessorUPP(mPropertyFromListAccessor);
-
-	if (mAnythingFromAppAccessor)
-		DisposeOSLAccessorUPP(mAnythingFromAppAccessor);
-
-	if (mCountItemsCallback)
-		DisposeOSLCountUPP(mCountItemsCallback);
-
-	if (mCompareItemsCallback)
-		DisposeOSLCompareUPP(mCompareItemsCallback);
-}
-
-#pragma mark -
-
-
-/*----------------------------------------------------------------------------
-	HandleCoreSuiteEvent 
-	
-----------------------------------------------------------------------------*/
-void AECoreClass::HandleCoreSuiteEvent(const AppleEvent *appleEvent, AppleEvent *reply)
-{
-	StAEDesc		directParameter;
-	StAEDesc		token;
-	OSErr		err = noErr;
-	
-	// extract the direct parameter (an object specifier)
-	err = ::AEGetKeyDesc(appleEvent, keyDirectObject, typeWildCard, &directParameter);
-	ThrowIfOSErr(err);
-
-	DescType	dispatchClass  	= typeNull;
-	
-	// check for null descriptor, which AEResolve doesn't handle well
-	// If it's not null, then AEResolve will return an application-defined token
-	if (directParameter.descriptorType == typeNull) 
-	{
-		token = directParameter;			// can throw
-	}
-	else
-	{
-		// The direct parameter contains an object specifier, or an "reference" in
-		// AppleScript terminology, such as "rectangle 1 of document 1". 
-		// AEResolve() will recursively call our installed object accessors
-		// until it returns a token with data referencing the requested object.
-		 
-		err = ::AEResolve(&directParameter, kAEIDoMinimum, &token);
-	}
-
-	if (err == errAENoSuchObject || err == errAEIllegalIndex)
-	{
-		// If we were executing an "Exists..." AppleEvent, we can reply it here
-		// because we have already determined that it DOES NOT exist.
-		// First, we get the event ID. We use "eventError" instead of "err"
-		// so that the result of AEGetAttributePtr() does not disturb the
-		// errAENoSuchObject result previously returned.
-		
-		AEEventID		eventID;
-		OSType		typeCode;
-		Size			actualSize = 0;		
-		OSErr		eventError = ::AEGetAttributePtr(appleEvent, 
-										  		 keyEventIDAttr, 
-										  		 typeType, 
-										  		 &typeCode, 
-										  		 (Ptr)&eventID, 	// Get the eventID from the AppleEvent
-										  		 sizeof(eventID), 
-										  		 &actualSize);
-										  
-		// If event was an "Exists..." message, store the result (false) in the reply
-		// because AEResolve() returned errAENoSuchObject.
-		
-		if (eventError == noErr && eventID == kAEDoObjectsExist)
-		{
-			Boolean	foundIt = false;
-			(void)AEPutParamPtr(reply, keyAEResult, typeBoolean, (Ptr)&foundIt, sizeof(Boolean));
-			
-			// Now, we set the err to noErr so that the scripting component doesn't complain
-			// that the object does not exist. We only do this if we were executing an "Exists..."
-			// event. Otherwise, the errAENoSuchObject will be returned.
-			ThrowNoErr();
-		}
-		
-		ThrowIfOSErr(err);
-		return;
-	}
-
-	ThrowIfOSErr(err);
-	
-	// Pass the token returned by AEResolve(), and the original AppleEvent event and reply,
-	// on to the appropriate object dispatcher
-
-	// The token type is, by convention, the same as class ID that handles this event.
-	// However, for property tokens, tokenType is cProperty for all objects, so
-	// we look inside the token at its dispatchClass to find out which class of object
-	// should really handle this AppleEvent.
-	
-	// Also, if the resolver returned a list of objects in the token, 
-	// the type will be typeAEList or one of our special list types, so
-	// we set the dispatch class based on the list type
-	// instead of on the type of the token itself
-	
-	if (AEListUtils::TokenContainsTokenList(&token))
-	{
-		SInt32	numItems;
-		
-		err = AECountItems(&token, &numItems);
-		
-		if (numItems == 0)	// could be an empty list
-		{
-			dispatchClass = typeNull;
-		}
-		else
-		{
-			StAEDesc	tempToken;
-			err = AEListUtils::GetFirstNonListToken((AEDesc *)&token, &tempToken);
-			if (err == noErr && tempToken.descriptorType != typeNull)
-			{
-				ConstAETokenDesc	tokenDesc(&tempToken);
-				dispatchClass = tokenDesc.GetDispatchClass();
-			}
-			else
-			{
-				dispatchClass = typeNull;
-				err = noErr;
-			}
-		}
-	}
-	else if (token.descriptorType == typeNull)	           // make sure we correctly handle things for cApplication that don't have a direct parameter
-	{
-		dispatchClass = typeNull;
-	}
-	else
-	{
-		ConstAETokenDesc	tokenDesc(&token);
-		dispatchClass = tokenDesc.GetDispatchClass();
-	}
-	
-	// why is this special-cased?
-	if (dispatchClass == cFile)
-	{
-		AEEventID eventID	= 0;
-		OSType  typeCode 	= 0;
-		Size   actualSize	= 0;
-		
-		AEGetAttributePtr(appleEvent, keyEventIDAttr,
-                      typeType,
-                      &typeCode,
-                      (Ptr)&eventID, // Get the eventID from the AppleEvent
-                      sizeof(eventID),
-                      &actualSize);
-	}
-
-
-	AEDispatchHandler*	handler = GetDispatchHandler(dispatchClass);
-	if (!handler)
-		ThrowIfOSErr(errAEEventNotHandled);
-		
-	handler->DispatchEvent(&token, appleEvent, reply);
-}
-
-
-/*----------------------------------------------------------------------------
-	HandleRequiredSuiteEvent 
-	
-----------------------------------------------------------------------------*/
-void AECoreClass::HandleRequiredSuiteEvent(const AppleEvent *appleEvent, AppleEvent *reply)
-{
-	StAEDesc	token;
-	
-	// ignore error; direct object param might be optional
-	(void)::AEGetParamDesc(appleEvent, keyDirectObject, typeAEList, &token);
-	
-	AEDispatchHandler*	handler = GetDispatchHandler(cApplication);
-	if (!handler)
-		ThrowIfOSErr(errAEEventNotHandled);
-		
-	handler->DispatchEvent(&token, appleEvent, reply);
-}
-
-
-/*----------------------------------------------------------------------------
-	HandleCreateElementEvent 
-	
-----------------------------------------------------------------------------*/
-void AECoreClass::HandleCreateElementEvent(const AppleEvent *appleEvent, AppleEvent *reply)
-{
-	StAEDesc		token;
-	OSErr		err = noErr;
-	
- 	// Extract the type of object we want to create.
- 	// We use this to call the event dispatcher for that kind of objects
-	err = ::AEGetParamDesc(appleEvent, keyAEObjectClass, typeType, &token);
-	ThrowIfOSErr(err);
-
-	DescType	dispatchClass = **(DescType **)(token.dataHandle);
-
-	AEDispatchHandler*	handler = GetDispatchHandler(dispatchClass);
-	if (!handler)
-		ThrowIfOSErr(errAEEventNotHandled);
-		
-	handler->DispatchEvent(&token, appleEvent, reply);
-}
-
-
-/*----------------------------------------------------------------------------
-	HandleEventSuspend 
-	
-----------------------------------------------------------------------------*/
-void AECoreClass::HandleEventSuspend(const AppleEvent *appleEvent, AppleEvent *reply)
-{
-	mSuspendedEvent = *appleEvent;
-	mReplyToSuspendedEvent = *reply;
-	OSErr	err = ::AESuspendTheCurrentEvent(appleEvent);
-	ThrowIfOSErr(err);
-}
-
-
-/*----------------------------------------------------------------------------
-	PropertyTokenFromList 
-	
-----------------------------------------------------------------------------*/
-void AECoreClass::PropertyTokenFromList(			DescType			desiredClass,
-			 								const AEDesc*		containerToken,
-			 								DescType			containerClass,
-			 								DescType			keyForm,
-		    									const AEDesc*		keyData,
-			 								AEDesc*			resultToken)
-{
-	DescType		handlerClass;
-	ConstAETokenDesc	containerDesc(containerToken);
-	
-	switch (containerClass)
-	{
-		case cProperty:
-			// this is to handle our property from property hack, which enables an article to be a property
-			// of an article window, and thence to get properties of that article.
-			handlerClass = containerDesc.GetDispatchClass();
-			break;
-
-		default:
-			handlerClass = containerClass;
-			break;
-	
-	}
-	AEDispatchHandler*	handler = GetDispatchHandler(handlerClass);
-	if (!handler)
-		ThrowIfOSErr(errAEEventNotHandled);
-		
-	handler->GetProperty(		desiredClass,
-							containerToken,
-							containerClass,
-							keyForm,
-							keyData,
-							resultToken);
-}
-
-
-/*----------------------------------------------------------------------------
-	GetAnythingFromApp 
-	
-----------------------------------------------------------------------------*/
-void AECoreClass::GetAnythingFromApp(				DescType			desiredClass,
-			 								const AEDesc*		containerToken,
-			 								DescType			containerClass,
-			 								DescType			keyForm,
-		    									const AEDesc*		keyData,
-			 								AEDesc*			resultToken)
-{
-	AEDispatchHandler*	handler = GetDispatchHandler(desiredClass);
-	if (!handler)
-		ThrowIfOSErr(errAEEventNotHandled);
-		
-	handler->GetItemFromContainer(		desiredClass,
-									containerToken,
-									containerClass,
-									keyForm,
-									keyData,
-									resultToken);
-}
-
-
-#pragma mark -
-
-/*----------------------------------------------------------------------------
-	SuspendEventHandler 
-	
-	This handler receives ALL core suite events EXCEPT Make (CreateElement).
-	It simply suspends the current event and returns. Someone has to resume
-	this event later, when we are ready to handle it, by calling ResumeEventHandling().
-
-----------------------------------------------------------------------------*/
-
-pascal OSErr AECoreClass::SuspendEventHandler(const AppleEvent *appleEvent, AppleEvent *reply, SInt32 refCon)
-{
-	AECoreClass*	coreClass = reinterpret_cast<AECoreClass *>(refCon);
-	OSErr		err = noErr;
-	
-	if (coreClass == nil)
-		return errAECorruptData;
-	
-	try
-	{
-		coreClass->HandleEventSuspend(appleEvent, reply);
-	}
-	catch (OSErr catchErr)
-	{
-		err = catchErr;
-	}
-	catch ( ... )
-	{
-		err = paramErr;
-	}
-	
-	return err;
-}
-
-/*----------------------------------------------------------------------------
-	RequiredSuiteHandler 
-	
-	This handler receives ALL core suite events EXCEPT Make (CreateElement)
-	and passes them on to the correct object dispatcher:
-	   cApplication, cDocument, cFile, cGraphicObject, and cWindow.
-	Make (CreateElement) is different because it passes its ospec in the
-	insertionLoc parameter instead of in the direct object parameter.
-
-----------------------------------------------------------------------------*/
-
-pascal OSErr AECoreClass::RequiredSuiteHandler(const AppleEvent *appleEvent, AppleEvent *reply, SInt32 refCon)
-{
-	AECoreClass*	coreClass = reinterpret_cast<AECoreClass *>(refCon);
-	OSErr		err = noErr;
-	
-	if (coreClass == nil)
-		return errAECorruptData;
-	
-	try
-	{
-		coreClass->HandleRequiredSuiteEvent(appleEvent, reply);
-	}
-	catch (OSErr catchErr)
-	{
-		err = catchErr;
-	}
-	catch ( ... )
-	{
-		err = paramErr;
-	}
-	
-	return err;
-}
-
-/*----------------------------------------------------------------------------
-	CoreSuiteHandler 
-	
-	This handler receives ALL core suite events EXCEPT Make (CreateElement)
-	and passes them on to the correct object dispatcher:
-	   cApplication, cDocument, cFile, cGraphicObject, and cWindow.
-	Make (CreateElement) is different because it passes its ospec in the
-	insertionLoc parameter instead of in the direct object parameter.
-
-----------------------------------------------------------------------------*/
-
-pascal OSErr AECoreClass::CoreSuiteHandler(const AppleEvent *appleEvent, AppleEvent *reply, SInt32 refCon)
-{
-	AECoreClass*	coreClass = reinterpret_cast<AECoreClass *>(refCon);
-	OSErr		err = noErr;
-	
-	if (coreClass == nil)
-		return errAECorruptData;
-	
-	try
-	{
-		coreClass->HandleCoreSuiteEvent(appleEvent, reply);
-	}
-	catch (OSErr catchErr)
-	{
-		err = catchErr;
-	}
-	catch ( ... )
-	{
-		err = paramErr;
-	}
-	
-	return err;
-}
-
-/*----------------------------------------------------------------------------
-	CreateElementHandler 
-	
-----------------------------------------------------------------------------*/
-
-pascal OSErr AECoreClass::CreateElementHandler(const AppleEvent *appleEvent, AppleEvent *reply, SInt32 refCon)
-{
-	AECoreClass*	coreClass = reinterpret_cast<AECoreClass *>(refCon);
-	OSErr		err = noErr;
-	
-	if (coreClass == nil)
-		return errAECorruptData;
-	
-	try
-	{
-		coreClass->HandleCreateElementEvent(appleEvent, reply);
-	}
-	catch (OSErr catchErr)
-	{
-		err = catchErr;
-	}
-	catch ( ... )
-	{
-		err = paramErr;
-	}
-	
-	return err;
-}
-
-#pragma mark -
-
-/*----------------------------------------------------------------------------
-	MozillaSuiteHandler 
-	
-----------------------------------------------------------------------------*/
-pascal OSErr AECoreClass::MozillaSuiteHandler(const AppleEvent *appleEvent, AppleEvent *reply, SInt32 refCon)
-{
-	AECoreClass*	coreClass = reinterpret_cast<AECoreClass *>(refCon);
-	OSErr		err = noErr;
-	
-	if (coreClass == nil)
-		return errAECorruptData;
-	
-	try
-	{
-		coreClass->HandleMozillaSuiteEvent(appleEvent, reply);
-	}
-	catch (OSErr catchErr)
-	{
-		err = catchErr;
-	}
-	catch ( ... )
-	{
-		err = paramErr;
-	}
-	
-	return err;
-}
-
-
-/*----------------------------------------------------------------------------
-	GetURLSuiteHandler 
-	
-
-----------------------------------------------------------------------------*/
-pascal OSErr AECoreClass::GetURLSuiteHandler(const AppleEvent *appleEvent, AppleEvent *reply, SInt32 refCon)
-{
-	AECoreClass*	coreClass = reinterpret_cast<AECoreClass *>(refCon);
-	OSErr		err = noErr;
-	
-	if (coreClass == nil)
-		return errAECorruptData;
-	
-	try
-	{
-		coreClass->HandleGetURLSuiteEvent(appleEvent, reply);
-	}
-	catch (OSErr catchErr)
-	{
-		err = catchErr;
-	}
-	catch ( ... )
-	{
-		err = paramErr;
-	}
-	
-	return err;
-}
-
-/*----------------------------------------------------------------------------
-	SpyGlassSuiteHandler 
-	
-
-----------------------------------------------------------------------------*/
-
-pascal OSErr AECoreClass::SpyglassSuiteHandler(const AppleEvent *appleEvent, AppleEvent *reply, SInt32 refCon)
-{
-	AECoreClass*	coreClass = reinterpret_cast<AECoreClass *>(refCon);
-	OSErr		err = noErr;
-	
-	if (coreClass == nil)
-		return errAECorruptData;
-	
-	try
-	{
-		coreClass->HandleSpyglassSuiteEvent(appleEvent, reply);
-	}
-	catch (OSErr catchErr)
-	{
-		err = catchErr;
-	}
-	catch ( ... )
-	{
-		err = paramErr;
-	}
-	
-	return err;
-}
-
-
-#pragma mark -
-
-/*----------------------------------------------------------------------------
-	HandleMozillaSuiteEvent 
-	
-	We probably want to handle events for this suite off to another class.
-----------------------------------------------------------------------------*/
-void AECoreClass::HandleMozillaSuiteEvent(const AppleEvent *appleEvent, AppleEvent *reply)
-{
-	mMozillaSuiteHandler.HandleMozillaSuiteEvent(appleEvent, reply);
-}
-
-
-/*----------------------------------------------------------------------------
-	HandleGetURLSuiteEvent 
-	
-	We probably want to handle events for this suite off to another class.
-----------------------------------------------------------------------------*/
-void AECoreClass::HandleGetURLSuiteEvent(const AppleEvent *appleEvent, AppleEvent *reply)
-{
-	mGetURLSuiteHandler.HandleGetURLSuiteEvent(appleEvent, reply);
-}
-
-
-/*----------------------------------------------------------------------------
-	HandleSpyGlassSuiteEvent 
-	
-	We probably want to handle events for this suite off to another class.
-----------------------------------------------------------------------------*/
-void AECoreClass::HandleSpyglassSuiteEvent(const AppleEvent *appleEvent, AppleEvent *reply)
-{
-	mSpyglassSuiteHandler.HandleSpyglassSuiteEvent(appleEvent, reply);
-}
-
-
-#pragma mark -
-
-/*----------------------------------------------------------------------------
-	PropertyTokenFromAnything 
-	
-----------------------------------------------------------------------------*/
-pascal OSErr AECoreClass::PropertyTokenFromAnything(			DescType			desiredClass,
-					 								const AEDesc*		containerToken,
-					 								DescType			containerClass,
-					 								DescType			keyForm,
-				    									const AEDesc*		keyData,
-					 								AEDesc*			resultToken,
-					 								long 				refCon)
-{
-	AECoreClass*		coreClass = reinterpret_cast<AECoreClass *>(refCon);
-	if (!coreClass) return paramErr;
-	
-	OSErr	err = noErr;
-	
-	try
-	{
-		coreClass->PropertyTokenFromList(desiredClass, containerToken, containerClass, keyForm, keyData, resultToken);
-	}
-	catch (OSErr catchErr)
-	{
-		err = catchErr;
-	}
-	catch (...)
-	{
-		err = paramErr;
-	}
-	
-	return err;
-}
-
-
-
-/*----------------------------------------------------------------------------
-	AnythingFromAppAccessor 
-	
-----------------------------------------------------------------------------*/
-pascal OSErr AECoreClass::AnythingFromAppAccessor(			DescType			desiredClass,
-					 								const AEDesc*		containerToken,
-					 								DescType			containerClass,
-					 								DescType			keyForm,
-				    									const AEDesc*		keyData,
-					 								AEDesc*			resultToken,
-					 								long 				refCon)
-{
-	AECoreClass*		coreClass = reinterpret_cast<AECoreClass *>(refCon);
-	
-	if (!coreClass)
-		return paramErr;
-	
-	OSErr	err = noErr;
-	
-	try
-	{
-		coreClass->GetAnythingFromApp(desiredClass, containerToken, containerClass, keyForm, keyData, resultToken);
-	}
-	catch (OSErr catchErr)
-	{
-		err = catchErr;
-	}
-	catch (...)
-	{
-		err = paramErr;
-	}
-	
-	return err;
-}
-
-
-/*----------------------------------------------------------------------------
-	CompareObjectsCallback 
-	
-----------------------------------------------------------------------------*/
-pascal OSErr AECoreClass::CompareObjectsCallback(	DescType			comparisonOperator, 	// operator to use
-											const AEDesc *		object,				// left-hand side
-											const AEDesc *		descriptorOrObject, 		// right-hand side
-											Boolean *			result)
-{
-	OSErr	err = noErr;
-	try
-	{
-		OSErr		err = noErr;
-		StAEDesc		desc1;
-		StAEDesc		desc2;
-
-		// This first AEDesc is a token to a specific object, so we resolve it.
-		AECoreClass::GetAECoreHandler()->ExtractData(object, &desc1);
-			
-		// A second AEDesc is either a token to another object or an AEDesc containing literal data.
-		AECoreClass::GetAECoreHandler()->ExtractData(descriptorOrObject, &desc2);	
-
-		// Make sure the data type extracted from the second AEDesc is the same as the
-		// data specified by the first AEDesc.
-		
-		if (desc1.descriptorType != desc2.descriptorType) 
-		{
-			StAEDesc		temp;
-			
-			// Create a temporary duplicate of desc2 and coerce it to the
-			// requested type. This could call a coercion handler you have
-			// installed. If there are no errors, stuff the coerced value back into desc2
-			err = AEDuplicateDesc(&desc2, &temp);
-			ThrowIfOSErr(err);
-			
-			desc2.Clear();
-			
-			err = AECoerceDesc(&temp, desc1.descriptorType, &desc2);
-			ThrowIfOSErr(err);
-		}
-
-		AEDispatchHandler*	handler = AECoreClass::GetDispatchHandlerForClass(desc1.descriptorType);
-		if (handler)
-			handler->CompareObjects(comparisonOperator, &desc1, &desc2, result);
-		else
-			*result = AEComparisons::TryPrimitiveComparison(comparisonOperator, &desc1, &desc2);
-	}
-	catch (OSErr catchErr)
-	{
-		err = catchErr;
-	}
-	catch (...)
-	{
-		err = paramErr;
-	}
-	
-	return err;
-}
-
-
-/*----------------------------------------------------------------------------
-	CountObjectsCallback 
-	
-----------------------------------------------------------------------------*/
-pascal OSErr AECoreClass::CountObjectsCallback(		DescType 		 	desiredType,
-											DescType 		 	containerClass,
-											const AEDesc *		container,
-							   				long *			result)
-{
-	AEDispatchHandler*	handler = AECoreClass::GetDispatchHandlerForClass(containerClass);
-	if (!handler)
-		return errAEEventNotHandled;
-	
-	OSErr	err = noErr;
-	try
-	{
-		handler->CountObjects(				desiredType,
-										containerClass,
-										container,
-										result);
-
-	}
-	catch (OSErr catchErr)
-	{
-		err = catchErr;
-	}
-	catch (...)
-	{
-		err = paramErr;
-	}
-	
-	return err;
-}
-
-#pragma mark -
-
-/*----------------------------------------------------------------------------
-	GetEventKeyDataParameter 
-	
-	Extract the keyData parameter data from an apple event
----------------------------------------------------------------------------*/
-void AECoreClass::GetEventKeyDataParameter(const AppleEvent *appleEvent, DescType requestedType, AEDesc *data)
-{
-	StAEDesc	keyData;
-
-	OSErr	err = AEGetKeyDesc(appleEvent, keyAEData, requestedType, &keyData);
-	ThrowIfOSErr(err);
-	
-	ExtractData(&keyData, data);
-}
-
-
-/*----------------------------------------------------------------------------
-	ExtractData 
-	
-	ExtractData can receive several types of data:
-	Source				 Processing
-	-------------------- 	-----------------------------
-	an object specifier		call AEResolve() to get token, then handle below
-	a property token		call public accessors to get raw data from token
-	a object token			if it's not a property token, the token itself is returned
-	 raw data				just return it, it's already data!
----------------------------------------------------------------------------*/
-
-void AECoreClass::ExtractData(const AEDesc *source, AEDesc *data)
-{
-	OSErr		err = noErr;
-	StAEDesc		temp;
-	DescType		dispatchClass;
-		
-	if ((source->descriptorType == typeNull) || (source->dataHandle == nil))
-		ThrowIfOSErr(errAENoSuchObject);
-	
-	// If it's an object specifier, resolve into a token
-	// Otherwise, just copy it
-	
-	if (source->descriptorType == typeObjectSpecifier) 
-	{
-		err = AEResolve(source, kAEIDoMinimum, &temp);
-	}
-	else
-	{
-		err = AEDuplicateDesc(source, &temp);
-	}
-	ThrowIfOSErr(err);
-	
-	// Next, determine which object should handle it, if any. 
-	// If it's a property token, get the dispatch class. 
-	// Otherwise, just get the descriptorType. 
-	
-	if (temp.descriptorType == typeProperty)
-	{
-		ConstAETokenDesc	tokenDesc(&temp);
-		dispatchClass = tokenDesc.GetDispatchClass();
-	}
-	else
-		dispatchClass = temp.descriptorType;
-	
-	// If it's a property token, get the data it refers to,
-	// otherwise duplicate it and return
-		
-	AEDispatchHandler*	handler = GetDispatchHandler(dispatchClass);
-	if (handler)
-	{
-		/*
-		case cApplication:
-			// why?
-			ThrowIfOSErr(errAEEventNotHandled);
-			break;
-		*/
-		handler->GetDataFromListOrObject(&temp, nil, data);
-	}
-	else
-	{
-		err = AEDuplicateDesc(&temp, data);
-		ThrowIfOSErr(err);
-	}
-}
-
-#pragma mark -
-
-/*----------------------------------------------------------------------------
-	RegisterClassHandler 
-	
-	This is where a handler class registers itself
-----------------------------------------------------------------------------*/
-void AECoreClass::RegisterClassHandler(DescType handlerClass, AEGenericClass* classHandler, Boolean isDuplicate /* = false */)
-{
-	mDispatchTree.InsertHandler(handlerClass, classHandler, isDuplicate);
-}
-
-/*----------------------------------------------------------------------------
-	GetDispatchHandler 
-	
-	Get a dispatch handler for the given class
-----------------------------------------------------------------------------*/
-AEDispatchHandler* AECoreClass::GetDispatchHandler(DescType dispatchClass)
-{
-	return mDispatchTree.FindHandler(dispatchClass);
-}
-
-
-/*----------------------------------------------------------------------------
-	GetDispatchHandler 
-	
-	Get a dispatch handler for the given class.
-	
-	Static
-----------------------------------------------------------------------------*/
-AEDispatchHandler* AECoreClass::GetDispatchHandlerForClass(DescType dispatchClass)
-{
-	if (!sAECoreHandler)
-		return nil;
-	
-	return sAECoreHandler->GetDispatchHandler(dispatchClass);
-}
-
-
-
-/*----------------------------------------------------------------------------
-	InstallSuitesGenericHandler 
-	
-	Install a handler for each of our suites
-----------------------------------------------------------------------------*/
-void AECoreClass::InstallSuiteHandlers(Boolean suspendEvents)
-{
-	OSErr	err;
-
-	err = ::AEInstallEventHandler(kCoreEventClass,  	typeWildCard, 
-											suspendEvents ? mSuspendEventHandlerUPP : mRequiredSuiteHandlerUPP, 
-											(long)this, 
-											false);
-	ThrowIfOSErr(err);
-	
-	err = ::AEInstallEventHandler(kAECoreSuite,  		typeWildCard, 
-											suspendEvents ? mSuspendEventHandlerUPP : mStandardSuiteHandlerUPP, 
-											(long)this, 
-											false);
-	ThrowIfOSErr(err);
-	
-	// install the mozilla suite handler
-	err = ::AEInstallEventHandler(AEMozillaSuiteHandler::kSuiteSignature,  	typeWildCard, 
-											suspendEvents ? mSuspendEventHandlerUPP : mMozillaSuiteHandlerUPP, 
-											(long)this,
-											false);
-	ThrowIfOSErr(err);
-
-	// install the GetURL suite handler
-	err = ::AEInstallEventHandler(AEGetURLSuiteHandler::kSuiteSignature,  	typeWildCard, 
-											suspendEvents ? mSuspendEventHandlerUPP : mGetURLSuiteHandlerUPP, 
-											(long)this, 
-											false);
-	ThrowIfOSErr(err);
-	
-	// install the SpyGlass suite handler
-	err = ::AEInstallEventHandler(AESpyglassSuiteHandler::kSuiteSignature,  	typeWildCard, 
-											suspendEvents ? mSuspendEventHandlerUPP : mSpyGlassSuiteHandlerUPP, 
-											(long)this, 
-											false);
-	ThrowIfOSErr(err);
-}
-
-
-/*----------------------------------------------------------------------------
-	HandleCoreSuiteEvent 
-	
-----------------------------------------------------------------------------*/
-void AECoreClass::ResumeEventHandling(const AppleEvent *appleEvent, AppleEvent *reply, Boolean dispatchEvent)
-{
-	InstallSuiteHandlers(false);
-
-	OSErr	err;
-
-	// now resume the passed in event
-	err = ::AEResumeTheCurrentEvent(appleEvent, reply, (AEEventHandlerUPP)(dispatchEvent ? kAEUseStandardDispatch : kAENoDispatch), (long)this);
-	ThrowIfOSErr(err);
-}
deleted file mode 100644
--- a/xpfe/bootstrap/appleevents/nsAECoreClass.h
+++ /dev/null
@@ -1,207 +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.
- *
- * 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):
- *   Simon Fraser <sfraser@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 __AECORECLASS__
-#define __AECORECLASS__
-
-#ifdef __cplusplus
-
-
-#include <AEDataModel.h>
-#include <AppleEvents.h>
-#include <AEObjects.h>
-
-#include "nsAEClassDispatcher.h"
-
-#include "nsAEMozillaSuiteHandler.h"
-#include "nsAEGetURLSuiteHandler.h"
-#include "nsAESpyglassSuiteHandler.h"
-
-class AEApplicationClass;
-class AEDocumentClass;
-class AEWindowClass;
-
-class AECoreClass
-{
-public:
-	
-						AECoreClass(Boolean suspendEvents = false);	// throws OSErrs
-						~AECoreClass();
-
-	void					HandleCoreSuiteEvent(const AppleEvent *appleEvent, AppleEvent *reply);			// throws OSErrs
-	void					HandleRequiredSuiteEvent(const AppleEvent *appleEvent, AppleEvent *reply);		// throws OSErrs
-
-	void					HandleMozillaSuiteEvent(const AppleEvent *appleEvent, AppleEvent *reply);		// throws OSErrs
-	void					HandleGetURLSuiteEvent(const AppleEvent *appleEvent, AppleEvent *reply);		// throws OSErrs
-	void					HandleSpyglassSuiteEvent(const AppleEvent *appleEvent, AppleEvent *reply);		// throws OSErrs
-
-	void					HandleCreateElementEvent(const AppleEvent *appleEvent, AppleEvent *reply);		// throws OSErrs
-	
-	void					HandleEventSuspend(const AppleEvent *appleEvent, AppleEvent *reply);
-	void					ResumeEventHandling(const AppleEvent *appleEvent, AppleEvent *reply, Boolean dispatchEvent);
-	
-	// AE Handlers
-	static pascal OSErr		SuspendEventHandler(const AppleEvent *appleEvent, AppleEvent *reply, SInt32 refCon);
-	static pascal OSErr		RequiredSuiteHandler(const AppleEvent *appleEvent, AppleEvent *reply, SInt32 refCon);
-	static pascal OSErr		CoreSuiteHandler(const AppleEvent *appleEvent, AppleEvent *reply, SInt32 refCon);
-	static pascal OSErr		CreateElementHandler(const AppleEvent *appleEvent, AppleEvent *reply, SInt32 refCon);
-
-	// Handler for Mozilla Suite events
-	static pascal OSErr		MozillaSuiteHandler(const AppleEvent *appleEvent, AppleEvent *reply, SInt32 refCon);
-
-	// Handler for GetURL events
-	static pascal OSErr		GetURLSuiteHandler(const AppleEvent *appleEvent, AppleEvent *reply, SInt32 refCon);
-
-	// Handler for GetURL events
-	static pascal OSErr		SpyglassSuiteHandler(const AppleEvent *appleEvent, AppleEvent *reply, SInt32 refCon);
-
-
-	AEDispatchHandler*		GetDispatchHandler(DescType dispatchClass);
-	
-	
-	void					GetSuspendedEvent(AppleEvent *appleEvent, AppleEvent *reply)
-						{
-							*appleEvent = mSuspendedEvent;
-							*reply = mReplyToSuspendedEvent;
-						}
-						
-protected:
-
-	// Property token from list of tokens accessor
-	void					PropertyTokenFromList(			DescType			desiredClass,
-					 								const AEDesc*		containerToken,
-					 								DescType			containerClass,
-					 								DescType			keyForm,
-				    									const AEDesc*		keyData,
-					 								AEDesc*			resultToken);
-	
-	void					GetAnythingFromApp(			DescType			desiredClass,
-					 								const AEDesc*		containerToken,
-					 								DescType			containerClass,
-					 								DescType			keyForm,
-				    									const AEDesc*		keyData,
-					 								AEDesc*			resultToken);
-	
-	void					RegisterClassHandler(			DescType			handlerClass,
-													AEGenericClass*	classHandler,
-													Boolean			isDuplicate = false);
-
-
-	void					InstallSuiteHandlers(				Boolean			suspendEvents);
-	
-public:
-
-	void					GetEventKeyDataParameter(		const AppleEvent*	appleEvent,
-													DescType			requestedType,
-													AEDesc*			data);
-
-	static pascal OSErr		PropertyTokenFromAnything(		DescType			desiredClass,
-					 								const AEDesc*		containerToken,
-					 								DescType			containerClass,
-					 								DescType			keyForm,
-				    									const AEDesc*		keyData,
-					 								AEDesc*			resultToken,
-					 								long 				refCon);
-
-	static pascal OSErr		AnythingFromAppAccessor(		DescType			desiredClass,
-					 								const AEDesc*		containerToken,
-					 								DescType			containerClass,
-					 								DescType			keyForm,
-				    									const AEDesc*		keyData,
-					 								AEDesc*			resultToken,
-					 								long 				refCon);
-
-	static pascal OSErr		CompareObjectsCallback(			DescType			comparisonOperator, 	// operator to use
-													const AEDesc *		object,				// left-hand side
-													const AEDesc *		descriptorOrObject, 		// right-hand side
-													Boolean *			result);
-
-
-	static pascal OSErr		CountObjectsCallback(			DescType 		 	desiredType,
-													DescType 		 	containerClass,
-													const AEDesc *		container,
-									   				long *			result);
-
-	void					ExtractData(					const AEDesc*		source,
-													AEDesc*			data);
-	
-	
-	static AEDispatchHandler*	GetDispatchHandlerForClass(	DescType			dispatchClass);
-	
-protected:
-	
-	AEDispatchTree			mDispatchTree;				// tree of handler dispatchers
-
-	AEEventHandlerUPP		mSuspendEventHandlerUPP;
-	
-	AEEventHandlerUPP		mStandardSuiteHandlerUPP;
-	AEEventHandlerUPP		mRequiredSuiteHandlerUPP;
-	AEEventHandlerUPP		mCreateElementHandlerUPP;
-
-	AEEventHandlerUPP		mMozillaSuiteHandlerUPP;
-	AEEventHandlerUPP		mGetURLSuiteHandlerUPP;
-	AEEventHandlerUPP		mSpyGlassSuiteHandlerUPP;
-
-        AEMozillaSuiteHandler      mMozillaSuiteHandler;
-        AEGetURLSuiteHandler      mGetURLSuiteHandler;
-        AESpyglassSuiteHandler   mSpyglassSuiteHandler;
-        
-	OSLAccessorUPP		mPropertyFromListAccessor;
-	OSLAccessorUPP		mAnythingFromAppAccessor;
-
-	OSLCountUPP			mCountItemsCallback;
-	OSLCompareUPP		mCompareItemsCallback;
-
-private:
-
-	AppleEvent			mSuspendedEvent;
-	AppleEvent			mReplyToSuspendedEvent;
-	
-public:
-
-	static AECoreClass*		GetAECoreHandler() { return sAECoreHandler; }
-	static AECoreClass*		sAECoreHandler;
-
-};
-
-#endif	//__cplusplus
-
-#endif /* __AECORECLASS__ */
-
deleted file mode 100644
--- a/xpfe/bootstrap/appleevents/nsAEDefs.h
+++ /dev/null
@@ -1,93 +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.
- *
- * 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):
- *   Simon Fraser <sfraser@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 nsAEDefs_h_
-#define nsAEDefs_h_
-
-
-#include <MacTypes.h>
-
-
-typedef char	CStr255[256];		/* like Str255, except for C-format strings. */
-typedef long TAEListIndex;    // a 1-based list index
-typedef short TWindowKind;
-
-
-/*
-	We don't (yet) actually set these window kinds on the Mac windows
-	that Mozilla creates. These values are derived from the windowtype
-	strings that XUL windows have. See functions in nsWindowUtils.cpp.
-*/
-enum {
-	kAnyWindowKind = 99,
-	
-	// custom window kinds should start at 9 or above
-	kBrowserWindowKind = 100,
-	kMailWindowKind,
-	kMailComposeWindowKind,
-	kComposerWindowKind,
-	kAddressBookWindowKind,
-	kOtherWindowKind
-	
-};
-
-
-typedef enum
-{
-	eSaveUnspecified,
-	eSaveYes,
-	eSaveNo,
-	eSaveAsk
-} TAskSave;
-
-
-#if DEBUG
-
-#define AE_ASSERT(x,msg)	{ if (!(x)) { DebugStr("\p"msg); } }
-
-#else
-
-#define AE_ASSERT(x,msg)	((void) 0)
-
-#endif
-
-
-
-
-#endif // nsAEDefs_h_
deleted file mode 100644
--- a/xpfe/bootstrap/appleevents/nsAEDocumentClass.cpp
+++ /dev/null
@@ -1,709 +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.
- *
- * 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):
- *   Simon Fraser <sfraser@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 ***** */
-
-#include "nsAEUtils.h"
-#include "nsAETokens.h"
-#include "nsAECoreClass.h"
-#include "nsAEApplicationClass.h"
-
-#include "nsAEDocumentClass.h"
-
-
-/*----------------------------------------------------------------------------
-	AEDocumentClass 
-	
-----------------------------------------------------------------------------*/
-AEDocumentClass::AEDocumentClass()
-:	AEGenericClass(cDocument, typeNull)
-{
-}
-
-
-/*----------------------------------------------------------------------------
-	~AEDocumentClass 
-	
-----------------------------------------------------------------------------*/
-AEDocumentClass::~AEDocumentClass()
-{
-}
-
-#pragma mark -
-
-/*----------------------------------------------------------------------------
-	PropertyFromApplicationAccessor 
-	
-----------------------------------------------------------------------------*/
-pascal OSErr AEDocumentClass::PropertyAccessor(		DescType			desiredClass,
-											const AEDesc*		containerToken,
-											DescType			containerClass,
-											DescType			keyForm,
-											const AEDesc*		keyData,
-											AEDesc*			resultToken,
-											long 				refCon)
-{
-	AEDocumentClass*	docClass = reinterpret_cast<AEDocumentClass *>(refCon);
-	if (!docClass) return paramErr;
-	
-	OSErr		err = noErr;
-	
-	try
-	{
-		docClass->GetProperty(desiredClass, containerToken, containerClass, keyForm, keyData, resultToken);
-	}
-	catch(OSErr catchErr)
-	{
-		err = catchErr;
-	}
-	catch(...)
-	{
-		err = paramErr;
-	}
-	
-	return err;
-}
-
-/*----------------------------------------------------------------------------
-	GetItemFromContainer 
-	
-	Not appropriate for the application
-----------------------------------------------------------------------------*/
-void AEDocumentClass::GetItemFromContainer(		DescType			desiredClass,
-										const AEDesc*		containerToken,
-										DescType			containerClass, 
-										DescType			keyForm,
-										const AEDesc*		keyData,
-										AEDesc*			resultToken)
-{
-	ThrowIfOSErr(errAEEventNotHandled);
-}
-
-/*----------------------------------------------------------------------------
-	GetDocumentFromApp 
-	
-----------------------------------------------------------------------------*/
-void AEDocumentClass::GetDocumentFromApp(		DescType			desiredClass,		// cDocument
-										const AEDesc*		containerToken,	// null container
-										DescType			containerClass,  	 // cApplication
-										DescType			keyForm,
-										const AEDesc*		keyData,
-										AEDesc*			resultToken)		// specified Document is returned in result
-{
-	OSErr				err			= noErr;
-	DescType				keyDataType 	= keyData->descriptorType;
-	long					index;
-	long					numItems;
-	Boolean				wantsAllItems	= false;
-	StAEDesc 				startObject;	// These are used to resolve formRange
-	StAEDesc 				stopObject;
-	DocumentReference		document;
-	Str63				documentName;
-	CoreTokenRecord 		token;
-	
-	numItems = CountDocuments();
-
-	switch (keyForm) 
-	{
-		case formName:											// Document by name
-			{
-				if (DescToPString(keyData, documentName, 63) != noErr)
-				{
-					err = errAECoercionFail;
-				}
-				else
-				{
-					document = GetDocumentByName(documentName);
-					if (document == nil)
-						err = errAENoSuchObject;
-				}
-			}
-			break;
-		
-		case formAbsolutePosition:									// Document by number
-			err = NormalizeAbsoluteIndex(keyData, &index, numItems, &wantsAllItems);
-			if ((err == noErr) && (wantsAllItems == false))
-			{
-				document = GetDocumentByIndex(index);
-				if (document == nil)
-					err = errAEIllegalIndex;
-			}
-			break;	
-		
-		case formRelativePosition:
-			ProcessFormRelativePostition(containerToken, keyData, &document);
-			break;	
-		
-		case formRange:
-			switch (keyDataType)
-			{		
-				case typeRangeDescriptor:
-					err = ProcessFormRange((AEDesc *)keyData, &startObject, &stopObject);
-					if (err == noErr)
-					{
-						ConstAETokenDesc	startTokenDesc(&startObject);
-						ConstAETokenDesc	stopTokenDesc(&startObject);
-						
-						DescType startType = startTokenDesc.GetDispatchClass();
-						DescType stopType  = stopTokenDesc.GetDispatchClass();
-	 
-						if (startType != cDocument || stopType != cDocument)
-							err = errAEWrongDataType;
-					}
-					break;
-
-				default:
-					err = errAEWrongDataType;
-					break;	
-			}
-			break;	
-
-		default:
-			err = errAEEventNotHandled;
-			break;
-	}
-	
-	// if user asked for all items, and there aren't any,
-	// we'll be kind and return an empty list.
-
-	if (wantsAllItems && (err == errAENoSuchObject || err == errAEIllegalIndex))
-	{
-		err = AECreateList(NULL, 0, false, (AEDescList*)resultToken);
-		ThrowIfOSErr(err);
-		return;
-	}
-
-	ThrowIfOSErr(err);
-	
-	// fill in the result token
-
-	token.dispatchClass  	= GetClass();
-	token.objectClass	= GetClass();
-	token.propertyCode 	= typeNull;
-
-	if (wantsAllItems)
-	{						
-		err = AECreateList(NULL, 0, false, (AEDescList*)resultToken);
-		
-		if (err == noErr)
-		{
-			for (index = 1; index <= numItems; index++)
-			{
-				document = GetDocumentByIndex(index);
-				ThrowIfOSErr(errAEEventNotHandled);
-				
-				token.documentID = GetDocumentID(document);
-				
-				err = AEPutPtr(resultToken, 0, desiredClass, &token, sizeof(token));
-				ThrowIfOSErr(err);
-			}
-		}
-	}
-	else if (keyForm == formRange)
-	{			
-		DocumentReference	beginDocument;
-		DocumentReference	endDocument;
-		long				beginIndex;
-		long				endIndex;
-		
-		beginDocument = GetDocumentReferenceFromToken(&startObject);
-		beginIndex = GetDocumentIndex(beginDocument);
-
-		endDocument = GetDocumentReferenceFromToken(&stopObject);
-		endIndex = GetDocumentIndex(endDocument);
-								
-		err = AECreateList(NULL, 0, false, (AEDescList*)resultToken);
-		ThrowIfOSErr(err);
-			
-		if (beginIndex > endIndex) // swap elements
-		{
-			DocumentReference temp;
-			temp			= beginDocument;
-			beginDocument	= endDocument;
-			endDocument	= temp;
-		}
-		
-		document = beginDocument;
-		while (document != nil)
-		{
-			token.documentID = GetDocumentID(document);
-			
-			err = AEPutPtr(resultToken, 0, desiredClass, &token, sizeof(token));
-			ThrowIfOSErr(err);
-
-			if (document == endDocument)
-				break;
-			document = GetNextDocument(document);
-		}
-	}
-	else
-	{
-		token.documentID = GetDocumentID(document);
-		err = AECreateDesc(desiredClass, &token, sizeof(token), resultToken);
-	}
-
-	ThrowIfOSErr(err);		
-}
-
-
-/*----------------------------------------------------------------------------
-	DocumentAccessor 
-	
-	Document from null accessor
-----------------------------------------------------------------------------*/
-pascal OSErr AEDocumentClass::DocumentAccessor(		DescType			desiredClass,		// cDocument
-											const AEDesc*		containerToken,	// null container
-											DescType			containerClass,  	 // cApplication
-											DescType			keyForm,
-											const AEDesc*		keyData,
-											AEDesc*			resultToken,		// specified Document is returned in result
-											long 				refCon)
-{
-	AEDocumentClass*		docClass = reinterpret_cast<AEDocumentClass *>(refCon);
-	if (!docClass) return paramErr;
-	
-	OSErr		err = noErr;
-	
-	try
-	{
-		docClass->GetDocumentFromApp(desiredClass, containerToken, containerClass, keyForm, keyData, resultToken);
-	}
-	catch(OSErr catchErr)
-	{
-		err = catchErr;
-	}
-	catch(...)
-	{
-		err = paramErr;
-	}
-	
-	return err;
-}
-
-											
-
-
-#pragma mark -
-
-/*----------------------------------------------------------------------------
-	ProcessFormRelativePostition 
-	
-----------------------------------------------------------------------------*/
-void AEDocumentClass::ProcessFormRelativePostition(const AEDesc* anchorToken, const AEDesc *keyData, DocumentReference *document)
-{
-	ConstAETokenDesc		tokenDesc(anchorToken);
-	OSErr			err = noErr;
-	DescType 			positionEnum;
-	DocumentReference	anchorDocument;
-	DocumentReference	relativeDocument = nil;
-	
-	*document = nil;
-	
-	anchorDocument = GetDocumentReferenceFromToken(anchorToken);
-
-	if (err == noErr)
-	{
-	
-		switch (keyData->descriptorType)
-		{
-		   case typeEnumerated:
-				if (DescToDescType((AEDesc*)keyData, &positionEnum) != noErr)
-				{
-					err = errAECoercionFail;
-				}
-				else
-				{
-					switch (positionEnum)
-					{
-						case kAENext:						// get the document behind the anchor
-							*document = GetPreviousDocument(anchorDocument);
-							if (*document == nil)
-								err = errAENoSuchObject;
-							break;
-							
-						case kAEPrevious:					// get the document in front of the anchor
-							*document = GetNextDocument(anchorDocument);
-							if (*document == nil)
-								err = errAENoSuchObject;
-							break;
-							
-						default:
-							err = errAEEventNotHandled;
-							break;
-					}
-				}
-				break;
-				
-			default:
-				err = errAECoercionFail;
-				break;
-		}
-	}
-	
-	ThrowIfOSErr(err);
-}
-
-#pragma mark -
-
-/*----------------------------------------------------------------------------
-	CanGetProperty 
-	
-----------------------------------------------------------------------------*/
-Boolean AEDocumentClass::CanGetProperty(DescType property)
-{
-	Boolean	result = false;
-	
-	switch (property)
-	{
-		// Properties we can get:
-		
-		case pBestType:
-		case pClass:
-		case pDefaultType:
-		case pObjectType:
-		
-		case pName:
-		case pProperties:
-		case pIsModified:
-			result = true;
-			break;
-			
-		// Properties we can't get:
-		default:
-			result = Inherited::CanGetProperty(property);
-			break;
-	}
-
-	return result;
-}
-
-
-/*----------------------------------------------------------------------------
-	CanSetProperty 
-	
-----------------------------------------------------------------------------*/
-Boolean AEDocumentClass::CanSetProperty(DescType property)
-{
-	Boolean	result = false;
-	
-	switch (property)
-	{
-		// Properties we can set:
-		
-		case pName:
-			result = true;
-			break;
-			
-		// Properties we can't set:
-
-		case pBestType:
-		case pClass:
-		case pDefaultType:
-		case pObjectType:
-		
-		case pProperties:
-		case pIsModified:
-			result = false;
-			break;
-			
-		default:
-			result = Inherited::CanSetProperty(property);
-			break;
-	}
-
-	return result;
-}
-
-
-#pragma mark -
-
-
-/*----------------------------------------------------------------------------
-	GetDataFromObject 
-	
-----------------------------------------------------------------------------*/
-void AEDocumentClass::GetDataFromObject(const AEDesc *token, AEDesc *desiredTypes, AEDesc *data)
-{
-	OSErr			err				= noErr;
-	Boolean			usePropertyCode	= false;	
-	DocumentReference	document 			= nil;
-	ConstAETokenDesc		tokenDesc(token);
-	DescType			aType			= cDocument;
-	Str63 			documentName;
-	Boolean 			isModified;
-	
-	// ugh
-	document = GetDocumentReferenceFromToken(token);
-	ThrowIfOSErr(err);
-	if (document == nil)
-		ThrowIfOSErr(paramErr);
-
-	GetDocumentName(document, documentName);						
-	isModified = DocumentIsModified(document);						
-
-	usePropertyCode = tokenDesc.UsePropertyCode();
-	
-	DescType propertyCode = tokenDesc.GetPropertyCode();
-	
-	switch (propertyCode)
-	{
-		case pProperties:
-			err = AECreateList(NULL, 0L, true, data);
-			ThrowIfOSErr(err);
-
-			err = AEPutKeyPtr(data, pObjectType,	typeType, 	&aType, 		 	sizeof(DescType));
-			err = AEPutKeyPtr(data, pName, 		typeChar, 	&documentName[1], 	documentName[0]);
-			err = AEPutKeyPtr(data, pIsModified, 	typeBoolean, 	&isModified, 		sizeof(Boolean));
-			break;
-			
-		case pBestType:
-		case pClass:
-		case pDefaultType:
-		case pObjectType:
-			err = AECreateDesc(typeType, &aType, sizeof(DescType), data);
-			break;
-			
-		case pName:
-			err = AECreateDesc(typeChar, &documentName[1], documentName[0], data);
-			break;
-			
-		case pIsModified:
-			err = AECreateDesc(typeBoolean, &isModified, sizeof(Boolean), data);
-			break;
-			
-		default:
-			Inherited::GetDataFromObject(token, desiredTypes, data);
-			break;
-	}
-	
-	ThrowIfOSErr(err);
-}
-
-/*----------------------------------------------------------------------------
-	SetDataForObject 
-	
-----------------------------------------------------------------------------*/
-void AEDocumentClass::SetDataForObject(const AEDesc *token, AEDesc *data)
-{
-	OSErr				err = noErr;		
-	Boolean				usePropertyCode;
-	DescType				propertyCode;
-	DocumentReference 		document = nil;
-	ConstAETokenDesc			tokenDesc(token);
-	StAEDesc 				propertyRecord;
-
-	usePropertyCode = tokenDesc.UsePropertyCode();
-	document = GetDocumentReferenceFromToken(token);
-		
-	if (usePropertyCode == false)
-	{
-		err = errAEWriteDenied;
-	}
-	else
-	{
-		propertyCode = tokenDesc.GetPropertyCode();
-		
-		if (data->descriptorType == typeAERecord)
-		{		
-			SetDocumentProperties(document, data);
-		}
-		else	// Build a record with one property
-		{
-			err = AECreateList(NULL, 0L, true, &propertyRecord);
-			ThrowIfOSErr(err);
-			
-			err = AEPutKeyDesc(&propertyRecord, propertyCode, data);
-			ThrowIfOSErr(err);
-		
-			SetDocumentProperties(document, &propertyRecord);
-		}
-	}
-
-	ThrowIfOSErr(err);
-}
-
-
-/*----------------------------------------------------------------------------
-	SetDocumentProperties 
-	
-----------------------------------------------------------------------------*/
-void	AEDocumentClass::SetDocumentProperties(DocumentReference document, AEDesc *propertyRecord)
-{
-
-}
-
-
-/*----------------------------------------------------------------------------
-	CountDocuments 
-	
-----------------------------------------------------------------------------*/
-long AEDocumentClass::CountDocuments()
-{
-	return 0;
-}
-
-
-/*----------------------------------------------------------------------------
-	GetDocumentByName 
-	
-----------------------------------------------------------------------------*/
-DocumentReference  AEDocumentClass::GetDocumentByName(ConstStr255Param docName)
-{
-	return nil;
-}
-
-/*----------------------------------------------------------------------------
-	GetDocumentByIndex 
-	
-----------------------------------------------------------------------------*/
-DocumentReference  AEDocumentClass::GetDocumentByIndex(long index)
-{
-	return nil;
-}
-
-/*----------------------------------------------------------------------------
-	GetDocumentByID 
-	
-----------------------------------------------------------------------------*/
-DocumentReference AEDocumentClass::GetDocumentByID(long docID)
-{
-	return nil;
-}
-
-/*----------------------------------------------------------------------------
-	GetNextDocument 
-	
-----------------------------------------------------------------------------*/
-DocumentReference AEDocumentClass::GetNextDocument(DocumentReference docRef)
-{
-	return nil;
-}
-
-
-/*----------------------------------------------------------------------------
-	GetPreviousDocument 
-	
-----------------------------------------------------------------------------*/
-DocumentReference AEDocumentClass::GetPreviousDocument(DocumentReference docRef)
-{
-	return nil;
-}
-
-
-/*----------------------------------------------------------------------------
-	GetDocumentReferenceFromToken 
-	
-----------------------------------------------------------------------------*/
-DocumentReference AEDocumentClass::GetDocumentReferenceFromToken(const AEDesc *token)
-{
-	ConstAETokenDesc	tokenDesc(token);
-	long			docID = tokenDesc.GetDocumentID();
-	
-	return GetDocumentByID(docID);
-}
-
-/*----------------------------------------------------------------------------
-	CloseWindowSaving 
-	
-----------------------------------------------------------------------------*/
-void AEDocumentClass::CloseWindowSaving(AEDesc *token, const AEDesc *saving, AEDesc *savingIn)
-{
-	OSErr			err			= noErr;
-	DocumentReference	document;
-
-	document = GetDocumentReferenceFromToken(token);
-	
-	if (document != nil)
-	{
-		// DestroyDocument(document);
-	}
-	else
-		err = errAEEventNotHandled;
-	
-	ThrowIfOSErr(err);
-}
-
-#pragma mark -
-
-/*----------------------------------------------------------------------------
-	CreateSelfSpecifier 
-
-----------------------------------------------------------------------------*/
-void AEDocumentClass::CreateSelfSpecifier(const AEDesc *token, AEDesc *outSpecifier)
-{
-	ThrowIfOSErr(errAENoSuchObject);
-}
-
-#pragma mark -
-
-/*----------------------------------------------------------------------------
-	GetDocumentID 
-	
-----------------------------------------------------------------------------*/
-long GetDocumentID(DocumentReference docRef)
-{
-	return 0;
-}
-
-	
-/*----------------------------------------------------------------------------
-	GetDocumentIndex 
-	
-----------------------------------------------------------------------------*/
-long GetDocumentIndex(DocumentReference docRef)
-{
-	return 0;
-}
-
-/*----------------------------------------------------------------------------
-	GetDocumentIndex 
-	
-----------------------------------------------------------------------------*/
-void	GetDocumentName(DocumentReference docRef, Str63 docName)
-{
-	docName[0] = 0;
-}
-
-
-/*----------------------------------------------------------------------------
-	GetDocumentIndex 
-	
-----------------------------------------------------------------------------*/
-Boolean DocumentIsModified(DocumentReference docRef)
-{
-	return false;
-}
-
deleted file mode 100644
--- a/xpfe/bootstrap/appleevents/nsAEDocumentClass.h
+++ /dev/null
@@ -1,140 +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.
- *
- * 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):
- *   Simon Fraser <sfraser@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 __AEDOCUMENTCLASS__
-#define __AEDOCUMENTCLASS__
-
-#include "nsAEGenericClass.h"
-
-
-typedef WindowPtr	DocumentReference;		// for now, we'll refer to document by their window
-
-
-class AEDocumentClass : public AEGenericClass
-{
-	friend class AECoreClass;
-	
-private:
-	typedef AEGenericClass	Inherited;
-	
-protected:
-	// only the AECoreClass can instantiate us
-						AEDocumentClass();
-						~AEDocumentClass();
-
-	void					GetDocumentFromApp(		DescType			desiredClass,		// cDocument
-												const AEDesc*		containerToken,	// null container
-												DescType			containerClass,  	 // cApplication
-												DescType			keyForm,
-												const AEDesc*		keyData,
-												AEDesc*			resultToken);		// specified Document is returned in result
-
-	virtual void			GetItemFromContainer(		DescType			desiredClass,
-												const AEDesc*		containerToken,
-												DescType			containerClass, 
-												DescType			keyForm,
-												const AEDesc*		keyData,
-												AEDesc*			resultToken);
-
-public:
-
-	static pascal OSErr		DocumentAccessor(			DescType			desiredClass,		// cDocument
-												const AEDesc*		containerToken,	// null container
-												DescType			containerClass,  	// cApplication
-												DescType			keyForm,
-												const AEDesc*		keyData,
-												AEDesc*			resultToken,		// specified Document is returned in result
-												long 				refCon);
-
-	static pascal OSErr		PropertyAccessor(			DescType			desiredClass,
-												const AEDesc*		containerToken,
-												DescType			containerClass,
-												DescType			keyForm,
-												const AEDesc*		keyData,
-												AEDesc*			resultToken,
-												long 				refCon);
-
-	void					ProcessFormRelativePostition(	const AEDesc* 		anchorToken,
-												const AEDesc*		keyData,
-												DocumentReference*	document);
-
-	void					CloseWindowSaving(			AEDesc*			token,
-												const AEDesc*		saving,
-												AEDesc*			savingIn);
-	
-protected:
-
-	// ----------------------------------------------------------------------------
-	//	Get and Set methods for objects and list. Note that the object methods are pure virtual
-	// ----------------------------------------------------------------------------
-	virtual void			GetDataFromObject(const AEDesc *token, AEDesc *desiredTypes, AEDesc *data);
-	void					GetDataFromList(AEDesc *srcList, AEDesc *desiredTypes, AEDesc *dstList);
-
-	virtual void			SetDataForObject(const AEDesc *token, AEDesc *data);
-	void 					SetDataForList(const AEDesc *token, AEDesc *data);
-
-	virtual void			CreateSelfSpecifier(const AEDesc *token, AEDesc *outSpecifier);
-
-	virtual Boolean			CanSetProperty(DescType propertyCode);
-	virtual Boolean			CanGetProperty(DescType propertyCode);
-
-
-	void					SetDocumentProperties(DocumentReference document, AEDesc *propertyRecord);
-
-	DocumentReference		GetDocumentReferenceFromToken(const AEDesc *token);		// these can all throw
-	DocumentReference		GetDocumentByName(ConstStr255Param docName);
-	DocumentReference		GetDocumentByIndex(long index);
-	DocumentReference		GetDocumentByID(long docID);
-	
-	DocumentReference		GetNextDocument(DocumentReference docRef);
-	DocumentReference		GetPreviousDocument(DocumentReference docRef);
-
-public:
-	static long				CountDocuments();
-
-};
-
-
-long		GetDocumentID(DocumentReference docRef);
-long		GetDocumentIndex(DocumentReference docRef);
-void		GetDocumentName(DocumentReference docRef, Str63 docName);
-Boolean	DocumentIsModified(DocumentReference docRef);
-
-
-#endif /* __AEDOCUMENTCLASS__ */
deleted file mode 100644
--- a/xpfe/bootstrap/appleevents/nsAEEventHandling.cpp
+++ /dev/null
@@ -1,159 +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.
- *
- * 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):
- *   Simon Fraser <sfraser@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 ***** */
-
-
-#include "nsAEEventHandling.h"
-
-#include "nsAECoreClass.h"
-
-/*----------------------------------------------------------------------------
-	CreateAEHandlerClasses 
-	
-	This call creates everything.
-----------------------------------------------------------------------------*/
-
-OSErr CreateAEHandlerClasses(Boolean suspendFirstEvent)
-{
-	OSErr	err = noErr;
-	
-	// if we have one, assume we have all
-	if (AECoreClass::sAECoreHandler)
-		return noErr;
-	
-	try
-	{
-		AECoreClass::sAECoreHandler = new AECoreClass(suspendFirstEvent);
-	}
-	catch(OSErr catchErr)
-	{
-		err = catchErr;
-	}
-	catch( ... )
-	{
-		err = paramErr;
-	}
-	
-	return err;
-}
-
-/*----------------------------------------------------------------------------
-	CreateAEHandlerClasses 
-	
-	This call creates everything.
-----------------------------------------------------------------------------*/
-
-OSErr ResumeAEHandling(AppleEvent *appleEvent, AppleEvent *reply, Boolean dispatchEvent)
-{
-	OSErr	err = noErr;
-	
-	if (!AECoreClass::sAECoreHandler)
-		return paramErr;
-	
-	try
-	{
-		AECoreClass::sAECoreHandler->ResumeEventHandling(appleEvent, reply, dispatchEvent);
-	}
-	catch(OSErr catchErr)
-	{
-		err = catchErr;
-	}
-	catch( ... )
-	{
-		err = paramErr;
-	}
-
-	return err;
-}
-
-
-/*----------------------------------------------------------------------------
-	GetSuspendedEvent 
-	
-	Return the suspended event, if any
-----------------------------------------------------------------------------*/
-OSErr GetSuspendedEvent(AppleEvent *theEvent, AppleEvent *reply)
-{
-	OSErr	err = noErr;
-	
-	theEvent->descriptorType = typeNull;
-	theEvent->dataHandle = nil;
-	
-	reply->descriptorType = typeNull;
-	reply->dataHandle = nil;
-	
-	if (!AECoreClass::sAECoreHandler)
-		return paramErr;
-	
-	try
-	{
-		AECoreClass::sAECoreHandler->GetSuspendedEvent(theEvent, reply);
-	}
-	catch(OSErr catchErr)
-	{
-		err = catchErr;
-	}
-	catch( ... )
-	{
-		err = paramErr;
-	}
-	
-	return err;
-}
-
-/*----------------------------------------------------------------------------
-	ShutdownAEHandlerClasses 
-	
-	and this destroys the whole lot.
-----------------------------------------------------------------------------*/
-OSErr ShutdownAEHandlerClasses(void)
-{
-	if (!AECoreClass::sAECoreHandler)
-		return noErr;
-	
-	try
-	{
-		delete AECoreClass::sAECoreHandler;
-	}
-	catch(...)
-	{
-	}
-	
-	AECoreClass::sAECoreHandler = nil;
-	return noErr;
-}
-
deleted file mode 100644
--- a/xpfe/bootstrap/appleevents/nsAEEventHandling.h
+++ /dev/null
@@ -1,55 +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.
- *
- * 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):
- *   Simon Fraser <sfraser@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 ***** */
-
-
-#include "nsAEUtils.h"
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-OSErr CreateAEHandlerClasses(Boolean suspendFirstEvent);
-OSErr GetSuspendedEvent(AppleEvent *event, AppleEvent *reply);
-OSErr ResumeAEHandling(AppleEvent *event, AppleEvent *reply, Boolean dispatchEvent);
-OSErr ShutdownAEHandlerClasses(void);
-
-#ifdef __cplusplus
-}
-#endif
-
deleted file mode 100644
--- a/xpfe/bootstrap/appleevents/nsAEGenericClass.cpp
+++ /dev/null
@@ -1,984 +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.
- *
- * 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):
- *   Simon Fraser <sfraser@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 ***** */
-
-
-#include "nsAEUtils.h"
-#include "nsAETokens.h"
-#include "nsAECoreClass.h"
-
-#include "nsAEGenericClass.h"
-
-
-/*----------------------------------------------------------------------------
-	AEGenericClass 
-	
-----------------------------------------------------------------------------*/
-AEGenericClass::AEGenericClass(DescType classType, DescType containerClass)
-:	mClass(classType)
-,	mContainerClass(containerClass)
-,	mItemFromContainerAccessor(nil)
-{
-
-	// Window from null accessor used by the entire window hierarchy
-	mItemFromContainerAccessor = NewOSLAccessorUPP(AEGenericClass::ItemFromContainerAccessor);
-	ThrowIfNil(mItemFromContainerAccessor);
-	
-	OSErr	err;
-	err = AEInstallObjectAccessor(mClass,	 	containerClass, 
-										mItemFromContainerAccessor, 
-										(long)this, 
-										false);
-
-	// although items of a given class can't contain other items of the same class, 
-	// we need this accessor to support formRelativePostion,
-	// which sends us one item as a "container" and asks us to find
-	// either the item before or after that item
-	err = AEInstallObjectAccessor(mClass, 		mClass, 
-										mItemFromContainerAccessor, 
-										(long)this, 
-										false);
-	ThrowIfOSErr(err);
-
-}
-
-/*----------------------------------------------------------------------------
-	~AEGenericClass 
-	
-----------------------------------------------------------------------------*/
-AEGenericClass::~AEGenericClass()
-{
-	if (mItemFromContainerAccessor)
-		DisposeOSLAccessorUPP(mItemFromContainerAccessor);
-}
-
-#pragma mark -
-
-
-/*----------------------------------------------------------------------------
-	DispatchEvent 
-	
-	Handles all OSL messages that this object should handle
-----------------------------------------------------------------------------*/
-void AEGenericClass::DispatchEvent(AEDesc *token, const AppleEvent *appleEvent, AppleEvent *reply)
-{
-	OSErr		err = noErr;
-	
-	AEEventID		eventID;
-	OSType		typeCode;
-	Size			actualSize 	= 0L;
-	
-	// Get the event ID
-	err = AEGetAttributePtr(appleEvent, 	keyEventIDAttr, 
-									typeType, 
-									&typeCode, 
-									(Ptr)&eventID, 
-									sizeof(eventID), 
-									&actualSize);
-	ThrowIfOSErr(err);
-	
-	try
-	{
-		switch (eventID)
-		{
-			case kAEClone:
-				HandleDuplicate(token, appleEvent, reply);
-				break;
-				
-			case kAEClose:
-				HandleClose(token, appleEvent, reply);
-				break;
-				
-			case kAECountElements:
-				HandleCount(token, appleEvent, reply);
-				break;
-				
-			case kAECreateElement:
-				HandleMake(token, appleEvent, reply);
-				break;
-				
-			case kAEDelete:
-				HandleDelete(token, appleEvent, reply);
-				break;
-				
-			case kAEDoObjectsExist:
-				HandleExists(token, appleEvent, reply);
-				break;
-				
-			case kAEGetData:
-				HandleGetData(token, appleEvent, reply);
-				break;
-				
-			case kAEGetDataSize:
-				HandleDataSize(token, appleEvent, reply);
-				break;
-				
-			case kAEMove:
-				HandleMove(token, appleEvent, reply);
-				break;
-				
-			case kAEOpen:		// == kAEOpenDocuments
-				HandleOpen(token, appleEvent, reply);
-				break;
-				
-			case kAEPrint:
-				HandlePrint(token, appleEvent, reply);
-				break;
-			
-			case kAEOpenApplication:
-				HandleRun(token, appleEvent, reply);
-				break;
-			
-			case kAEReopenApplication:
-			  HandleReOpen(token, appleEvent, reply);
-			  break; 
-							
-			case kAEQuitApplication:
-				HandleQuit(token, appleEvent, reply);
-				break;
-				
-			case kAESave:
-				HandleSave(token, appleEvent, reply);
-				break;
-				
-			case kAESetData:
-				HandleSetData(token, appleEvent, reply);
-				break;
-
-			// MT-NW suite
-			case kAEExtract:
-				HandleExtract(token, appleEvent, reply);
-				break;
-				
-			case kAESendMessage:
-				HandleSendMessage(token, appleEvent, reply);
-				break;
-				
-			default:
-				err = errAEEventNotHandled;
-				break;
-		}
-	}
-	catch (OSErr catchErr)
-	{
-		PutReplyErrorNumber(reply, catchErr);
-		throw;
-	}
-	catch ( ... )
-	{
-		PutReplyErrorNumber(reply, paramErr);
-		throw;
-	}
-}
-
-
-/*----------------------------------------------------------------------------
-	GetProperty 
-	
-----------------------------------------------------------------------------*/
-void	AEGenericClass::GetProperty(				DescType			desiredClass,
-										const AEDesc*		containerToken,
-										DescType			containerClass,
-										DescType			keyForm,
-										const AEDesc*		keyData,
-										AEDesc*			resultToken)
-{
-	
-	// call the base class utility method, which calls back up to the object
-	GetPropertyFromListOrObject(desiredClass, containerToken, containerClass, keyForm, keyData, resultToken);
-}
-
-#pragma mark -
-
-/*----------------------------------------------------------------------------
-	ItemFromContainerAccessor
-	
-	Callback for getting an item from its container
-----------------------------------------------------------------------------*/
-pascal OSErr AEGenericClass::ItemFromContainerAccessor(	DescType			desiredClass,		// cWindow
-												const AEDesc*		containerToken,	// null container
-												DescType			containerClass,  	 // cApplication
-												DescType			keyForm,
-												const AEDesc*		keyData,
-												AEDesc*			resultToken,		// specified window is returned in result
-												long 				refCon)
-{
-	AEGenericClass*	itemClass = reinterpret_cast<AEGenericClass *>(refCon);
-	if (!itemClass) return paramErr;
-	
-	OSErr		err = noErr;
-	
-	try
-	{
-		itemClass->GetItemFromContainer(desiredClass, containerToken, containerClass, keyForm, keyData, resultToken);
-	}
-	catch(OSErr catchErr)
-	{
-		err = catchErr;
-	}
-	catch(...)
-	{
-		err = paramErr;
-	}
-	
-	return err;
-}
-
-
-
-#pragma mark -
-
-/*----------------------------------------------------------------------------
-	HandleClose 
-	
-----------------------------------------------------------------------------*/
-void AEGenericClass::HandleClose(AEDesc *token, const AppleEvent *appleEvent, AppleEvent *reply)
-{
-	ThrowIfOSErr(errAEEventNotHandled);
-}
-
-/*----------------------------------------------------------------------------
-	HandleCount 
-	
-----------------------------------------------------------------------------*/
-void AEGenericClass::HandleCount(AEDesc *token, const AppleEvent *appleEvent, AppleEvent *reply)
-{
-	ConstAETokenDesc	tokenDesc(token);
-	long 			numberOfObjects = 0;
-	DescType		objectClass;
-	OSErr		err = noErr;	
-
-	if (!reply->dataHandle)
-		return;
-	
-	// Get the class of object that we will count
-	err = GetObjectClassFromAppleEvent(appleEvent, &objectClass);
-	ThrowIfOSErr(err);
-	
-	err = CheckForUnusedParameters(appleEvent);
-	ThrowIfOSErr(err);
-
-	if (AEListUtils::TokenContainsTokenList(token))
-	{
-		err = AECountItems(token, &numberOfObjects);
-		ThrowIfOSErr(err);
-		
-	}
-	else
-	{
-		CountObjects(objectClass, tokenDesc.GetDispatchClass(), token, &numberOfObjects);
-	}
-
-	err = AEPutParamPtr(reply, keyAEResult, 
-								 typeLongInteger, 
-								 (Ptr)&numberOfObjects, 
-								 sizeof(long));
-	ThrowIfOSErr(err);
-}
-
-
-/*----------------------------------------------------------------------------
-	HandleGetData 
-	
-----------------------------------------------------------------------------*/
-void AEGenericClass::HandleGetData(AEDesc *tokenOrTokenList, const AppleEvent *appleEvent, AppleEvent *reply)
-{
-	OSErr 		err 			= noErr;	
-	StAEDesc		data;
-	StAEDesc		desiredTypes;
-	
-	(void)AEGetParamDesc(appleEvent, keyAERequestedType, typeAEList, &desiredTypes);
-	
-	GetDataFromListOrObject(tokenOrTokenList, &desiredTypes, &data);
-
-	if (reply->descriptorType != typeNull)
-	{
-		err = AEPutKeyDesc(reply, keyDirectObject, &data);
-		ThrowIfOSErr(err);
-	}
-}
-
-/*----------------------------------------------------------------------------
-	HandleSetData 
-
-	
-----------------------------------------------------------------------------*/
-void AEGenericClass::HandleSetData(AEDesc *token, const AppleEvent *appleEvent, AppleEvent *reply)
-{
-	SetDataForListOrObject(token, appleEvent, reply);
-}
-
-/*----------------------------------------------------------------------------
-	HandleDataSize 
-	
-----------------------------------------------------------------------------*/
-void AEGenericClass::HandleDataSize(AEDesc *token, const AppleEvent *appleEvent, AppleEvent *reply)
-{
-	ThrowIfOSErr(errAEEventNotHandled);
-}
-
-/*----------------------------------------------------------------------------
-	HandleDelete 
-
-	All attempts to delete an empty list are handled here
-	Application contains documents and windows, and they can't be deleted
-	
-----------------------------------------------------------------------------*/
-void AEGenericClass::HandleDelete(AEDesc *token, const AppleEvent *appleEvent, AppleEvent *reply)
-{
-	ThrowIfOSErr(errAEEventNotHandled);
-}
-
-/*----------------------------------------------------------------------------
-	HandleDuplicate 
-	
-----------------------------------------------------------------------------*/
-void AEGenericClass::HandleDuplicate(AEDesc *token, const AppleEvent *appleEvent, AppleEvent *reply)
-{
-	ThrowIfOSErr(errAEEventNotHandled);
-}
-
-/*----------------------------------------------------------------------------
-	HandleExists 
-
-	If <anObject> exists...
-	The AEResolve() function in AERCoreSuite.c will already have filtered
-	out all cases where the object did not exist, so this function should
-	always return TRUE.
-
-----------------------------------------------------------------------------*/
-void AEGenericClass::HandleExists(AEDesc *token, const AppleEvent *appleEvent, AppleEvent *reply)
-{
-	OSErr	err;
-	Boolean	foundIt	= true;
-
-	err = AEPutParamPtr(reply, 
-					 keyAEResult, 
-					 typeBoolean, 
-					 (Ptr)&foundIt, 
-					 sizeof(Boolean));
-		
-	ThrowIfOSErr(err);
-}
-
-/*----------------------------------------------------------------------------
-	HandleMake 
-
-	
-----------------------------------------------------------------------------*/
-void AEGenericClass::HandleMake(AEDesc *token, const AppleEvent *appleEvent, AppleEvent *reply)
-{
-	DescType		insertionPos	= typeNull;
-	OSErr		err 			= noErr;
-
-	StAEDesc		insertionLoc;
-	StAEDesc		objectSpec;
-
-	// For Create Element, the object specifier is contained in  
-	// a typeInsertionLoc record instead of in a direct parameter. 
-	// We coerce the insertionLoc record into an AERecord so we can extract the fields.	 
-	// Notice that this is a REQUIRED parameter, but we give it a default behavior
-	// by creating a new element at beginning of the first document
-	
-	err = ::AEGetParamDesc(appleEvent, 				// Extract as a AERecord
-								  keyAEInsertHere, 
-								  typeAERecord, 
-								  &insertionLoc);
-	if (err == errAEDescNotFound)
-	{
-		insertionPos	= kAEBeginning;
-		err			= noErr;
-	}
-	else if (err == noErr)
-	{
-		// Get the enumerated insertion location (at end, in front, before, after, replace.)
-		
-		OSType		typeCode;
-		Size			actualSize;
-		err = ::AEGetKeyPtr(&insertionLoc, 
-								  	keyAEPosition, 			// insertion location
-									typeEnumeration, 
-									&typeCode, 
-									(Ptr)&insertionPos,
-						   			sizeof(insertionPos), 
-						   			&actualSize);
-
-		// Extract and resolve the object specifier from the insertion location record.
-		// In a case like "make new rectangle before rectangle 1 of document 1",
-		// the ospec will resolve to "rectangle 1 of document 1"
-				 
-		err = ::AEGetKeyDesc(&insertionLoc, 
-									keyAEObject, 
-									typeWildCard, 
-									&objectSpec);
-	}
-
-	// if there was a object specifier in the insertion location (eg, "before rectangle 1 of document 1"),
-	//   then we call AEResolve() to get a token for it,
-	// Otherwise, is was something like "at end" or "at beginning", which is also OK, 
-	//   then deal with it correctly later.
-	if (objectSpec.descriptorType == typeNull) 
-	{
-		::AEDisposeDesc(token);			// destroy its old representation, token will now be null descriptor
-	}
-	else
-	{
-		err = ::AEResolve(&objectSpec, 
-							 kAEIDoMinimum, 
-							 token);			// token will contain info about the object to insert before, after, etc.
-		ThrowIfOSErr(err);
-	}
-		
-	// Extract the optional parameters from the AppleEvent
-	
-	// ----- [with data ....] -----
-	
-	StAEDesc		withData;
-	const AEDesc*	withDataPtr = nil;
-	
-	err = ::AEGetParamDesc(appleEvent, 
-								  keyAEData,
-								  typeWildCard,
-								  &withData);
-	if (err == errAEDescNotFound)
-		err = noErr;
-	else
-	{
-		ThrowIfOSErr(err);
-		withDataPtr = &withData;
-	}
-
-	// ----- [with properties {property: value, ...}] -----
-	StAEDesc		withProperties;
-	const AEDesc*	withPropertiesPtr = nil;
-	err = AEGetParamDesc(appleEvent, 
-								  keyAEPropData, 
-								  typeWildCard, 
-								  &withProperties);
-								  
-	if (err == errAEDescNotFound)
-		err = noErr;
-	else
-	{
-		ThrowIfOSErr(err);
-		withPropertiesPtr = &withProperties;
-	}
-	
-	// Finally, use the token and other parameters to create & initialize the object
-	MakeNewObject(insertionPos, token, withDataPtr, withPropertiesPtr, reply);
-}
-
-/*----------------------------------------------------------------------------
-	HandleMove 
-
-	
-----------------------------------------------------------------------------*/
-void AEGenericClass::HandleMove(AEDesc *token, const AppleEvent *appleEvent, AppleEvent *reply)
-{
-	ThrowIfOSErr(errAEEventNotHandled);
-}
-
-/*----------------------------------------------------------------------------
-	HandleOpen 
-
-	
-----------------------------------------------------------------------------*/
-void AEGenericClass::HandleOpen(AEDesc *token, const AppleEvent *appleEvent, AppleEvent *reply)
-{
-	ThrowIfOSErr(errAEEventNotHandled);
-}
-
-/*----------------------------------------------------------------------------
-	HandleReOpen 
-
-	
-----------------------------------------------------------------------------*/
-void AEGenericClass::HandleReOpen(AEDesc *token, const AppleEvent *appleEvent, AppleEvent *reply)
-{
-	ThrowIfOSErr(errAEEventNotHandled);
-}
-
-/*----------------------------------------------------------------------------
-	HandleRun 
-
-	
-----------------------------------------------------------------------------*/
-void AEGenericClass::HandleRun(AEDesc *token, const AppleEvent *appleEvent, AppleEvent *reply)
-{
-	ThrowIfOSErr(errAEEventNotHandled);
-}
-
-/*----------------------------------------------------------------------------
-	HandlePrint 
-
-	
-----------------------------------------------------------------------------*/
-void AEGenericClass::HandlePrint(AEDesc *token, const AppleEvent *appleEvent, AppleEvent *reply)
-{
-	ThrowIfOSErr(errAEEventNotHandled);
-}
-
-/*----------------------------------------------------------------------------
-	HandleQuit 
-
-	
-----------------------------------------------------------------------------*/
-void AEGenericClass::HandleQuit(AEDesc *token, const AppleEvent *appleEvent, AppleEvent *reply)
-{
-	ThrowIfOSErr(errAEEventNotHandled);
-}
-
-/*----------------------------------------------------------------------------
-	HandleSave 
-
-	
-----------------------------------------------------------------------------*/
-void AEGenericClass::HandleSave(AEDesc *token, const AppleEvent *appleEvent, AppleEvent *reply)
-{
-	ThrowOSErr(errAEEventNotHandled);
-}
-
-
-/*----------------------------------------------------------------------------
-	HandleExtract 
-
-	
-----------------------------------------------------------------------------*/
-void AEGenericClass::HandleExtract(AEDesc *token, const AppleEvent *appleEvent, AppleEvent *reply)
-{
-	ThrowOSErr(errAEEventNotHandled);
-}
-
-
-/*----------------------------------------------------------------------------
-	HandleSendMessage 
-
-	
-----------------------------------------------------------------------------*/
-void AEGenericClass::HandleSendMessage(AEDesc *token, const AppleEvent *appleEvent, AppleEvent *reply)
-{
-	ThrowOSErr(errAEEventNotHandled);
-}
-
-
-#pragma mark -
-
-/*----------------------------------------------------------------------------
-	CompareObjects 
-	
-----------------------------------------------------------------------------*/
-void AEGenericClass::CompareObjects(				DescType			comparisonOperator,
-											const AEDesc *		object,
-											const AEDesc *		descriptorOrObject,
-											Boolean *			result)
-{
-	ThrowOSErr(errAEEventNotHandled);
-}
-
-/*----------------------------------------------------------------------------
-	CountObjects 
-	
-----------------------------------------------------------------------------*/
-void AEGenericClass::CountObjects(					DescType 		 	desiredType,
-											DescType 		 	containerClass,
-											const AEDesc *		container,
-							   				long *			result)
-{
-	ThrowOSErr(errAEEventNotHandled);
-}
-
-#pragma mark -
-
-/*----------------------------------------------------------------------------
-	GetDataFromListOrObject 
-
-	
-----------------------------------------------------------------------------*/
-
-void AEGenericClass::GetDataFromListOrObject(const AEDesc *tokenOrTokenList, AEDesc *desiredTypes, AEDesc *data)
-{
-	if (AEListUtils::TokenContainsTokenList(tokenOrTokenList) == false)
-	{
-		GetDataFromObject(tokenOrTokenList, desiredTypes, data);
-	}
-	else
-	{
-		ThrowIfOSErr(AECreateList(nil, 0, false, data));
-		GetDataFromList(tokenOrTokenList, desiredTypes, data);
-	}
-}
-
-/*----------------------------------------------------------------------------
-	GetDataFromListOrObject 
-
-	
-----------------------------------------------------------------------------*/
-
-void AEGenericClass::SetDataForListOrObject(const AEDesc *tokenOrTokenList, const AppleEvent *appleEvent, AppleEvent *reply)
-{
-	StAEDesc			data;
-	
-	switch (tokenOrTokenList->descriptorType)
-	{
-		case typeAEList:
-			{
-				AECoreClass::GetAECoreHandler()->GetEventKeyDataParameter(appleEvent, typeWildCard, &data);
-				SetDataForList(tokenOrTokenList, &data);
-			}
-			break;
-				
-		case cProperty:
-			{
-				ConstAETokenDesc	tokenDesc(tokenOrTokenList);
-				DescType		propertyCode = tokenDesc.GetPropertyCode();
-				//DescType		objectClass    = tokenDesc.GetObjectClass();
-				
-				if (CanSetProperty(propertyCode))
-				{
-					AECoreClass::GetAECoreHandler()->GetEventKeyDataParameter(appleEvent, GetKeyEventDataAs(propertyCode), &data);
-					SetDataForObject(tokenOrTokenList, &data);
-				}
-				else
-				{
-					ThrowIfOSErr(errAENotModifiable);
-				}
-			}
-			break;
-			
-		default:
-			ThrowIfOSErr(errAENotModifiable);
-	}
-}
-
-/*----------------------------------------------------------------------------
-	GetDataFromList 
-
-	
-----------------------------------------------------------------------------*/
-void AEGenericClass::GetDataFromList(const AEDesc *srcList, AEDesc *desiredTypes, AEDesc *dstList)
-{
-	OSErr		err;
-	long			itemNum;
-	long			numItems;
-	DescType		keyword;
-	StAEDesc		srcItem;
-	StAEDesc		dstItem;
-		
-	err = AECountItems((AEDescList*)srcList, &numItems);
-	ThrowIfOSErr(err);
-		
-	for (itemNum = 1; itemNum <= numItems; itemNum++)
-	{
-		err = AEGetNthDesc(srcList, itemNum, typeWildCard, &keyword, &srcItem);
-		ThrowIfOSErr(err);
-		
-		if (AEListUtils::TokenContainsTokenList(&srcItem) == false)
-		{
-			GetDataFromObject(&srcItem, desiredTypes, &dstItem);  // Get data from single item
-		}
-		else
-		{
-			ThrowIfOSErr(AECreateList(nil, 0, false, &dstItem));
-			GetDataFromList(&srcItem, desiredTypes, &dstItem);
-		}
-		err = AEPutDesc(dstList, itemNum, &dstItem);
-		ThrowIfOSErr(err);
-	}
-}
-
-
-/*----------------------------------------------------------------------------
-	GetDataFromObject 
-
-	
-----------------------------------------------------------------------------*/
-void AEGenericClass::GetDataFromObject(const AEDesc *token, AEDesc *desiredTypes, AEDesc *data)
-{
-	ConstAETokenDesc		tokenDesc(token);
-	DescType 			propertyCode 		= tokenDesc.GetPropertyCode();
-	OSErr			err				= noErr;
-
-	switch (propertyCode)
-	{
-		case pContents:
-		case typeNull:
-			// must mean contents. Make a self specifier.
-			CreateSpecifier(token, data);
-			break;
-			
-		default:
-			err = errAECantSupplyType;
-			break;
-	}
-	
-	ThrowIfOSErr(err);
-}
-
-
-/*----------------------------------------------------------------------------
-	SetDataForList 
-
-	Given a token that contains a list of cWindow tokens,
-	walk the list recursively to set the data for each token in the list
-	
-----------------------------------------------------------------------------*/
-void AEGenericClass::SetDataForList(const AEDesc *token, AEDesc *data)
-{
-	OSErr 			err;
-		
-	if (AEListUtils::TokenContainsTokenList(token) == false)
-	{
-		SetDataForObject(token, data);
-	}
-	else
-	{
-		long			numItems;
-		long			itemNum;
-		err = AECountItems((AEDescList*)token, &numItems);
-		ThrowIfOSErr(err);
-		
-		for (itemNum = 1; itemNum <= numItems; itemNum++)
-		{
-			StAEDesc	  	tempToken;
-			AEKeyword	keyword;
-			
-		 	err = AEGetNthDesc((AEDescList*)token, itemNum, typeWildCard, &keyword, &tempToken);
-			ThrowIfOSErr(err);
-			
-			if (AEListUtils::TokenContainsTokenList(&tempToken) == false)
-			{
-				SetDataForObject(&tempToken, data);  		// Set data from single item
-			}
-			else
-			{
-				SetDataForList(&tempToken, data); 	// Recurse sublist
-			}
-		}
-	}
-}
-
-
-/*----------------------------------------------------------------------------
-	CanGetProperty 
-
-----------------------------------------------------------------------------*/
-DescType AEGenericClass::GetKeyEventDataAs(DescType propertyCode)
-{
-	return typeWildCard;
-}
-
-#pragma mark -
-
-/*----------------------------------------------------------------------------
-	CanGetProperty 
-
-----------------------------------------------------------------------------*/
-Boolean AEGenericClass::CanGetProperty(DescType propertyCode)
-{
-	Boolean	canGet = false;
-	
-	switch (propertyCode)
-	{
-		case pContents:
-			canGet = true;
-			break;
-	}
-	return canGet;
-}
-
-/*----------------------------------------------------------------------------
-	CanSetProperty 
-
-----------------------------------------------------------------------------*/
-Boolean AEGenericClass::CanSetProperty(DescType propertyCode)
-{
-	return false;
-}
-
-
-#pragma mark -
-
-/*----------------------------------------------------------------------------
-	CreateSpecifier 
-
-	Subclasses should not need to override this. It 
-----------------------------------------------------------------------------*/
-void AEGenericClass::CreateSpecifier(const AEDesc *token, AEDesc *outSpecifier)
-{
-	CreateSelfSpecifier(token, outSpecifier);
-}
-
-/*----------------------------------------------------------------------------
-	GetContainerSpecifier 
-
-----------------------------------------------------------------------------*/
-void AEGenericClass::GetContainerSpecifier(const AEDesc *token, AEDesc *outContainerSpecifier)
-{
-	outContainerSpecifier->descriptorType = typeNull;
-	outContainerSpecifier->dataHandle = nil;
-	
-	AEDispatchHandler*	handler = AECoreClass::GetDispatchHandlerForClass(mContainerClass);
-	if (handler)
-	{
-		handler->CreateSelfSpecifier(token, outContainerSpecifier);
-	}
-}
-
-#pragma mark -
-
-/*----------------------------------------------------------------------------
-	GetPropertyFromListOrObject 
-
-----------------------------------------------------------------------------*/
-void AEGenericClass::GetPropertyFromListOrObject(		DescType			desiredClass,
-												const AEDesc*		containerToken,
-												DescType			containerClass,
-												DescType			keyForm,
-												const AEDesc*		keyData,
-												AEDesc*			resultToken)
-{
-	if (AEListUtils::TokenContainsTokenList((AEDescList*)containerToken) == false)
-	{
-		GetPropertyFromObject(desiredClass, containerToken, containerClass, keyForm, keyData, resultToken);
-	}
-	else
-	{
-		OSErr	err = AECreateList(nil, 0, false, resultToken);
-		ThrowIfOSErr(err);
-		
-		GetPropertyFromList(desiredClass, containerToken, containerClass, keyForm, keyData, resultToken);
-	}
-}
-
-
-/*----------------------------------------------------------------------------
-	GetPropertyFromList 
-
-----------------------------------------------------------------------------*/
-void AEGenericClass::GetPropertyFromList(				DescType			desiredClass,
-												const AEDesc*		containerToken,
-												DescType			containerClass,
-												DescType			keyForm,
-												const AEDesc*		keyData,
-												AEDesc*			resultToken)
-{
-	OSErr		err		= noErr;
-	long			itemNum;
-	long			numItems;
-	DescType		keyword;
-	
-	err = AECountItems((AEDescList*)containerToken, &numItems);
-	ThrowIfOSErr(err);
-		
-	for (itemNum = 1; itemNum <= numItems; itemNum++)
-	{
-		StAEDesc		srcItem;
-		StAEDesc		dstItem;
-		
-		err = AEGetNthDesc(containerToken, itemNum, typeWildCard, &keyword, &srcItem);
-		ThrowIfOSErr(err);
-		
-		if (AEListUtils::TokenContainsTokenList(&srcItem) == false)
-		{
-			GetPropertyFromObject(desiredClass, &srcItem, containerClass, keyForm, keyData, &dstItem);
-		}
-		else
-		{
-			err = AECreateList(nil, 0, false, &dstItem);
-			ThrowIfOSErr(err);
-			
-			GetPropertyFromList(desiredClass, &srcItem, containerClass, keyForm, keyData, &dstItem);
-		}
-
-		err = AEPutDesc(resultToken, itemNum, &dstItem);
-		ThrowIfOSErr(err);
-	}
-	
-}
-
-
-/*----------------------------------------------------------------------------
-	GetPropertyFromObject 
-
-----------------------------------------------------------------------------*/
-void AEGenericClass::GetPropertyFromObject(			DescType			desiredType,
-						  					const AEDesc*		containerToken,
-								  			DescType			containerClass,
-								  			DescType			keyForm,
-								 			const AEDesc*		keyData,
-								  			AEDesc*			resultToken)
-{
-	OSErr			err;	
-	DescType			requestedProperty;
-
-	err = AEDuplicateDesc(containerToken, resultToken);
-	ThrowIfOSErr(err);
-		
-	requestedProperty = **(DescType**)(keyData->dataHandle);
-	
-	if (requestedProperty == kAEAll || requestedProperty == keyAEProperties)
-		requestedProperty = pProperties;
-
-	if (CanGetProperty(requestedProperty) || CanSetProperty(requestedProperty))
-	{
-		AETokenDesc		resultTokenDesc(resultToken);
-		resultToken->descriptorType = desiredType;
-		resultTokenDesc.SetPropertyCode(requestedProperty);
-	}
-	else
-	{
-		ThrowIfOSErr(errAEEventNotHandled);
-	}
-}
-
-
-#pragma mark -
-
-
-/*----------------------------------------------------------------------------
-	MakeNewObject 
-
-----------------------------------------------------------------------------*/
-void AEGenericClass::MakeNewObject(				const DescType		insertionPosition,
-											const AEDesc*		token,
-											const AEDesc*		ptrToWithData, 
-											const AEDesc*		ptrToWithProperties,
-											AppleEvent*		reply)
-{
-	ThrowOSErr(errAEEventNotHandled);
-}
-
deleted file mode 100644
--- a/xpfe/bootstrap/appleevents/nsAEGenericClass.h
+++ /dev/null
@@ -1,218 +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.
- *
- * 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):
- *   Simon Fraser <sfraser@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 __AEGENERICCLASS__
-#define __AEGENERICCLASS__
-
-
-#include "nsAEClassIterator.h"
-
-// pure virtual base class that provides stubs for much objecct functionality.
-
-class AEGenericClass
-{
-	friend class AEDispatchHandler;
-public:
-	
-						AEGenericClass(DescType classType, DescType containerClass);			// throws OSErrs
-	virtual				~AEGenericClass();
-
-
-	// ----------------------------------------------------------------------------
-	//	Dispatch routine
-	// ----------------------------------------------------------------------------
-	void					DispatchEvent(					AEDesc*			token, 
-													const AppleEvent*	appleEvent,
-													AppleEvent*		reply);	// throws OSErrs
-
-	// ----------------------------------------------------------------------------
-	//	Item from container accessor
-	// ----------------------------------------------------------------------------
-	static pascal OSErr		ItemFromContainerAccessor(		DescType			desiredClass,
-													const AEDesc*		containerToken,
-													DescType			containerClass, 
-													DescType			keyForm,
-													const AEDesc*		keyData,
-													AEDesc*			resultToken,
-													long 				refCon);
-
-protected:	
-	
-	// MT-NW suite events
-	enum {
-		kAEExtract			= 'Extr',
-		kExtractKeyDestFolder	= 'Fold',
-		
-		kAESendMessage		= 'Post'
-	};
-	
-	
-	virtual void			GetPropertyFromObject(			DescType			desiredClass,
-													const AEDesc*		containerToken,
-													DescType			containerClass,
-													DescType			keyForm,
-													const AEDesc*		keyData,
-													AEDesc*			resultToken);
-
-	virtual void			GetProperty(					DescType			desiredClass,
-													const AEDesc*		containerToken,
-													DescType			containerClass,
-													DescType			keyForm,
-													const AEDesc*		keyData,
-													AEDesc*			resultToken);
-	
-	// ----------------------------------------------------------------------------
-	//	GetItemFromContainer
-	//		
-	//	Overridable method to get an item from its container.
-	//		
-	// ----------------------------------------------------------------------------
-	virtual void			GetItemFromContainer(			DescType			desiredClass,
-													const AEDesc*		containerToken,
-													DescType			containerClass, 
-													DescType			keyForm,
-													const AEDesc*		keyData,
-													AEDesc*			resultToken) = 0;
-										
-	// ----------------------------------------------------------------------------
-	//	OSL Callbacks (compare and count)
-	// ----------------------------------------------------------------------------
-	virtual void 			CompareObjects(				DescType			comparisonOperator,
-													const AEDesc *		object,
-													const AEDesc *		descriptorOrObject,
-													Boolean *			result);
-
-	virtual void 			CountObjects(					DescType 		 	desiredType,
-													DescType 		 	containerClass,
-													const AEDesc *		container,
-									   				long *			result);
-
-	// ----------------------------------------------------------------------------
-	//	Core Suite Object Event handlers
-	// ----------------------------------------------------------------------------
-	virtual void			HandleClose(AEDesc *token, const AppleEvent *appleEvent, AppleEvent *reply);
-	virtual void			HandleCount(AEDesc *token, const AppleEvent *appleEvent, AppleEvent *reply);
-	virtual void			HandleSetData(AEDesc *token, const AppleEvent *appleEvent, AppleEvent *reply);
-	virtual void			HandleGetData(AEDesc *token, const AppleEvent *appleEvent, AppleEvent *reply);
-	virtual void			HandleDataSize(AEDesc *token, const AppleEvent *appleEvent, AppleEvent *reply);
-	virtual void			HandleDelete(AEDesc *token, const AppleEvent *appleEvent, AppleEvent *reply);
-	virtual void			HandleDuplicate(AEDesc *token, const AppleEvent *appleEvent, AppleEvent *reply);
-	virtual void			HandleExists(AEDesc *token, const AppleEvent *appleEvent, AppleEvent *reply);
-	virtual void			HandleMake(AEDesc *token, const AppleEvent *appleEvent, AppleEvent *reply);
-	virtual void			HandleMove(AEDesc *token, const AppleEvent *appleEvent, AppleEvent *reply);
-	virtual void			HandleOpen(AEDesc *token, const AppleEvent *appleEvent, AppleEvent *reply);
-	virtual void			HandleReOpen(AEDesc *token, const AppleEvent *appleEvent, AppleEvent *reply);
-	virtual void			HandleRun(AEDesc *token, const AppleEvent *appleEvent, AppleEvent *reply);
-	virtual void			HandlePrint(AEDesc *token, const AppleEvent *appleEvent, AppleEvent *reply);
-	virtual void			HandleQuit(AEDesc *token, const AppleEvent *appleEvent, AppleEvent *reply);
-	virtual void			HandleSave(AEDesc *token, const AppleEvent *appleEvent, AppleEvent *reply);
-
-	// ----------------------------------------------------------------------------
-	//	MT-NW suite event handlers
-	// ----------------------------------------------------------------------------
-	virtual void			HandleExtract(AEDesc *token, const AppleEvent *appleEvent, AppleEvent *reply);
-	virtual void			HandleSendMessage(AEDesc *token, const AppleEvent *appleEvent, AppleEvent *reply);
-	
-	// ----------------------------------------------------------------------------
-	//	Get and Set methods for objects and list. Note that the object methods are pure virtual
-	// ----------------------------------------------------------------------------
-	
-	virtual void			GetDataFromObject(const AEDesc *token, AEDesc *desiredTypes, AEDesc *data) = 0;
-	virtual void			SetDataForObject(const AEDesc *token, AEDesc *data) = 0;
-
-	// ----------------------------------------------------------------------------
-	//	Methods for creating self and container specifiers
-	// ----------------------------------------------------------------------------
-
-	void					CreateSpecifier(const AEDesc *token, AEDesc *outSpecifier);
-	virtual void			GetContainerSpecifier(const AEDesc *token, AEDesc *outContainerSpecifier);
-
-	virtual void			CreateSelfSpecifier(const AEDesc *token, AEDesc *outSpecifier) = 0;
-
-	void					GetDataFromListOrObject(const AEDesc *tokenOrTokenList, AEDesc *desiredTypes, AEDesc *data);
-	void					SetDataForListOrObject(const AEDesc *tokenOrTokenList, const AppleEvent *appleEvent, AppleEvent *reply);
-
-	void					GetDataFromList(const AEDesc *srcList, AEDesc *desiredTypes, AEDesc *dstList);
-	void 					SetDataForList(const AEDesc *token, AEDesc *data);
-
-	void					GetPropertyFromListOrObject(		DescType			desiredClass,
-													const AEDesc*		containerToken,
-													DescType			containerClass,
-													DescType			keyForm,
-													const AEDesc*		keyData,
-													AEDesc*			resultToken);
-	
-	void					GetPropertyFromList(			DescType			desiredClass,
-													const AEDesc*		containerToken,
-													DescType			containerClass,
-													DescType			keyForm,
-													const AEDesc*		keyData,
-													AEDesc*			resultToken);
-
-	virtual DescType		GetKeyEventDataAs(DescType propertyCode);
-	
-	virtual Boolean			CanSetProperty(DescType propertyCode) = 0;
-	virtual Boolean			CanGetProperty(DescType propertyCode) = 0;
-
-	DescType				GetClass()				{ return mClass; }
-
-
-	// ----------------------------------------------------------------------------
-	//	Methods called from the main handlers
-	// ----------------------------------------------------------------------------
-
-	virtual void			MakeNewObject(				const DescType		insertionPosition,
-													const AEDesc*		token,
-													const AEDesc*		ptrToWithData, 
-													const AEDesc*		ptrToWithProperties,
-													AppleEvent*		reply);
-
-
-protected:
-
-	DescType				mClass;
-	DescType				mContainerClass;
-	
-	OSLAccessorUPP		mItemFromContainerAccessor;
-
-};
-
-
-#endif /* __AEGENERICCLASS__ */
-
deleted file mode 100644
--- a/xpfe/bootstrap/appleevents/nsAEGetURLSuiteHandler.cpp
+++ /dev/null
@@ -1,206 +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.
- *
- * 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):
- *   Simon Fraser <sfraser@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 ***** */
-
-
-#include "nsMemory.h"
-
-#include "nsWindowUtils.h"
-#include "nsAETokens.h"
-
-#include "nsAEGetURLSuiteHandler.h"
-#include "nsCommandLineServiceMac.h"
-
-#include "nsCOMPtr.h"
-#include "nsIServiceManager.h"
-#include "nsIWindowMediator.h"
-#include "nsIXULWindow.h"
-
-#include "nsIURI.h"
-#include "nsNetUtil.h"
-
-using namespace nsWindowUtils;
-
-
-/*----------------------------------------------------------------------------
-	AEGetURLSuiteHandler 
-	
-----------------------------------------------------------------------------*/
-AEGetURLSuiteHandler::AEGetURLSuiteHandler()
-{
-}
-
-/*----------------------------------------------------------------------------
-	~AEGetURLSuiteHandler 
-	
-----------------------------------------------------------------------------*/
-AEGetURLSuiteHandler::~AEGetURLSuiteHandler()
-{
-}
-
-
-/*----------------------------------------------------------------------------
-	HandleGetURLSuiteEvent 
-	
-----------------------------------------------------------------------------*/
-void AEGetURLSuiteHandler::HandleGetURLSuiteEvent(const AppleEvent *appleEvent, AppleEvent *reply)
-{
-	OSErr		err = noErr;
-	
-	AEEventID		eventID;
-	OSType		typeCode;
-	Size			actualSize 	= 0L;
-	
-	// Get the event ID
-	err = AEGetAttributePtr(appleEvent, 	keyEventIDAttr, 
-									typeType, 
-									&typeCode, 
-									(Ptr)&eventID, 
-									sizeof(eventID), 
-									&actualSize);
-	ThrowIfOSErr(err);
-	
-	try
-	{
-		switch (eventID)
-		{
-			case kGetURLEvent:
-				HandleGetURLEvent(appleEvent, reply);
-				break;
-				
-			default:
-				ThrowOSErr(errAEEventNotHandled);
-				break;
-		}
-	}
-	catch (OSErr catchErr)
-	{
-		PutReplyErrorNumber(reply, catchErr);
-		throw;
-	}
-	catch ( ... )
-	{
-		PutReplyErrorNumber(reply, paramErr);
-		throw;
-	}
-}
-
-
-/*----------------------------------------------------------------------------
-	HandleGetURLEvent 
-	
-----------------------------------------------------------------------------*/
-void AEGetURLSuiteHandler::HandleGetURLEvent(const AppleEvent *appleEvent, AppleEvent *reply)
-{
-	StAEDesc		directParameter;
-	WindowPtr		targetWindow = NULL;
-	OSErr				err;
-	
-	// extract the direct parameter (an object specifier)
-	err = ::AEGetKeyDesc(appleEvent, keyDirectObject, typeWildCard, &directParameter);
-	ThrowIfOSErr(err);
-
-	// we need to look for other parameters, to do with destination etc.
-	long		dataSize = directParameter.GetDataSize();
-	char*	urlString = (char *)nsMemory::Alloc(dataSize + 1);
-	ThrowIfNil(urlString);	
-	directParameter.GetCString(urlString, dataSize + 1);
-
-	// bail if it is a chrome URL for security reasons (bug 305374)
-        // Don't use nsIURI because xpcom may not be running
-        CFURLRef url = ::CFURLCreateWithBytes(nsnull, (UInt8*)urlString,
-                                              dataSize,
-                                              kCFStringEncodingUTF8,
-                                              nsnull);
-        if (!url)
-          return;
-
-        CFStringRef scheme = ::CFURLCopyScheme(url);
-        ::CFRelease(url);
-        if (!scheme)
-          return;
-
-        CFComparisonResult isChrome = ::CFStringCompare(scheme, CFSTR("chrome"),
-                                                        kCFCompareCaseInsensitive);
-        ::CFRelease(scheme);
-
-        if (isChrome == kCFCompareEqualTo)
-          return;
-
-	// get the destination window, if applicable
-	StAEDesc		openInWindowDesc;
-	err = ::AEGetKeyDesc(appleEvent, kInsideWindowParameter, typeObjectSpecifier, &openInWindowDesc);
-	if (err != errAEDescNotFound)
-	{
-		// resolve the object specifier into a token record
-		StAEDesc		tokenDesc;
-		err = ::AEResolve(&openInWindowDesc, kAEIDoMinimum, &tokenDesc);
-		ThrowIfOSErr(err);
-		
-		ConstAETokenDesc	tokenContainer(&tokenDesc);
-		targetWindow = tokenContainer.GetWindowPtr();		
-	}
-
-  // if the AE didn't specify a target, try to dispatch to the frontmost
-  // window. there user prefs for determining the actual target window
-  // will be respected.
-  if ( targetWindow )
-    LoadURLInWindow(targetWindow, urlString);
-  else {
-    nsCOMPtr<nsIXULWindow> xulwindow;
-    nsCOMPtr<nsIWindowMediator> mediator (
-                                do_GetService(NS_WINDOWMEDIATOR_CONTRACTID) );
-    if ( mediator ) {
-      nsCOMPtr<nsISimpleEnumerator> windowEnum;
-      mediator->GetZOrderXULWindowEnumerator(
-                  NS_LITERAL_STRING("navigator:browser").get(),
-                  PR_TRUE, getter_AddRefs(windowEnum));
-      if ( windowEnum ) {
-        nsCOMPtr<nsISupports> windowSupports;
-        windowEnum->GetNext(getter_AddRefs(windowSupports));
-        xulwindow = do_QueryInterface(windowSupports);
-      }
-    }
-    if ( xulwindow )
-      LoadURLInXULWindow(xulwindow, urlString);
-    else
-      LoadURLInWindow(nsnull, urlString);
-  }
-
-	nsMemory::Free(urlString);	
-}
-
deleted file mode 100644
--- a/xpfe/bootstrap/appleevents/nsAEGetURLSuiteHandler.h
+++ /dev/null
@@ -1,72 +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.
- *
- * 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):
- *   Simon Fraser <sfraser@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 nsAEGetURLSuiteHandler_h_
-#define nsAEGetURLSuiteHandler_h_
-
-#include "nsAEUtils.h"
-#include "prtypes.h"
-
-
-class AEGetURLSuiteHandler
-{
-public:
-	enum {
-		kSuiteSignature			= 'GURL',
-		kGetURLEvent			= 'GURL',
-		
-		kInsideWindowParameter	= 'HWIN',
-		kReferrerParameter		= 'refe'		
-	};
-	
-						AEGetURLSuiteHandler();
-						~AEGetURLSuiteHandler();
-
-	void				HandleGetURLSuiteEvent(const AppleEvent *appleEvent, AppleEvent *reply);	// throws OSErrs
-
-protected:
-
-	void				HandleGetURLEvent(const AppleEvent *appleEvent, AppleEvent *reply);
-};
-
-
-
-
-#endif // nsAEGetURLSuiteHandler_h_
deleted file mode 100644
--- a/xpfe/bootstrap/appleevents/nsAEMozillaSuiteHandler.cpp
+++ /dev/null
@@ -1,107 +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.
- *
- * 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):
- *   Simon Fraser <sfraser@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 ***** */
-
-
-#include "nsAEMozillaSuiteHandler.h"
-
-
-/*----------------------------------------------------------------------------
-	AEMozillaSuiteHandler 
-	
-----------------------------------------------------------------------------*/
-AEMozillaSuiteHandler::AEMozillaSuiteHandler()
-{
-}
-
-
-/*----------------------------------------------------------------------------
-	~AEMozillaSuiteHandler 
-	
-----------------------------------------------------------------------------*/
-AEMozillaSuiteHandler::~AEMozillaSuiteHandler()
-{
-}
-
-
-/*----------------------------------------------------------------------------
-	HandleMozillaSuiteEvent 
-	
-----------------------------------------------------------------------------*/
-void AEMozillaSuiteHandler::HandleMozillaSuiteEvent(const AppleEvent *appleEvent, AppleEvent *reply)
-{
-	OSErr		err = noErr;
-	
-	AEEventID		eventID;
-	OSType		typeCode;
-	Size			actualSize 	= 0L;
-	
-	// Get the event ID
-	err = AEGetAttributePtr(appleEvent, 	keyEventIDAttr, 
-									typeType, 
-									&typeCode, 
-									(Ptr)&eventID, 
-									sizeof(eventID), 
-									&actualSize);
-	ThrowIfOSErr(err);
-	
-	try
-	{
-		switch (eventID)
-		{
-			case kDoJavaScriptEvent:
-				// write me!
-				ThrowOSErr(errAEEventNotHandled);
-				break;
-				
-			default:
-				ThrowOSErr(errAEEventNotHandled);
-				break;
-		}
-	}
-	catch (OSErr catchErr)
-	{
-		PutReplyErrorNumber(reply, catchErr);
-		throw;
-	}
-	catch ( ... )
-	{
-		PutReplyErrorNumber(reply, paramErr);
-		throw;
-	}
-}
-
deleted file mode 100644
--- a/xpfe/bootstrap/appleevents/nsAEMozillaSuiteHandler.h
+++ /dev/null
@@ -1,67 +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.
- *
- * 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):
- *   Simon Fraser <sfraser@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 nsAEMozillaSuiteHandler_h_
-#define nsAEMozillaSuiteHandler_h_
-
-#include "nsAEUtils.h"
-
-
-class AEMozillaSuiteHandler
-{
-public:
-	enum {
-		kSuiteSignature			= 'MOZZ',
-		kDoJavaScriptEvent		= 'jscr'
-	};
-	
-						AEMozillaSuiteHandler();
-						~AEMozillaSuiteHandler();
-
-	void					HandleMozillaSuiteEvent(const AppleEvent *appleEvent, AppleEvent *reply);		// throws OSErrs
-
-protected:
-
-
-};
-
-
-
-#endif // nsAEMozillaSuiteHandler_h_
deleted file mode 100644
--- a/xpfe/bootstrap/appleevents/nsAESpyglassSuiteHandler.cpp
+++ /dev/null
@@ -1,215 +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.
- *
- * 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):
- *   Simon Fraser <sfraser@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 ***** */
-
-#include "nsMemory.h"
-
-#include "nsAESpyglassSuiteHandler.h"
-#include "nsCommandLineServiceMac.h"
-#include "nsDocLoadObserver.h"
-
-/*----------------------------------------------------------------------------
-	AESpyglassSuiteHandler 
-	
-----------------------------------------------------------------------------*/
-AESpyglassSuiteHandler::AESpyglassSuiteHandler()
-:   mDocObserver(nsnull)
-{
-}
-
-/*----------------------------------------------------------------------------
-	~AESpyglassSuiteHandler 
-	
-----------------------------------------------------------------------------*/
-AESpyglassSuiteHandler::~AESpyglassSuiteHandler()
-{
-    NS_IF_RELEASE(mDocObserver);
-}
-
-
-/*----------------------------------------------------------------------------
-	HandleSpyglassSuiteEvent 
-	
-----------------------------------------------------------------------------*/
-void AESpyglassSuiteHandler::HandleSpyglassSuiteEvent(const AppleEvent *appleEvent, AppleEvent *reply)
-{
-	OSErr		err = noErr;
-	
-	AEEventID		eventID;
-	OSType		typeCode;
-	Size			actualSize 	= 0L;
-	
-	// Get the event ID
-	err = AEGetAttributePtr(appleEvent, 	keyEventIDAttr, 
-									typeType, 
-									&typeCode, 
-									(Ptr)&eventID, 
-									sizeof(eventID), 
-									&actualSize);
-	ThrowIfOSErr(err);
-	
-	try
-	{
-		switch (eventID)
-		{
-			case kOpenURLEvent:
-				HandleOpenURLEvent(appleEvent, reply);
-				break;
-			
-			case kRegisterURLEchoEvent:
-				HandleRegisterURLEchoEvent(appleEvent, reply);
-				break;
-				
-			case kUnregisterURLEchoEvent:
-				HandleUnregisterURLEchoEvent(appleEvent, reply);
-				break;
-			
-			default:
-				ThrowOSErr(errAEEventNotHandled);
-				break;
-		}
-	}
-	catch (OSErr catchErr)
-	{
-		PutReplyErrorNumber(reply, catchErr);
-		throw;
-	}
-	catch ( ... )
-	{
-		PutReplyErrorNumber(reply, paramErr);
-		throw;
-	}
-}
-
-
-/*----------------------------------------------------------------------------
-	HandleOpenURLEvent 
-	
-----------------------------------------------------------------------------*/
-void AESpyglassSuiteHandler::HandleOpenURLEvent(const AppleEvent *appleEvent, AppleEvent *reply)
-{
-	StAEDesc		directParameter;
-	FSSpec		saveToFile;
-	Boolean		gotSaveToFile = false;
-	SInt32		targetWindowID = -1;
-	SInt32		openFlags = 0;
-	OSErr		err;
-	
-	// extract the direct parameter (an object specifier)
-	err = ::AEGetKeyDesc(appleEvent, keyDirectObject, typeWildCard, &directParameter);
-	ThrowIfOSErr(err);
-
-	// look for the save to file param
-	StAEDesc		targetFileDesc;
-	err = ::AEGetKeyDesc(appleEvent, kParamSaveToFileDest, typeFSS, &targetFileDesc);
-	if (err != errAEDescNotFound)
-	{
-		targetFileDesc.GetFileSpec(saveToFile);
-		gotSaveToFile = true;
-	}
-	
-#if 0
-	// look for the target window param
-	StAEDesc		openInWindowDesc;
-	err = ::AEGetKeyDesc(appleEvent, kParamOpenInWindow, typeLongInteger, &openInWindowDesc);
-	if (err != errAEDescNotFound)
-		targetWindowID = openInWindowDesc.GetLong();
-
-	// look for the open flags
-	StAEDesc		openFlagsDesc;
-	err = ::AEGetKeyDesc(appleEvent, kParamOpenFlags, typeLongInteger, &openFlagsDesc);
-	if (err != errAEDescNotFound)
-		openFlags = openFlagsDesc.GetLong();
-
-        // do something with targetWindowID and openFlags...
-#endif
-	
-	long		dataSize = directParameter.GetDataSize();
-	char*	urlString = (char *)nsMemory::Alloc(dataSize + 1);
-	ThrowIfNil(urlString);
-	
-	directParameter.GetCString(urlString, dataSize + 1);
-	
-	nsMacCommandLine&  cmdLine = nsMacCommandLine::GetMacCommandLine();
-	cmdLine.DispatchURLToNewBrowser(urlString);
-	
-	nsMemory::Free(urlString);	
-}
-
-
-
-/*----------------------------------------------------------------------------
-	HandleRegisterURLEchoEvent 
-	
-----------------------------------------------------------------------------*/
-void AESpyglassSuiteHandler::HandleRegisterURLEchoEvent(const AppleEvent *appleEvent, AppleEvent *reply)
-{
-	// extract the direct parameter (the requester's signature)
-	StAEDesc directParameter;
-	OSErr err = ::AEGetKeyDesc(appleEvent, keyDirectObject, typeType, &directParameter);
-	ThrowIfOSErr(err);
-
-	if (typeType == directParameter.descriptorType)
-	{
-	    if (mDocObserver == nsnull) {
-    		mDocObserver = new nsDocLoadObserver;
-    		ThrowIfNil(mDocObserver);
-    		NS_ADDREF(mDocObserver);        // our owning ref
-    	}
-    	OSType requester;
-    	if (AEGetDescData(&directParameter, &requester, sizeof(requester)) == noErr)
-    		mDocObserver->AddEchoRequester(requester);
-	}
-}
-
-/*----------------------------------------------------------------------------
-	HandleUnregisterURLEchoEvent 
-	
-----------------------------------------------------------------------------*/
-void AESpyglassSuiteHandler::HandleUnregisterURLEchoEvent(const AppleEvent *appleEvent, AppleEvent *reply)
-{
-	// extract the direct parameter (the requester's signature)
-	StAEDesc directParameter;
-	OSErr err = ::AEGetKeyDesc(appleEvent, keyDirectObject, typeType, &directParameter);
-	ThrowIfOSErr(err);
-
-	if (typeType == directParameter.descriptorType)
-	{
-	    if (mDocObserver)
-		mDocObserver->RemoveEchoRequester(**(OSType**)directParameter.dataHandle);
-	}
-}
deleted file mode 100644
--- a/xpfe/bootstrap/appleevents/nsAESpyglassSuiteHandler.h
+++ /dev/null
@@ -1,109 +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.
- *
- * 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):
- *   Simon Fraser <sfraser@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 nsAESpyglassSuiteHandler_h_
-#define nsAESpyglassSuiteHandler_h_
-
-
-#include "nsAEUtils.h"
-
-class nsDocLoadObserver;
-
-class AESpyglassSuiteHandler
-{
-public:
-	enum {
-		kSuiteSignature					= 'WWW!',
-				
-		kOpenURLEvent					= 'OURL',			// OpenURL
-		kRegisterURLEchoEvent		= 'RGUE',			// Register URL echo handler
-		kUnregisterURLEchoEvent	= 'UNRU',			// Unregister URL echo handler
-
-// the following are unhandled in Mozilla
-		kRegisterViewerEvent 		= 'RGVW',			// RegisterViewer
-		kUnregisterViewerEvent	= 'UNRV',			// UnregisterViewer
-		kShowFileEvent					= 'SHWF',			// ShowFile
-		kParseAnchorEvent			= 'PRSA',			// ParseAnchor
-		kSpyActivateEvent			= 'ACTV',			// Activate
-		kSpyListWindowsEvent		= 'LSTW',			// ListWindows
-		kGetWindowInfoEvent		= 'WNFO',			// GetWindowInfo
-		kRegisterWinCloseEvent	= 'RGWC',			// RegisterWindowClose
-		kUnregisterWinCloseEvent	= 'UNRC',			// UnregisterWindowClose
-		kRegisterProtocolEvent		= 'RGPR',			// RegisterProtocol
-		kUnregisterProtocolEvent	= 'UNRP',			// UnregisterProtocol
-		kCancelProgressEvent		= 'CNCL',			// Cancel download
-		kFindURLEvent					= 'FURL',			// Find the URL for the file
-
-// Spyglass send events
-
-		kSpyglassSendSignature	= 'WWW?',
-		kSendURLEchoEvent			= 'URLE'
-
-	};
-
-	// event params
-	enum {
-		kParamSaveToFileDest		= 'INTO',		// FSSpec save to file
-		kParamOpenInWindow		= 'WIND',		// long, target window (window ID)
-		kParamOpenFlags			= 'FLGS',		// long, Binary: any combination of 1, 2 and 4 is allowed: 1 and 2 mean force reload the document. 4 is ignored
-		kParamPostData			= 'POST',		// text, Form posting data
-		kParamPostType			= 'MIME',		// text, MIME type of the posting data. Defaults to application/x-www-form-urlencoded
-		kParamProgressApp			= 'PROG'		// 'psn ', Application that will display progress
-	};
-	
-						AESpyglassSuiteHandler();
-						~AESpyglassSuiteHandler();
-
-	void					HandleSpyglassSuiteEvent(const AppleEvent *appleEvent, AppleEvent *reply);	// throws OSErrs
-
-protected:
-
-	void					HandleOpenURLEvent(const AppleEvent *appleEvent, AppleEvent *reply);
-	
-	void					HandleRegisterURLEchoEvent(const AppleEvent *appleEvent, AppleEvent *reply);
-	void					HandleUnregisterURLEchoEvent(const AppleEvent *appleEvent, AppleEvent *reply);
-
-protected:
-
-    nsDocLoadObserver*  mDocObserver;
-    
-};
-
-
-
-#endif // nsAESpyglassSuiteHandler_h_
deleted file mode 100644
--- a/xpfe/bootstrap/appleevents/nsAETokens.cpp
+++ /dev/null
@@ -1,174 +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.
- *
- * 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):
- *   Simon Fraser <sfraser@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 ***** */
-
-
-
-#include "nsAETokens.h"
-
-// ---------------------------------------------------------------------------
-ConstAETokenDesc::ConstAETokenDesc(const AEDesc* token)
-{
-	mTokenWasNull = (token->descriptorType == typeNull);
-	
-	if (!mTokenWasNull)
-	{
-		if (::AEGetDescDataSize(token) != sizeof(CoreTokenRecord))
-			ThrowOSErr(paramErr);			// invalid token
-
-		ThrowIfOSErr(::AEGetDescData(token, &mTokenRecord, sizeof(CoreTokenRecord)));
-	}
-}
-
-
-// ---------------------------------------------------------------------------
-
-DescType ConstAETokenDesc::GetDispatchClass() const
-{
-	ThrowErrIfTrue(mTokenWasNull, paramErr);
-	return mTokenRecord.dispatchClass;
-}
-
-// ---------------------------------------------------------------------------
-
-DescType ConstAETokenDesc::GetObjectClass() const
-{
-	ThrowErrIfTrue(mTokenWasNull, paramErr);
-	return mTokenRecord.objectClass;
-}
-
-// ---------------------------------------------------------------------------
-// The field usePropertyCode has been removed from the token record,
-// so we emulate it here by seeing if the propertyCode field is typeNull,
-// which is interpreted to mean that this is NOT a property token
-
-Boolean ConstAETokenDesc::UsePropertyCode() const
-{
-	ThrowErrIfTrue(mTokenWasNull, paramErr);
-	return (mTokenRecord.propertyCode != typeNull);
-}
-
-// ---------------------------------------------------------------------------
-
-DescType ConstAETokenDesc::GetPropertyCode() const
-{
-	ThrowErrIfTrue(mTokenWasNull, paramErr);
-	return mTokenRecord.propertyCode;
-}
-
-// ---------------------------------------------------------------------------
-
-long ConstAETokenDesc::GetDocumentID() const
-{
-	ThrowErrIfTrue(mTokenWasNull, paramErr);
-	return mTokenRecord.documentID;
-}
-
-// ---------------------------------------------------------------------------
-
-WindowPtr ConstAETokenDesc::GetWindowPtr() const
-{
-	ThrowErrIfTrue(mTokenWasNull, paramErr);
-	return mTokenRecord.window;
-}
-
-
-// ---------------------------------------------------------------------------
-
-TAEListIndex ConstAETokenDesc::GetElementNumber() const
-{
-	ThrowErrIfTrue(mTokenWasNull, paramErr);
-	return mTokenRecord.elementNumber;
-}
-
-
-
-#pragma mark -
-
-// ---------------------------------------------------------------------------
-AETokenDesc::AETokenDesc(AEDesc* token)
-:	ConstAETokenDesc(token)
-,	mTokenDesc(token)
-{
-	if (mTokenWasNull)			// we cannot wrap a null token
-		ThrowOSErr(paramErr);
-}
-
-// ---------------------------------------------------------------------------
-AETokenDesc::~AETokenDesc()
-{
-	UpdateDesc();		// update the AEDesc that we wrap
-}
-
-// ---------------------------------------------------------------------------
-
-void AETokenDesc::SetPropertyCode(DescType propertyCode)
-{
-	mTokenRecord.propertyCode = propertyCode;
-}
-
-// ---------------------------------------------------------------------------
-void AETokenDesc::SetDispatchClass(DescType dispatchClass)
-{
-	mTokenRecord.dispatchClass = dispatchClass;
-}
-
-
-// ---------------------------------------------------------------------------
-void AETokenDesc::SetObjectClass(DescType objectClass)
-{
-	mTokenRecord.objectClass = objectClass;
-}
-
-// ---------------------------------------------------------------------------
-void AETokenDesc::SetElementNumber(TAEListIndex number)
-{
-	mTokenRecord.elementNumber = number;
-}
-
-// ---------------------------------------------------------------------------
-void AETokenDesc::SetWindow(WindowPtr wind)
-{
-	mTokenRecord.window = wind;
-}
-
-// ---------------------------------------------------------------------------
-void AETokenDesc::UpdateDesc()
-{
-	OSErr	err = ::AEReplaceDescData(mTokenDesc->descriptorType, &mTokenRecord, sizeof(CoreTokenRecord), mTokenDesc);
-	ThrowIfOSErr(err);
-}
deleted file mode 100644
--- a/xpfe/bootstrap/appleevents/nsAETokens.h
+++ /dev/null
@@ -1,129 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; 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.
- *
- * 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):
- *   Simon Fraser <sfraser@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 __AETOKENS__
-#define __AETOKENS__
-
-#include "nsAEUtils.h"
-
-
-// ----------------------------------------------------------------------------
-// This is the token record used for all tokens in the CORE Suite
-// This uses the "kitchen sink" token metaphor: a single token is used to represent
-// all objects, and some fields are only appropriate for some objects.
-
-struct CoreTokenRecord
-{
-	DescType				dispatchClass;		// the class that will dispatch this class
-	DescType				objectClass;		// the actual class of the tokenized object
-	DescType				propertyCode;		// property code, or typeNull if not a property token
-	long					documentID;
-	TAEListIndex			elementNumber;
-	WindowPtr			window;			// only used for window objects
-	
-	CoreTokenRecord()
-	:	dispatchClass(typeNull)
-	,	objectClass(typeNull)
-	,	propertyCode(typeNull)
-	,	documentID(0)
-	,	elementNumber(0)
-	,	window(nil)
-	{
-	}
-};
-
-
-typedef struct CoreTokenRecord CoreTokenRecord, *CoreTokenPtr, **CoreTokenHandle;
-
-
-
-// ConstAETokenDesc
-// This is a read-only wrapper for an AEDesc* that can be used
-// to read the contents of the token record.
-
-class ConstAETokenDesc
-{
-public:
-						ConstAETokenDesc(const AEDesc* token);
-
-
-	DescType			GetDispatchClass() const;
-	DescType 			GetObjectClass() const;
-	Boolean				UsePropertyCode() const;
-	DescType			GetPropertyCode() const;
-		
-	long				GetDocumentID() const;
-	WindowPtr			GetWindowPtr() const;
-	TAEListIndex		GetElementNumber() const;
-
-protected:
-
-	CoreTokenRecord     mTokenRecord;
-	Boolean				mTokenWasNull;		// true if we were passed an empty AEDesc
-};
-
-
-
-// AETokenDesc
-// A read-write wrapper for an AEDesc*. Use this if you want to
-// update the contents of the AEDesc's data handle
-
-class AETokenDesc : public ConstAETokenDesc
-{
-public:
-						AETokenDesc(AEDesc* token);
-						~AETokenDesc();
-	
-	void				SetDispatchClass(DescType dispatchClass);
-	void				SetObjectClass(DescType objectClass);
-	void				SetPropertyCode(DescType propertyCode);
-	void				SetElementNumber(TAEListIndex number);
-	void				SetWindow(WindowPtr wind);
-
-	void				UpdateDesc();			// update the AEDesc wrapped by this class
-
-	CoreTokenRecord&	GetTokenRecord()	{ return mTokenRecord; }
-	
-protected:
-	
-	AEDesc*				mTokenDesc;
-	
-};
-
-#endif /* __AETOKENS__ */
deleted file mode 100644
--- a/xpfe/bootstrap/appleevents/nsAEUtils.cpp
+++ /dev/null
@@ -1,1098 +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.
- *
- * 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):
- *   Simon Fraser <sfraser@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 ***** */
-
-
-#include <string.h>
-
-
-#include "nsAETokens.h"
-#include "nsAEUtils.h"
-
-static OSErr AECoerceDescData(const AEDesc *theAEDesc, DescType typeCode, void *dataPtr, Size maximumSize);
-
-/*----------------------------------------------------------------------------
-	CreateAliasAEDesc 
-	
-	Create an AE descriptor for an alias
-----------------------------------------------------------------------------*/
-
-OSErr CreateAliasAEDesc(AliasHandle theAlias, AEDesc *ioDesc)
-{
-	char		state = HGetState((Handle)theAlias);
-	OSErr	err;
-
-	HLock((Handle)theAlias);
-	err = AECreateDesc(typeAlias, *theAlias, GetHandleSize((Handle)theAlias), ioDesc);
-	HSetState((Handle)theAlias, state);
-	return err;
-}
-
-
-/*----------------------------------------------------------------------------
-	GetTextFromAEDesc 
-	
-	Get a text handle from an AEDesc
-----------------------------------------------------------------------------*/
-OSErr GetTextFromAEDesc(const AEDesc *inDesc, Handle *outTextHandle)
-{
-	Handle	textHandle = nil;
-	Size		textLength;
-	OSErr	err;
-
-	textLength = AEGetDescDataSize(inDesc);
-
-	err = MyNewHandle(textLength, &textHandle);
-	if (err != noErr) return err;
-	
-	MyHLock(textHandle);
-	err = AECoerceDescData(inDesc, typeChar, *textHandle, textLength);
-	MyHUnlock(textHandle);
-	
-	if (err != noErr)
-		goto exit;
-	
-	*outTextHandle = textHandle;
-	return noErr;
-	
-exit:
-	MyDisposeHandle(textHandle);
-	return err;
-}
-
-
-#if !TARGET_CARBON
-
-/*----------------------------------------------------------------------------
-	AEGetDescData 
-	
-	Get a copy of the data from the AE desc. The will attempt to coerce to the
-	requested type, returning an error on failure.
-----------------------------------------------------------------------------*/
-
-OSErr AEGetDescData(const AEDesc *theAEDesc, void *dataPtr, Size maximumSize)
-{
-  OSErr err = noErr;
-  
-	if (theAEDesc->dataHandle)
-	{
-		Size dataLength = GetHandleSize(theAEDesc->dataHandle);
-		BlockMoveData(*theAEDesc->dataHandle, dataPtr, Min(dataLength, maximumSize));
-	}
-	else
-		err = paramErr;
-		
-	return err;
-}
-
-/*----------------------------------------------------------------------------
-	AEGetDescDataSize 
-	
-	Get the size of the datahandle.
-----------------------------------------------------------------------------*/
-Size AEGetDescDataSize(const AEDesc *theAEDesc)
-{
-	Size		dataSize = 0;
-	
-	if (theAEDesc->dataHandle)
-		dataSize = GetHandleSize(theAEDesc->dataHandle);
-	
-	return dataSize;
-}
-
-/*----------------------------------------------------------------------------
-	AEReplaceDescData 
-	
-	Replace the data in the descriptor
-----------------------------------------------------------------------------*/
-OSErr AEReplaceDescData(DescType typeCode, const void *dataPtr, Size dataSize, AEDesc* theAEDesc)
-{
-	AEDisposeDesc(theAEDesc);
-	return AECreateDesc(typeCode, dataPtr, dataSize, theAEDesc);
-}
-
-#endif //TARGET_CARBON
-
-static OSErr AECoerceDescData(const AEDesc *theAEDesc, DescType typeCode, void *dataPtr, Size maximumSize)
-{
-	OSErr err;
-	
-	if (theAEDesc->descriptorType != typeCode)
-	{
-		AEDesc	coercedDesc = { typeNull, nil };
-		err = AECoerceDesc(theAEDesc, typeCode, &coercedDesc);
-		if (err != noErr) return err;
-		
-		err = AEGetDescData(&coercedDesc, dataPtr, maximumSize);
-		AEDisposeDesc(&coercedDesc);
-		return err;
-	}
-	else
-	{
-	    return AEGetDescData(theAEDesc, dataPtr, maximumSize);
-	}
-}
-
-#pragma mark -
-
-
-/*----------------------------------------------------------------------------
-	CreateThreadAEInfo 
-	
-	Allocate a block for the thread info, and fill it.
-----------------------------------------------------------------------------*/
-OSErr CreateThreadAEInfo(const AppleEvent *event, AppleEvent *reply, TThreadAEInfoPtr *outThreadAEInfo)
-{
-	TThreadAEInfo	*threadAEInfo = nil;
-	OSErr		err;
-	
-	err = MyNewBlockClear(sizeof(TThreadAEInfo), (void**)&threadAEInfo);
-	if (err != noErr) return err;
-	
-	threadAEInfo->mAppleEvent = *event;
-	threadAEInfo->mReply = *reply;
-	threadAEInfo->mGotEventData = event && reply;
-	threadAEInfo->mSuspendCount = nil;
-	
-	*outThreadAEInfo = threadAEInfo;
-	return noErr;
-
-exit:
-	MyDisposeBlock(threadAEInfo);
-	return err;
-}
-
-
-/*----------------------------------------------------------------------------
-	DisposeThreadAEInfo 
-	
-	Dispose of the thread AE info
-----------------------------------------------------------------------------*/
-void DisposeThreadAEInfo(TThreadAEInfo *threadAEInfo)
-{
-	AE_ASSERT(threadAEInfo && threadAEInfo->mSuspendCount == 0, "Bad suspend count");
-	MyDisposeBlock(threadAEInfo);
-}
-
-
-/*----------------------------------------------------------------------------
-	SuspendThreadAE 
-	
-	If this if the first suspend, suspend the event. Increment the suspend count.
-----------------------------------------------------------------------------*/
-OSErr SuspendThreadAE(TThreadAEInfo *threadAEInfo)
-{
-	if (threadAEInfo == nil) return noErr;
-	if (!threadAEInfo->mGotEventData) return noErr;
-	
-	if (threadAEInfo->mSuspendCount == 0)
-	{
-		OSErr	err = AESuspendTheCurrentEvent(&threadAEInfo->mAppleEvent);
-		if (err != noErr) return err;
-	}
-	
-	++ threadAEInfo->mSuspendCount;
-	return noErr;
-}
-
-
-/*----------------------------------------------------------------------------
-	ResumeThreadAE 
-	
-	Decrement the suspend count. If this is the last resume, resume the event.
-----------------------------------------------------------------------------*/
-
-static OSErr AddErrorCodeToReply(TThreadAEInfo *threadAEInfo, OSErr threadError)
-{
-	long		errorValue = threadError;
-	
-	if (threadError == noErr) return noErr;
-	
-	return AEPutParamPtr(&threadAEInfo->mReply, keyErrorNumber, typeLongInteger,  (Ptr)&errorValue, sizeof(long));
-}
-
-
-/*----------------------------------------------------------------------------
-	ResumeThreadAE 
-	
-	Decrement the suspend count. If this is the last resume, resume the event.
-----------------------------------------------------------------------------*/
-OSErr ResumeThreadAE(TThreadAEInfo *threadAEInfo, OSErr threadError)
-{
-	if (threadAEInfo == nil) return noErr;
-	if (!threadAEInfo->mGotEventData) return noErr;
-
-	-- threadAEInfo->mSuspendCount;
-	
-	AddErrorCodeToReply(threadAEInfo, threadError);
-	
-	if (threadAEInfo->mSuspendCount == 0)
-		return AEResumeTheCurrentEvent(&threadAEInfo->mAppleEvent, &threadAEInfo->mReply, (AEEventHandlerUPP)kAENoDispatch, 0);
-
-	return noErr;
-}
-
-
-#pragma mark -
-
-/*----------------------------------------------------------------------------
-	Copy ctor
-	
-	this can throw 
-	
-----------------------------------------------------------------------------*/
-
-StAEDesc::StAEDesc(const StAEDesc& rhs)
-{
-	ThrowIfOSErr(AEDuplicateDesc(&rhs, this));
-}
-
-/*----------------------------------------------------------------------------
-	operator =
-	
-	this can throw 
-	
-----------------------------------------------------------------------------*/
-
-StAEDesc& StAEDesc::operator= (const StAEDesc& rhs)
-{
-	ThrowIfOSErr(AEDuplicateDesc(&rhs, this));
-	return *this;
-}
-
-
-/*----------------------------------------------------------------------------
-	Data getters
-	
-	These should try to coerce when necessary also.
-----------------------------------------------------------------------------*/
-
-Boolean StAEDesc::GetBoolean()
-{
-    Boolean result = false;
-    OSErr err = ::AECoerceDescData(this, typeBoolean, &result, sizeof(result));
-    if (err != noErr)
-        ThrowOSErr(errAECoercionFail);
-    return result;
-}
-
-SInt16 StAEDesc::GetShort()
-{
-    SInt16 result = 0;
-    OSErr err = ::AECoerceDescData(this, typeShortInteger, &result, sizeof(result));
-    if (err != noErr)
-        ThrowOSErr(errAECoercionFail);
-    return result;
-}
-
-SInt32 StAEDesc::GetLong()
-{
-    SInt32 result = 0;
-    OSErr err = ::AECoerceDescData(this, typeLongInteger, &result, sizeof(result));
-    if (err != noErr)
-        ThrowOSErr(errAECoercionFail);
-    return result;
-}
-
-DescType StAEDesc::GetEnumType()
-{
-    DescType result = typeNull;
-    OSErr err = ::AECoerceDescData(this, typeEnumeration, &result, sizeof(result));
-    if (err != noErr)
-        ThrowOSErr(errAECoercionFail);
-    return result;
-}
-
-void StAEDesc::GetRect(Rect& outData)
-{
-    OSErr err = ::AECoerceDescData(this, typeQDRectangle, &outData, sizeof(Rect));
-    if (err != noErr)
-        ThrowOSErr(errAECoercionFail);
-}
-
-
-void StAEDesc::GetRGBColor(RGBColor& outData)
-{
-    OSErr err = ::AECoerceDescData(this, typeRGBColor, &outData, sizeof(RGBColor));
-    if (err != noErr)
-        ThrowOSErr(errAECoercionFail);
-}
-
-void StAEDesc::GetLongDateTime(LongDateTime& outDateTime)
-{
-    OSErr err = ::AECoerceDescData(this, typeLongDateTime, &outDateTime, sizeof(LongDateTime));
-    if (err != noErr)
-        ThrowOSErr(errAECoercionFail);
-}
-
-void StAEDesc::GetFileSpec(FSSpec &outFileSpec)
-{
-    OSErr err = ::AECoerceDescData(this, typeFSS, &outFileSpec, sizeof(FSSpec));
-    if (err != noErr)
-        ThrowOSErr(errAECoercionFail);
-}
-
-void StAEDesc::GetCString(char *outString, short maxLen)
-{
-	if (descriptorType == typeChar)
-	{
-		long dataSize = GetDataSize();
-		dataSize = Min(dataSize, maxLen-1);
-		if (AEGetDescData(this, outString, dataSize) == noErr)
-    		outString[dataSize] = '\0';
-	}
-	else
-	{
-		StAEDesc tempDesc;
-		if (::AECoerceDesc(this, typeChar, &tempDesc) == noErr)
-		{
-			long dataSize = tempDesc.GetDataSize();
-    		dataSize = Min(dataSize, maxLen-1);
-    		if (AEGetDescData(&tempDesc, outString, dataSize) == noErr)
-        		outString[dataSize] = '\0';
-		}
-		else
-			ThrowOSErr(errAECoercionFail);
-	}
-}
-
-void StAEDesc::GetPString(Str255 outString)
-{
-	if (descriptorType == typeChar)
-	{
-		long stringLen = GetDataSize();
-		if (stringLen > 255)
-			stringLen = 255;
-		AEGetDescData(this, outString+1, stringLen);
-		outString[0] = stringLen;
-	}
-	else
-	{
-		StAEDesc	tempDesc;
-		if (::AECoerceDesc(this, typeChar, &tempDesc) == noErr)
-		{
-			long stringLen = tempDesc.GetDataSize();
-			if (stringLen > 255)
-				stringLen = 255;
-			AEGetDescData(&tempDesc, outString+1, stringLen);
-			outString[0] = stringLen;
-		}
-		else
-			ThrowOSErr(errAECoercionFail);
-	}
-}
-
-Handle StAEDesc::GetTextHandle()
-{
-    Handle data = nil;
-    
-	if (descriptorType == typeChar)
-	{
-	    Size dataSize = GetDataSize();
-	    data = ::NewHandle(dataSize);
-	    if (data == NULL)
-	        ThrowOSErr(memFullErr);
-        ::HLock(data);
-        ::AEGetDescData(this, *data, dataSize);
-        ::HUnlock(data);
-	}
-	else
-	{
-    	StAEDesc tempDesc;
-		if (::AECoerceDesc(this, typeChar, &tempDesc) == noErr)
-		    data = tempDesc.GetTextHandle();
-		else
-		    ThrowOSErr(errAECoercionFail);
-	}
-	
-	return data;
-}
-
-
-#pragma mark -
-
-/*----------------------------------------------------------------------------
-	GetFirstNonListToken
-	
-	Note: make sure the result descriptor is {typeNull, nil} when it is passed in to this
-	
-----------------------------------------------------------------------------*/
-OSErr AEListUtils::GetFirstNonListToken(const AEDesc *token, AEDesc *result)
-{
-	OSErr 		err = noErr;
-	AEDesc 		tempToken = { typeNull, nil };
-	AEKeyword	keyword;
-	long			numItems;
-	long 			itemNum;
-	
-	if (result->descriptorType == typeNull)
-	{
-		if (TokenContainsTokenList(token) == false)
-		{
-			err = AEDuplicateDesc(token, result);
-		}
-		else
-		{
-			err = AECountItems(token, &numItems);
-			
-			for (itemNum = 1; itemNum <= numItems; itemNum++)
-			{
-				err = AEGetNthDesc((AEDescList *)token, itemNum, typeWildCard, &keyword, &tempToken);
-				if (err != noErr)
-					goto CleanUp;
-					
-				err = GetFirstNonListToken(&tempToken, result);				
-				if ((err != noErr) || (result->descriptorType != typeNull))
-					break;
-					
-				AEDisposeDesc(&tempToken);
-			}
-		}
-	}
-	
-CleanUp:
-	if (err != noErr)
-		AEDisposeDesc(result);
-		
-	AEDisposeDesc(&tempToken);
-	return err;
-}
-
-/*----------------------------------------------------------------------------
-	FlattenAEList
-	
-----------------------------------------------------------------------------*/
-OSErr AEListUtils::FlattenAEList(AEDescList *deepList, AEDescList *flatList)
-{
-	OSErr		err = noErr;
-	AEDesc		item	= {typeNull, nil};
-	AEKeyword	keyword;
-	long			itemNum;
-	long			numItems;
-
-	err = AECountItems(deepList, &numItems);
-	if (err != noErr)
-		goto CleanUp;
-	
-	for (itemNum = 1; itemNum <= numItems; itemNum++)
-	{
-		err = AEGetNthDesc(deepList, itemNum, typeWildCard, &keyword, &item);
-		if (err != noErr)
-			goto CleanUp;
-			
-		if (item.descriptorType == typeAEList)
-			err = FlattenAEList(&item, flatList);
-		else
-			err = AEPutDesc(flatList, 0L, &item);
-		
-		if (err != noErr)
-			goto CleanUp;
-			
-		AEDisposeDesc(&item);
-	}
-
-CleanUp:
-	if (err != noErr)
-		AEDisposeDesc(flatList);
-
-	AEDisposeDesc(&item);
-	
-	return err;
-}
-
-
-#pragma mark -
-
-/*----------------------------------------------------------------------------
-	StEventSuspender
-	
-----------------------------------------------------------------------------*/
-StEventSuspender::StEventSuspender(const AppleEvent *appleEvent, AppleEvent *reply, Boolean deleteData)
-:	mThreadAEInfo(nil)
-,	mDeleteData(deleteData)
-{
-	ThrowIfOSErr(CreateThreadAEInfo(appleEvent, reply, &mThreadAEInfo));
-}
-
-
-/*----------------------------------------------------------------------------
-	~StEventSuspender
-	
-----------------------------------------------------------------------------*/
-StEventSuspender::~StEventSuspender()
-{
-	if (mDeleteData)
-		DisposeThreadAEInfo(mThreadAEInfo);
-}
-
-/*----------------------------------------------------------------------------
-	SuspendEvent
-	
-----------------------------------------------------------------------------*/
-void StEventSuspender::SuspendEvent()
-{
-	ThrowIfOSErr(SuspendThreadAE(mThreadAEInfo));
-}
-
-
-/*----------------------------------------------------------------------------
-	ResumeEvent
-	
-----------------------------------------------------------------------------*/
-void StEventSuspender::ResumeEvent()
-{
-	ThrowIfOSErr(ResumeThreadAE(mThreadAEInfo, noErr));
-}
-
-
-
-#pragma mark -
-
-
-/*----------------------------------------------------------------------------
-	StHandleHolder
-	
-----------------------------------------------------------------------------*/
-StHandleHolder::StHandleHolder(Handle inHandle)
-:	mHandle(inHandle)
-,	mLockCount(0)
-{
-}
-
-
-/*----------------------------------------------------------------------------
-	~StHandleHolder
-	
-----------------------------------------------------------------------------*/
-StHandleHolder::~StHandleHolder()
-{
-	if (mHandle)
-		DisposeHandle(mHandle);
-}
-
-
-/*----------------------------------------------------------------------------
-	operator=
-	
-----------------------------------------------------------------------------*/
-StHandleHolder& StHandleHolder::operator=(Handle rhs)
-{
-	AE_ASSERT(mLockCount == 0, "Bad lock count");
-	mLockCount = 0;
-	
-	if (mHandle)
-		DisposeHandle(mHandle);
-		
-	mHandle = rhs;
-	return *this;
-}
-
-/*----------------------------------------------------------------------------
-	Lock
-	
-----------------------------------------------------------------------------*/
-void StHandleHolder::Lock()
-{
-	ThrowIfNil(mHandle);
-	if (++mLockCount > 1) return;
-	mOldHandleState = HGetState(mHandle);
-	HLock(mHandle);
-}
-
-/*----------------------------------------------------------------------------
-	Unlock
-	
-----------------------------------------------------------------------------*/
-void StHandleHolder::Unlock()
-{
-	ThrowIfNil(mHandle);
-	AE_ASSERT(mLockCount > 0, "Bad lock count");
-	if (--mLockCount == 0)
-		HSetState(mHandle, mOldHandleState);
-}
-
-
-#pragma mark -
-
-
-/*----------------------------------------------------------------------------
-	StAEListIterator
-	
-----------------------------------------------------------------------------*/
-AEListIterator::AEListIterator(AEDesc *token)
-:	mNumItems(0)
-,	mCurItem(0)
-,	mIsListDesc(false)
-{
-	ThrowIfNil(token);
-	mListToken = *token;
-	mIsListDesc = AEListUtils::TokenContainsTokenList(&mListToken);
-	if (mIsListDesc)
-	{
-		ThrowIfOSErr(::AECountItems(token, &mNumItems));
-		mCurItem = 1;
-	}
-	else
-	{
-		mCurItem = 0;
-		mNumItems = 1;
-	}
-}
-
-
-/*----------------------------------------------------------------------------
-	Next
-	
-----------------------------------------------------------------------------*/
-Boolean AEListIterator::Next(AEDesc* outItemData)
-{
-	if (mIsListDesc)
-	{
-		AEKeyword	keyword;
-		
-		if (mCurItem == 0 || mCurItem > mNumItems)
-			return false;
-		
-		ThrowIfOSErr(::AEGetNthDesc(&mListToken, mCurItem, typeWildCard, &keyword, outItemData));
-		
-		// what about nested lists?
-		AE_ASSERT(!AEListUtils::TokenContainsTokenList(outItemData), "Nested list found");
-	}
-	else
-	{
-		if (mCurItem > 0)
-			return false;
-		
-		ThrowIfOSErr(::AEDuplicateDesc(&mListToken, outItemData));
-	}
-	
-	mCurItem ++;
-	return true;
-}
-
-
-
-#pragma mark -
-
-/*----------------------------------------------------------------------------
-	CheckForUnusedParameters 
-	
-	Check to see if there exist any additional required parameters in the Apple Event.
-	If so, return an err to the calling routine, because we didn't extract them all.
-----------------------------------------------------------------------------*/
-OSErr  CheckForUnusedParameters(const AppleEvent* appleEvent)
-{
-	OSErr		err 		= noErr;
-	
-	DescType	actualType	= typeNull;
-	Size		actualSize	= 0L;
-	
-	err = AEGetAttributePtr(appleEvent, 
-									keyMissedKeywordAttr, 
-									typeWildCard,
-									&actualType, 
-									nil, 
-									0, 
-									&actualSize);
-									
-	if (err == errAEDescNotFound)
-		err = noErr;
-	else
-		err = errAEParamMissed;
-		
-	return err;
-}
-
-/*----------------------------------------------------------------------------
-	PutReplyErrorNumber 
-	
-	If a reply is expected, the err number is returned in the reply parameter.
-----------------------------------------------------------------------------*/
-OSErr  PutReplyErrorNumber(AppleEvent* reply, long errorNumber)
-{
-	OSErr err = noErr;
-	
-	if (reply->dataHandle != nil && errorNumber != noErr)
-	{
-		err = AEPutParamPtr(reply, 
-									 keyErrorNumber, 
-									 typeLongInteger, 
-									 (Ptr)&errorNumber, 
-									 sizeof(long));
-	}
-	return err;
-}
-
-/*----------------------------------------------------------------------------
-	PutReplyErrorMessage 
-	
-	If a reply is expected, the err message is inserted into the reply parameter.
-----------------------------------------------------------------------------*/
-OSErr  PutReplyErrorMessage(AppleEvent* reply, char *message)
-{
-	OSErr err = noErr;
-	
-	if (reply->dataHandle != nil && message != NULL)
-	{
-		err = AEPutParamPtr(reply, 
-									 keyErrorString, 
-									 typeChar, 
-									 (Ptr)message, 
-									 strlen(message));
-	}
-	return err;
-}
-
-
-/*----------------------------------------------------------------------------
-	GetObjectClassFromAppleEvent 
-	
-	This is used to extract the type of object that an appleevent is supposed
-	to work with. In the Core events, this includes:
-		count <reference> each <typeOfObject>
-		make new <typeOfObject>
-		save <reference> in <alias> as <typeOfObject>
----------------------------------------------------------------------------*/
-OSErr GetObjectClassFromAppleEvent(const AppleEvent *appleEvent, DescType *objectClass)
-{
-	OSErr	err     = noErr;
-	OSType	typeCode;					// should be typeType
-	long		actualSize;
-	
-	// Get the class of object that we will count
-
-	err = AEGetParamPtr(appleEvent, 
-								 keyAEObjectClass, 
-								 typeType, 
-								 &typeCode,
-								 (Ptr)objectClass, 
-								 sizeof(DescType), 
-								 &actualSize);
-								 
-	if (typeCode != typeType) 
-		err = errAECoercionFail;
-	
-	return err;
-}
-
-#pragma mark -
-
-/*----------------------------------------------------------------------------
-	DescToPString 
-	
-	Converts descriptor dataHandle  to a pascal string
-	
----------------------------------------------------------------------------*/
-OSErr DescToPString(const AEDesc* desc, Str255 aPString, short maxLength)
-{
-	if (desc->descriptorType == typeChar)
-	{
-		long stringLen = AEGetDescDataSize(desc);
-		if (stringLen > maxLength)
-			stringLen = maxLength;
-		AEGetDescData(desc, aPString+1, stringLen);
-		aPString[0] = stringLen;
-	}
-	else
-	{
-    	StAEDesc tempDesc;
-		if (AECoerceDesc(desc, typeChar, &tempDesc) == noErr) {
-    		long stringLen = tempDesc.GetDataSize();
-    		if (stringLen > maxLength)
-    			stringLen = maxLength;
-    		AEGetDescData(&tempDesc, aPString+1, stringLen);
-    		aPString[0] = stringLen;
-		} else
-			return errAECoercionFail;
-	}
-	return noErr;
-}
-
-
-/*----------------------------------------------------------------------------
-	DescToCString 
-	
-	Converts descriptor dataHandle  to a C string
-	
---------------------------------------------------------------------------- */
-OSErr DescToCString(const AEDesc* desc, CStr255 aCString, short maxLength)
-{
-	if (desc->descriptorType == typeChar)
-	{
-	    long stringLen = AEGetDescDataSize(desc);
-	    if (stringLen >= maxLength)
-	        stringLen = maxLength - 1;
-		if (AEGetDescData(desc, aCString, stringLen) == noErr)
-    		aCString[stringLen] = '\0';
-    	else
-			return errAECoercionFail;
-	}
-	else
-	{
-    	StAEDesc tempDesc;
-		if (AECoerceDesc(desc, typeChar, &tempDesc) == noErr) {
-    	    long stringLen = AEGetDescDataSize(&tempDesc);
-    	    if (stringLen >= maxLength)
-    	        stringLen = maxLength - 1;
-    		if (AEGetDescData(&tempDesc, aCString, stringLen) == noErr)
-        		aCString[stringLen] = '\0';
-        	else
-    			return errAECoercionFail;
-		} else
-			return errAECoercionFail;
-	}
-	return noErr;
-}
-
-//----------------------------------------------------------------------------------
-//	Converts descriptor dataHandle  to a DescType
-//----------------------------------------------------------------------------------
-
-OSErr DescToDescType(const AEDesc *desc, DescType *descType)
-{
-	if (AEGetDescDataSize(desc) == sizeof(DescType))
-	    return AEGetDescData(desc, descType, sizeof(DescType));
-	else
-		return errAECoercionFail;
-}
-
-//----------------------------------------------------------------------------------
-//	Converts descriptor dataHandle  to a boolean
-//----------------------------------------------------------------------------------
-
-OSErr DescToBoolean(const AEDesc* desc, Boolean* aBoolean)
-{
-    return AECoerceDescData(desc, typeBoolean, aBoolean, sizeof(Boolean));
-}
-
-//----------------------------------------------------------------------------------
-//	Converts descriptor dataHandle  to a Fixed
-//----------------------------------------------------------------------------------
-
-OSErr DescToFixed(const  AEDesc* desc, Fixed* aFixed)
-{
-    return AECoerceDescData(desc, typeFixed, aFixed, sizeof(Fixed));
-}
-
-//----------------------------------------------------------------------------------
-//	Converts descriptor dataHandle  to a float
-//----------------------------------------------------------------------------------
-
-OSErr DescToFloat(const  AEDesc* desc, float* aFloat)
-{
-    return AECoerceDescData(desc, typeFloat, aFloat, sizeof(float));
-}
-
-//----------------------------------------------------------------------------------
-//	Converts descriptor dataHandle  to a long
-//----------------------------------------------------------------------------------
-
-OSErr DescToLong(const AEDesc* desc, long* aLong)
-{
-    return AECoerceDescData(desc, typeLongInteger, aLong, sizeof(long));
-}
-
-//----------------------------------------------------------------------------------
-//	Converts descriptor dataHandle  to a RGBColor 
-//----------------------------------------------------------------------------------
-
-OSErr DescToRGBColor(const  AEDesc* desc, RGBColor* aRGBColor)
-{
-    return AECoerceDescData(desc, typeRGBColor, aRGBColor, sizeof(RGBColor));
-}
-
-//----------------------------------------------------------------------------------
-//	Converts descriptor dataHandle  to a short.
-//----------------------------------------------------------------------------------
-
-OSErr DescToShort(const  AEDesc* desc, short* aShort)
-{
-    return AECoerceDescData(desc, typeShortInteger, aShort, sizeof(short));
-}
-
-//----------------------------------------------------------------------------------
-//	Copies descriptor dataHandle to another handle, if its text
-//----------------------------------------------------------------------------------
-
-OSErr DescToTextHandle(const AEDesc* desc, Handle *text)
-{
-    Handle data = nil;
-    
-	if (desc->descriptorType == typeChar)
-	{
-	    Size dataSize = ::AEGetDescDataSize(desc);
-	    data = ::NewHandle(dataSize);
-	    if (data == NULL)
-	        return memFullErr;
-        ::HLock(data);
-        ::AEGetDescData(desc, *data, dataSize);
-        ::HUnlock(data);
-	}
-	else
-	{
-    	StAEDesc tempDesc;
-		if (::AECoerceDesc(desc, typeChar, &tempDesc) == noErr)
-		    data = tempDesc.GetTextHandle();
-		else
-		    return errAECoercionFail;
-	}
-	*text = data;
-	return noErr;
-}
-
-//----------------------------------------------------------------------------------
-//	Converts descriptor dataHandle  to a Rectangle 
-//----------------------------------------------------------------------------------
-
-OSErr DescToRect(const  AEDesc* desc, Rect* aRect)
-{
-    return AECoerceDescData(desc, typeRectangle, aRect, sizeof(Rect));
-}
-
-//----------------------------------------------------------------------------------
-//	Converts descriptor dataHandle  to a Point 
-//----------------------------------------------------------------------------------
-
-OSErr DescToPoint(const  AEDesc* desc, Point* aPoint)
-{