diff --git a/mozilla/Makefile.in b/mozilla/Makefile.in index 5d8077f2893..51fcb50c298 100644 --- a/mozilla/Makefile.in +++ b/mozilla/Makefile.in @@ -128,6 +128,7 @@ tier_2_dirs += \ modules/libreg \ string \ xpcom \ + xpcom/obsolete \ $(NULL) ifdef NS_TRACE_MALLOC @@ -184,6 +185,7 @@ tier_9_dirs += \ content \ layout \ db \ + xpfe/components/shistory \ docshell \ webshell \ profile \ @@ -206,7 +208,11 @@ ifdef MOZ_JPROF tier_9_dirs += tools/jprof endif -tier_9_dirs += xpfe xpinstall +tier_9_dirs += xpfe + +ifdef MOZ_XPINSTALL +tier_9_dirs += xpinstall +endif ifdef MOZ_LEAKY tier_9_dirs += tools/leaky diff --git a/mozilla/allmakefiles.sh b/mozilla/allmakefiles.sh index 25c19cc9b84..0631dc1a285 100755 --- a/mozilla/allmakefiles.sh +++ b/mozilla/allmakefiles.sh @@ -177,6 +177,7 @@ intl/uconv/ucvtw/Makefile intl/uconv/ucvtw2/Makefile intl/uconv/ucvko/Makefile intl/uconv/ucvibm/Makefile +intl/uconv/native/Makefile intl/locale/Makefile intl/locale/public/Makefile intl/locale/idl/Makefile @@ -337,6 +338,7 @@ MAKEFILES_libreg=" modules/libreg/Makefile modules/libreg/include/Makefile modules/libreg/src/Makefile +modules/libreg/standalone/Makefile " MAKEFILES_libpref=" @@ -585,6 +587,8 @@ xpcom/reflect/xptinfo/Makefile xpcom/reflect/xptinfo/public/Makefile xpcom/reflect/xptinfo/src/Makefile xpcom/reflect/xptinfo/tests/Makefile +xpcom/obsolete/Makefile +xpcom/obsolete/component/Makefile xpcom/proxy/Makefile xpcom/proxy/public/Makefile xpcom/proxy/src/Makefile diff --git a/mozilla/build/mac/build_scripts/MozillaBuildList.pm b/mozilla/build/mac/build_scripts/MozillaBuildList.pm index 0e40b374367..907c9256efa 100644 --- a/mozilla/build/mac/build_scripts/MozillaBuildList.pm +++ b/mozilla/build/mac/build_scripts/MozillaBuildList.pm @@ -851,6 +851,8 @@ sub BuildClientDist() #LIBREG InstallFromManifest(":mozilla:modules:libreg:include:MANIFEST", "$distdirectory:libreg:"); + InstallFromManifest(":mozilla:modules:libreg:xpcom:MANIFEST", "$distdirectory:mozreg:"); + InstallFromManifest(":mozilla:modules:libreg:xpcom:MANIFEST_IDL", "$distdirectory:idl:"); #STRING InstallFromManifest(":mozilla:string:public:MANIFEST", "$distdirectory:string:"); @@ -1427,6 +1429,7 @@ sub BuildIDLProjects() BuildIDLProject(":mozilla:security:manager:boot:macbuild:pipbootIDL.xml", "pipboot"); } + BuildIDLProject(":mozilla:modules:libreg:xpcom:macbuild:mozregIDL.xml", "mozreg"); BuildIDLProject(":mozilla:modules:libpref:macbuild:libprefIDL.xml", "libpref"); BuildIDLProject(":mozilla:modules:libutil:macbuild:libutilIDL.xml", "libutil"); BuildIDLProject(":mozilla:modules:libjar:macbuild:libjarIDL.xml", "libjar"); @@ -1701,6 +1704,7 @@ sub BuildCommonProjects() BuildOneProject(":mozilla:modules:libreg:macbuild:libreg.xml", "libreg$D.shlb", 1, $main::ALIAS_SYM_FILES, 0); BuildOneProject(":mozilla:xpcom:macbuild:xpcomPPC.xml", "xpcom$D.shlb", 1, $main::ALIAS_SYM_FILES, 0); + BuildOneProject(":mozilla:modules:libreg:xpcom:macbuild:mozreg.xml", "mozreg$D.shlb", 1, $main::ALIAS_SYM_FILES, 1); BuildOneProject(":mozilla:js:macbuild:JavaScript.xml", "JavaScript$D.shlb", 1, $main::ALIAS_SYM_FILES, 0); BuildOneProject(":mozilla:js:macbuild:LiveConnect.xml", "LiveConnect$D.$S", 1, $main::ALIAS_SYM_FILES, 0); diff --git a/mozilla/chrome/src/nsChromeRegistry.cpp b/mozilla/chrome/src/nsChromeRegistry.cpp index dfc4f954b11..5f79bff8c92 100644 --- a/mozilla/chrome/src/nsChromeRegistry.cpp +++ b/mozilla/chrome/src/nsChromeRegistry.cpp @@ -44,8 +44,6 @@ #include #include "nsCOMPtr.h" -#include "nsIFileSpec.h" -#include "nsSpecialSystemDirectory.h" #include "nsIChromeRegistry.h" #include "nsChromeRegistry.h" #include "nsChromeUIDataSource.h" diff --git a/mozilla/config/autoconf.mk.in b/mozilla/config/autoconf.mk.in index 39dd3c4b456..118e206e479 100644 --- a/mozilla/config/autoconf.mk.in +++ b/mozilla/config/autoconf.mk.in @@ -87,6 +87,10 @@ ENABLE_TESTS = @ENABLE_TESTS@ IBMBIDI = @IBMBIDI@ SUNCTL = @SUNCTL@ ACCESSIBILITY = @ACCESSIBILITY@ +MOZ_XPINSTALL = @MOZ_XPINSTALL@ +MOZ_JSLOADER = @MOZ_JSLOADER@ +MOZ_USE_NATIVE_UCONV = @MOZ_USE_NATIVE_UCONV@ +MOZ_SINGLE_PROFILE = @MOZ_SINGLE_PROFILE@ MOZ_LDAP_XPCOM = @MOZ_LDAP_XPCOM@ MOZ_LDAP_XPCOM_EXPERIMENTAL = @MOZ_LDAP_XPCOM_EXPERIMENTAL@ XPCOM_USE_LEA = @XPCOM_USE_LEA@ @@ -96,6 +100,9 @@ MOZ_INSTALLER = @MOZ_INSTALLER@ MOZ_NO_ACTIVEX_SUPPORT = @MOZ_NO_ACTIVEX_SUPPORT@ MOZ_ACTIVEX_SCRIPTING_SUPPORT = @MOZ_ACTIVEX_SCRIPTING_SUPPORT@ XPC_IDISPATCH_SUPPORT = @MOZ_ACTIVEX_SCRIPTING_SUPPORT@ +MOZ_JSLOADER = @MOZ_JSLOADER@ +MOZ_XPINSTALL = @MOZ_XPINSTALL@ +MOZ_XPFE_COMPONENTS = @MOZ_XPFE_COMPONENTS@ MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS = @MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS@ MOZ_COMPONENT_NSPR_LIBS=@MOZ_COMPONENT_NSPR_LIBS@ @@ -289,6 +296,7 @@ NSPR_LIBS = @NSPR_LIBS@ LDAP_CFLAGS = @LDAP_CFLAGS@ LDAP_LIBS = @LDAP_LIBS@ XPCOM_GLUE_LIBS = @XPCOM_GLUE_LIBS@ +MOZ_XPCOM_OBSOLETE_LIBS = @MOZ_XPCOM_OBSOLETE_LIBS@ # UNIX98 iconv support diff --git a/mozilla/configure.in b/mozilla/configure.in index 649d4c29488..72c11211dda 100644 --- a/mozilla/configure.in +++ b/mozilla/configure.in @@ -498,6 +498,7 @@ XPCOM_LIBS='-L$(DIST)/bin -lxpcom' MOZ_COMPONENT_NSPR_LIBS='-L$(DIST)/bin $(NSPR_LIBS)' MOZ_COMPONENT_XPCOM_LIBS='$(XPCOM_LIBS)' +MOZ_XPCOM_OBSOLETE_LIBS='-L$(DIST)/lib -lxpcom_compat' _PLATFORM_DEFAULT_TOOLKIT=gtk MOZ_WIDGET_TOOLKIT_LDFLAGS='-lwidget_$(MOZ_WIDGET_TOOLKIT)' @@ -1034,6 +1035,7 @@ case "$target" in XPCOM_LIBS='$(DIST)/lib/xpcom.lib' MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)' MOZ_COMPONENT_XPCOM_LIBS='$(XPCOM_LIBS)' + MOZ_XPCOM_OBSOLETE_LIBS='$(DIST)/lib/xpcom_compat.lib' fi AC_DEFINE(HAVE_SNPRINTF) AC_DEFINE(_WINDOWS) @@ -1259,6 +1261,7 @@ case "$target" in AC_DEFINE(OS2EMX_PLAIN_CHAR) MOZ_COMPONENT_NSPR_LIBS='-L$(DIST)/lib $(NSPR_LIBS)' MOZ_COMPONENT_XPCOM_LIBS='-L$(DIST)/lib $(DIST)/lib/xpcom.lib' + MOZ_XPCOM_OBSOLETE_LIBS='-L$(DIST)/lib $(DIST)/lib/xpcom_compat.lib' XPCOM_LIBS='-L$(DIST)/lib -lxpcom' MOZ_JS_LIBS='$(DIST)/lib/libmozjs.lib' MOZ_COMPONENT_XPCOM_LIBS='$(DIST)/lib/libxpcom.lib' @@ -1305,6 +1308,7 @@ case "$target" in MKCSHLIB='$(LD) $(DSO_LDOPTS)' MOZ_JS_LIBS='$(DIST)/lib/mozjs.lib' MOZ_COMPONENT_XPCOM_LIBS='$(DIST)/lib/xpcom.lib' + MOZ_XPCOM_OBSOLETE_LIBS='$(DIST)/lib/xpcom_compat.lib' XPCOM_LIBS='$(DIST)/lib/xpcom.lib' MOZ_JPEG_LIBS='$(DIST)/lib/mozjpeg.$(LIB_SUFFIX)' MOZ_ZLIB_LIBS='$(DIST)/lib/mozz.$(LIB_SUFFIX)' @@ -3372,6 +3376,57 @@ if test "$ACCESSIBILITY"; then AC_DEFINE(ACCESSIBILITY) fi +dnl ======================================================== +dnl xpfe/components on by default +dnl ======================================================== +MOZ_XPFE_COMPONENTS=1 +MOZ_ARG_DISABLE_BOOL(xpfe-components, +[ --disable-xpfe-components Disable xpfe components], + MOZ_XPFE_COMPONENTS= ) + +dnl ======================================================== +dnl xpinstall support on by default +dnl ======================================================== +MOZ_XPINSTALL=1 +MOZ_ARG_DISABLE_BOOL(xpinstall, +[ --disable-xpinstall Disable xpinstall support], + MOZ_XPINSTALL= ) +if test "$MOZ_XPINSTALL"; then + AC_DEFINE(MOZ_XPINSTALL) +fi + +dnl ======================================================== +dnl Single profile support off by default +dnl ======================================================== +MOZ_SINGLE_PROFILE= +MOZ_ARG_ENABLE_BOOL(single-profile, +[ --enable-single-profile Enable single profile support ], + MOZ_SINGLE_PROFILE=1, + MOZ_SINGLE_PROFILE= ) + +dnl ======================================================== +dnl xpcom js loader support on by default +dnl ======================================================== +MOZ_JSLOADER=1 +MOZ_ARG_DISABLE_BOOL(jsloader, +[ --disable-jsloader Disable xpcom js loader support], + MOZ_JSLOADER= ) +if test "$MOZ_JSLOADER"; then + AC_DEFINE(MOZ_JSLOADER) +fi + +dnl ======================================================== +dnl use native unicode converters +dnl ======================================================== +MOZ_USE_NATIVE_UCONV= +MOZ_ARG_ENABLE_BOOL(native-uconv, +[ --enable-native-uconv enable iconv support], + MOZ_USE_NATIVE_UCONV=1 ) +if test "$MOZ_USE_NATIVE_UCONV"; then + AC_DEFINE(MOZ_USE_NATIVE_UCONV) +fi + + dnl ======================================================== dnl Libeditor can be build as plaintext-only, dnl or as a full html and text editing component. @@ -4590,8 +4645,10 @@ dnl = Cleanup section for misc ordering snafus dnl = if test "$OS_ARCH" = "WINNT" -a -z "$GNU_CC"; then XPCOM_GLUE_LIBS='$(DIST)/lib/$(LIB_PREFIX)xpcomglue.$(LIB_SUFFIX) $(DIST)/lib/$(LIB_PREFIX)string_s.$(LIB_SUFFIX) $(DIST)/lib/$(LIB_PREFIX)string_obsolete_s.$(LIB_SUFFIX)' + MOZ_XPCOM_OBSOLETE_LIBS='$(DIST)/lib/$(LIB_PREFIX)xpcom_compat.$(LIB_SUFFIX)' else XPCOM_GLUE_LIBS='-L${DIST}/bin -L${DIST}/lib -lxpcomglue -lstring_s -lstring_obsolete_s' + MOZ_XPCOM_OBSOLETE_LIBS='-L${DIST}/bin -L${DIST}/lib -lxpcom_compat' fi dnl ======================================================== @@ -4685,6 +4742,8 @@ AC_SUBST(MOZ_LOG_REFCNT) AC_SUBST(MOZ_LEAKY) AC_SUBST(MOZ_JPROF) AC_SUBST(MOZ_XPCTOOLS) +AC_SUBST(MOZ_JSLOADER) +AC_SUBST(MOZ_USE_NATIVE_UCONV) AC_SUBST(MOZ_INSURE) AC_SUBST(MOZ_INSURE_DIRS) AC_SUBST(MOZ_INSURE_EXCLUDE_DIRS) @@ -4714,6 +4773,9 @@ AC_SUBST(ENABLE_TESTS) AC_SUBST(IBMBIDI) AC_SUBST(SUNCTL) AC_SUBST(ACCESSIBILITY) +AC_SUBST(MOZ_XPINSTALL) +AC_SUBST(MOZ_SINGLE_PROFILE) +AC_SUBST(MOZ_XPFE_COMPONENTS) AC_SUBST(MOZ_USER_DIR) AC_SUBST(ENABLE_STRIP) @@ -4722,6 +4784,7 @@ AC_SUBST(USE_PREBINDING) AC_SUBST(MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS) AC_SUBST(MOZ_COMPONENT_NSPR_LIBS) AC_SUBST(MOZ_COMPONENT_XPCOM_LIBS) +AC_SUBST(MOZ_XPCOM_OBSOLETE_LIBS) AC_SUBST(XPCOM_LIBS) AC_SUBST(MOZ_BUILD_ROOT) diff --git a/mozilla/content/html/content/src/nsFormSubmission.cpp b/mozilla/content/html/content/src/nsFormSubmission.cpp index 668613457d2..cd12e19590b 100644 --- a/mozilla/content/html/content/src/nsFormSubmission.cpp +++ b/mozilla/content/html/content/src/nsFormSubmission.cpp @@ -39,15 +39,12 @@ // JBK added for submit move from content frame #include "nsIFile.h" -#include "nsIFileStreams.h" -#include "nsIFileSpec.h" #include "nsDirectoryServiceDefs.h" #include "nsIFormProcessor.h" #include "nsIURI.h" #include "nsNetUtil.h" #include "nsIPrefBranch.h" #include "nsIPrefService.h" -#include "nsSpecialSystemDirectory.h" #include "nsLinebreakConverter.h" #include "nsICharsetConverterManager.h" #include "xp_path.h" diff --git a/mozilla/content/xbl/src/nsXBLWindowHandler.cpp b/mozilla/content/xbl/src/nsXBLWindowHandler.cpp index 139e76b5336..bfd4ff22779 100644 --- a/mozilla/content/xbl/src/nsXBLWindowHandler.cpp +++ b/mozilla/content/xbl/src/nsXBLWindowHandler.cpp @@ -57,6 +57,7 @@ #include "nsIDOMEvent.h" #include "nsIContent.h" #include "nsHTMLAtoms.h" +#include "nsXULAtoms.h" #include "nsINameSpaceManager.h" #include "nsIXBLDocumentInfo.h" #include "nsIDocument.h" diff --git a/mozilla/docshell/base/nsDocShell.cpp b/mozilla/docshell/base/nsDocShell.cpp index 3a58733cdec..26cfd119efe 100644 --- a/mozilla/docshell/base/nsDocShell.cpp +++ b/mozilla/docshell/base/nsDocShell.cpp @@ -59,6 +59,7 @@ #include "nsContentPolicyUtils.h" // NS_CheckContentLoadPolicy(...) #include "nsICategoryManager.h" #include "nsXPCOMCID.h" +#include "nsISeekableStream.h" // we want to explore making the document own the load group // so we can associate the document URI with the load group. @@ -83,7 +84,6 @@ #include "nsIWebProgress.h" #include "nsILayoutHistoryState.h" #include "nsITimer.h" -#include "nsIFileStream.h" #include "nsISHistoryInternal.h" #include "nsIPrincipal.h" #include "nsIHistoryEntry.h" diff --git a/mozilla/docshell/base/nsWebShell.cpp b/mozilla/docshell/base/nsWebShell.cpp index 3206d345c82..dd50f18830d 100644 --- a/mozilla/docshell/base/nsWebShell.cpp +++ b/mozilla/docshell/base/nsWebShell.cpp @@ -113,11 +113,11 @@ typedef unsigned long HMTX; #include "nsIController.h" #include "nsIFocusController.h" #include "nsGUIEvent.h" -#include "nsIFileStream.h" #include "nsISHistoryInternal.h" #include "nsIHttpChannel.h" #include "nsIUploadChannel.h" +#include "nsISeekableStream.h" #include "nsILocaleService.h" #include "nsIStringBundle.h" diff --git a/mozilla/docshell/build/Makefile.in b/mozilla/docshell/build/Makefile.in index 0ed9e871c0d..4d98f013197 100644 --- a/mozilla/docshell/build/Makefile.in +++ b/mozilla/docshell/build/Makefile.in @@ -40,7 +40,6 @@ REQUIRES = xpcom \ necko \ gfx \ layout \ - uriloader \ webshell \ widget \ pref \ @@ -54,6 +53,15 @@ REQUIRES = xpcom \ commandhandler \ $(NULL) +REQUIRES += \ + uriloader \ + exthandler \ + helperAppDlg \ + mimetype \ + rdf \ + prefetch \ + $(NULL) + ifeq ($(OS_ARCH),WINNT) EXTRA_DSO_LIBS = gkgfx endif @@ -70,12 +78,17 @@ CPPSRCS = \ SHARED_LIBRARY_LIBS= \ $(DIST)/lib/$(LIB_PREFIX)basedocshell_s.$(LIB_SUFFIX) \ + $(DIST)/lib/$(LIB_PREFIX)uriloaderbase_s.$(LIB_SUFFIX) \ + $(DIST)/lib/$(LIB_PREFIX)exthandler_s.$(LIB_SUFFIX) \ + $(DIST)/lib/$(LIB_PREFIX)prefetch_s.$(LIB_SUFFIX) \ + $(DIST)/lib/$(LIB_PREFIX)shistory_s.$(LIB_SUFFIX) \ $(NULL) EXTRA_DSO_LDOPTS= \ $(LIBS_DIR) \ $(EXTRA_DSO_LIBS) \ $(MOZ_JS_LIBS) \ + $(MOZ_UNICHARUTIL_LIBS) \ $(MOZ_COMPONENT_LIBS) \ $(NULL) @@ -84,5 +97,20 @@ include $(topsrcdir)/config/rules.mk LOCAL_INCLUDES = \ -I$(srcdir) \ -I$(srcdir)/../base \ + -I$(topsrcdir)/uriloader/base \ + -I$(topsrcdir)/uriloader/prefetch \ + -I$(topsrcdir)/uriloader/exthandler \ + -I$(topsrcdir)/xpfe/components/shistory/src \ $(NULL) +ifneq (,$(filter mac cocoa,$(MOZ_WIDGET_TOOLKIT))) +LOCAL_INCLUDES += -I$(topsrcdir)/uriloader/exthandler/mac +EXTRA_DSO_LDOPTS += \ + $(TK_LIBS) \ + $(NULL) +endif + +ifeq ($(OS_ARCH),WINNT) +OS_LIBS += shell32.lib +endif + diff --git a/mozilla/docshell/build/nsDocShellModule.cpp b/mozilla/docshell/build/nsDocShellModule.cpp index 804b0ef2823..566c6bc1958 100644 --- a/mozilla/docshell/build/nsDocShellModule.cpp +++ b/mozilla/docshell/build/nsDocShellModule.cpp @@ -25,9 +25,39 @@ #include "nsWebShell.h" #include "nsDefaultURIFixup.h" +// uriloader +#include "nsURILoader.h" +#include "nsDocLoader.h" +#include "nsOSHelperAppService.h" +#include "nsExternalProtocolHandler.h" +#include "nsPrefetchService.h" + +// session history +#include "nsSHEntry.h" +#include "nsSHistory.h" +#include "nsSHTransaction.h" + +// docshell NS_GENERIC_FACTORY_CONSTRUCTOR(nsWebShell); NS_GENERIC_FACTORY_CONSTRUCTOR(nsDefaultURIFixup); +// uriloader +NS_GENERIC_FACTORY_CONSTRUCTOR(nsURILoader) +NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsDocLoaderImpl, Init) +NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsOSHelperAppService, Init) +NS_GENERIC_FACTORY_CONSTRUCTOR(nsExternalProtocolHandler) +NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsPrefetchService, Init) + +#if defined(XP_MAC) || defined(XP_MACOSX) +#include "nsInternetConfigService.h" +NS_GENERIC_FACTORY_CONSTRUCTOR(nsInternetConfigService); +#endif + +// session history +NS_GENERIC_FACTORY_CONSTRUCTOR(nsSHEntry) +NS_GENERIC_FACTORY_CONSTRUCTOR(nsSHTransaction) +NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsSHistory, Init) + // Currently no-one is instantiating docshell's directly because // nsWebShell is still our main "shell" class. nsWebShell is a subclass // of nsDocShell. Once migration is complete, docshells will be the main @@ -36,6 +66,7 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(nsDefaultURIFixup); //NS_GENERIC_FACTORY_CONSTRUCTOR(nsDocShell); static const nsModuleComponentInfo gDocShellModuleInfo[] = { + // docshell { "WebShell", NS_WEB_SHELL_CID, "@mozilla.org/webshell;1", @@ -45,7 +76,39 @@ static const nsModuleComponentInfo gDocShellModuleInfo[] = { NS_DEFAULTURIFIXUP_CID, NS_URIFIXUP_CONTRACTID, nsDefaultURIFixupConstructor - } + }, + + // uriloader + { "Netscape URI Loader Service", NS_URI_LOADER_CID, NS_URI_LOADER_CONTRACTID, nsURILoaderConstructor, }, + { "Netscape Doc Loader", NS_DOCUMENTLOADER_CID, NS_DOCUMENTLOADER_CONTRACTID, nsDocLoaderImplConstructor, }, + { "Netscape Doc Loader Service", NS_DOCUMENTLOADER_SERVICE_CID, NS_DOCUMENTLOADER_SERVICE_CONTRACTID, + nsDocLoaderImplConstructor, }, + { "Netscape External Helper App Service", NS_EXTERNALHELPERAPPSERVICE_CID, NS_EXTERNALHELPERAPPSERVICE_CONTRACTID, + nsOSHelperAppServiceConstructor, }, + { "Netscape External Helper App Service", NS_EXTERNALHELPERAPPSERVICE_CID, NS_EXTERNALPROTOCOLSERVICE_CONTRACTID, + nsOSHelperAppServiceConstructor, }, + { "Netscape Mime Mapping Service", NS_EXTERNALHELPERAPPSERVICE_CID, NS_MIMESERVICE_CONTRACTID, + nsOSHelperAppServiceConstructor, }, + { "Netscape Default Protocol Handler", NS_EXTERNALPROTOCOLHANDLER_CID, NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX"default", + nsExternalProtocolHandlerConstructor, }, + { NS_PREFETCHSERVICE_CLASSNAME, NS_PREFETCHSERVICE_CID, NS_PREFETCHSERVICE_CONTRACTID, + nsPrefetchServiceConstructor, }, +#if defined(XP_MAC) || defined(XP_MACOSX) + { "Internet Config Service", NS_INTERNETCONFIGSERVICE_CID, NS_INTERNETCONFIGSERVICE_CONTRACTID, + nsInternetConfigServiceConstructor, }, +#endif + + // session history + { "nsSHEntry", NS_SHENTRY_CID, + NS_SHENTRY_CONTRACTID, nsSHEntryConstructor }, + { "nsSHEntry", NS_HISTORYENTRY_CID, + NS_HISTORYENTRY_CONTRACTID, nsSHEntryConstructor }, + { "nsSHTransaction", NS_SHTRANSACTION_CID, + NS_SHTRANSACTION_CONTRACTID, nsSHTransactionConstructor }, + { "nsSHistory", NS_SHISTORY_CID, + NS_SHISTORY_CONTRACTID, nsSHistoryConstructor }, + { "nsSHistory", NS_SHISTORY_INTERNAL_CID, + NS_SHISTORY_INTERNAL_CONTRACTID, nsSHistoryConstructor } }; // "docshell provider" to illustrate that this thing really *should* diff --git a/mozilla/dom/src/base/nsHistory.cpp b/mozilla/dom/src/base/nsHistory.cpp index ae795b7ab69..431eff29887 100644 --- a/mozilla/dom/src/base/nsHistory.cpp +++ b/mozilla/dom/src/base/nsHistory.cpp @@ -52,7 +52,6 @@ #include "nsXPIDLString.h" #include "nsReadableUtils.h" #include "nsDOMClassInfo.h" - // // History class implementation // diff --git a/mozilla/dom/src/build/Makefile.in b/mozilla/dom/src/build/Makefile.in index e5fd76f92aa..c6be14638b4 100644 --- a/mozilla/dom/src/build/Makefile.in +++ b/mozilla/dom/src/build/Makefile.in @@ -44,8 +44,11 @@ REQUIRES = xpcom \ sidebar \ plugin \ necko \ + jsurl \ + uconv \ $(NULL) -IS_COMPONENT = 1 + +IS_COMPONENT=1 MODULE_NAME = DOM_components ifeq ($(OS_ARCH),WINNT) @@ -64,6 +67,7 @@ CPPSRCS = \ SHARED_LIBRARY_LIBS = \ $(DIST)/lib/$(LIB_PREFIX)jsdombase_s.$(LIB_SUFFIX) \ $(DIST)/lib/$(LIB_PREFIX)jsdomevents_s.$(LIB_SUFFIX) \ + $(DIST)/lib/$(LIB_PREFIX)jsurl_s.$(LIB_SUFFIX) \ $(NULL) EXTRA_DSO_LDOPTS = \ diff --git a/mozilla/dom/src/build/nsDOMFactory.cpp b/mozilla/dom/src/build/nsDOMFactory.cpp index 82bd3704636..12fe60bf714 100644 --- a/mozilla/dom/src/build/nsDOMFactory.cpp +++ b/mozilla/dom/src/build/nsDOMFactory.cpp @@ -52,6 +52,8 @@ #include "nsScriptNameSpaceManager.h" #include "nsDOMException.h" +#include "nsJSProtocolHandler.h" + extern nsresult NS_CreateScriptContext(nsIScriptGlobalObject *aGlobal, nsIScriptContext **aContext); @@ -289,7 +291,11 @@ static const nsModuleComponentInfo gDOMModuleInfo[] = { NS_BASE_DOM_EXCEPTION_CID, nsnull, nsBaseDOMExceptionConstructor - } + }, + { "JavaScript Protocol Handler", + NS_JSPROTOCOLHANDLER_CID, + NS_JSPROTOCOLHANDLER_CONTRACTID, + nsJSProtocolHandler::Create }, }; void PR_CALLBACK diff --git a/mozilla/dom/src/jsurl/Makefile.in b/mozilla/dom/src/jsurl/Makefile.in index 7a9330bbd31..e1fde78157b 100644 --- a/mozilla/dom/src/jsurl/Makefile.in +++ b/mozilla/dom/src/jsurl/Makefile.in @@ -27,9 +27,9 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk MODULE = jsurl -LIBRARY_NAME = jsurl +LIBRARY_NAME = jsurl_s EXPORT_LIBRARY = 1 -IS_COMPONENT = 1 +FORCE_STATIC_LIB = 1 MODULE_NAME = javascript__protocol GRE_MODULE = 1 diff --git a/mozilla/dom/src/jsurl/nsJSProtocolHandler.cpp b/mozilla/dom/src/jsurl/nsJSProtocolHandler.cpp index a9db5b93537..a3fbd8a8a84 100644 --- a/mozilla/dom/src/jsurl/nsJSProtocolHandler.cpp +++ b/mozilla/dom/src/jsurl/nsJSProtocolHandler.cpp @@ -780,16 +780,3 @@ nsJSProtocolHandler::AllowPort(PRInt32 port, const char *scheme, PRBool *_retval return NS_OK; } - -//////////////////////////////////////////////////////////////////////////////// - -static const nsModuleComponentInfo gJSModuleInfo[] = { - { "JavaScript Protocol Handler", - NS_JSPROTOCOLHANDLER_CID, - NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "javascript", - nsJSProtocolHandler::Create } -}; - -NS_IMPL_NSGETMODULE(javascript__protocol, gJSModuleInfo) - -//////////////////////////////////////////////////////////////////////////////// diff --git a/mozilla/dom/src/jsurl/nsJSProtocolHandler.h b/mozilla/dom/src/jsurl/nsJSProtocolHandler.h index 3535c31ff2a..08410ac9142 100644 --- a/mozilla/dom/src/jsurl/nsJSProtocolHandler.h +++ b/mozilla/dom/src/jsurl/nsJSProtocolHandler.h @@ -50,6 +50,10 @@ {0x8c, 0xd3, 0x00, 0x60, 0xb0, 0xfc, 0x14, 0xa3} \ } +#define NS_JSPROTOCOLHANDLER_CONTRACTID \ + NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "javascript" + + class nsJSProtocolHandler : public nsIProtocolHandler { public: diff --git a/mozilla/editor/composer/src/nsEditorService.cpp b/mozilla/editor/composer/src/nsEditorService.cpp index 7f70963d2a1..3a5f9c39b6d 100644 --- a/mozilla/editor/composer/src/nsEditorService.cpp +++ b/mozilla/editor/composer/src/nsEditorService.cpp @@ -38,6 +38,8 @@ * ***** END LICENSE BLOCK ***** */ #include "nsEditorService.h" +#include "nsString.h" +#include "plstr.h" nsEditorService::nsEditorService() { diff --git a/mozilla/editor/libeditor/html/nsHTMLDataTransfer.cpp b/mozilla/editor/libeditor/html/nsHTMLDataTransfer.cpp index c80bc7725c0..5fb86af1a20 100644 --- a/mozilla/editor/libeditor/html/nsHTMLDataTransfer.cpp +++ b/mozilla/editor/libeditor/html/nsHTMLDataTransfer.cpp @@ -84,7 +84,6 @@ #include "nsISupportsArray.h" #include "nsCOMArray.h" #include "nsVoidArray.h" -#include "nsFileSpec.h" #include "nsIFile.h" #include "nsIURL.h" #include "nsIComponentManager.h" @@ -805,7 +804,7 @@ FindPositiveIntegerAfterString(const char *aLeadingString, nsCString &aCStr) PRInt32 numFront = aCStr.Find(aLeadingString); if (numFront == -1) return -1; - numFront += nsCRT::strlen(aLeadingString); + numFront += strlen(aLeadingString); PRInt32 numBack = aCStr.FindCharInSet(CRLF, numFront); if (numBack == -1) diff --git a/mozilla/editor/libeditor/html/nsHTMLEditor.cpp b/mozilla/editor/libeditor/html/nsHTMLEditor.cpp index 51093efd720..401fa756a78 100644 --- a/mozilla/editor/libeditor/html/nsHTMLEditor.cpp +++ b/mozilla/editor/libeditor/html/nsHTMLEditor.cpp @@ -38,6 +38,7 @@ * * ***** END LICENSE BLOCK ***** */ #include "nsICaret.h" +#include "nsCRT.h" #include "nsReadableUtils.h" #include "nsUnicharUtils.h" @@ -95,7 +96,6 @@ #include "nsIDOMNSRange.h" #include "nsISupportsArray.h" #include "nsVoidArray.h" -#include "nsFileSpec.h" #include "nsIURL.h" #include "nsIComponentManager.h" #include "nsIServiceManager.h" diff --git a/mozilla/editor/libeditor/text/nsPlaintextDataTransfer.cpp b/mozilla/editor/libeditor/text/nsPlaintextDataTransfer.cpp index 29fa8aff5a5..44bba6aa34b 100644 --- a/mozilla/editor/libeditor/text/nsPlaintextDataTransfer.cpp +++ b/mozilla/editor/libeditor/text/nsPlaintextDataTransfer.cpp @@ -77,7 +77,6 @@ #include "nsIDOMNSRange.h" #include "nsISupportsArray.h" #include "nsVoidArray.h" -#include "nsFileSpec.h" #include "nsIURL.h" #include "nsIComponentManager.h" #include "nsIServiceManager.h" diff --git a/mozilla/editor/libeditor/text/nsPlaintextEditor.cpp b/mozilla/editor/libeditor/text/nsPlaintextEditor.cpp index 95a999745b1..729bff6ebfd 100644 --- a/mozilla/editor/libeditor/text/nsPlaintextEditor.cpp +++ b/mozilla/editor/libeditor/text/nsPlaintextEditor.cpp @@ -62,6 +62,7 @@ #include "nsISelectionController.h" #include "nsGUIEvent.h" #include "nsIDOMEventGroup.h" +#include "nsCRT.h" #include "nsIIndependentSelection.h" //domselections answer to frameselection @@ -77,7 +78,6 @@ #include "nsIDOMNSRange.h" #include "nsISupportsArray.h" #include "nsVoidArray.h" -#include "nsFileSpec.h" #include "nsIURL.h" #include "nsIComponentManager.h" #include "nsIServiceManager.h" diff --git a/mozilla/editor/txmgr/src/nsTransactionStack.cpp b/mozilla/editor/txmgr/src/nsTransactionStack.cpp index f4cc633b209..db7d29da0b2 100644 --- a/mozilla/editor/txmgr/src/nsTransactionStack.cpp +++ b/mozilla/editor/txmgr/src/nsTransactionStack.cpp @@ -106,7 +106,7 @@ nsTransactionStack::Peek(nsTransactionItem **aTransaction) return NS_OK; } - *aTransaction = (nsTransactionItem *)(mQue.End().GetCurrent()); + *aTransaction = (nsTransactionItem *)(mQue.Last()); return NS_OK; } diff --git a/mozilla/embedding/browser/gtk/tests/Makefile.in b/mozilla/embedding/browser/gtk/tests/Makefile.in index 84072e0b75a..97cbeb1e48f 100644 --- a/mozilla/embedding/browser/gtk/tests/Makefile.in +++ b/mozilla/embedding/browser/gtk/tests/Makefile.in @@ -35,19 +35,24 @@ ifdef NS_TRACE_MALLOC REQUIRES += tracemalloc endif -CPPSRCS = \ - TestGtkEmbed.cpp \ +CPPSRCS = TestGtkEmbed.cpp + +ifdef ENABLE_TESTS +CPPSRCS += \ TestGtkEmbedNotebook.cpp \ TestGtkEmbedSocket.cpp \ TestGtkEmbedChild.cpp +endif SIMPLE_PROGRAMS = $(CPPSRCS:.cpp=) # ENABLE_GNOME=1 ifdef ENABLE_GNOME +ifdef ENABLE_TESTS CPPSRCS += TestGtkEmbedMDI.cpp endif +endif ifdef MOZ_ENABLE_GTK LIBS += \ @@ -85,6 +90,9 @@ ifdef NS_TRACE_MALLOC EXTRA_LIBS += -ltracemalloc endif +ifdef MOZ_PERF_METRICS +EXTRA_LIBS += -lmozutil_s +endif EXTRA_LIBS += $(MOZ_JS_LIBS) EXTRA_LIBS += $(MOZ_COMPONENT_LIBS) diff --git a/mozilla/embedding/components/printingui/src/win/nsPrintDialogUtil.cpp b/mozilla/embedding/components/printingui/src/win/nsPrintDialogUtil.cpp index c1208917498..56dd5d6dc2a 100644 --- a/mozilla/embedding/components/printingui/src/win/nsPrintDialogUtil.cpp +++ b/mozilla/embedding/components/printingui/src/win/nsPrintDialogUtil.cpp @@ -886,7 +886,7 @@ ShowNativePrintDialog(HWND aHWnd, char* dbStr = GetACPString(nsString(printerName)); NS_ENSURE_TRUE(dbStr, NS_ERROR_FAILURE); - PRUint32 len = nsCRT::strlen(dbStr); + PRUint32 len = strlen(dbStr); hDevNames = (HGLOBAL)::GlobalAlloc(GHND, len+sizeof(DEVNAMES)+1); DEVNAMES* pDevNames = (DEVNAMES*)::GlobalLock(hDevNames); pDevNames->wDriverOffset = sizeof(DEVNAMES); diff --git a/mozilla/embedding/components/webbrowserpersist/src/nsWebBrowserPersist.cpp b/mozilla/embedding/components/webbrowserpersist/src/nsWebBrowserPersist.cpp index 7dc7137b744..d4940638a94 100644 --- a/mozilla/embedding/components/webbrowserpersist/src/nsWebBrowserPersist.cpp +++ b/mozilla/embedding/components/webbrowserpersist/src/nsWebBrowserPersist.cpp @@ -23,10 +23,6 @@ #include "nspr.h" -#define NO_XPCOM_FILE_STREAMS -#include "nsIFileStream.h" // Old XPCOM file streams -#undef NO_XPCOM_FILE_STREAMS - #include "nsIFileStreams.h" // New Necko file streams #ifdef XP_MAC @@ -36,6 +32,7 @@ #include "nsNetUtil.h" #include "nsComponentManagerUtils.h" #include "nsIStorageStream.h" +#include "nsISeekableStream.h" #include "nsIHttpChannel.h" #include "nsIEncodedChannel.h" #include "nsIUploadChannel.h" diff --git a/mozilla/embedding/config/Makefile.in b/mozilla/embedding/config/Makefile.in index e305904c4c5..6c8a57c4c17 100644 --- a/mozilla/embedding/config/Makefile.in +++ b/mozilla/embedding/config/Makefile.in @@ -67,6 +67,9 @@ else endif embed_copy:: + -mkdir $(DIST)/Embed/defaults/ + -mkdir $(DIST)/Embed/defaults/pref + -cp $(srcdir)/all.js $(DIST)/Embed/defaults/pref $(PERL) $(topsrcdir)/xpinstall/packager/pkgcp.pl -s $(DIST)/bin -d $(DIST) --f $(srcdir)/$(BASEBROWSER) -o $(_PLATFORM) -v ifeq ($(OS_ARCH),WINNT) $(PERL) $(topsrcdir)/xpinstall/packager/pkgcp.pl -s $(DIST)/bin -d $(DIST) --f $(srcdir)/$(BASEBROWSER_SUPP) -o $(_PLATFORM) -v diff --git a/mozilla/embedding/config/basebrowser-installer-win.pkg b/mozilla/embedding/config/basebrowser-installer-win.pkg index c92dde707f4..f7d278a5120 100644 --- a/mozilla/embedding/config/basebrowser-installer-win.pkg +++ b/mozilla/embedding/config/basebrowser-installer-win.pkg @@ -48,8 +48,6 @@ plugins\npmozax.dll components\xpcom_base.xpt components\xpcom_components.xpt components\xpcom_ds.xpt -components\xpcom_eventloop_windows.xpt -components\xpcom_eventloop_xp.xpt components\xpcom_io.xpt components\xpcom_nativeapp.xpt components\xpcom_thread.xpt @@ -67,7 +65,6 @@ components\gkgfxwin.dll components\gkwidget.dll components\widget.xpt components\gfx.xpt -components\gkview.dll ; layout moz_art_lgpl.dll @@ -107,7 +104,6 @@ components\appshell.dll components\appshell.xpt components\docshell.dll components\docshell_base.xpt -components\urildr.dll components\uriloader.xpt components\chrome.dll components\chrome.xpt @@ -130,7 +126,6 @@ components\profile.dll components\profile.xpt ; session history -components\shistory.dll components\shistory.xpt ; optional typeaheadfind @@ -166,7 +161,6 @@ components\dom_xbl.xpt components\dom_xul.xpt ; "javascript:" URLs -components\jsurl.dll components\jsurl.xpt ; editor diff --git a/mozilla/embedding/config/basebrowser-mac-cfm b/mozilla/embedding/config/basebrowser-mac-cfm index 425fd9e8cc5..bc07453cc10 100644 --- a/mozilla/embedding/config/basebrowser-mac-cfm +++ b/mozilla/embedding/config/basebrowser-mac-cfm @@ -104,7 +104,6 @@ Essential Files:gfx.shlb Components:gfxComponent.shlb ; javascript -Components:JSUrl.shlb Components:jsurl.xpt ; layout @@ -112,7 +111,6 @@ res:dtd:xhtml11.dtd Components:layout.shlb Components:htmlparser.shlb Components:htmlparser.xpt -Components:view.shlb Components:content.xpt Components:layout.xpt @@ -146,6 +144,8 @@ Components:oji.xpt ; profile Components:profile.shlb Components:profileservices.xpt +Components:mozreg.shlb +Components:mozreg.xpt ; wallet ; Optional - only if you need password persistence @@ -185,7 +185,6 @@ Components:RDFLibrary.shlb Components:rdf.xpt ; session history -Components:shistory.shlb Components:shistory.xpt ; optional typeaheadfind @@ -222,7 +221,6 @@ defaults:Profile:mimeTypes.rdf defaults:Profile:US:mimeTypes.rdf ; uriloader -Components:uriLoader.shlb Components:uriLoader.xpt ; widget diff --git a/mozilla/embedding/config/basebrowser-mac-cfmDebug b/mozilla/embedding/config/basebrowser-mac-cfmDebug index 9d8c3644a63..66f8eaeadcb 100644 --- a/mozilla/embedding/config/basebrowser-mac-cfmDebug +++ b/mozilla/embedding/config/basebrowser-mac-cfmDebug @@ -104,7 +104,6 @@ Essential Files:gfxDebug.shlb Components:gfxComponentDebug.shlb ; javascript -Components:JSUrlDebug.shlb Components:jsurl.xpt ; layout @@ -112,7 +111,6 @@ res:dtd:xhtml11.dtd Components:layoutDebug.shlb Components:htmlparserDebug.shlb Components:htmlparser.xpt -Components:viewDebug.shlb Components:content.xpt Components:layout.xpt @@ -147,6 +145,8 @@ Components:oji.xpt ; profile Components:profileDebug.shlb Components:profileservices.xpt +Components:mozregDebug.shlb +Components:mozreg.xpt ; wallet ; Optional - only if you need password persistence @@ -186,7 +186,6 @@ Components:RDFLibraryDebug.shlb Components:rdf.xpt ; session history -Components:shistoryDebug.shlb Components:shistory.xpt ; optional typeaheadfind @@ -223,7 +222,6 @@ defaults:Profile:mimeTypes.rdf defaults:Profile:US:mimeTypes.rdf ; uriloader -Components:uriLoaderDebug.shlb Components:uriLoader.xpt ; widget diff --git a/mozilla/embedding/config/basebrowser-mac-macho b/mozilla/embedding/config/basebrowser-mac-macho index 8ecb10e1bc0..1a138fb7481 100644 --- a/mozilla/embedding/config/basebrowser-mac-macho +++ b/mozilla/embedding/config/basebrowser-mac-macho @@ -99,15 +99,12 @@ components/libjar50.dylib components/jar.xpt ; javascript -components/libjsurl.dylib components/jsurl.xpt ; layout res/dtd/xhtml11.dtd components/libgklayout.dylib components/libhtmlpars.dylib -components/libgkview.dylib -components/layout_base.xpt components/layout_xul.xpt components/content_base.xpt @@ -138,6 +135,8 @@ components/libpref.dylib ; profile components/libprofile.dylib components/profile.xpt +components/mozreg.dylib +components/mozreg.xpt ; wallet ; Optional - only if you need password persistence @@ -171,7 +170,6 @@ components/librdf.dylib components/rdf.xpt ; session history -components/libshistory.dylib components/shistory.xpt ; optional typeaheadfind @@ -199,7 +197,6 @@ defaults/pref/all.js defaults/pref/macprefs.js ; uriloader -components/liburiloader.dylib components/uriloader.xpt ; widget diff --git a/mozilla/embedding/config/basebrowser-unix b/mozilla/embedding/config/basebrowser-unix index 6232c732fec..591ffe9674a 100644 --- a/mozilla/embedding/config/basebrowser-unix +++ b/mozilla/embedding/config/basebrowser-unix @@ -52,6 +52,7 @@ components/libgfxps.so components/libgfxxprint.so components/gfx.xpt components/libwidget_gtk.so +components/libwidget_gtk2.so components/widget.xpt ; layout @@ -59,7 +60,6 @@ libmoz_art_lgpl.so res/dtd/xhtml11.dtd components/libgklayout.so components/libhtmlpars.so -components/libgkview.so components/layout_base.xpt components/layout_xul.xpt components/content_base.xpt @@ -91,7 +91,6 @@ components/libcookie.so ; appshell, docshell, uriloader, chrome, components components/libdocshell.so components/docshell.xpt -components/liburiloader.so components/uriloader.xpt components/libchrome.so components/chrome.xpt @@ -113,7 +112,6 @@ components/libprofile.so components/profile.xpt ; session history -components/libshistory.so components/shistory.xpt ; optional typeaheadfind @@ -152,7 +150,6 @@ components/dom_xbl.xpt components/dom_xul.xpt ; "javascript:" URLs -components/libjsurl.so components/jsurl.xpt ; editor @@ -224,7 +221,7 @@ res/unixcharset.properties ; res/strres.properties ; required prefs files -defaults/pref/all.js +;defaults/pref/all.js defaults/pref/unix.js diff --git a/mozilla/embedding/config/basebrowser-win b/mozilla/embedding/config/basebrowser-win index 7cd9339b383..64a3353772b 100644 --- a/mozilla/embedding/config/basebrowser-win +++ b/mozilla/embedding/config/basebrowser-win @@ -48,8 +48,6 @@ xpcom.dll components\xpcom_base.xpt components\xpcom_components.xpt components\xpcom_ds.xpt -components\xpcom_eventloop_windows.xpt -components\xpcom_eventloop_xp.xpt components\xpcom_io.xpt components\xpcom_nativeapp.xpt components\xpcom_thread.xpt @@ -69,7 +67,6 @@ components\gkgfxwin.dll components\gkwidget.dll components\widget.xpt components\gfx.xpt -components\gkview.dll ; layout moz_art_lgpl.dll @@ -107,7 +104,6 @@ components\appshell.dll components\appshell.xpt components\docshell.dll components\docshell_base.xpt -components\urildr.dll components\uriloader.xpt components\chrome.dll components\chrome.xpt @@ -129,7 +125,6 @@ components\profile.dll components\profile.xpt ; session history -components\shistory.dll components\shistory.xpt ; optional typeaheadfind @@ -165,7 +160,6 @@ components\dom_xbl.xpt components\dom_xul.xpt ; "javascript:" URLs -components\jsurl.dll components\jsurl.xpt ; editor diff --git a/mozilla/embedding/qa/testembed/Makefile.in b/mozilla/embedding/qa/testembed/Makefile.in index 05e896fedc9..e544bcf7106 100644 --- a/mozilla/embedding/qa/testembed/Makefile.in +++ b/mozilla/embedding/qa/testembed/Makefile.in @@ -41,6 +41,7 @@ RESFILE = testembed.res MODULE = testEmbed REQUIRES = \ + xpcom_obsolete \ xpcom \ string \ necko \ diff --git a/mozilla/embedding/tests/mfcembed/Makefile.in b/mozilla/embedding/tests/mfcembed/Makefile.in index edc067d9681..aefae8cd15e 100644 --- a/mozilla/embedding/tests/mfcembed/Makefile.in +++ b/mozilla/embedding/tests/mfcembed/Makefile.in @@ -39,6 +39,7 @@ RESFILE = MfcEmbed.res MODULE = mfcEmbed REQUIRES = \ + xpcom_obsolete \ xpcom \ string \ necko \ diff --git a/mozilla/extensions/access-builtin/accessproxy/Makefile.in b/mozilla/extensions/access-builtin/accessproxy/Makefile.in index b05ac105e5f..ceec502a8b7 100644 --- a/mozilla/extensions/access-builtin/accessproxy/Makefile.in +++ b/mozilla/extensions/access-builtin/accessproxy/Makefile.in @@ -38,7 +38,8 @@ LIBRARY_NAME = accessproxy ifneq ($(OS_ARCH),WINNT) SHORT_LIBNAME = accproxy endif -REQUIRES = xpcom \ +REQUIRES = xpcom_obsolete \ + xpcom \ string \ docshell \ dom \ diff --git a/mozilla/extensions/cookie/nsCookies.cpp b/mozilla/extensions/cookie/nsCookies.cpp index facaad56b86..e29c05605ec 100644 --- a/mozilla/extensions/cookie/nsCookies.cpp +++ b/mozilla/extensions/cookie/nsCookies.cpp @@ -41,7 +41,6 @@ #include "nsCookies.h" #include "nsPermissions.h" #include "nsUtils.h" -#include "nsIFileSpec.h" #include "nsVoidArray.h" #include "prprf.h" #include "prmem.h" @@ -56,6 +55,9 @@ #include "nsComObsolete.h" #include +#include "nsCRT.h" +#include "nsNetUtil.h" + // we want to explore making the document own the load group // so we can associate the document URI with the load group. // until this point, we have an evil hack: @@ -104,7 +106,7 @@ PRLogModuleInfo* gCookieLog = nsnull; #define MAX_EXPIRE 0 #endif -static const char *kCookiesFileName = "cookies.txt"; +static const char kCookiesFileName[] = "cookies.txt"; MODULE_PRIVATE nsresult cookie_ParseDate(const nsAFlatCString &date_string, time_t & date); @@ -290,7 +292,7 @@ COOKIE_DeletePersistentUserData(void) nsCOMPtr cookiesFile; res = NS_GetSpecialDirectory(NS_APP_USER_PROFILE_50_DIR, getter_AddRefs(cookiesFile)); if (NS_SUCCEEDED(res)) { - res = cookiesFile->AppendNative(nsDependentCString(kCookiesFileName)); + res = cookiesFile->AppendNative(NS_LITERAL_CSTRING(kCookiesFileName)); if (NS_SUCCEEDED(res)) (void) cookiesFile->Remove(PR_FALSE); } @@ -1707,30 +1709,31 @@ COOKIE_Write() { cookie_CookieStruct * cookie_s; time_t cur_date = get_current_time(); char date_string[36]; - nsFileSpec dirSpec; + + nsCOMPtr dirSpec; + nsresult rv; - rv = CKutil_ProfileDirectory(dirSpec); + rv = CKutil_ProfileDirectory(getter_AddRefs(dirSpec)); if (NS_FAILED(rv)) { return rv; } - dirSpec += kCookiesFileName; - PRBool ignored; - dirSpec.ResolveSymlink(ignored); - nsOutputFileStream strm(dirSpec); - if (!strm.is_open()) { - /* file doesn't exist -- that's not an error */ - return NS_OK; - } + + dirSpec->AppendNative(NS_LITERAL_CSTRING(kCookiesFileName)); + + nsCOMPtr strm; + NS_NewLocalFileOutputStream(getter_AddRefs(strm), + dirSpec); #define COOKIEFILE_LINE1 "# HTTP Cookie File\n" #define COOKIEFILE_LINE2 "# http://www.netscape.com/newsref/std/cookie_spec.html\n" #define COOKIEFILE_LINE3 "# This is a generated file! Do not edit.\n" #define COOKIEFILE_LINE4 "# To delete cookies, use the Cookie Manager.\n\n" - strm.write(COOKIEFILE_LINE1, PL_strlen(COOKIEFILE_LINE1)); - strm.write(COOKIEFILE_LINE2, PL_strlen(COOKIEFILE_LINE2)); - strm.write(COOKIEFILE_LINE3, PL_strlen(COOKIEFILE_LINE3)); - strm.write(COOKIEFILE_LINE4, PL_strlen(COOKIEFILE_LINE4)); + PRUint32 ignore; + strm->Write(COOKIEFILE_LINE1, sizeof(COOKIEFILE_LINE1)-1, &ignore); + strm->Write(COOKIEFILE_LINE2, sizeof(COOKIEFILE_LINE2)-1, &ignore); + strm->Write(COOKIEFILE_LINE3, sizeof(COOKIEFILE_LINE3)-1, &ignore); + strm->Write(COOKIEFILE_LINE4, sizeof(COOKIEFILE_LINE4)-1, &ignore); /* format shall be: * @@ -1750,36 +1753,33 @@ COOKIE_Write() { continue; } - strm.write(cookie_s->host.get(), cookie_s->host.Length()); + strm->Write(cookie_s->host.get(), cookie_s->host.Length(), &ignore); if (cookie_s->isDomain) { - strm.write("\tTRUE\t", 6); + strm->Write("\tTRUE\t", 6, &ignore); } else { - strm.write("\tFALSE\t", 7); + strm->Write("\tFALSE\t", 7, &ignore); } - strm.write(cookie_s->path.get(), cookie_s->path.Length()); + strm->Write(cookie_s->path.get(), cookie_s->path.Length(), &ignore); if (cookie_s->isSecure) { - strm.write("\tTRUE\t", 6); + strm->Write("\tTRUE\t", 6, &ignore); } else { - strm.write("\tFALSE\t", 7); + strm->Write("\tFALSE\t", 7, &ignore); } PR_snprintf(date_string, sizeof(date_string), "%lu", NS_STATIC_CAST(unsigned long, cookie_s->expires)); - strm.write(date_string, strlen(date_string)); - strm.write("\t", 1); - strm.write(cookie_s->name.get(), cookie_s->name.Length()); - strm.write("\t", 1); - strm.write(cookie_s->cookie.get(), cookie_s->cookie.Length()); - strm.write("\n", 1); + strm->Write(date_string, strlen(date_string), &ignore); + strm->Write("\t", 1, &ignore); + strm->Write(cookie_s->name.get(), cookie_s->name.Length(), &ignore); + strm->Write("\t", 1, &ignore); + strm->Write(cookie_s->cookie.get(), cookie_s->cookie.Length(), &ignore); + strm->Write("\n", 1, &ignore); } cookie_changed = PR_FALSE; - strm.flush(); - strm.close(); - return NS_OK; } @@ -1802,13 +1802,21 @@ COOKIE_Read() { cookie_CookieStruct *new_cookie, *tmp_cookie_ptr; nsCAutoString buffer; PRBool added_to_list; - nsFileSpec dirSpec; - nsresult rv = CKutil_ProfileDirectory(dirSpec); + + nsCOMPtr dirSpec; + nsresult rv = CKutil_ProfileDirectory(getter_AddRefs(dirSpec)); if (NS_FAILED(rv)) { return rv; } - nsInputFileStream strm(dirSpec + kCookiesFileName); - if (!strm.is_open()) { + + dirSpec->AppendNative(NS_LITERAL_CSTRING(kCookiesFileName)); + + nsCOMPtr strm; + NS_NewLocalFileInputStream(getter_AddRefs(strm), + dirSpec); + + PRBool exists = PR_FALSE;; + if (NS_FAILED(dirSpec->Exists(&exists)) || !exists) { /* file doesn't exist -- that's not an error */ return NS_OK; } @@ -1858,7 +1866,6 @@ COOKIE_Read() { /* create a new cookie_struct and fill it in */ new_cookie = new cookie_CookieStruct; if (!new_cookie) { - strm.close(); return NS_ERROR_OUT_OF_MEMORY; } new_cookie->name = name; @@ -1899,8 +1906,7 @@ COOKIE_Read() { if (!cookie_list) { cookie_list = new nsVoidArray(); if (!cookie_list) { - delete new_cookie; - strm.close(); + deleteCookie((void*)new_cookie, nsnull); return NS_ERROR_OUT_OF_MEMORY; } } @@ -1923,7 +1929,6 @@ COOKIE_Read() { } } - strm.close(); cookie_changed = PR_FALSE; return NS_OK; } diff --git a/mozilla/extensions/cookie/nsPermissions.cpp b/mozilla/extensions/cookie/nsPermissions.cpp index 8cdf6d3ac98..9b212239483 100644 --- a/mozilla/extensions/cookie/nsPermissions.cpp +++ b/mozilla/extensions/cookie/nsPermissions.cpp @@ -44,7 +44,6 @@ #include "nsUtils.h" #include "nsXPIDLString.h" #include "nsReadableUtils.h" -#include "nsIFileSpec.h" #include "nsIPrompt.h" #include "nsVoidArray.h" #include "prmem.h" @@ -56,6 +55,11 @@ #include "nsComObsolete.h" #include "nsIWindowWatcher.h" +#include "nsIFile.h" +#include "nsNetUtil.h" +#include "plstr.h" +#include "nsCRT.h" + #include "nsICookieAcceptDialog.h" #include "nsCookiePromptService.h" @@ -398,26 +402,26 @@ Permission_Save(PRBool notify) { if (permission_list == nsnull) { return; } - nsFileSpec dirSpec; - nsresult rval = CKutil_ProfileDirectory(dirSpec); + nsCOMPtr dirSpec; + nsresult rval = CKutil_ProfileDirectory(getter_AddRefs(dirSpec)); if (NS_FAILED(rval)) { return; } - dirSpec += kCookiesPermFileName; - PRBool ignored; - dirSpec.ResolveSymlink(ignored); - nsOutputFileStream strm(dirSpec); - if (!strm.is_open()) { - return; - } + + dirSpec->AppendNative(nsDependentCString(kCookiesPermFileName)); + + PRUint32 ignore; + nsCOMPtr strm; + NS_NewLocalFileOutputStream(getter_AddRefs(strm), + dirSpec); #define PERMISSIONFILE_LINE1 "# HTTP Permission File\n" #define PERMISSIONFILE_LINE2 "# http://www.netscape.com/newsref/std/cookie_spec.html\n" #define PERMISSIONFILE_LINE3 "# This is a generated file! Do not edit.\n\n" - strm.write(PERMISSIONFILE_LINE1, PL_strlen(PERMISSIONFILE_LINE1)); - strm.write(PERMISSIONFILE_LINE2, PL_strlen(PERMISSIONFILE_LINE2)); - strm.write(PERMISSIONFILE_LINE3, PL_strlen(PERMISSIONFILE_LINE3)); + strm->Write(PERMISSIONFILE_LINE1, PL_strlen(PERMISSIONFILE_LINE1), &ignore); + strm->Write(PERMISSIONFILE_LINE2, PL_strlen(PERMISSIONFILE_LINE2), &ignore); + strm->Write(PERMISSIONFILE_LINE3, PL_strlen(PERMISSIONFILE_LINE3), &ignore); /* format shall be: * host \t permission \t permission ... \n @@ -427,43 +431,42 @@ Permission_Save(PRBool notify) { for (PRInt32 i = 0; i < hostCount; ++i) { hostStruct = NS_STATIC_CAST(permission_HostStruct*, permission_list->ElementAt(i)); if (hostStruct) { - strm.write(hostStruct->host, strlen(hostStruct->host)); + strm->Write(hostStruct->host, strlen(hostStruct->host), &ignore); PRInt32 typeCount = hostStruct->permissionList->Count(); for (PRInt32 typeIndex=0; typeIndexpermissionList->ElementAt(typeIndex)); - strm.write("\t", 1); + strm->Write("\t", 1, &ignore); nsCAutoString tmp; tmp.AppendInt(typeStruct->type); - strm.write(tmp.get(), tmp.Length()); + strm->Write(tmp.get(), tmp.Length(), &ignore); if (typeStruct->permission) { - strm.write("T", 1); + strm->Write("T", 1, &ignore); } else { - strm.write("F", 1); + strm->Write("F", 1, &ignore); } } - strm.write("\n", 1); + strm->Write("\n", 1, &ignore); } } /* save current state of nag boxs' checkmarks */ - strm.write("@@@@", 4); + strm->Write("@@@@", 4, &ignore); for (PRInt32 type = 0; type < NUMBER_OF_PERMISSIONS; type++) { - strm.write("\t", 1); + strm->Write("\t", 1, &ignore); nsCAutoString tmp; tmp.AppendInt(type); - strm.write(tmp.get(), tmp.Length()); + strm->Write(tmp.get(), tmp.Length(), &ignore); if (permission_GetRememberChecked(type)) { - strm.write("T", 1); + strm->Write("T", 1, &ignore); } else { - strm.write("F", 1); + strm->Write("F", 1, &ignore); } } - strm.write("\n", 1); + strm->Write("\n", 1, &ignore); permission_changed = PR_FALSE; - strm.flush(); - strm.close(); + strm->Close(); /* Notify cookie manager dialog to update its display */ if (notify) { @@ -487,13 +490,20 @@ PERMISSION_Read() { return NS_ERROR_OUT_OF_MEMORY; } nsCAutoString buffer; - nsFileSpec dirSpec; - nsresult rv = CKutil_ProfileDirectory(dirSpec); + nsCOMPtr dirSpec; + nsresult rv = CKutil_ProfileDirectory(getter_AddRefs(dirSpec)); if (NS_FAILED(rv)) { return rv; } - nsInputFileStream strm(dirSpec + kCookiesPermFileName); - if (!strm.is_open()) { + + dirSpec->AppendNative(nsDependentCString(kCookiesPermFileName)); + + nsCOMPtr strm; + NS_NewLocalFileInputStream(getter_AddRefs(strm), + dirSpec); + + PRBool exists = PR_FALSE;; + if (NS_FAILED(dirSpec->Exists(&exists)) || !exists) { /* file doesn't exist -- that's not an error */ for (PRInt32 type=0; typeClose(); return rv; } } @@ -582,7 +592,7 @@ PERMISSION_Read() { } } - strm.close(); + strm->Close(); permission_changed = PR_FALSE; return NS_OK; } diff --git a/mozilla/extensions/cookie/nsUtils.cpp b/mozilla/extensions/cookie/nsUtils.cpp index f82eb0dd0be..94e2a1b67c8 100644 --- a/mozilla/extensions/cookie/nsUtils.cpp +++ b/mozilla/extensions/cookie/nsUtils.cpp @@ -40,18 +40,19 @@ #include "nsXPIDLString.h" #include "nsIStringBundle.h" #include "nsIPref.h" -#include "nsIFileSpec.h" #include "nsILocalFile.h" #include "nsAppDirectoryServiceDefs.h" #include "prmem.h" #include "nsComObsolete.h" +#include "plstr.h" +#include "nsCRT.h" static NS_DEFINE_IID(kStringBundleServiceCID, NS_STRINGBUNDLESERVICE_CID); #define LOCALIZATION "chrome://cookie/locale/cookie.properties" nsresult -ckutil_getChar(nsInputFileStream& strm, +ckutil_getChar(nsIInputStream* strm, char *buffer, PRInt32 bufsize, PRInt32& next, PRInt32& count, char& c) { @@ -62,7 +63,13 @@ ckutil_getChar(nsInputFileStream& strm, count = bufsize; return NS_ERROR_FAILURE; } - count = strm.read(buffer, bufsize); + + + PRUint32 theCount; + strm->Read(buffer, bufsize, &theCount); + + count = theCount; + next = 0; if (count == 0) { next = bufsize; @@ -80,7 +87,7 @@ ckutil_getChar(nsInputFileStream& strm, * strip carriage returns and line feeds from end of line */ PUBLIC PRInt32 -CKutil_GetLine(nsInputFileStream& strm, char *buffer, PRInt32 bufsize, +CKutil_GetLine(nsIInputStream* strm, char *buffer, PRInt32 bufsize, PRInt32& next, PRInt32& count, nsACString& aLine) { /* read the line */ @@ -121,21 +128,8 @@ CKutil_Localize(const PRUnichar *genericString) { } PUBLIC nsresult -CKutil_ProfileDirectory(nsFileSpec& dirSpec) { - nsresult res; - nsCOMPtr aFile; - nsCOMPtr tempSpec; - - res = NS_GetSpecialDirectory(NS_APP_USER_PROFILE_50_DIR, getter_AddRefs(aFile)); - if (NS_FAILED(res)) return res; - - // TODO: When the calling code can take an nsIFile, - // this conversion to nsFileSpec can be avoided. - res = NS_NewFileSpecFromIFile(aFile, getter_AddRefs(tempSpec)); - if (NS_FAILED(res)) return res; - res = tempSpec->GetFileSpec(&dirSpec); - - return res; +CKutil_ProfileDirectory(nsIFile** out) { + return NS_GetSpecialDirectory(NS_APP_USER_PROFILE_50_DIR, out); } PUBLIC char * diff --git a/mozilla/extensions/cookie/nsUtils.h b/mozilla/extensions/cookie/nsUtils.h index f3b13570b8a..7ffd13fa8dc 100644 --- a/mozilla/extensions/cookie/nsUtils.h +++ b/mozilla/extensions/cookie/nsUtils.h @@ -40,12 +40,13 @@ #define UTILS_H #include "nsString.h" -#include "nsFileStream.h" +#include "nsIInputStream.h" +#include "nsIFile.h" -extern PRInt32 CKutil_GetLine(nsInputFileStream& strm, char *aBuf, PRInt32 sz, +extern PRInt32 CKutil_GetLine(nsIInputStream* strm, char *aBuf, PRInt32 sz, PRInt32& next, PRInt32& count, nsACString& aLine); extern PRUnichar* CKutil_Localize(const PRUnichar *genericString); -extern nsresult CKutil_ProfileDirectory(nsFileSpec& dirSpec); +extern nsresult CKutil_ProfileDirectory(nsIFile** dirSpec); extern char * CKutil_StrAllocCopy(char *&destination, const char *source); extern char * CKutil_StrAllocCat(char *&destination, const char *source); diff --git a/mozilla/extensions/python/xpcom/src/loader/Makefile.in b/mozilla/extensions/python/xpcom/src/loader/Makefile.in index e015ee9f969..b4141716b0b 100644 --- a/mozilla/extensions/python/xpcom/src/loader/Makefile.in +++ b/mozilla/extensions/python/xpcom/src/loader/Makefile.in @@ -49,7 +49,7 @@ include $(DEPTH)/config/autoconf.mk LIBRARY_NAME = pyloader IS_COMPONENT = 1 -REQUIRES = xpcom string $(NULL) +REQUIRES = xpcom string xpcom_obsolete $(NULL) LOCAL_INCLUDES = $(PYTHON_INCLUDES) EXTRA_LIBS += $(PYTHON_LIBS) diff --git a/mozilla/extensions/typeaheadfind/src/nsTypeAheadFindRegistration.cpp b/mozilla/extensions/typeaheadfind/src/nsTypeAheadFindRegistration.cpp index 578658369d1..6d19624280d 100644 --- a/mozilla/extensions/typeaheadfind/src/nsTypeAheadFindRegistration.cpp +++ b/mozilla/extensions/typeaheadfind/src/nsTypeAheadFindRegistration.cpp @@ -40,7 +40,6 @@ #include "nsIGenericFactory.h" #include "nsTypeAheadFind.h" #include "nsIServiceManager.h" -#include "nsIRegistry.h" #include "prprf.h" #include "nsCRT.h" #include "nsICategoryManager.h" diff --git a/mozilla/extensions/wallet/src/Makefile.in b/mozilla/extensions/wallet/src/Makefile.in index c0a40b53a66..59af8d339c3 100644 --- a/mozilla/extensions/wallet/src/Makefile.in +++ b/mozilla/extensions/wallet/src/Makefile.in @@ -34,6 +34,7 @@ MODULE_NAME = nsWalletModule GRE_MODULE = 1 REQUIRES = xpcom \ + xpcom_obsolete \ string \ necko \ dom \ @@ -74,6 +75,7 @@ EXTRA_DSO_LDOPTS = \ $(LIBS_DIRS) \ $(MOZ_UNICHARUTIL_LIBS) \ $(MOZ_COMPONENT_LIBS) \ + $(MOZ_XPCOM_OBSOLETE_LIBS) \ $(NULL) include $(topsrcdir)/config/rules.mk diff --git a/mozilla/gfx/src/x11shared/nsFT2FontCatalog.cpp b/mozilla/gfx/src/x11shared/nsFT2FontCatalog.cpp index 473b3b50178..be5ef49207e 100644 --- a/mozilla/gfx/src/x11shared/nsFT2FontCatalog.cpp +++ b/mozilla/gfx/src/x11shared/nsFT2FontCatalog.cpp @@ -52,7 +52,6 @@ PRUint32 gFontDebug = 0 | NS_FONT_DEBUG_FONT_SCAN; #include #include #include -#include "nsIFileSpec.h" #include "nsAppDirectoryServiceDefs.h" #include "nsLocalFileUnix.h" #include "nsIEnumerator.h" diff --git a/mozilla/htmlparser/public/nsHTMLTokens.h b/mozilla/htmlparser/public/nsHTMLTokens.h index f546acf1e58..96dc519f9a4 100644 --- a/mozilla/htmlparser/public/nsHTMLTokens.h +++ b/mozilla/htmlparser/public/nsHTMLTokens.h @@ -128,9 +128,7 @@ class CStartToken: public CHTMLToken { virtual PRBool IsEmpty(void); virtual void SetEmpty(PRBool aValue); -#ifdef DEBUG - virtual void DebugDumpSource(nsOutputStream& out); -#endif + virtual const nsAString& GetStringValue(); virtual void GetSource(nsString& anOutputString); virtual void AppendSourceTo(nsAString& anOutputString); @@ -180,9 +178,7 @@ class CEndToken: public CHTMLToken { virtual PRInt32 GetTypeID(void); virtual const char* GetClassName(void); virtual PRInt32 GetTokenType(void); -#ifdef DEBUG - virtual void DebugDumpSource(nsOutputStream& out); -#endif + virtual const nsAString& GetStringValue(); virtual void GetSource(nsString& anOutputString); virtual void AppendSourceTo(nsAString& anOutputString); @@ -240,9 +236,7 @@ class CEntityToken : public CHTMLToken { virtual nsresult Consume(PRUnichar aChar,nsScanner& aScanner,PRInt32 aMode); static nsresult ConsumeEntity(PRUnichar aChar,nsString& aString,nsScanner& aScanner); static PRInt32 TranslateToUnicodeStr(PRInt32 aValue,nsString& aString); -#ifdef DEBUG - virtual void DebugDumpSource(nsOutputStream& out); -#endif + virtual const nsAString& GetStringValue(void); virtual void GetSource(nsString& anOutputString); virtual void AppendSourceTo(nsAString& anOutputString); @@ -372,15 +366,9 @@ class CAttributeToken: public CHTMLToken { virtual void BindKey(nsScanner* aScanner, nsReadingIterator& aStart, nsReadingIterator& aEnd); virtual const nsAString& GetValue(void) {return mTextValue;} virtual void SanitizeKey(); -#ifdef DEBUG - virtual void DebugDumpToken(nsOutputStream& out); -#endif virtual const nsAString& GetStringValue(void); virtual void GetSource(nsString& anOutputString); virtual void AppendSourceTo(nsAString& anOutputString); -#ifdef DEBUG - virtual void DebugDumpSource(nsOutputStream& out); -#endif PRPackedBool mHasEqualWithoutValue; protected: diff --git a/mozilla/htmlparser/public/nsIParser.h b/mozilla/htmlparser/public/nsIParser.h index 29b11b9dc88..86e7ad8b160 100644 --- a/mozilla/htmlparser/public/nsIParser.h +++ b/mozilla/htmlparser/public/nsIParser.h @@ -232,7 +232,7 @@ class nsIParser : public nsISupports { virtual PRBool IsComplete() =0; virtual nsresult Parse(nsIURI* aURL,nsIRequestObserver* aListener = nsnull,PRBool aEnableVerify=PR_FALSE, void* aKey=0,nsDTDMode aMode=eDTDMode_autodetect) = 0; - virtual nsresult Parse(nsIInputStream& aStream, const nsACString& aMimeType,PRBool aEnableVerify=PR_FALSE, void* aKey=0,nsDTDMode aMode=eDTDMode_autodetect) = 0; + virtual nsresult Parse(nsIInputStream* aStream, const nsACString& aMimeType,PRBool aEnableVerify=PR_FALSE, void* aKey=0,nsDTDMode aMode=eDTDMode_autodetect) = 0; virtual nsresult Parse(const nsAString& aSourceBuffer,void* aKey,const nsACString& aMimeType,PRBool aEnableVerify,PRBool aLastCall,nsDTDMode aMode=eDTDMode_autodetect) = 0; virtual nsresult Terminate(void) = 0; diff --git a/mozilla/htmlparser/public/nsToken.h b/mozilla/htmlparser/public/nsToken.h index 985e13519bb..3aa395d440c 100644 --- a/mozilla/htmlparser/public/nsToken.h +++ b/mozilla/htmlparser/public/nsToken.h @@ -72,7 +72,6 @@ #include "prtypes.h" #include "nsString.h" #include "nsError.h" -#include "nsFileSpec.h" #include "nsFixedSizeAllocator.h" #define NS_HTMLTOKENS_NOT_AN_ENTITY \ @@ -221,22 +220,6 @@ class CToken { */ virtual nsresult Consume(PRUnichar aChar,nsScanner& aScanner,PRInt32 aMode); -#ifdef DEBUG - /** - * Causes token to dump itself in debug form to given output stream - * @update gess5/11/98 - * @param out is the output stream where token should write itself - */ - virtual void DebugDumpToken(nsOutputStream& out); - - /** - * Causes token to dump itself in source form to given output stream - * @update gess5/11/98 - * @param out is the output stream where token should write itself - */ - virtual void DebugDumpSource(nsOutputStream& out); -#endif - /** * Getter which retrieves type of token * @update gess5/11/98 diff --git a/mozilla/htmlparser/src/CNavDTD.cpp b/mozilla/htmlparser/src/CNavDTD.cpp index 1cf2a05d87f..1c2070a1129 100644 --- a/mozilla/htmlparser/src/CNavDTD.cpp +++ b/mozilla/htmlparser/src/CNavDTD.cpp @@ -37,7 +37,6 @@ * ***** END LICENSE BLOCK ***** */ //#define ENABLE_CRC -//#define RICKG_DEBUG //#define ALLOW_TR_AS_CHILD_OF_TABLE //by setting this to true, TR is allowable directly in TABLE. #define ENABLE_RESIDUALSTYLE @@ -69,6 +68,7 @@ #include "nsReadableUtils.h" #include "nsUnicharUtils.h" #include "prmem.h" +#include "nsIServiceManager.h" #ifdef NS_DEBUG #include "nsLoggingSink.h" @@ -190,13 +190,6 @@ CNavDTD::CNavDTD() : nsIDTD(), #endif { mBodyContext=new nsDTDContext(); - -#ifdef RICKG_DEBUG - //DebugDumpContainmentRules2(*this,"c:/temp/DTDRules.new","New CNavDTD Containment Rules"); - nsHTMLElement::DebugDumpContainment("c:/temp/contain.new","ElementTable Rules"); - nsHTMLElement::DebugDumpMembership("c:/temp/membership.out"); - nsHTMLElement::DebugDumpContainType("c:/temp/ctnrules.out"); -#endif } /** @@ -1393,16 +1386,6 @@ nsresult CNavDTD::HandleDefaultStartToken(CToken* aToken,eHTMLTags aChildTag,nsC return result; } - - -#ifdef RICKG_DEBUG -void WriteTokenToLog(CToken* aToken) { - - static nsFileSpec fileSpec("c:\\temp\\tokenlog.html"); - static nsOutputFileStream outputStream(fileSpec); - aToken->DebugDumpSource(outputStream); //write token without close bracket... -} -#endif /** * This gets called before we've handled a given start tag. @@ -1689,10 +1672,6 @@ nsresult CNavDTD::HandleKeyGen(nsIParserNode* aNode) { nsresult CNavDTD::HandleStartToken(CToken* aToken) { NS_PRECONDITION(0!=aToken,kNullToken); - #ifdef RICKG_DEBUG - WriteTokenToLog(aToken); - #endif - //Begin by gathering up attributes... nsCParserNode* theNode=mNodeAllocator.CreateNode(aToken, mTokenAllocator); @@ -1947,10 +1926,6 @@ nsresult CNavDTD::HandleEndToken(CToken* aToken) { nsresult result=NS_OK; eHTMLTags theChildTag=(eHTMLTags)aToken->GetTypeID(); - #ifdef RICKG_DEBUG - WriteTokenToLog(aToken); - #endif - switch(theChildTag) { case eHTMLTag_script: @@ -2198,9 +2173,6 @@ nsresult CNavDTD::HandleEntityToken(CToken* aToken) { result=HandleOmittedTag(aToken,theCurrTag,theParentTag,theNode); } else { -#ifdef RICKG_DEBUG - WriteTokenToLog(aToken); -#endif result=AddLeaf(theNode); } IF_FREE(theNode, &mNodeAllocator); @@ -2227,10 +2199,6 @@ nsresult CNavDTD::HandleCommentToken(CToken* aToken) { if(theNode) { - #ifdef RICKG_DEBUG - WriteTokenToLog(aToken); - #endif - STOP_TIMER(); MOZ_TIMER_DEBUGLOG(("Stop: Parse Time: CNavDTD::HandleCommentToken(), this=%p\n", this)); @@ -2304,10 +2272,6 @@ nsresult CNavDTD::HandleProcessingInstructionToken(CToken* aToken){ nsCParserNode* theNode=mNodeAllocator.CreateNode(aToken, mTokenAllocator); if(theNode) { - #ifdef RICKG_DEBUG - WriteTokenToLog(aToken); - #endif - STOP_TIMER(); MOZ_TIMER_DEBUGLOG(("Stop: Parse Time: CNavDTD::HandleProcessingInstructionToken(), this=%p\n", this)); @@ -2335,10 +2299,6 @@ nsresult CNavDTD::HandleDocTypeDeclToken(CToken* aToken){ nsresult result=NS_OK; - #ifdef RICKG_DEBUG - WriteTokenToLog(aToken); - #endif - CDoctypeDeclToken* theToken = NS_STATIC_CAST(CDoctypeDeclToken*,aToken); nsAutoString docTypeStr(theToken->GetStringValue()); mLineNumber += docTypeStr.CountChar(kNewLine); @@ -2406,10 +2366,6 @@ nsresult CNavDTD::CollectAttributes(nsIParserNode& aNode,eHTMLTags aTag,PRInt32 ((CAttributeToken*)theToken)->SanitizeKey(); mLineNumber += theToken->GetNewlineCount(); - #ifdef RICKG_DEBUG - WriteTokenToLog(theToken); - #endif - aNode.AddAttribute(theToken); } } diff --git a/mozilla/htmlparser/src/COtherDTD.cpp b/mozilla/htmlparser/src/COtherDTD.cpp index aaf6fe09074..87cce9258a0 100644 --- a/mozilla/htmlparser/src/COtherDTD.cpp +++ b/mozilla/htmlparser/src/COtherDTD.cpp @@ -38,8 +38,6 @@ * ***** END LICENSE BLOCK ***** */ //#define ENABLE_CRC -//#define RICKG_DEBUG - #include "nsDebug.h" #include "nsIAtom.h" @@ -176,14 +174,6 @@ COtherDTD::COtherDTD() : nsIDTD() { if(!gElementTable) { gElementTable = new CElementTable(); } - -#ifdef RICKG_DEBUG - //DebugDumpContainmentRules2(*this,"c:/temp/DTDRules.new","New COtherDTD Containment Rules"); - nsHTMLElement::DebugDumpContainment("c:/temp/contain.new","ElementTable Rules"); - nsHTMLElement::DebugDumpMembership("c:/temp/membership.out"); - nsHTMLElement::DebugDumpContainType("c:/temp/ctnrules.out"); -#endif - } /** @@ -628,16 +618,6 @@ nsresult COtherDTD::DidHandleStartTag(nsIParserNode& aNode,eHTMLTags aChildTag){ return result; } - -#ifdef RICKG_DEBUG -void WriteTokenToLog(CToken* aToken) { - - static nsFileSpec fileSpec("c:\\temp\\tokenlog.html"); - static nsOutputFileStream outputStream(fileSpec); - aToken->DebugDumpSource(outputStream); //write token without close bracket... -} -#endif - /** * This gets called before we've handled a given start tag. * It's a generic hook to let us do pre processing. @@ -694,9 +674,6 @@ nsresult COtherDTD::WillHandleStartTag(CToken* aToken,eHTMLTags aTag,nsIParserNo * @return PR_TRUE if all went well; PR_FALSE if error occured */ nsresult COtherDTD::HandleStartToken(CToken* aToken) { - #ifdef RICKG_DEBUG - WriteTokenToLog(aToken); - #endif //Begin by gathering up attributes... @@ -767,10 +744,6 @@ nsresult COtherDTD::HandleEndToken(CToken* aToken) { nsresult result=NS_OK; eHTMLTags theChildTag=(eHTMLTags)aToken->GetTypeID(); - #ifdef RICKG_DEBUG - WriteTokenToLog(aToken); - #endif - switch(theChildTag) { case eHTMLTag_body: //we intentionally don't let the user close HTML or BODY @@ -826,10 +799,6 @@ nsresult COtherDTD::CollectAttributes(nsIParserNode& aNode,eHTMLTags aTag,PRInt3 // a legitimate "SELECTED" key. ((CAttributeToken*)theToken)->SanitizeKey(); - #ifdef RICKG_DEBUG - WriteTokenToLog(theToken); - #endif - aNode.AddAttribute(theToken); } } diff --git a/mozilla/htmlparser/src/nsDTDUtils.cpp b/mozilla/htmlparser/src/nsDTDUtils.cpp index aa6f63d01c7..f91f8cf8efa 100644 --- a/mozilla/htmlparser/src/nsDTDUtils.cpp +++ b/mozilla/htmlparser/src/nsDTDUtils.cpp @@ -1489,40 +1489,6 @@ nsCParserNode* nsNodeAllocator::CreateNode(CToken* aToken, #ifdef DEBUG void DebugDumpContainmentRules(nsIDTD& theDTD,const char* aFilename,const char* aTitle) { -#ifdef RICKG_DEBUG - -#include - - const char* prefix=" "; - fstream out(aFilename,ios::out); - out << "==================================================" << endl; - out << aTitle << endl; - out << "=================================================="; - int i,j=0; - int written; - for(i=1;i" << endl; - out << prefix; - written=0; - if(theDTD.IsContainer(i)) { - for(j=1;j -#endif - #ifdef DEBUG void nsHTMLElement::DebugDumpContainment(const char* aFilename,const char* aTitle){ -#ifdef RICKG_DEBUG - - PRBool t=CanContain(eHTMLTag_address,eHTMLTag_object); - - const char* prefix=" "; - fstream out(aFilename,ios::out); - out << "==================================================" << endl; - out << aTitle << endl; - out << "=================================================="; - int i,j=0; - int written; - int linenum=5; - for(i=1;i" << endl; - out << prefix; - linenum+=3; - written=0; - char startChar=0; - if(IsContainer((eHTMLTags)i)) { - for(j=1;j* aDTD) return PR_FALSE; } } - nsSpecialSystemDirectory dtdPath(nsSpecialSystemDirectory::OS_CurrentProcessDirectory); - dtdPath += PromiseFlatCString(nsDependentCString(kDTDDirectory) + fileName).get(); - if (dtdPath.Exists()) { + + nsCOMPtr dtdPath; + NS_GetSpecialDirectory(NS_OS_CURRENT_PROCESS_DIR, + getter_AddRefs(dtdPath)); + + if (!dtdPath) + return PR_FALSE; + + nsCOMPtr lfile = do_QueryInterface(dtdPath); + + nsCAutoString path; + path = NS_LITERAL_CSTRING(kDTDDirectory) + fileName; + lfile->AppendRelativeNativePath(path); + + PRBool exists; + dtdPath->Exists(&exists); + + if (exists) { // The DTD was found in the local DTD directory. - // Set aDTD to a file: url pointing to the local DTD - nsFileURL dtdFile(dtdPath); + // Set aDTD to a file: url pointing to the local DT nsCOMPtr dtdURI; - NS_NewURI(getter_AddRefs(dtdURI), dtdFile.GetURLString()); + NS_NewFileURI(getter_AddRefs(dtdURI), dtdPath); + if (dtdURI) { *aDTD = dtdURI; isLoadable = PR_TRUE; diff --git a/mozilla/htmlparser/src/nsExpatDriver.h b/mozilla/htmlparser/src/nsExpatDriver.h index 650f4c01942..cd68396dec7 100644 --- a/mozilla/htmlparser/src/nsExpatDriver.h +++ b/mozilla/htmlparser/src/nsExpatDriver.h @@ -43,7 +43,7 @@ #include "nsString.h" #include "nsIDTD.h" #include "nsITokenizer.h" -#include "nsFileSpec.h" +#include "nsIInputStream.h" class nsIExpatSink; struct nsCatalogData; diff --git a/mozilla/htmlparser/src/nsHTMLTokens.cpp b/mozilla/htmlparser/src/nsHTMLTokens.cpp index 4b09e80446b..87ddf261919 100644 --- a/mozilla/htmlparser/src/nsHTMLTokens.cpp +++ b/mozilla/htmlparser/src/nsHTMLTokens.cpp @@ -236,21 +236,6 @@ nsresult CStartToken::Consume(PRUnichar aChar, nsScanner& aScanner,PRInt32 aFlag } -#ifdef DEBUG -/* - * Dump contents of this token to givne output stream - * - * @update gess 3/25/98 - * @param out -- ostream to output content - * @return - */ -void CStartToken::DebugDumpSource(nsOutputStream& out) { - out << "<" << NS_LossyConvertUCS2toASCII(mTextValue).get(); - if(!mAttributed) - out << ">"; -} -#endif - const nsAString& CStartToken::GetStringValue() { if((eHTMLTag_unknown"; -} -#endif - const nsAString& CEndToken::GetStringValue() { if((eHTMLTag_unknown"; -} -#endif - void CAttributeToken::SetKey(const nsAString& aKey) { mTextKey.Rebind(aKey); @@ -2201,20 +2139,6 @@ PRInt32 CEntityToken::TranslateToUnicodeStr(nsString& aString) { return value; } -#ifdef DEBUG -/* - * Dump contents of this token to givne output stream - * - * @update gess 3/25/98 - * @param out -- ostream to output content - * @return - */ -void CEntityToken::DebugDumpSource(nsOutputStream& out) { - char* cp = ToNewCString(mTextValue); - out << "&" << *cp; - delete[] cp; -} -#endif const nsAString& CEntityToken::GetStringValue(void) { diff --git a/mozilla/htmlparser/src/nsParser.cpp b/mozilla/htmlparser/src/nsParser.cpp index 26faba90f5e..beb7a5bdf53 100644 --- a/mozilla/htmlparser/src/nsParser.cpp +++ b/mozilla/htmlparser/src/nsParser.cpp @@ -66,6 +66,7 @@ #include "nsIEventQueue.h" #include "nsIEventQueueService.h" #include "nsExpatDriver.h" +#include "nsIServiceManager.h" //#define rickgdebug #define NS_PARSER_FLAG_DTD_VERIFICATION 0x00000001 @@ -1517,8 +1518,7 @@ nsresult nsParser::Parse(nsIURI* aURL,nsIRequestObserver* aListener,PRBool aVeri * @param aStream is the i/o source * @return error code -- 0 if ok, non-zero if error. */ -nsresult nsParser::Parse(nsIInputStream& aStream,const nsACString& aMimeType,PRBool aVerifyEnabled, void* aKey,nsDTDMode aMode){ - +nsresult nsParser::Parse(nsIInputStream* aStream,const nsACString& aMimeType,PRBool aVerifyEnabled, void* aKey,nsDTDMode aMode){ if (aVerifyEnabled) { mFlags |= NS_PARSER_FLAG_DTD_VERIFICATION; } @@ -1531,9 +1531,9 @@ nsresult nsParser::Parse(nsIInputStream& aStream,const nsACString& aMimeType,PRB //ok, time to create our tokenizer and begin the process nsAutoString theUnknownFilename(NS_LITERAL_STRING("unknown")); - nsInputStream input(&aStream); + // references + nsScanner* theScanner=new nsScanner(theUnknownFilename,aStream,mCharset,mCharsetSource); - nsScanner* theScanner=new nsScanner(theUnknownFilename,input,mCharset,mCharsetSource); CParserContext* pc=new CParserContext(theScanner,aKey,mCommand,0); if(pc && theScanner) { PushContext(*pc); @@ -2606,23 +2606,6 @@ PRBool nsParser::DidTokenize(PRBool aIsFinalChunk){ return result; } -#ifdef DEBUG -void nsParser::DebugDumpSource(nsOutputStream& aStream) { - PRInt32 theIndex=-1; - - nsITokenizer* theTokenizer=0; - PRInt32 type = mParserContext && mParserContext->mDTD ? - mParserContext->mDTD->GetType() : NS_IPARSER_FLAG_HTML; - if(NS_SUCCEEDED(mParserContext->GetTokenizer(type, theTokenizer))){ - CToken* theToken; - while(nsnull != (theToken=theTokenizer->GetTokenAt(++theIndex))) { - // theToken->DebugDumpToken(out); - theToken->DebugDumpSource(aStream); - } - } -} -#endif - /** * Get the channel associated with this parser * @update harishd,gagan 07/17/01 diff --git a/mozilla/htmlparser/src/nsParser.h b/mozilla/htmlparser/src/nsParser.h index 6f7485606d8..d16b7aac6db 100644 --- a/mozilla/htmlparser/src/nsParser.h +++ b/mozilla/htmlparser/src/nsParser.h @@ -204,7 +204,7 @@ class nsParser : public nsIParser, * @param aStream is the i/o source * @return TRUE if all went well -- FALSE otherwise */ - virtual nsresult Parse(nsIInputStream& aStream,const nsACString& aMimeType,PRBool aEnableVerify=PR_FALSE,void* aKey=0,nsDTDMode aMode=eDTDMode_autodetect); + virtual nsresult Parse(nsIInputStream* aStream,const nsACString& aMimeType,PRBool aEnableVerify=PR_FALSE,void* aKey=0,nsDTDMode aMode=eDTDMode_autodetect); /** * @update gess5/11/98 @@ -273,10 +273,6 @@ class nsParser : public nsIParser, PRBool aIsFinalChunk = PR_FALSE, PRBool aCanInterrupt = PR_TRUE); -#ifdef DEBUG - void DebugDumpSource(nsOutputStream& anOutput); -#endif - //********************************************* // These methods are callback methods used by // net lib to let us know about our inputstream. diff --git a/mozilla/htmlparser/src/nsScanner.cpp b/mozilla/htmlparser/src/nsScanner.cpp index e3371fb683a..5e0a11cc382 100644 --- a/mozilla/htmlparser/src/nsScanner.cpp +++ b/mozilla/htmlparser/src/nsScanner.cpp @@ -43,8 +43,10 @@ #include "nsIServiceManager.h" #include "nsICharsetConverterManager.h" #include "nsICharsetAlias.h" -#include "nsFileSpec.h" #include "nsReadableUtils.h" +#include "nsIInputStream.h" +#include "nsILocalFile.h" +#include "nsNetUtil.h" static NS_DEFINE_CID(kCharsetAliasCID, NS_CHARSETALIAS_CID); @@ -118,8 +120,6 @@ nsScanner::nsScanner(const nsAString& anHTMLString, const nsString& aCharset, PR mSlidingBuffer->BeginReading(mCurrentPosition); mMarkPosition = mCurrentPosition; mIncremental=PR_FALSE; - mOwnsStream=PR_FALSE; - mInputStream=0; mUnicodeDecoder = 0; mCharsetSource = kCharsetUninitialized; SetDocumentCharset(aCharset, aSource); @@ -149,10 +149,15 @@ nsScanner::nsScanner(nsString& aFilename,PRBool aCreateStream, const nsString& a mIncremental=PR_TRUE; mCountRemaining = 0; mTotalRead=0; - mOwnsStream=aCreateStream; - mInputStream=0; + if(aCreateStream) { - mInputStream = new nsInputFileStream(nsFileSpec(aFilename)); + nsCOMPtr file; + nsCOMPtr fileStream; + + NS_NewLocalFile(aFilename, PR_TRUE, getter_AddRefs(file)); + if (file) + NS_NewLocalFileInputStream(getter_AddRefs(mInputStream), file); + } //if mUnicodeDecoder = 0; mCharsetSource = kCharsetUninitialized; @@ -168,7 +173,7 @@ nsScanner::nsScanner(nsString& aFilename,PRBool aCreateStream, const nsString& a * @param aFilename -- * @return */ -nsScanner::nsScanner(const nsAString& aFilename,nsInputStream& aStream,const nsString& aCharset, PRInt32 aSource) : +nsScanner::nsScanner(const nsAString& aFilename,nsIInputStream* aStream,const nsString& aCharset, PRInt32 aSource) : mFilename(aFilename) { MOZ_COUNT_CTOR(nsScanner); @@ -183,8 +188,7 @@ nsScanner::nsScanner(const nsAString& aFilename,nsInputStream& aStream,const nsS mIncremental=PR_FALSE; mCountRemaining = 0; mTotalRead=0; - mOwnsStream=PR_FALSE; - mInputStream=&aStream; + mInputStream=aStream; mUnicodeDecoder = 0; mCharsetSource = kCharsetUninitialized; SetDocumentCharset(aCharset, aSource); @@ -254,11 +258,10 @@ nsScanner::~nsScanner() { MOZ_COUNT_DTOR(nsScanner); if(mInputStream) { - mInputStream->close(); - if(mOwnsStream) - delete mInputStream; + mInputStream->Close(); + mInputStream = 0; } - mInputStream=0; + NS_IF_RELEASE(mUnicodeDecoder); } @@ -424,14 +427,13 @@ nsresult nsScanner::FillBuffer(void) { result=kEOF; } else { - PRInt32 numread=0; - char* buf = new char[kBufsize+1]; + PRUint32 numread=0; + char buf[kBufsize+1]; buf[kBufsize]=0; if(mInputStream) { - numread = mInputStream->read(buf, kBufsize); + result = mInputStream->Read(buf, kBufsize, &numread); if (0 == numread) { - delete [] buf; return kEOF; } } @@ -441,7 +443,6 @@ nsresult nsScanner::FillBuffer(void) { PRUnichar* unichars = ToNewUnicode(str); AppendToBuffer(unichars, unichars+numread, unichars+kBufsize+1); } - delete [] buf; mTotalRead+=numread; } diff --git a/mozilla/htmlparser/src/nsScanner.h b/mozilla/htmlparser/src/nsScanner.h index 9dcc9b3d609..994c597c491 100644 --- a/mozilla/htmlparser/src/nsScanner.h +++ b/mozilla/htmlparser/src/nsScanner.h @@ -52,12 +52,13 @@ #ifndef SCANNER #define SCANNER +#include "nsCOMPtr.h" #include "nsString.h" #include "nsIParser.h" #include "prtypes.h" #include "nsIUnicodeDecoder.h" -#include "nsFileStream.h" #include "nsSlidingString.h" +#include "nsIInputStream.h" class nsScannerString : public nsSlidingString { public: @@ -117,7 +118,7 @@ class nsScanner { * @param aMode represents the parser mode (nav, other) * @return */ - nsScanner(const nsAString& aFilename, nsInputStream& aStream, const nsString& aCharset, PRInt32 aSource); + nsScanner(const nsAString& aFilename, nsIInputStream* aStream, const nsString& aCharset, PRInt32 aSource); ~nsScanner(); @@ -382,7 +383,7 @@ class nsScanner { PRUnichar* aDataEnd, PRUnichar* aStorageEnd); - nsInputStream* mInputStream; + nsCOMPtr mInputStream; nsScannerString* mSlidingBuffer; nsReadingIterator mCurrentPosition; // The position we will next read from in the scanner buffer nsReadingIterator mMarkPosition; // The position last marked (we may rewind to here) @@ -391,7 +392,6 @@ class nsScanner { PRUint32 mCountRemaining; // The number of bytes still to be read // from the scanner buffer PRUint32 mTotalRead; - PRPackedBool mOwnsStream; PRPackedBool mIncremental; PRInt32 mCharsetSource; nsString mCharset; diff --git a/mozilla/htmlparser/src/nsToken.cpp b/mozilla/htmlparser/src/nsToken.cpp index 2eedff1650b..6cb6d9201a2 100644 --- a/mozilla/htmlparser/src/nsToken.cpp +++ b/mozilla/htmlparser/src/nsToken.cpp @@ -111,38 +111,6 @@ nsresult CToken::Consume(PRUnichar aChar,nsScanner& aScanner,PRInt32 aMode) { return result; } - -#ifdef DEBUG -/** - * This debug method causes the token to dump its content - * to the given stream (formated for debugging). - * - * @update gess 3/25/98 - * @param ostream -- output stream to accept output data - */ -void CToken::DebugDumpToken(nsOutputStream& anOutputStream) { - anOutputStream << "[" << GetClassName() << "] "; - PRUint32 i=0; - PRUint32 theLen=GetStringValue().Length(); - for(i=0;iUnicodeToChar(stringNormalized, &str, mCharset); if (NS_SUCCEEDED(res) && str != NULL) { if (mUseCodePointOrder) { - *outLen = nsCRT::strlen(str); + *outLen = strlen(str); } else { DoSetLocale(); @@ -239,7 +239,7 @@ nsresult nsCollationUnix::CreateRawSortKey(const nsCollationStrength strength, res = mCollation->UnicodeToChar(stringNormalized, &str, mCharset); if (NS_SUCCEEDED(res) && str != NULL) { if (mUseCodePointOrder) { - *outLen = nsCRT::strlen(str); + *outLen = strlen(str); memcpy(key, str, *outLen); } else { diff --git a/mozilla/intl/locale/src/unix/nsPosixLocale.cpp b/mozilla/intl/locale/src/unix/nsPosixLocale.cpp index 5c88b641fdd..ba810c8990c 100644 --- a/mozilla/intl/locale/src/unix/nsPosixLocale.cpp +++ b/mozilla/intl/locale/src/unix/nsPosixLocale.cpp @@ -43,7 +43,7 @@ #include "nsPosixLocale.h" #include "nsLocaleCID.h" #include "prprf.h" -#include "nsFileSpec.h" +#include "plstr.h" /* nsPosixLocale ISupports */ NS_IMPL_ISUPPORTS1(nsPosixLocale, nsIPosixLocale) diff --git a/mozilla/intl/strres/src/nsStringBundle.cpp b/mozilla/intl/strres/src/nsStringBundle.cpp index ac1594ce231..e834a31fd90 100644 --- a/mozilla/intl/strres/src/nsStringBundle.cpp +++ b/mozilla/intl/strres/src/nsStringBundle.cpp @@ -38,7 +38,6 @@ #include "nsStringBundle.h" #include "nsID.h" -#include "nsFileSpec.h" #include "nsString.h" #include "nsReadableUtils.h" #include "nsIStringBundle.h" @@ -80,6 +79,7 @@ #include "nsIEventQueueService.h" #include "prenv.h" +#include "nsCRT.h" static NS_DEFINE_CID(kErrorServiceCID, NS_ERRORSERVICE_CID); static NS_DEFINE_CID(kPersistentPropertiesCID, NS_IPERSISTENTPROPERTIES_CID); diff --git a/mozilla/intl/strres/tests/StringBundleTest.cpp b/mozilla/intl/strres/tests/StringBundleTest.cpp index a97a7a2ab5e..ae2ba0f5a45 100644 --- a/mozilla/intl/strres/tests/StringBundleTest.cpp +++ b/mozilla/intl/strres/tests/StringBundleTest.cpp @@ -47,12 +47,12 @@ #include "nsIComponentRegistrar.h" #include "nsNetCID.h" +#include "nsString.h" + #include "nsXPCOM.h" #include "nsIServiceManager.h" #include "nsIComponentManager.h" // -#include "nsIFileSpec.h" - #define TEST_URL "resource:/res/strres.properties" static NS_DEFINE_CID(kEventQueueServiceCID, NS_EVENTQUEUESERVICE_CID); diff --git a/mozilla/intl/uconv/src/Makefile.in b/mozilla/intl/uconv/src/Makefile.in index 8ec1b3f36e2..a735c6cb46c 100644 --- a/mozilla/intl/uconv/src/Makefile.in +++ b/mozilla/intl/uconv/src/Makefile.in @@ -28,7 +28,7 @@ include $(DEPTH)/config/autoconf.mk MODULE = uconv LIBRARY_NAME = uconv -EXPORT_LIBRARY = 1 +Expcom_obsolete_LIBRARY = 1 IS_COMPONENT = 1 MODULE_NAME = nsUConvModule GRE_MODULE = 1 @@ -38,6 +38,7 @@ ifneq ($(OS_ARCH),WINNT) SHORT_LIBNAME = mozuconv endif REQUIRES = xpcom \ + xpcom_obsolete \ string \ intl \ locale \ diff --git a/mozilla/intl/uconv/src/nsCharsetConverterManager.h b/mozilla/intl/uconv/src/nsCharsetConverterManager.h index 203764ac7ec..75554a57fb7 100644 --- a/mozilla/intl/uconv/src/nsCharsetConverterManager.h +++ b/mozilla/intl/uconv/src/nsCharsetConverterManager.h @@ -42,7 +42,6 @@ #include "nsICharsetConverterManager.h" #include "nsIStringBundle.h" #include "nsISupportsArray.h" -#include "nsIRegistry.h" class nsCharsetConverterManager : public nsICharsetConverterManager, public nsICharsetConverterManager2 diff --git a/mozilla/intl/uconv/src/nsUConvModule.cpp b/mozilla/intl/uconv/src/nsUConvModule.cpp index 577d738f193..88dc4c1afc5 100644 --- a/mozilla/intl/uconv/src/nsUConvModule.cpp +++ b/mozilla/intl/uconv/src/nsUConvModule.cpp @@ -37,6 +37,7 @@ * * ***** END LICENSE BLOCK ***** */ #include "nsCOMPtr.h" +#include "nsCRT.h" #include "nsIModule.h" #include "nsIGenericFactory.h" #include "nsIComponentManager.h" @@ -53,7 +54,6 @@ #include "nsITextToSubURI.h" #include "nsIServiceManager.h" #include "nsUConvDll.h" -#include "nsFileSpec.h" #include "nsIFile.h" #include "nsIScriptableUConv.h" #include "nsConverterInputStream.h" diff --git a/mozilla/intl/uconv/ucvmath/Makefile.in b/mozilla/intl/uconv/ucvmath/Makefile.in index 8ada8eba466..5cdc5416b8b 100644 --- a/mozilla/intl/uconv/ucvmath/Makefile.in +++ b/mozilla/intl/uconv/ucvmath/Makefile.in @@ -28,12 +28,13 @@ include $(DEPTH)/config/autoconf.mk MODULE = ucvmath LIBRARY_NAME = ucvmath -EXPORT_LIBRARY = 1 +Expcom_obsolete_LIBRARY = 1 IS_COMPONENT = 1 MODULE_NAME = nsUCvMathModule GRE_MODULE = 1 REQUIRES = xpcom \ + xpcom_obsolete \ string \ uconv \ $(NULL) diff --git a/mozilla/intl/unicharutil/src/nsUcharUtilConstructors.h b/mozilla/intl/unicharutil/src/nsUcharUtilConstructors.h index 56ce43874e5..7bc2671b60e 100644 --- a/mozilla/intl/unicharutil/src/nsUcharUtilConstructors.h +++ b/mozilla/intl/unicharutil/src/nsUcharUtilConstructors.h @@ -47,7 +47,6 @@ #include "nsEntityConverter.h" #include "nsSaveAsCharset.h" #include "nsUUDll.h" -#include "nsFileSpec.h" #include "nsIFile.h" #include "nsUnicodeNormalizer.h" diff --git a/mozilla/js/src/xpconnect/Makefile.in b/mozilla/js/src/xpconnect/Makefile.in index 593182a7266..0c9f1976f40 100644 --- a/mozilla/js/src/xpconnect/Makefile.in +++ b/mozilla/js/src/xpconnect/Makefile.in @@ -38,7 +38,13 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk -DIRS = public idl loader src shell +DIRS = public idl + +ifdef MOZ_JSLOADER +DIRS += loader +endif + +DIRS += src shell ifdef ENABLE_TESTS DIRS += tests diff --git a/mozilla/js/src/xpconnect/loader/mozJSComponentLoader.h b/mozilla/js/src/xpconnect/loader/mozJSComponentLoader.h index 00ce1673aff..6f2742ccf53 100644 --- a/mozilla/js/src/xpconnect/loader/mozJSComponentLoader.h +++ b/mozilla/js/src/xpconnect/loader/mozJSComponentLoader.h @@ -26,7 +26,6 @@ #include "nsIXPConnect.h" #include "nsIModule.h" #include "nsSupportsArray.h" -#include "nsIFileSpec.h" #include "nsIFile.h" #ifndef XPCONNECT_STANDALONE #include "nsIPrincipal.h" diff --git a/mozilla/js/src/xpconnect/shell/xpcshell.cpp b/mozilla/js/src/xpconnect/shell/xpcshell.cpp index 46511b21521..9021f2a14b8 100644 --- a/mozilla/js/src/xpconnect/shell/xpcshell.cpp +++ b/mozilla/js/src/xpconnect/shell/xpcshell.cpp @@ -73,8 +73,6 @@ #include "jsarena.h" #include "jscntxt.h" -#include "nsSpecialSystemDirectory.h" // For exe dir - #include "nsIJSContextStack.h" /***************************************************************************/ @@ -196,7 +194,7 @@ Dump(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) return JS_FALSE; char *bytes = JS_GetStringBytes(str); - bytes = nsCRT::strdup(bytes); + bytes = strdup(bytes); #ifdef XP_MAC for (char *c = bytes; *c; c++) diff --git a/mozilla/js/src/xpconnect/src/Makefile.in b/mozilla/js/src/xpconnect/src/Makefile.in index 22b20ea796d..3be0e8687e9 100644 --- a/mozilla/js/src/xpconnect/src/Makefile.in +++ b/mozilla/js/src/xpconnect/src/Makefile.in @@ -110,9 +110,11 @@ EXTRA_DSO_LDOPTS += \ $(MOZ_JS_LIBS) \ $(NULL) +ifdef MOZ_JSLOADER SHARED_LIBRARY_LIBS = \ $(DIST)/lib/$(LIB_PREFIX)jsloader_s.$(LIB_SUFFIX) \ $(NULL) +endif include $(topsrcdir)/config/rules.mk diff --git a/mozilla/js/src/xpconnect/src/xpcmodule.cpp b/mozilla/js/src/xpconnect/src/xpcmodule.cpp index e6b180eb1e4..02d25c33f2a 100644 --- a/mozilla/js/src/xpconnect/src/xpcmodule.cpp +++ b/mozilla/js/src/xpconnect/src/xpcmodule.cpp @@ -36,8 +36,9 @@ /* Module level methods. */ #include "xpcprivate.h" - +#ifdef MOZ_JSLOADER #include "mozJSLoaderConstructors.h" +#endif /* Module implementation for the xpconnect library. */ @@ -83,6 +84,7 @@ static const nsModuleComponentInfo components[] = { {nsnull, SCRIPTABLE_INTERFACES_CID, NS_SCRIPTABLE_INTERFACES_CONTRACTID, nsXPCComponents_InterfacesConstructor }, {nsnull, XPCVARIANT_CID, XPCVARIANT_CONTRACTID, nsnull, nsnull, nsnull, nsnull, NS_CI_INTERFACE_GETTER_NAME(XPCVariant), nsnull, &NS_CLASSINFO_NAME(XPCVariant)}, +#ifdef MOZ_JSLOADER // jsloader stuff { "JS component loader", MOZJSCOMPONENTLOADER_CID, mozJSComponentLoaderContractID, mozJSComponentLoaderConstructor, @@ -91,6 +93,7 @@ static const nsModuleComponentInfo components[] = { ,{ "JS subscript loader", MOZ_JSSUBSCRIPTLOADER_CID, mozJSSubScriptLoadContractID, mozJSSubScriptLoaderConstructor } #endif +#endif #ifdef XPC_IDISPATCH_SUPPORT ,{ nsnull, NS_IDISPATCH_SUPPORT_CID, NS_IDISPATCH_SUPPORT_CONTRACTID, nsIDispatchSupportConstructor } diff --git a/mozilla/layout/base/nsCSSFrameConstructor.cpp b/mozilla/layout/base/nsCSSFrameConstructor.cpp index 365c432f4cc..8e6b1a657f8 100644 --- a/mozilla/layout/base/nsCSSFrameConstructor.cpp +++ b/mozilla/layout/base/nsCSSFrameConstructor.cpp @@ -115,6 +115,8 @@ #include "nsISelectElement.h" #include "nsLayoutErrors.h" #include "nsAutoPtr.h" +#include "nsScrollPortFrame.h" +#include "nsXULAtoms.h" static NS_DEFINE_CID(kTextNodeCID, NS_TEXTNODE_CID); static NS_DEFINE_CID(kHTMLElementFactoryCID, NS_HTML_ELEMENT_FACTORY_CID); @@ -5274,9 +5276,9 @@ nsCSSFrameConstructor::CreateAnonymousFrames(nsIPresShell* aPresShell aTag != nsHTMLAtoms::input && aTag != nsHTMLAtoms::textarea && aTag != nsHTMLAtoms::combobox && - aTag != nsHTMLAtoms::isindex && + aTag != nsHTMLAtoms::isindex #ifdef INCLUDE_XUL - aTag != nsXULAtoms::scrollbar + && aTag != nsXULAtoms::scrollbar #endif ) return NS_OK; diff --git a/mozilla/layout/build/Makefile.in b/mozilla/layout/build/Makefile.in index d77828e7968..ca7bb0260de 100644 --- a/mozilla/layout/build/Makefile.in +++ b/mozilla/layout/build/Makefile.in @@ -45,6 +45,7 @@ REQUIRES = xpcom \ content \ gfx \ widget \ + view \ locale \ necko \ dom \ @@ -87,9 +88,7 @@ SHARED_LIBRARY_LIBS = \ $(DIST)/lib/$(LIB_PREFIX)gkhtmltable_s.$(LIB_SUFFIX) \ $(DIST)/lib/$(LIB_PREFIX)gkxulbase_s.$(LIB_SUFFIX) \ $(DIST)/lib/$(LIB_PREFIX)gkbase_s.$(LIB_SUFFIX) \ - $(DIST)/lib/$(LIB_PREFIX)gkconshared_s.$(LIB_SUFFIX) \ - $(DIST)/lib/$(LIB_PREFIX)gkxultree_s.$(LIB_SUFFIX) \ - $(DIST)/lib/$(LIB_PREFIX)gkxulgrid_s.$(LIB_SUFFIX) \ + $(DIST)/lib/$(LIB_PREFIX)gkconbase_s.$(LIB_SUFFIX) \ $(DIST)/lib/$(LIB_PREFIX)gkconevents_s.$(LIB_SUFFIX) \ $(DIST)/lib/$(LIB_PREFIX)gkconhtmlcon_s.$(LIB_SUFFIX) \ $(DIST)/lib/$(LIB_PREFIX)gkconhtmldoc_s.$(LIB_SUFFIX) \ @@ -97,13 +96,21 @@ SHARED_LIBRARY_LIBS = \ $(DIST)/lib/$(LIB_PREFIX)gkconxmlcon_s.$(LIB_SUFFIX) \ $(DIST)/lib/$(LIB_PREFIX)gkconxmldoc_s.$(LIB_SUFFIX) \ $(DIST)/lib/$(LIB_PREFIX)gkconxsldoc_s.$(LIB_SUFFIX) \ - $(DIST)/lib/$(LIB_PREFIX)gkconxulcon_s.$(LIB_SUFFIX) \ - $(DIST)/lib/$(LIB_PREFIX)gkconxuldoc_s.$(LIB_SUFFIX) \ - $(DIST)/lib/$(LIB_PREFIX)gkconxultmpl_s.$(LIB_SUFFIX) \ $(DIST)/lib/$(LIB_PREFIX)gkconxbl_s.$(LIB_SUFFIX) \ - $(DIST)/lib/$(LIB_PREFIX)gkconbase_s.$(LIB_SUFFIX) \ + $(DIST)/lib/$(LIB_PREFIX)gkconxuldoc_s.$(LIB_SUFFIX) \ + $(DIST)/lib/$(LIB_PREFIX)gkconshared_s.$(LIB_SUFFIX) \ + $(DIST)/lib/$(LIB_PREFIX)gkview_s.$(LIB_SUFFIX) \ $(NULL) +ifdef MOZ_XUL +SHARED_LIBRARY_LIBS += \ + $(DIST)/lib/$(LIB_PREFIX)gkxultree_s.$(LIB_SUFFIX) \ + $(DIST)/lib/$(LIB_PREFIX)gkxulgrid_s.$(LIB_SUFFIX) \ + $(DIST)/lib/$(LIB_PREFIX)gkconxulcon_s.$(LIB_SUFFIX) \ + $(DIST)/lib/$(LIB_PREFIX)gkconxultmpl_s.$(LIB_SUFFIX) \ + $(NULL) +endif + ifdef MOZ_MATHML SHARED_LIBRARY_LIBS += \ $(DIST)/lib/$(LIB_PREFIX)gkmathmlcon_s.$(LIB_SUFFIX) \ @@ -156,6 +163,7 @@ INCLUDES += -I$(srcdir)/../base/src \ -I$(srcdir)/../../content/xul/content/src \ -I$(srcdir)/../../content/xul/templates/src \ -I$(srcdir)/../../content/events/src \ + -I$(topsrcdir)/view/src \ -I. \ $(NULL) diff --git a/mozilla/layout/build/nsLayoutModule.cpp b/mozilla/layout/build/nsLayoutModule.cpp index e9b0d8d9026..a847608a82e 100644 --- a/mozilla/layout/build/nsLayoutModule.cpp +++ b/mozilla/layout/build/nsLayoutModule.cpp @@ -128,6 +128,15 @@ #include "nsIAutoCopy.h" #include "nsIPrintPreviewContext.h" #include "nsCSSLoader.h" +#include "nsXULAtoms.h" +#include "nsLayoutCID.h" + +// view stuff +#include "nsViewsCID.h" +#include "nsView.h" +#include "nsScrollingView.h" +#include "nsScrollPortView.h" +#include "nsViewManager.h" class nsIDocumentLoaderFactory; @@ -148,7 +157,6 @@ class nsIDocumentLoaderFactory; #include "nsIXULPrototypeDocument.h" #include "nsIXULPrototypeDocument.h" #include "nsIXULSortService.h" -#include "nsXULAtoms.h" #include "nsXULContentUtils.h" #include "nsXULElement.h" @@ -220,9 +228,9 @@ Initialize(nsIModule* aSelf) nsHTMLAtoms::AddRefAtoms(); nsXBLAtoms::AddRefAtoms(); nsLayoutAtoms::AddRefAtoms(); + nsXULAtoms::AddRefAtoms(); #ifdef MOZ_XUL - nsXULAtoms::AddRefAtoms(); nsXULContentUtils::Init(); #endif @@ -283,16 +291,17 @@ Shutdown(nsIModule* aSelf) nsXBLAtoms::ReleaseAtoms(); nsLayoutAtoms::ReleaseAtoms(); + nsXULAtoms::ReleaseAtoms(); + nsRepeatService::Shutdown(); + nsStackLayout::Shutdown(); + nsBox::Shutdown(); + #ifdef MOZ_XUL nsXULContentUtils::Finish(); - nsXULAtoms::ReleaseAtoms(); nsXULElement::ReleaseGlobals(); nsXULPrototypeElement::ReleaseGlobals(); nsXULPrototypeScript::ReleaseGlobals(); - nsRepeatService::Shutdown(); nsSprocketLayout::Shutdown(); - nsStackLayout::Shutdown(); - nsBox::Shutdown(); #endif #ifdef MOZ_MATHML @@ -360,6 +369,35 @@ nsresult NS_NewFrameLoader(nsIFrameLoader** aResult); nsresult NS_NewSyncLoadDOMService(nsISyncLoadDOMService** aResult); nsresult NS_NewDOMEventGroup(nsIDOMEventGroup** aResult); +extern nsresult NS_CreateFrameTraversal(nsIFrameTraversal** aResult); +extern nsresult NS_CreateCSSFrameConstructor(nsICSSFrameConstructor** aResult); +extern nsresult NS_NewLayoutHistoryState(nsILayoutHistoryState** aResult); +extern nsresult NS_NewAutoCopyService(nsIAutoCopyService** aResult); +extern nsresult NS_NewSelectionImageService(nsISelectionImageService** aResult); + +extern nsresult NS_NewSelection(nsIFrameSelection** aResult); +extern nsresult NS_NewDomSelection(nsISelection** aResult); +extern nsresult NS_NewDocumentViewer(nsIDocumentViewer** aResult); +extern nsresult NS_NewRange(nsIDOMRange** aResult); +extern nsresult NS_NewRangeUtils(nsIRangeUtils** aResult); +extern nsresult NS_NewContentIterator(nsIContentIterator** aResult); +extern nsresult NS_NewPreContentIterator(nsIContentIterator** aResult); +extern nsresult NS_NewGenRegularIterator(nsIContentIterator** aResult); +extern nsresult NS_NewContentSubtreeIterator(nsIContentIterator** aResult); +extern nsresult NS_NewGenSubtreeIterator(nsIContentIterator** aInstancePtrResult); +extern nsresult NS_NewContentDocumentLoaderFactory(nsIDocumentLoaderFactory** aResult); +extern nsresult NS_NewHTMLElementFactory(nsIElementFactory** aResult); +extern nsresult NS_NewXMLElementFactory(nsIElementFactory** aResult); +extern nsresult NS_NewHTMLCopyTextEncoder(nsIDocumentEncoder** aResult); +extern nsresult NS_NewTextEncoder(nsIDocumentEncoder** aResult); +extern nsresult NS_NewXBLService(nsIXBLService** aResult); +extern nsresult NS_NewBindingManager(nsIBindingManager** aResult); +extern nsresult NS_NewNodeInfoManager(nsINodeInfoManager** aResult); +extern nsresult NS_NewContentPolicy(nsIContentPolicy** aResult); +extern nsresult NS_NewFrameLoader(nsIFrameLoader** aResult); +extern nsresult NS_NewSyncLoadDOMService(nsISyncLoadDOMService** aResult); +extern nsresult NS_NewDOMEventGroup(nsIDOMEventGroup** aResult); + #ifdef MOZ_XUL nsresult NS_NewXULElementFactory(nsIElementFactory** aResult); NS_IMETHODIMP NS_NewXULControllers(nsISupports* aOuter, REFNSIID aIID, void** aResult); @@ -402,6 +440,7 @@ MAKE_CTOR(CreateNewPresState, nsIPresState, NS_NewPresState) MAKE_CTOR(CreateNewGalleyContext, nsIPresContext, NS_NewGalleyContext) MAKE_CTOR(CreateNewPrintContext, nsIPrintContext, NS_NewPrintContext) MAKE_CTOR(CreateNewPrintPreviewContext, nsIPrintPreviewContext, NS_NewPrintPreviewContext) +#ifdef MOZ_XUL MAKE_CTOR(CreateNewBoxObject, nsIBoxObject, NS_NewBoxObject) MAKE_CTOR(CreateNewListBoxObject, nsIBoxObject, NS_NewListBoxObject) MAKE_CTOR(CreateNewMenuBoxObject, nsIBoxObject, NS_NewMenuBoxObject) @@ -411,6 +450,7 @@ MAKE_CTOR(CreateNewEditorBoxObject, nsIBoxObject, NS_NewEditorBoxO MAKE_CTOR(CreateNewIFrameBoxObject, nsIBoxObject, NS_NewIFrameBoxObject) MAKE_CTOR(CreateNewScrollBoxObject, nsIBoxObject, NS_NewScrollBoxObject) MAKE_CTOR(CreateNewTreeBoxObject, nsIBoxObject, NS_NewTreeBoxObject) +#endif MAKE_CTOR(CreateNewAutoCopyService, nsIAutoCopyService, NS_NewAutoCopyService) MAKE_CTOR(CreateSelectionImageService, nsISelectionImageService,NS_NewSelectionImageService) MAKE_CTOR(CreateCaret, nsICaret, NS_NewCaret) @@ -489,6 +529,38 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(nsWyciwygProtocolHandler) NS_GENERIC_FACTORY_CONSTRUCTOR(nsContentAreaDragDrop) MAKE_CTOR(CreateSyncLoadDOMService, nsISyncLoadDOMService, NS_NewSyncLoadDOMService) +// views are not refcounted, so this is the same as +// NS_GENERIC_FACTORY_CONSTRUCTOR without the NS_ADDREF/NS_RELEASE +#define NS_GENERIC_FACTORY_CONSTRUCTOR_NOREFS(_InstanceClass) \ +static NS_IMETHODIMP \ +_InstanceClass##Constructor(nsISupports *aOuter, REFNSIID aIID, \ + void **aResult) \ +{ \ + nsresult rv; \ + \ + _InstanceClass * inst; \ + \ + *aResult = NULL; \ + if (NULL != aOuter) { \ + rv = NS_ERROR_NO_AGGREGATION; \ + return rv; \ + } \ + \ + NS_NEWXPCOM(inst, _InstanceClass); \ + if (NULL == inst) { \ + rv = NS_ERROR_OUT_OF_MEMORY; \ + return rv; \ + } \ + rv = inst->QueryInterface(aIID, aResult); \ + \ + return rv; \ +} \ + +NS_GENERIC_FACTORY_CONSTRUCTOR(nsViewManager) +NS_GENERIC_FACTORY_CONSTRUCTOR_NOREFS(nsView) +NS_GENERIC_FACTORY_CONSTRUCTOR_NOREFS(nsScrollingView) +NS_GENERIC_FACTORY_CONSTRUCTOR_NOREFS(nsScrollPortView) + static NS_IMETHODIMP CreateHTMLImgElement(nsISupports* aOuter, REFNSIID aIID, void** aResult) { @@ -654,6 +726,7 @@ static const nsModuleComponentInfo gComponents[] = { CreateNewPrintPreviewContext }, // XXX end ick +#ifdef MOZ_XUL { "XUL Box Object", NS_BOXOBJECT_CID, "@mozilla.org/layout/xul-boxobject;1", @@ -698,6 +771,7 @@ static const nsModuleComponentInfo gComponents[] = { NS_TREEBOXOBJECT_CID, "@mozilla.org/layout/xul-boxobject-tree;1", CreateNewTreeBoxObject }, +#endif { "AutoCopy Service", NS_AUTOCOPYSERVICE_CID, @@ -1015,6 +1089,11 @@ static const nsModuleComponentInfo gComponents[] = { "@mozilla.org/DOM/Level2/CSS/computedStyleDeclaration;1", CreateComputedDOMStyle }, + { "XUL Controllers", + NS_XULCONTROLLERS_CID, + "@mozilla.org/xul/xul-controllers;1", + NS_NewXULControllers }, + #ifdef MOZ_XUL { "XUL Sort Service", NS_XULSORTSERVICE_CID, @@ -1046,11 +1125,6 @@ static const nsModuleComponentInfo gComponents[] = { "@mozilla.org/xul/xul-popup-listener;1", CreateXULPopupListener }, - { "XUL Controllers", - NS_XULCONTROLLERS_CID, - "@mozilla.org/xul/xul-controllers;1", - NS_NewXULControllers }, - { "XUL Prototype Cache", NS_XULPROTOTYPECACHE_CID, "@mozilla.org/xul/xul-prototype-cache;1", @@ -1065,6 +1139,11 @@ static const nsModuleComponentInfo gComponents[] = { NS_XULELEMENTFACTORY_CID, NS_ELEMENT_FACTORY_CONTRACTID_PREFIX "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul", CreateXULElementFactory }, +#else + { "XML Element Factory", + NS_XULELEMENTFACTORY_CID, + NS_ELEMENT_FACTORY_CONTRACTID_PREFIX "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul", + CreateXMLElementFactory }, #endif #ifdef MOZ_MATHML @@ -1113,8 +1192,16 @@ static const nsModuleComponentInfo gComponents[] = { { "SyncLoad DOM Service", NS_SYNCLOADDOMSERVICE_CID, NS_SYNCLOADDOMSERVICE_CONTRACTID, - CreateSyncLoadDOMService } + CreateSyncLoadDOMService }, + // view stuff + { "View Manager", NS_VIEW_MANAGER_CID, "@mozilla.org/view-manager;1", + nsViewManagerConstructor }, + { "View", NS_VIEW_CID, "@mozilla.org/view;1", nsViewConstructor }, + { "Scrolling View", NS_SCROLLING_VIEW_CID, "@mozilla.org/scrolling-view;1", + nsScrollingViewConstructor }, + { "Scroll Port View", NS_SCROLL_PORT_VIEW_CID, + "@mozilla.org/scroll-port-view;1", nsScrollPortViewConstructor } }; NS_IMPL_NSGETMODULE_WITH_CTOR_DTOR(nsLayoutModule, gComponents, Initialize, Shutdown) diff --git a/mozilla/layout/html/style/src/nsCSSFrameConstructor.cpp b/mozilla/layout/html/style/src/nsCSSFrameConstructor.cpp index 365c432f4cc..8e6b1a657f8 100644 --- a/mozilla/layout/html/style/src/nsCSSFrameConstructor.cpp +++ b/mozilla/layout/html/style/src/nsCSSFrameConstructor.cpp @@ -115,6 +115,8 @@ #include "nsISelectElement.h" #include "nsLayoutErrors.h" #include "nsAutoPtr.h" +#include "nsScrollPortFrame.h" +#include "nsXULAtoms.h" static NS_DEFINE_CID(kTextNodeCID, NS_TEXTNODE_CID); static NS_DEFINE_CID(kHTMLElementFactoryCID, NS_HTML_ELEMENT_FACTORY_CID); @@ -5274,9 +5276,9 @@ nsCSSFrameConstructor::CreateAnonymousFrames(nsIPresShell* aPresShell aTag != nsHTMLAtoms::input && aTag != nsHTMLAtoms::textarea && aTag != nsHTMLAtoms::combobox && - aTag != nsHTMLAtoms::isindex && + aTag != nsHTMLAtoms::isindex #ifdef INCLUDE_XUL - aTag != nsXULAtoms::scrollbar + && aTag != nsXULAtoms::scrollbar #endif ) return NS_OK; diff --git a/mozilla/mailnews/addrbook/build/Makefile.in b/mozilla/mailnews/addrbook/build/Makefile.in index 510abcba6ce..ee29469f5a0 100644 --- a/mozilla/mailnews/addrbook/build/Makefile.in +++ b/mozilla/mailnews/addrbook/build/Makefile.in @@ -33,6 +33,7 @@ EXPORT_LIBRARY = 1 IS_COMPONENT = 1 MODULE_NAME = nsAbModule REQUIRES = xpcom \ + xpcom_obsolete \ string \ necko \ mime \ @@ -78,6 +79,7 @@ EXTRA_DSO_LDOPTS = \ $(EXTRA_DSO_LIBS) \ $(MOZ_UNICHARUTIL_LIBS) \ $(MOZ_COMPONENT_LIBS) \ + $(MOZ_XPCOM_OBSOLETE_LIBS) \ $(NULL) include $(topsrcdir)/config/rules.mk diff --git a/mozilla/mailnews/addrbook/src/Makefile.in b/mozilla/mailnews/addrbook/src/Makefile.in index f2af22ccf6c..3373d3fdffd 100644 --- a/mozilla/mailnews/addrbook/src/Makefile.in +++ b/mozilla/mailnews/addrbook/src/Makefile.in @@ -30,6 +30,7 @@ MODULE = addrbook LIBRARY_NAME = addrbook_s META_COMPONENT = mail REQUIRES = xpcom \ + xpcom_obsolete \ string \ rdf \ rdfutil \ diff --git a/mozilla/mailnews/addrbook/src/nsDirectoryDataSource.cpp b/mozilla/mailnews/addrbook/src/nsDirectoryDataSource.cpp index ec7c890944d..027653b8eb4 100644 --- a/mozilla/mailnews/addrbook/src/nsDirectoryDataSource.cpp +++ b/mozilla/mailnews/addrbook/src/nsDirectoryDataSource.cpp @@ -48,6 +48,7 @@ #include "nsRDFCID.h" #include "nsIRDFNode.h" #include "nsEnumeratorUtils.h" +#include "nsAdapterEnumerator.h" #include "nsIObserverService.h" #include "nsString.h" diff --git a/mozilla/mailnews/base/build/Makefile.in b/mozilla/mailnews/base/build/Makefile.in index c5840fdc902..aa4605275cd 100644 --- a/mozilla/mailnews/base/build/Makefile.in +++ b/mozilla/mailnews/base/build/Makefile.in @@ -33,10 +33,12 @@ LIBRARY_NAME = msgbase RESFILE = mail.res endif META_COMPONENT = mail -EXPORT_LIBRARY = 1 +Expcom_obsolete_LIBRARY = 1 IS_COMPONENT = 1 MODULE_NAME = nsMsgBaseModule REQUIRES = xpcom \ + xpcom_obsolete \ + xpobsolete \ string \ necko \ intl \ @@ -87,6 +89,7 @@ EXTRA_DSO_LDOPTS = \ $(MOZ_JS_LIBS) \ $(MOZ_UNICHARUTIL_LIBS) \ $(MOZ_COMPONENT_LIBS) \ + $(MOZ_XPCOM_OBSOLETE_LIBS) \ $(NULL) LOCAL_INCLUDES = -I$(srcdir) -I$(srcdir)/../src diff --git a/mozilla/mailnews/base/search/src/Makefile.in b/mozilla/mailnews/base/search/src/Makefile.in index 311fdefca7f..be365da4db2 100644 --- a/mozilla/mailnews/base/search/src/Makefile.in +++ b/mozilla/mailnews/base/search/src/Makefile.in @@ -31,6 +31,7 @@ XPIDL_MODULE = msgsearch LIBRARY_NAME = msgsearch_s META_COMPONENT = mail REQUIRES = xpcom \ + xpcom_obsolete \ string \ mailnews \ msgdb \ diff --git a/mozilla/mailnews/base/src/Makefile.in b/mozilla/mailnews/base/src/Makefile.in index 78eb00f1da0..d3138df9966 100644 --- a/mozilla/mailnews/base/src/Makefile.in +++ b/mozilla/mailnews/base/src/Makefile.in @@ -30,6 +30,7 @@ MODULE = msgbase LIBRARY_NAME = msgbase_s META_COMPONENT = mail REQUIRES = xpcom \ + xpcom_obsolete \ string \ necko \ dom \ diff --git a/mozilla/mailnews/base/src/nsMsgFolderDataSource.cpp b/mozilla/mailnews/base/src/nsMsgFolderDataSource.cpp index fbf72b1107c..4f2460aaed0 100644 --- a/mozilla/mailnews/base/src/nsMsgFolderDataSource.cpp +++ b/mozilla/mailnews/base/src/nsMsgFolderDataSource.cpp @@ -49,6 +49,7 @@ #include "nsRDFCID.h" #include "nsIRDFNode.h" #include "nsEnumeratorUtils.h" +#include "nsAdapterEnumerator.h" #include "nsString.h" #include "nsCOMPtr.h" diff --git a/mozilla/mailnews/base/util/Makefile.in b/mozilla/mailnews/base/util/Makefile.in index 762f149f4b4..cb927d9696b 100644 --- a/mozilla/mailnews/base/util/Makefile.in +++ b/mozilla/mailnews/base/util/Makefile.in @@ -32,6 +32,7 @@ META_COMPONENT = mail EXPORT_LIBRARY = 1 SHORT_LIBNAME = msgbsutl REQUIRES = xpcom \ + xpcom_obsolete \ string \ msgbase \ rdf \ @@ -80,6 +81,7 @@ CPPSRCS = \ nsMsgTxn.cpp \ nsMsgI18N.cpp \ nsMsgUtf7Utils.cpp \ + nsAdapterEnumerator.cpp \ $(NULL) EXPORTS = \ @@ -101,6 +103,7 @@ EXPORTS = \ nsMsgTxn.h \ nsMsgI18N.h \ nsMsgUtf7Utils.h \ + nsAdapterEnumerator.h \ $(NULL) EXTRA_DSO_LDOPTS = \ @@ -108,6 +111,7 @@ EXTRA_DSO_LDOPTS = \ $(DIST)/lib/$(LIB_PREFIX)rdfutil_s.$(LIB_SUFFIX) \ $(MOZ_UNICHARUTIL_LIBS) \ $(MOZ_COMPONENT_LIBS) \ + $(MOZ_XPCOM_OBSOLETE_LIBS) \ $(NULL) DEFINES += -D_IMPL_NS_MSG_BASE diff --git a/mozilla/mailnews/compose/build/Makefile.in b/mozilla/mailnews/compose/build/Makefile.in index 4e8318d2a95..0e72e2545cf 100644 --- a/mozilla/mailnews/compose/build/Makefile.in +++ b/mozilla/mailnews/compose/build/Makefile.in @@ -37,6 +37,7 @@ ifeq ($(OS_ARCH),WINNT) XPIDL_MODULE = msgcompo endif REQUIRES = xpcom \ + xpcom_obsolete \ string \ msgbase \ msgbaseutil \ @@ -75,6 +76,7 @@ EXTRA_DSO_LDOPTS = \ $(MOZ_JS_LIBS) \ $(MOZ_UNICHARUTIL_LIBS) \ $(MOZ_COMPONENT_LIBS) \ + $(MOZ_XPCOM_OBSOLETE_LIBS) \ $(NULL) include $(topsrcdir)/config/rules.mk diff --git a/mozilla/mailnews/compose/src/Makefile.in b/mozilla/mailnews/compose/src/Makefile.in index 3bd8565e395..1a253b9f56d 100644 --- a/mozilla/mailnews/compose/src/Makefile.in +++ b/mozilla/mailnews/compose/src/Makefile.in @@ -30,6 +30,7 @@ MODULE = msgcompose LIBRARY_NAME = msgcompose_s META_COMPONENT = mail REQUIRES = xpcom \ + xpcom_obsolete \ string \ dom \ editor \ diff --git a/mozilla/mailnews/compose/src/nsMsgComposeContentHandler.cpp b/mozilla/mailnews/compose/src/nsMsgComposeContentHandler.cpp index 107b8b5218d..4ee76f5ef32 100644 --- a/mozilla/mailnews/compose/src/nsMsgComposeContentHandler.cpp +++ b/mozilla/mailnews/compose/src/nsMsgComposeContentHandler.cpp @@ -41,6 +41,7 @@ #include "nsMsgCompCID.h" #include "nsIChannel.h" #include "nsIURI.h" +#include "nsCRT.h" static NS_DEFINE_CID(kMsgComposeServiceCID, NS_MSGCOMPOSESERVICE_CID); diff --git a/mozilla/mailnews/db/msgdb/build/Makefile.in b/mozilla/mailnews/db/msgdb/build/Makefile.in index 7f344305ce1..707a8a6bfa9 100644 --- a/mozilla/mailnews/db/msgdb/build/Makefile.in +++ b/mozilla/mailnews/db/msgdb/build/Makefile.in @@ -33,6 +33,7 @@ EXPORT_LIBRARY = 1 IS_COMPONENT = 1 MODULE_NAME = nsMsgDBModule REQUIRES = xpcom \ + xpcom_obsolete \ string \ mailnews \ locale \ @@ -58,6 +59,7 @@ EXTRA_DSO_LDOPTS = \ $(LIBS_DIR) \ $(EXTRA_DSO_LIBS) \ $(MOZ_COMPONENT_LIBS) \ + $(MOZ_XPCOM_OBSOLETE_LIBS) \ $(NULL) include $(topsrcdir)/config/rules.mk diff --git a/mozilla/mailnews/db/msgdb/src/Makefile.in b/mozilla/mailnews/db/msgdb/src/Makefile.in index 7b1d28e8dfe..c3084807533 100644 --- a/mozilla/mailnews/db/msgdb/src/Makefile.in +++ b/mozilla/mailnews/db/msgdb/src/Makefile.in @@ -30,6 +30,7 @@ MODULE = msgdb LIBRARY_NAME = msgdb_s META_COMPONENT = mail REQUIRES = xpcom \ + xpcom_obsolete \ string \ mailnews \ mork \ diff --git a/mozilla/mailnews/extensions/mailviews/build/Makefile.in b/mozilla/mailnews/extensions/mailviews/build/Makefile.in index f551833f6ae..05d29fa88f3 100644 --- a/mozilla/mailnews/extensions/mailviews/build/Makefile.in +++ b/mozilla/mailnews/extensions/mailviews/build/Makefile.in @@ -61,6 +61,7 @@ EXTRA_DSO_LDOPTS = \ $(EXTRA_DSO_LIBS) \ $(MOZ_JS_LIBS) \ $(MOZ_COMPONENT_LIBS) \ + $(MOZ_XPCOM_OBSOLETE_LIBS) \ $(NULL) include $(topsrcdir)/config/rules.mk diff --git a/mozilla/mailnews/extensions/mailviews/src/Makefile.in b/mozilla/mailnews/extensions/mailviews/src/Makefile.in index c4d3d789c24..36548c7fd8c 100644 --- a/mozilla/mailnews/extensions/mailviews/src/Makefile.in +++ b/mozilla/mailnews/extensions/mailviews/src/Makefile.in @@ -30,6 +30,7 @@ MODULE = mailview LIBRARY_NAME = mailview_s META_COMPONENT = mail REQUIRES = xpcom \ + xpcom_obsolete \ string \ msgbase \ mailnews \ diff --git a/mozilla/mailnews/extensions/mdn/build/Makefile.in b/mozilla/mailnews/extensions/mdn/build/Makefile.in index ca9f72a8db3..5cfc0f5c5bb 100644 --- a/mozilla/mailnews/extensions/mdn/build/Makefile.in +++ b/mozilla/mailnews/extensions/mdn/build/Makefile.in @@ -34,6 +34,7 @@ SHORT_LIBNAME = msgmdn IS_COMPONENT = 1 MODULE_NAME = nsMsgMdnModule REQUIRES = xpcom \ + xpcom_obsolete \ string \ mailnews \ mime \ @@ -61,6 +62,7 @@ EXTRA_DSO_LDOPTS = \ $(EXTRA_DSO_LIBS) \ $(MOZ_JS_LIBS) \ $(MOZ_COMPONENT_LIBS) \ + $(MOZ_XPCOM_OBSOLETE_LIBS) \ $(NULL) include $(topsrcdir)/config/rules.mk diff --git a/mozilla/mailnews/extensions/mdn/src/Makefile.in b/mozilla/mailnews/extensions/mdn/src/Makefile.in index f1963ed46fd..25086b75e87 100644 --- a/mozilla/mailnews/extensions/mdn/src/Makefile.in +++ b/mozilla/mailnews/extensions/mdn/src/Makefile.in @@ -30,6 +30,7 @@ MODULE = msgmdn LIBRARY_NAME = msgmdn_s META_COMPONENT = mail REQUIRES = xpcom \ + xpcom_obsolete \ string \ dom \ msgbase \ diff --git a/mozilla/mailnews/extensions/smime/build/Makefile.in b/mozilla/mailnews/extensions/smime/build/Makefile.in index 61e72638259..ddb89a76990 100644 --- a/mozilla/mailnews/extensions/smime/build/Makefile.in +++ b/mozilla/mailnews/extensions/smime/build/Makefile.in @@ -60,6 +60,7 @@ EXTRA_DSO_LDOPTS = \ $(EXTRA_DSO_LIBS) \ $(MOZ_JS_LIBS) \ $(MOZ_COMPONENT_LIBS) \ + $(MOZ_XPCOM_OBSOLETE_LIBS) \ $(NULL) include $(topsrcdir)/config/rules.mk diff --git a/mozilla/mailnews/extensions/smime/src/Makefile.in b/mozilla/mailnews/extensions/smime/src/Makefile.in index bd96ba860a5..3ede4dc7144 100644 --- a/mozilla/mailnews/extensions/smime/src/Makefile.in +++ b/mozilla/mailnews/extensions/smime/src/Makefile.in @@ -30,6 +30,7 @@ MODULE = msgsmime LIBRARY_NAME = msgsmime_s META_COMPONENT = mail REQUIRES = xpcom \ + xpcom_obsolete \ string \ msgbase \ mime \ diff --git a/mozilla/mailnews/imap/build/Makefile.in b/mozilla/mailnews/imap/build/Makefile.in index 80dac9b61dc..aa3ac58a05e 100644 --- a/mozilla/mailnews/imap/build/Makefile.in +++ b/mozilla/mailnews/imap/build/Makefile.in @@ -33,6 +33,7 @@ EXPORT_LIBRARY = 1 IS_COMPONENT = 1 MODULE_NAME = IMAP_factory REQUIRES = xpcom \ + xpcom_obsolete \ string \ mailnews \ msgbase \ @@ -70,6 +71,7 @@ EXTRA_DSO_LDOPTS = \ $(EXTRA_DSO_LIBS) \ $(MOZ_UNICHARUTIL_LIBS) \ $(MOZ_COMPONENT_LIBS) \ + $(MOZ_XPCOM_OBSOLETE_LIBS) \ $(NULL) include $(topsrcdir)/config/rules.mk diff --git a/mozilla/mailnews/imap/src/Makefile.in b/mozilla/mailnews/imap/src/Makefile.in index a045196377a..ad17147b79f 100644 --- a/mozilla/mailnews/imap/src/Makefile.in +++ b/mozilla/mailnews/imap/src/Makefile.in @@ -30,6 +30,7 @@ MODULE = msgimap LIBRARY_NAME = msgimap_s META_COMPONENT = mail REQUIRES = xpcom \ + xpcom_obsolete \ string \ mailnews \ rdf \ diff --git a/mozilla/mailnews/imap/src/nsImapIncomingServer.h b/mozilla/mailnews/imap/src/nsImapIncomingServer.h index 99188c8846a..9187bc4a100 100644 --- a/mozilla/mailnews/imap/src/nsImapIncomingServer.h +++ b/mozilla/mailnews/imap/src/nsImapIncomingServer.h @@ -48,6 +48,7 @@ #include "nsIMsgLogonRedirector.h" #include "nsISubscribableServer.h" #include "nsIUrlListener.h" +#include "nsAdapterEnumerator.h" /* get some implementation from nsMsgIncomingServer */ class nsImapIncomingServer : public nsMsgIncomingServer, diff --git a/mozilla/mailnews/import/comm4x/src/Makefile.in b/mozilla/mailnews/import/comm4x/src/Makefile.in index c8c31b53bf5..7764c8151ad 100644 --- a/mozilla/mailnews/import/comm4x/src/Makefile.in +++ b/mozilla/mailnews/import/comm4x/src/Makefile.in @@ -57,6 +57,7 @@ META_COMPONENT = mail MODULE_NAME = nsComm4xMailImportModule REQUIRES = xpcom \ + xpcom_obsolete \ string \ intl \ import \ @@ -85,6 +86,7 @@ EXTRA_DSO_LDOPTS = \ $(LIBS_DIR) \ $(EXTRA_DSO_LIBS) \ $(MOZ_COMPONENT_LIBS) \ + $(MOZ_XPCOM_OBSOLETE_LIBS) \ $(NULL) diff --git a/mozilla/mailnews/import/eudora/src/Makefile.in b/mozilla/mailnews/import/eudora/src/Makefile.in index 327a9e226a3..fed7ad084ae 100644 --- a/mozilla/mailnews/import/eudora/src/Makefile.in +++ b/mozilla/mailnews/import/eudora/src/Makefile.in @@ -34,6 +34,7 @@ META_COMPONENT = mail MODULE_NAME = nsEudoraImportModule REQUIRES = xpcom \ + xpcom_obsolete \ string \ import \ intl \ @@ -74,6 +75,7 @@ endif EXTRA_DSO_LDOPTS = \ $(LIBS_DIR) \ $(EXTRA_DSO_LIBS) \ + $(MOZ_XPCOM_OBSOLETE_LIBS) \ $(MOZ_UNICHARUTIL_LIBS) \ $(MOZ_COMPONENT_LIBS) \ $(NULL) diff --git a/mozilla/mailnews/import/oexpress/Makefile.in b/mozilla/mailnews/import/oexpress/Makefile.in index 208db94107a..76faa39cabc 100644 --- a/mozilla/mailnews/import/oexpress/Makefile.in +++ b/mozilla/mailnews/import/oexpress/Makefile.in @@ -34,6 +34,7 @@ META_COMPONENT = mail MODULE_NAME = nsOEImport REQUIRES = xpcom \ + xpcom_obsolete \ string \ import \ addrbook \ @@ -70,6 +71,7 @@ endif EXTRA_DSO_LDOPTS = \ $(EXTRA_DSO_LIBS) \ $(MOZ_COMPONENT_LIBS) \ + $(MOZ_XPCOM_OBSOLETE_LIBS) \ $(NULL) include $(topsrcdir)/config/rules.mk diff --git a/mozilla/mailnews/import/outlook/src/Makefile.in b/mozilla/mailnews/import/outlook/src/Makefile.in index b44bbd2870c..a9c0be5c480 100644 --- a/mozilla/mailnews/import/outlook/src/Makefile.in +++ b/mozilla/mailnews/import/outlook/src/Makefile.in @@ -39,6 +39,7 @@ EXTRA_DSO_LIBS = msgbaseutil endif REQUIRES = xpcom \ + xpcom_obsolete \ string \ import \ intl \ @@ -77,6 +78,7 @@ EXTRA_DSO_LDOPTS = \ $(EXTRA_DSO_LIBS) \ $(MOZ_UNICHARUTIL_LIBS) \ $(MOZ_COMPONENT_LIBS) \ + $(MOZ_XPCOM_OBSOLETE_LIBS) \ $(NULL) include $(topsrcdir)/config/rules.mk diff --git a/mozilla/mailnews/import/src/Makefile.in b/mozilla/mailnews/import/src/Makefile.in index 5dc3ca0a3d3..230ffbf1273 100644 --- a/mozilla/mailnews/import/src/Makefile.in +++ b/mozilla/mailnews/import/src/Makefile.in @@ -33,6 +33,7 @@ EXPORT_LIBRARY = 1 IS_COMPONENT = 1 MODULE_NAME = nsImportServiceModule REQUIRES = xpcom \ + xpcom_obsolete \ string \ mailnews \ addrbook \ @@ -79,6 +80,7 @@ EXTRA_DSO_LDOPTS += \ $(EXTRA_DSO_LIBS) \ $(MOZ_UNICHARUTIL_LIBS) \ $(MOZ_COMPONENT_LIBS) \ + $(MOZ_XPCOM_OBSOLETE_LIBS) \ $(NULL) diff --git a/mozilla/mailnews/import/text/src/Makefile.in b/mozilla/mailnews/import/text/src/Makefile.in index e1415823268..ab500465479 100644 --- a/mozilla/mailnews/import/text/src/Makefile.in +++ b/mozilla/mailnews/import/text/src/Makefile.in @@ -33,6 +33,7 @@ EXPORT_LIBRARY = 1 IS_COMPONENT = 1 MODULE_NAME = nsTextImportModule REQUIRES = xpcom \ + xpcom_obsolete \ string \ import \ intl \ @@ -51,6 +52,7 @@ CPPSRCS = \ EXTRA_DSO_LDOPTS = \ $(MOZ_COMPONENT_LIBS) \ + $(MOZ_XPCOM_OBSOLETE_LIBS) \ $(NULL) include $(topsrcdir)/config/rules.mk diff --git a/mozilla/mailnews/local/build/Makefile.in b/mozilla/mailnews/local/build/Makefile.in index de11575b482..9fcbea4f1fa 100644 --- a/mozilla/mailnews/local/build/Makefile.in +++ b/mozilla/mailnews/local/build/Makefile.in @@ -34,6 +34,7 @@ SHORT_LIBNAME = msglocal IS_COMPONENT = 1 MODULE_NAME = local_mail_services REQUIRES = xpcom \ + xpcom_obsolete \ string \ mailnews \ msgbase \ @@ -68,6 +69,7 @@ EXTRA_DSO_LDOPTS = \ $(EXTRA_DSO_LIBS) \ $(MOZ_UNICHARUTIL_LIBS) \ $(MOZ_COMPONENT_LIBS) \ + $(MOZ_XPCOM_OBSOLETE_LIBS) \ $(NULL) include $(topsrcdir)/config/rules.mk diff --git a/mozilla/mailnews/local/src/Makefile.in b/mozilla/mailnews/local/src/Makefile.in index a247c2f2a45..61f9355352e 100644 --- a/mozilla/mailnews/local/src/Makefile.in +++ b/mozilla/mailnews/local/src/Makefile.in @@ -30,6 +30,7 @@ MODULE = msglocal LIBRARY_NAME = msglocal_s META_COMPONENT = mail REQUIRES = xpcom \ + xpcom_obsolete \ string \ msgbase \ msgbaseutil \ diff --git a/mozilla/mailnews/mapi/mapihook/src/Makefile.in b/mozilla/mailnews/mapi/mapihook/src/Makefile.in index 2fa07a5c358..bf590a99ba7 100644 --- a/mozilla/mailnews/mapi/mapihook/src/Makefile.in +++ b/mozilla/mailnews/mapi/mapihook/src/Makefile.in @@ -34,6 +34,7 @@ IS_COMPONENT = 1 META_COMPONENT = mail REQUIRES = xpcom \ + xpcom_obsolete \ string \ MapiProxy \ appshell \ @@ -88,6 +89,7 @@ EXTRA_DSO_LDOPTS= \ $(EXTRA_DSO_LIBS) \ $(MOZ_UNICHARUTIL_LIBS) \ $(XPCOM_LIBS) \ + $(MOZ_XPCOM_OBSOLETE_LIBS) \ $(NSPR_LIBS) \ $(NULL) diff --git a/mozilla/mailnews/mime/build/Makefile.in b/mozilla/mailnews/mime/build/Makefile.in index 311896c6212..1af9aaf0e58 100644 --- a/mozilla/mailnews/mime/build/Makefile.in +++ b/mozilla/mailnews/mime/build/Makefile.in @@ -33,6 +33,7 @@ EXPORT_LIBRARY = 1 IS_COMPONENT = 1 MODULE_NAME = mime_services REQUIRES = xpcom \ + xpcom_obsolete \ string \ necko \ msgbase \ @@ -58,6 +59,7 @@ EXTRA_DSO_LDOPTS = \ $(EXTRA_DSO_LIBS) \ $(MOZ_UNICHARUTIL_LIBS) \ $(MOZ_COMPONENT_LIBS) \ + $(MOZ_XPCOM_OBSOLETE_LIBS) \ $(NULL) include $(topsrcdir)/config/rules.mk diff --git a/mozilla/mailnews/mime/cthandlers/vcard/Makefile.in b/mozilla/mailnews/mime/cthandlers/vcard/Makefile.in index 7955bea579c..483710fc42b 100644 --- a/mozilla/mailnews/mime/cthandlers/vcard/Makefile.in +++ b/mozilla/mailnews/mime/cthandlers/vcard/Makefile.in @@ -33,6 +33,7 @@ EXPORT_LIBRARY = 1 IS_COMPONENT = 1 MODULE_NAME = nsVCardModule REQUIRES = xpcom \ + xpcom_obsolete \ string \ mime \ msgbase \ @@ -69,6 +70,7 @@ EXTRA_DSO_LDOPTS = \ $(LIBS_DIR) \ $(EXTRA_DSO_LIBS) \ $(MOZ_COMPONENT_LIBS) \ + $(MOZ_XPCOM_OBSOLETE_LIBS) \ $(NULL) include $(topsrcdir)/config/rules.mk diff --git a/mozilla/mailnews/mime/emitters/build/Makefile.in b/mozilla/mailnews/mime/emitters/build/Makefile.in index 70f5e72d557..13a84fad8bd 100644 --- a/mozilla/mailnews/mime/emitters/build/Makefile.in +++ b/mozilla/mailnews/mime/emitters/build/Makefile.in @@ -34,6 +34,7 @@ SHORT_LIBNAME = emitter IS_COMPONENT = 1 MODULE_NAME = nsMimeEmitterModule REQUIRES = xpcom \ + xpcom_obsolete \ string \ mime \ necko \ @@ -60,6 +61,7 @@ EXTRA_DSO_LDOPTS = \ $(LIBS_DIRS) \ $(MOZ_UNICHARUTIL_LIBS) \ $(MOZ_COMPONENT_LIBS) \ + $(MOZ_XPCOM_OBSOLETE_LIBS) \ $(EXTRA_DSO_LIBS) \ $(NULL) diff --git a/mozilla/mailnews/mime/emitters/src/Makefile.in b/mozilla/mailnews/mime/emitters/src/Makefile.in index 52e0c0468dd..a113d1531f3 100644 --- a/mozilla/mailnews/mime/emitters/src/Makefile.in +++ b/mozilla/mailnews/mime/emitters/src/Makefile.in @@ -30,7 +30,9 @@ MODULE = mimeemitter LIBRARY_NAME = emitterutil_s META_COMPONENT = mail REQUIRES = xpcom \ + xpcom_obsolete \ string \ + xpcom_obsolete \ mime \ msgbase \ msgbaseutil \ diff --git a/mozilla/mailnews/mime/src/Makefile.in b/mozilla/mailnews/mime/src/Makefile.in index e327e0318f1..3dd3c7fe1d5 100644 --- a/mozilla/mailnews/mime/src/Makefile.in +++ b/mozilla/mailnews/mime/src/Makefile.in @@ -38,6 +38,7 @@ MODULE = mime LIBRARY_NAME = mime_s META_COMPONENT = mail REQUIRES = xpcom \ + xpcom_obsolete \ string \ msgbase \ msgbaseutil \ diff --git a/mozilla/mailnews/news/build/Makefile.in b/mozilla/mailnews/news/build/Makefile.in index a90d91d38db..81b3918b379 100644 --- a/mozilla/mailnews/news/build/Makefile.in +++ b/mozilla/mailnews/news/build/Makefile.in @@ -33,6 +33,7 @@ EXPORT_LIBRARY = 1 IS_COMPONENT = 1 MODULE_NAME = nsMsgNewsModule REQUIRES = xpcom \ + xpcom_obsolete \ string \ mailnews \ msgbase \ @@ -70,6 +71,7 @@ EXTRA_DSO_LDOPTS = \ $(EXTRA_DSO_LIBS) \ $(MOZ_JS_LIBS) \ $(MOZ_COMPONENT_LIBS) \ + $(MOZ_XPCOM_OBSOLETE_LIBS) \ $(NULL) include $(topsrcdir)/config/rules.mk diff --git a/mozilla/mailnews/news/src/Makefile.in b/mozilla/mailnews/news/src/Makefile.in index b0ba9eaa641..6a3418211fd 100644 --- a/mozilla/mailnews/news/src/Makefile.in +++ b/mozilla/mailnews/news/src/Makefile.in @@ -30,6 +30,7 @@ MODULE = msgnews LIBRARY_NAME = msgnews_s META_COMPONENT = mail REQUIRES = xpcom \ + xpcom_obsolete \ string \ mailnews \ msgbase \ diff --git a/mozilla/mailnews/news/src/nsNntpIncomingServer.h b/mozilla/mailnews/news/src/nsNntpIncomingServer.h index 43e7d9eb306..516d71741cd 100644 --- a/mozilla/mailnews/news/src/nsNntpIncomingServer.h +++ b/mozilla/mailnews/news/src/nsNntpIncomingServer.h @@ -48,7 +48,7 @@ #include "plstr.h" #include "prprf.h" -#include "nsEnumeratorUtils.h" +#include "nsAdapterEnumerator.h" #include "nsIMsgWindow.h" #include "nsISubscribableServer.h" #include "nsMsgLineBuffer.h" diff --git a/mozilla/modules/libjar/nsJARURI.cpp b/mozilla/modules/libjar/nsJARURI.cpp index 232268f95d5..f4aa388f0fa 100644 --- a/mozilla/modules/libjar/nsJARURI.cpp +++ b/mozilla/modules/libjar/nsJARURI.cpp @@ -19,7 +19,6 @@ #include "nsJARURI.h" #include "nsNetUtil.h" #include "nsIIOService.h" -#include "nsFileSpec.h" #include "nsCRT.h" #include "nsIComponentManager.h" #include "nsIServiceManager.h" diff --git a/mozilla/modules/libpref/src/Makefile.in b/mozilla/modules/libpref/src/Makefile.in index 12877df979c..7d5977db277 100644 --- a/mozilla/modules/libpref/src/Makefile.in +++ b/mozilla/modules/libpref/src/Makefile.in @@ -37,6 +37,7 @@ endif GRE_MODULE = 1 REQUIRES = xpcom \ + xpcom_obsolete \ string \ js \ xpconnect \ diff --git a/mozilla/modules/libreg/xpcom/Makefile.in b/mozilla/modules/libreg/xpcom/Makefile.in deleted file mode 100644 index d13f174a8ae..00000000000 --- a/mozilla/modules/libreg/xpcom/Makefile.in +++ /dev/null @@ -1,69 +0,0 @@ -# -# The contents of this file are subject to the Netscape Public -# License Version 1.1 (the "License"); you may not use this file -# except in compliance with the License. You may obtain a copy of -# the License at http://www.mozilla.org/NPL/ -# -# Software distributed under the License is distributed on an "AS -# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or -# implied. See the License for the specific language governing -# rights and limitations under the License. -# -# The Original Code is mozilla.org code. -# -# The Initial Developer of the Original Code is Netscape -# Communications Corporation. Portions created by Netscape are -# Copyright (C) 1998 Netscape Communications Corporation. All -# Rights Reserved. -# -# Contributor(s): -# - -DEPTH = ../../.. -topsrcdir = @top_srcdir@ -srcdir = @srcdir@ -VPATH = @srcdir@ - -include $(DEPTH)/config/autoconf.mk - -MODULE = mozreg -LIBRARY_NAME = mozreg_s -XPIDL_MODULE = mozreg - -# we don't want the shared lib, but we want to force the creation of a -# static lib. -FORCE_STATIC_LIB = 1 - -REQUIRES = libreg \ - string \ - xpcom \ - $(NULL) - -EXPORTS = nsIRegistryUtils.h nsRegistry.h -XPIDLSRCS = nsIRegistry.idl -CPPSRCS = nsRegistry.cpp - - -TESTCPPSRCS = regExport.cpp - -CPPSRCS += $(TESTCPPSRCS) - -SIMPLE_PROGRAMS = $(TESTCPPSRCS:.cpp=$(BIN_SUFFIX)) - -LIBS = \ - $(XPCOM_LIBS) \ - $(NSPR_LIBS) \ - $(NULL) - - -EXTRA_DSO_LDOPTS += $(NSPR_LIBS) $(XPCOM_LIBS) - -SHARED_LIBRARY_LIBS = \ - $(DIST)/lib/$(LIB_PREFIX)mozreg_s.$(LIB_SUFFIX) \ - $(NULL) - -include $(topsrcdir)/config/rules.mk - - - - diff --git a/mozilla/modules/libreg/xpcom/nsIRegistry.idl b/mozilla/modules/libreg/xpcom/nsIRegistry.idl deleted file mode 100644 index 36d4c641a15..00000000000 --- a/mozilla/modules/libreg/xpcom/nsIRegistry.idl +++ /dev/null @@ -1,167 +0,0 @@ -/* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * The contents of this file are subject to the Mozilla Public License - * Version 1.1 (the "MPL"); you may not use this file except in - * compliance with the MPL. You may obtain a copy of the MPL at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the MPL is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the MPL - * for the specific language governing rights and limitations under the - * MPL. - * - * The Initial Developer of this code under the MPL is Netscape - * Communications Corporation. Portions created by Netscape are - * Copyright (C) 1999 Netscape Communications Corporation. All Rights - * Reserved. - */ -#include "nsISupports.idl" -#include "nsIEnumerator.idl" - -interface nsIFile; - -typedef PRUint32 nsRegistryKey; -typedef long nsWellKnownRegistry; - -[scriptable,uuid(5D41A440-8E37-11d2-8059-00600811A9C3)] -interface nsIRegistry : nsISupports -{ - const long None = 0; - const long Users = 1; - const long Common = 2; - const long CurrentUser = 3; - - const long ApplicationComponentRegistry = 1; - const long ApplicationRegistry = 2; - - // Dont use this one. This for internal use only. - const long ApplicationCustomRegistry = -1; - - void open(in nsIFile regFile); - void openWellKnownRegistry(in nsWellKnownRegistry regid); - - void flush(); - boolean isOpen(); - - nsRegistryKey addKey(in nsRegistryKey baseKey, in wstring keyname); - nsRegistryKey getKey(in nsRegistryKey baseKey, in wstring keyname); - void removeKey(in nsRegistryKey baseKey, in wstring keyname); - - wstring getString(in nsRegistryKey baseKey, in wstring valname); - void setString(in nsRegistryKey baseKey, in wstring valname, in wstring value); - - string getStringUTF8(in nsRegistryKey baseKey, in string path); - void setStringUTF8(in nsRegistryKey baseKey, in string path, in string value); - - void getBytesUTF8(in nsRegistryKey baseKey, in string path, out PRUint32 length, [retval, array, size_is(length)] out PRUint8 valueArray); - void setBytesUTF8(in nsRegistryKey baseKey, in string path, in PRUint32 length, [array, size_is(length)] in PRUint8 valueArray); - PRInt32 getInt(in nsRegistryKey baseKey, in string path); - void setInt(in nsRegistryKey baseKey, in string path, in PRInt32 value); - PRInt64 getLongLong(in nsRegistryKey baseKey, in string path); - void setLongLong(in nsRegistryKey baseKey, in string path, inout PRInt64 value); - - /** - * addSubtree() and friends need to be renamed to addKeyUTF8(). - * If you are using these forms make sure you pass UTF8 data - */ - nsRegistryKey addSubtree(in nsRegistryKey baseKey, in string path); - void removeSubtree(in nsRegistryKey baseKey, in string path); - nsRegistryKey getSubtree(in nsRegistryKey baseKey, in string path); - - nsRegistryKey addSubtreeRaw(in nsRegistryKey baseKey, in string path); - void removeSubtreeRaw(in nsRegistryKey baseKey, in string path); - nsRegistryKey getSubtreeRaw(in nsRegistryKey baseKey, in string path); - - nsIEnumerator enumerateSubtrees(in nsRegistryKey baseKey); - nsIEnumerator enumerateAllSubtrees(in nsRegistryKey baseKey); - nsIEnumerator enumerateValues(in nsRegistryKey baseKey); - - const unsigned long String = 1; - const unsigned long Int32 = 2; - const unsigned long Bytes = 3; - const unsigned long File = 4; - - unsigned long getValueType(in nsRegistryKey baseKey, in string path); - PRUint32 getValueLength(in nsRegistryKey baseKey, in string path); - void deleteValue(in nsRegistryKey baseKey, in string path); - - /** - * escapeKey() takes arbitrary binary data and converts it into - * valid ASCII which can be used as registry key or value names - */ - void escapeKey([array, size_is(length)] in PRUint8 key, in PRUint32 terminator, inout PRUint32 length, [retval, array, size_is(length)] out PRUint8 escaped); - void unescapeKey([array, size_is(length)] in PRUint8 escaped, in PRUint32 terminator, inout PRUint32 length, [retval, array, size_is(length)] out PRUint8 key); - - attribute string currentUserName; - - void pack(); -}; - -[scriptable, uuid(8cecf236-1dd2-11b2-893c-f9848956eaec)] -interface nsIRegistryEnumerator : nsIEnumerator -{ - void currentItemInPlaceUTF8(out nsRegistryKey key, - [shared, retval] out string item); -}; - -[scriptable, uuid(D1B54831-AC07-11d2-805E-00600811A9C3)] -interface nsIRegistryNode : nsISupports -{ - readonly attribute string nameUTF8; - readonly attribute wstring name; - readonly attribute nsRegistryKey key; -}; - -[scriptable,uuid(5316C380-B2F8-11d2-A374-0080C6F80E4B)] -interface nsIRegistryValue : nsISupports -{ - readonly attribute wstring name; - readonly attribute string nameUTF8; - readonly attribute unsigned long type; - readonly attribute PRUint32 length; -}; - -[uuid(3A15FC88-7A61-4Ab4-8E58-31E95fAB3DA8)] -/** - * It sucks that nsIRegistry has to always allocate and return - * strings. nsIRegistryGetter adds in interfaces for non allocating getters - * to registry values. - */ -interface nsIRegistryGetter : nsISupports -{ - /** - * Get a string value of attribute valname in widestring or utf8 format - * - * @return - * NS_OK on success. - * buf has the string value copied into it. length is NOT changed. - * NS_ERROR_REG_BUFFER_TOO_SMALL if not enough buffer space. - * length is updated to actual length in chars including - * terminating NULL and buf will be unchanged. - * NS_ERROR_FAILURE if an unknown error happened. state of buf and - * length undefined. - * various failure codes otherwise. buf and length wont be updated. - */ - void getStringUTF8IntoBuffer(in nsRegistryKey baseKey, in string path, - inout char buf, inout PRUint32 length); - - /** - * Get a a byte array value of attribute valname - * - * @return - * NS_OK on success. buf has the string value copied into it. - * length is updated to actual number of bytes copied into buf. - * NS_ERROR_REG_BUFFER_TOO_SMALL if not enough buffer space. - * length is updated to actual length in PRUint8s including - * terminating NULL and buf will be unchanged. - * NS_ERROR_FAILURE if an unknown error happened. state of buf and - * length undefined. - * various other failure codes otherwise. buf and length wont be updated. - */ - void getBytesUTF8IntoBuffer(in nsRegistryKey baseKey, in string path, - inout PRUint8 buf, inout PRUint32 length); -}; - -%{ C++ -#include "nsIRegistryUtils.h" -%} diff --git a/mozilla/modules/libreg/xpcom/nsIRegistryUtils.h b/mozilla/modules/libreg/xpcom/nsIRegistryUtils.h deleted file mode 100644 index d77d741a3c5..00000000000 --- a/mozilla/modules/libreg/xpcom/nsIRegistryUtils.h +++ /dev/null @@ -1,59 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: NPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Netscape Public License - * Version 1.1 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * http://www.mozilla.org/NPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is mozilla.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 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 NPL, 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 NPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ -#ifndef __nsIRegistryUtils_h -#define __nsIRegistryUtils_h - -#define NS_REGISTRY_CONTRACTID "@mozilla.org/registry;1" -#define NS_REGISTRY_CLASSNAME "Mozilla Registry" -/* be761f00-a3b0-11d2-996c-0080c7cb1081 */ -#define NS_REGISTRY_CID \ -{ 0xbe761f00, 0xa3b0, 0x11d2, \ - {0x99, 0x6c, 0x00, 0x80, 0xc7, 0xcb, 0x10, 0x81} } - -/*------------------------------- Error Codes ---------------------------------- -------------------------------------------------------------------------------*/ -#define NS_ERROR_REG_BADTYPE NS_ERROR_GENERATE_FAILURE( NS_ERROR_MODULE_REG, 1 ) -#define NS_ERROR_REG_NO_MORE NS_ERROR_GENERATE_SUCCESS( NS_ERROR_MODULE_REG, 2 ) -#define NS_ERROR_REG_NOT_FOUND NS_ERROR_GENERATE_FAILURE( NS_ERROR_MODULE_REG, 3 ) -#define NS_ERROR_REG_NOFILE NS_ERROR_GENERATE_FAILURE( NS_ERROR_MODULE_REG, 4 ) -#define NS_ERROR_REG_BUFFER_TOO_SMALL NS_ERROR_GENERATE_FAILURE( NS_ERROR_MODULE_REG, 5 ) -#define NS_ERROR_REG_NAME_TOO_LONG NS_ERROR_GENERATE_FAILURE( NS_ERROR_MODULE_REG, 6 ) -#define NS_ERROR_REG_NO_PATH NS_ERROR_GENERATE_FAILURE( NS_ERROR_MODULE_REG, 7 ) -#define NS_ERROR_REG_READ_ONLY NS_ERROR_GENERATE_FAILURE( NS_ERROR_MODULE_REG, 8 ) -#define NS_ERROR_REG_BAD_UTF8 NS_ERROR_GENERATE_FAILURE( NS_ERROR_MODULE_REG, 9 ) - -#endif diff --git a/mozilla/modules/libreg/xpcom/nsRegistry.cpp b/mozilla/modules/libreg/xpcom/nsRegistry.cpp deleted file mode 100644 index e3078def514..00000000000 --- a/mozilla/modules/libreg/xpcom/nsRegistry.cpp +++ /dev/null @@ -1,2014 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: NPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Netscape Public License - * Version 1.1 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * http://www.mozilla.org/NPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is mozilla.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 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 NPL, 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 NPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ - -#ifdef MOZ_LOGGING -#define FORCE_PR_LOG /* Allow logging in the release build */ -#endif - -#include "nsRegistry.h" -#include "nsIEnumerator.h" -#include "nsDirectoryService.h" -#include "nsDirectoryServiceDefs.h" -#include "nsAppDirectoryServiceDefs.h" -#include "NSReg.h" -#include "prmem.h" -#include "prlock.h" -#include "prlog.h" -#include "prprf.h" -#include "nsCRT.h" -#include "nsMemory.h" - -#include "nsCOMPtr.h" -#include "nsILocalFile.h" -#include "nsIServiceManager.h" -#include "nsTextFormatter.h" - -#include "nsComponentManager.h" - -#ifdef XP_BEOS -#include -#include -#endif - -/* extra locking for the paranoid */ -/* #define EXTRA_THREADSAFE */ -#ifndef EXTRA_THREADSAFE -#define PR_Lock(x) (void)0 -#define PR_Unlock(x) (void)0 -#endif - -// Logging of debug output -extern PRLogModuleInfo *nsComponentManagerLog; - -PRUnichar widestrFormat[] = { PRUnichar('%'),PRUnichar('s'),PRUnichar(0)}; - -/*-------------------------------- nsRegistry ---------------------------------- -| This class implements the nsIRegistry interface using the functions | -| provided by libreg (as declared in mozilla/modules/libreg/include/NSReg.h). | -| | -| Since that interface is designed to match the libreg function, this class | -| is implemented with each member function being a simple wrapper for the | -| corresponding libreg function. | -| | -| #define EXTRA_THREADSAFE if you are worried about libreg thread safety. | -| It should not be necessary, but I'll leave in the code for the paranoid. | -------------------------------------------------------------------------------*/ - - - -#include "nsRegistry.h" -/* -struct nsRegistry : public nsIRegistry { - // This class implements the nsISupports interface functions. - NS_DECL_ISUPPORTS - - // This class implements the nsIRegistry interface functions. - NS_DECL_NSIREGISTRY - - // ctor/dtor - nsRegistry(); - virtual ~nsRegistry(); - -protected: - HREG mReg; // Registry handle. -#ifdef EXTRA_THREADSAFE - PRLock *mregLock; // libreg isn't threadsafe. Use locks to synchronize. -#endif - char *mCurRegFile; // these are to prevent open from opening the registry again - nsWellKnownRegistry mCurRegID; - - NS_IMETHOD Close(); -}; // nsRegistry -*/ - -#include "nsIFactory.h" -/*----------------------------- nsRegistryFactory ------------------------------ -| Class factory for nsRegistry objects. | -------------------------------------------------------------------------------*/ -struct nsRegistryFactory : public nsIFactory { - // This class implements the nsISupports interface functions. - NS_DECL_ISUPPORTS - - // nsIFactory methods - NS_IMETHOD CreateInstance(nsISupports *,const nsIID &,void **); - NS_IMETHOD LockFactory(PRBool aLock); - - // ctor - nsRegistryFactory(); -}; - - -/*--------------------------- nsRegSubtreeEnumerator --------------------------- -| This class implements the nsIEnumerator interface and is used to implement | -| the nsRegistry EnumerateSubtrees and EnumerateAllSubtrees functions. | -------------------------------------------------------------------------------*/ -struct nsRegSubtreeEnumerator : public nsIRegistryEnumerator { - // This class implements the nsISupports interface functions. - NS_DECL_ISUPPORTS - - // This class implements the nsIEnumerator interface functions. - NS_DECL_NSIENUMERATOR - - // And our magic behind-the-back fast-path thing. - NS_DECL_NSIREGISTRYENUMERATOR - - // ctor/dtor - nsRegSubtreeEnumerator( HREG hReg, RKEY rKey, PRBool all ); - virtual ~nsRegSubtreeEnumerator(); - -protected: - NS_IMETHOD advance(); // Implementation file; does appropriate NR_RegEnum call. - HREG mReg; // Handle to registry we're affiliated with. - RKEY mKey; // Base key being enumerated. - char mName[MAXREGPATHLEN]; // The name of the current key which is in mNext - REGENUM mEnum; // Corresponding libreg "enumerator". - REGENUM mNext; // Lookahead value. - PRUint32 mStyle; // Style (indicates all or some); - PRBool mDone; // Done flag. -#ifdef EXTRA_THREADSAFE - PRLock *mregLock; -#endif -}; // nsRegSubtreeEnumerator - - -/*--------------------------- nsRegValueEnumerator ----------------------------- -| This class is a variation on nsRegSubtreeEnumerator that allocates | -| nsRegistryValue objects rather than nsRegistryNode objects. It also | -| overrides certain functions to make sure the "value" oriented libreg | -| functions used rather than the subtree oriented ones. | -------------------------------------------------------------------------------*/ -struct nsRegValueEnumerator : public nsRegSubtreeEnumerator { - // Override CurrentItem to allocate nsRegistryValue objects. - NS_IMETHOD CurrentItem( nsISupports **result ); - - // Override advance() to use proper NR_RegEnumEntries. - NS_IMETHOD advance(); - - // ctor/dtor - nsRegValueEnumerator( HREG hReg, RKEY rKey ); -}; // nsRegValueEnumerator - -/*------------------------------ nsRegistryNode -------------------------------- -| This class implements the nsIRegistryNode interface. Instances are | -| allocated by nsRegSubtreeEnumerator::CurrentItem. | -------------------------------------------------------------------------------*/ -struct nsRegistryNode : public nsIRegistryNode { - // This class implements the nsISupports interface functions. - NS_DECL_ISUPPORTS - - // This class implements the nsIRegistryNode interface functions. - NS_DECL_NSIREGISTRYNODE - - // ctor - nsRegistryNode( HREG hReg, char *name, RKEY childKey ); - virtual ~nsRegistryNode(); - -protected: - HREG mReg; // Handle to registry this node is part of. - char mName[MAXREGPATHLEN]; // Buffer to hold name. - RKEY mChildKey; // Key corresponding to mName -#ifdef EXTRA_THREADSAFE - PRLock *mregLock; -#endif -}; // nsRegistryNode - - -/*------------------------------ nsRegistryValue ------------------------------- -| This class implements the nsIRegistryValue interface. Instances are | -| allocated by nsRegValueEnumerator::CurrentItem. | -------------------------------------------------------------------------------*/ -struct nsRegistryValue : public nsIRegistryValue { - // This class implements the nsISupports interface functions. - NS_DECL_ISUPPORTS - - // This class implements the nsIRegistryValue interface functions. - NS_DECL_NSIREGISTRYVALUE - - // ctor - nsRegistryValue( HREG hReg, RKEY key, REGENUM slot ); - virtual ~nsRegistryValue(); - -protected: - nsresult getInfo(); // Get registry info. - HREG mReg; // Handle to registry this node is part of. - RKEY mKey; // Key this node is under. - REGENUM mEnum; // Copy of corresponding content of parent enumerator. - REGINFO mInfo; // Value info. - char mName[MAXREGNAMELEN]; // Buffer to hold name. - REGERR mErr; // XXX This causes this class to be NON THREAD SAFE -#ifdef EXTRA_THREADSAFE - PRLock *mregLock; -#endif -}; // nsRegistryValue - - -/*----------------------------- regerr2nsresult -------------------------------- -| This utility function maps a REGERR value to a corresponding nsresult | -| error code. | -------------------------------------------------------------------------------*/ -static nsresult regerr2nsresult( REGERR err ) { - nsresult rv = NS_ERROR_UNEXPECTED; - switch( err ) { - case REGERR_OK: - rv = NS_OK; - break; - - case REGERR_FAIL: - rv = NS_ERROR_FAILURE; - break; - - case REGERR_NOMORE: - rv = NS_ERROR_REG_NO_MORE; - break; - - case REGERR_NOFIND: - rv = NS_ERROR_REG_NOT_FOUND; - break; - - case REGERR_PARAM: - case REGERR_BADTYPE: - case REGERR_BADNAME: - rv = NS_ERROR_INVALID_ARG; - break; - - case REGERR_NOFILE: - rv = NS_ERROR_REG_NOFILE; - break; - - case REGERR_MEMORY: - rv = NS_ERROR_OUT_OF_MEMORY; - break; - - case REGERR_BUFTOOSMALL: - rv = NS_ERROR_REG_BUFFER_TOO_SMALL; - break; - - case REGERR_NAMETOOLONG: - rv = NS_ERROR_REG_NAME_TOO_LONG; - break; - - case REGERR_NOPATH: - rv = NS_ERROR_REG_NO_PATH; - break; - - case REGERR_READONLY: - rv = NS_ERROR_REG_READ_ONLY; - break; - - case REGERR_BADUTF8: - rv = NS_ERROR_REG_BAD_UTF8; - break; - - } - return rv; -} - -/*----------------------------- reginfo2DataType ------------------------------- -| This utility function converts the type field in the REGINFO structure to | -| the corresponding nsIRegistry::DataType value. | -------------------------------------------------------------------------------*/ -static void reginfo2DataType( const REGINFO &in, PRUint32 &out ) { - // Transfer information, based on entry type. - switch( in.entryType ) { - case REGTYPE_ENTRY_STRING_UTF: - out = nsIRegistry::String; - //out.length = in.entryLength; - break; - - case REGTYPE_ENTRY_INT32_ARRAY: - out = nsIRegistry::Int32; - // Convert length in bytes to array dimension. - //out.length = in.entryLength / sizeof(PRInt32); - break; - - case REGTYPE_ENTRY_BYTES: - out = nsIRegistry::Bytes; - //out.length = in.entryLength; - break; - - case REGTYPE_ENTRY_FILE: - out = nsIRegistry::File; - //out.length = in.entryLength; - break; - } -} - -/*----------------------------- reginfo2DataType ------------------------------- -| This utility function converts the length field in the REGINFO structure to | -| the proper units (if type==Int32 array, we divide by sizeof(PRInt32)). | -------------------------------------------------------------------------------*/ -static void reginfo2Length( const REGINFO &in, PRUint32 &out ) { - // Transfer information, based on entry type. - switch( in.entryType ) { - case REGTYPE_ENTRY_STRING_UTF: - out = in.entryLength; - break; - - case REGTYPE_ENTRY_INT32_ARRAY: - // Convert length in bytes to array dimension. - out = in.entryLength / sizeof(PRInt32); - break; - - case REGTYPE_ENTRY_BYTES: - out = in.entryLength; - break; - - case REGTYPE_ENTRY_FILE: - out = in.entryLength; - break; - } -} - -/*------------------------ nsISupports Implementation -------------------------- -| This code generates the implementation of the nsISupports member functions | -| for each class implemented in this file. | -------------------------------------------------------------------------------*/ -NS_IMPL_THREADSAFE_ISUPPORTS2(nsRegistry, nsIRegistry, nsIRegistryGetter) -NS_IMPL_ISUPPORTS2( nsRegSubtreeEnumerator, nsIEnumerator, - nsIRegistryEnumerator) -NS_IMPL_ISUPPORTS1( nsRegistryNode, nsIRegistryNode ) -NS_IMPL_ISUPPORTS1( nsRegistryValue, nsIRegistryValue ) - -/*-------------------------- nsRegistry::nsRegistry ---------------------------- -| Vanilla nsRegistry constructor. | -------------------------------------------------------------------------------*/ -nsRegistry::nsRegistry() - : mReg(0), mCurRegID(0) { -#ifdef EXTRA_THREADSAFE - mregLock = PR_NewLock(); -#endif - return; -} - -/*------------------------- nsRegistry::~nsRegistry ---------------------------- -| The dtor closes the registry file(if open). | -------------------------------------------------------------------------------*/ -nsRegistry::~nsRegistry() { - if( mReg ) { - Close(); - } -#ifdef EXTRA_THREADSAFE - if (mregLock) { - PR_DestroyLock(mregLock); - } -#endif - return; -} - -/*----------------------------- nsRegistry::Open ------------------------------- -| If the argument is null, delegate to OpenDefault, else open the registry | -| file. We first check to see if a registry file is already open and close | -| it if so. | -------------------------------------------------------------------------------*/ -NS_IMETHODIMP nsRegistry::Open( nsIFile *regFile ) { - REGERR err = REGERR_OK; - - // Check for default. - if( !regFile ) { - return OpenWellKnownRegistry(nsIRegistry::ApplicationRegistry); - } - - nsCAutoString regPath; - nsresult rv = regFile->GetNativePath(regPath); - if (NS_FAILED(rv)) return rv; - -#ifdef DEBUG_dp - printf("nsRegistry: Opening registry %s\n", regPath.get()); -#endif /* DEBUG_dp */ - - if (mCurRegID != nsIRegistry::None && mCurRegID != nsIRegistry::ApplicationCustomRegistry) - { - // Cant open another registry without closing explictly. - return NS_ERROR_INVALID_ARG; - } - - // Do we have an open registry ? - if (mCurRegID != nsIRegistry::None) - { - PRBool equals; - if (mCurRegFile && NS_SUCCEEDED(mCurRegFile->Equals(regFile, &equals)) && equals) - { - // The right one is already open - return NS_OK; - } - else - { - // Opening a new registry without closing an already open one. - // This is an error. - return NS_ERROR_FAILURE; - } - } - - // Open specified registry. - PR_Lock(mregLock); - err = NR_RegOpen(NS_CONST_CAST(char*,regPath.get()), &mReg); - PR_Unlock(mregLock); - - mCurRegID = nsIRegistry::ApplicationCustomRegistry; - - // No error checking for no mem. Trust me. - if (NS_FAILED(regFile->Clone(getter_AddRefs(mCurRegFile)))) - mCurRegFile = nsnull; // not fatal - - // Convert the result. - return regerr2nsresult( err ); -} - -static void -EnsureDefaultRegistryDirectory() { - #if defined(XP_UNIX) && !defined(XP_MACOSX) - // Create ~/.mozilla as that is the default place for the registry file - - /* The default registry on the unix system is $HOME/.mozilla/registry per - * vr_findGlobalRegName(). vr_findRegFile() will create the registry file - * if it doesn't exist. But it wont create directories. - * - * Hence we need to create the directory if it doesn't exist already. - * - * Why create it here as opposed to the app ? - * ------------------------------------------ - * The app cannot create the directory in main() as most of the registry - * and initialization happens due to use of static variables. - * And we dont want to be dependent on the order in which - * these static stuff happen. - * - * Permission for the $HOME/.mozilla will be Read,Write,Execute - * for user only. Nothing to group and others. - */ - char *home = getenv("HOME"); - if (home != NULL) - { - char dotMozillaDir[1024]; - PR_snprintf(dotMozillaDir, sizeof(dotMozillaDir), - "%s/" NS_MOZILLA_DIR_NAME, home); - if (PR_Access(dotMozillaDir, PR_ACCESS_EXISTS) != PR_SUCCESS) - { - PR_MkDir(dotMozillaDir, NS_MOZILLA_DIR_PERMISSION); - PR_LOG(nsComponentManagerLog, PR_LOG_ALWAYS, - ("nsComponentManager: Creating Directory %s", dotMozillaDir)); - } - } -#endif /* XP_UNIX */ - -#ifdef XP_BEOS - BPath p; - const char *settings = "/boot/home/config/settings"; - if(find_directory(B_USER_SETTINGS_DIRECTORY, &p) == B_OK) - settings = p.Path(); - char settingsMozillaDir[1024]; - PR_snprintf(settingsMozillaDir, sizeof(settingsMozillaDir), - "%s/" NS_MOZILLA_DIR_NAME, settings); - if (PR_Access(settingsMozillaDir, PR_ACCESS_EXISTS) != PR_SUCCESS) { - PR_MkDir(settingsMozillaDir, NS_MOZILLA_DIR_PERMISSION); - PR_LOG(nsComponentManagerLog, PR_LOG_ALWAYS, - ("nsComponentManager: Creating Directory %s", settingsMozillaDir)); - } -#endif -} - -/*----------------------------- nsRegistry::OpenWellKnownRegistry -------------- -| Takes a registry id and maps that to a file name for opening. We first check | -| to see if a registry file is already open and close it if so. | -------------------------------------------------------------------------------*/ -NS_IMETHODIMP nsRegistry::OpenWellKnownRegistry( nsWellKnownRegistry regid ) -{ - REGERR err = REGERR_OK; - - if (mCurRegID != nsIRegistry::None && mCurRegID != regid) - { - // Cant open another registry without closing explictly. - return NS_ERROR_INVALID_ARG; - } - - if (mCurRegID == regid) - { - // Already opened. - return NS_OK; - } - - nsresult rv; - nsCOMPtr registryLocation; - - PRBool foundReg = PR_FALSE; - nsCAutoString regFile; - - switch ( (nsWellKnownRegistry) regid ) { - case ApplicationComponentRegistry: - NS_WARNING("ApplicationComponentRegistry is unsupported!"); - break; - case ApplicationRegistry: - { - // can't use NS_GetSpecialDirectory here. Called before service manager is initialized. - EnsureDefaultRegistryDirectory(); - nsCOMPtr directoryService; - rv = nsDirectoryService::Create(nsnull, - NS_GET_IID(nsIProperties), - getter_AddRefs(directoryService)); - if (NS_FAILED(rv)) return rv; - directoryService->Get(NS_APP_APPLICATION_REGISTRY_FILE, NS_GET_IID(nsIFile), - getter_AddRefs(registryLocation)); - - if (registryLocation) - { - foundReg = PR_TRUE; - rv = registryLocation->GetNativePath(regFile); // dougt fix... - // dveditz needs to fix his registry so that I can pass an - // nsIFile interface and not hack - if (NS_FAILED(rv)) - return rv; - } - } - break; - - default: - break; - } - - if (foundReg == PR_FALSE) { - return NS_ERROR_REG_BADTYPE; - } - -#ifdef DEBUG_dp - printf("nsRegistry: Opening std registry %s\n", regFile.get()); -#endif /* DEBUG_dp */ - - PR_Lock(mregLock); - err = NR_RegOpen((char*)regFile.get(), &mReg ); - PR_Unlock(mregLock); - - // Store the registry that was opened for optimizing future opens. - mCurRegID = regid; - - // Convert the result. - return regerr2nsresult( err ); -} - -#if 0 -/*-------------------------- nsRegistry::OpenDefault --------------------------- -| Open the "default" registry; in the case of this libreg-based implementation | -| that is done by passing a null file name pointer to NR_RegOpen. | -------------------------------------------------------------------------------*/ -NS_IMETHODIMP nsRegistry::OpenDefault() { - return OpenWellKnownRegistry(nsIRegistry::ApplicationRegistry); -} -#endif - -/*----------------------------- nsRegistry::Close ------------------------------ -| Tests the mReg handle and if non-null, closes the registry via NR_RegClose. | -------------------------------------------------------------------------------*/ -NS_IMETHODIMP nsRegistry::Close() { - REGERR err = REGERR_OK; - if( mReg ) { - PR_Lock(mregLock); - err = NR_RegClose( mReg ); - PR_Unlock(mregLock); - mReg = 0; - mCurRegFile = nsnull; - mCurRegID = 0; - } - return regerr2nsresult( err ); -} - -/*----------------------------- nsRegistry::Flush ------------------------------ -| Flushes the registry via NR_RegFlush. | -------------------------------------------------------------------------------*/ -NS_IMETHODIMP nsRegistry::Flush() { - REGERR err = REGERR_FAIL; - if( mReg ) { - PR_Lock(mregLock); - err = NR_RegFlush( mReg ); - PR_Unlock(mregLock); - } - return regerr2nsresult( err ); -} - -/*----------------------------- nsRegistry::IsOpen ----------------------------- -| Tests the mReg handle and returns whether the registry is open or not. | -------------------------------------------------------------------------------*/ -NS_IMETHODIMP nsRegistry::IsOpen( PRBool *result ) { - *result = ( mReg != 0 ); - return NS_OK; -} - - -/*--------------------------- nsRegistry::AddKey ------------------------------- -| Add a key into the registry or find an existing one. This is generally used | -| instead of GetKey unless it's an error for the key not to exist already i -------------------------------------------------------------------------------*/ -NS_IMETHODIMP nsRegistry::AddKey( nsRegistryKey baseKey, const PRUnichar *keyname, nsRegistryKey *_retval) -{ - if ( !keyname ) - return NS_ERROR_NULL_POINTER; - - return AddSubtree( baseKey, NS_ConvertUCS2toUTF8(keyname).get(), _retval ); -} - -/*--------------------------- nsRegistry::GetKey ------------------------------- -| returns the nsRegistryKey associated with a given node in the registry | -------------------------------------------------------------------------------*/ -NS_IMETHODIMP nsRegistry::GetKey(nsRegistryKey baseKey, const PRUnichar *keyname, nsRegistryKey *_retval) -{ - if ( !keyname || !_retval ) - return NS_ERROR_NULL_POINTER; - - return GetSubtree( baseKey, NS_ConvertUCS2toUTF8(keyname).get(), _retval ); -} - -/*--------------------------- nsRegistry::RemoveKey ---------------------------- -| Delete a key from the registry | -------------------------------------------------------------------------------*/ -NS_IMETHODIMP nsRegistry::RemoveKey(nsRegistryKey baseKey, const PRUnichar *keyname) -{ - if ( !keyname ) - return NS_ERROR_NULL_POINTER; - - return RemoveSubtree( baseKey, NS_ConvertUCS2toUTF8(keyname).get() ); -} - -NS_IMETHODIMP nsRegistry::GetString(nsRegistryKey baseKey, const PRUnichar *valname, PRUnichar **_retval) -{ - // Make sure caller gave us place for result. - if ( !valname || !_retval ) - return NS_ERROR_NULL_POINTER; - - // initialize the return value - *_retval = nsnull; - nsXPIDLCString tmpstr; - - nsresult rv = GetStringUTF8( baseKey, NS_ConvertUCS2toUTF8(valname).get(), getter_Copies(tmpstr) ); - - if (NS_SUCCEEDED(rv)) - { - *_retval = nsTextFormatter::smprintf( widestrFormat, tmpstr.get() ); - if ( *_retval == nsnull ) - rv = NS_ERROR_OUT_OF_MEMORY; - } - - return rv; -} - -NS_IMETHODIMP nsRegistry::SetString(nsRegistryKey baseKey, const PRUnichar *valname, const PRUnichar *value) -{ - if ( !valname || ! value ) - return NS_ERROR_NULL_POINTER; - - return SetStringUTF8( baseKey, - NS_ConvertUCS2toUTF8(valname).get(), - NS_ConvertUCS2toUTF8(value).get() ); -} - -/*--------------------------- nsRegistry::GetString ---------------------------- -| First, look for the entry using GetValueInfo. If found, and it's a string, | -| allocate space for it and fetch the value. | -------------------------------------------------------------------------------*/ -NS_IMETHODIMP nsRegistry::GetStringUTF8( nsRegistryKey baseKey, const char *path, char **result ) { - nsresult rv = NS_OK; - REGERR err = REGERR_OK; - - // Make sure caller gave us place for result. - if ( !result ) - return NS_ERROR_NULL_POINTER; - - char regStr[MAXREGPATHLEN]; - - // initialize the return value - *result = 0; - - // Attempt to get string into our fixed buffer - PR_Lock(mregLock); - err = NR_RegGetEntryString( mReg,(RKEY)baseKey,(char*)path, regStr, - sizeof(regStr) ); - PR_Unlock(mregLock); - - if ( err == REGERR_OK ) - { - *result = nsCRT::strdup(regStr); - if (!*result) - rv = NS_ERROR_OUT_OF_MEMORY; - } - else if ( err == REGERR_BUFTOOSMALL ) - { - // find the real size and malloc it - PRUint32 length; - rv = GetValueLength( baseKey, path, &length ); - // See if that worked. - if( rv == NS_OK ) - { - *result =(char*)nsMemory::Alloc( length + 1 ); - if( *result ) - { - // Get string from registry into result buffer. - PR_Lock(mregLock); - err = NR_RegGetEntryString( mReg,(RKEY)baseKey,(char*)path, *result, length+1 ); - PR_Unlock(mregLock); - - // Convert status. - rv = regerr2nsresult( err ); - if ( rv != NS_OK ) - { - // Didn't get result, free buffer - nsCRT::free( *result ); - *result = 0; - } - } - else - { - rv = NS_ERROR_OUT_OF_MEMORY; - } - } - } - else - { - // Convert status. - rv = regerr2nsresult( err ); - NS_ASSERTION(NS_FAILED(rv), "returning success code on failure"); - } - - return rv; -} - -NS_IMETHODIMP -nsRegistry::GetStringUTF8IntoBuffer( nsRegistryKey baseKey, const char *path, - char *buf, PRUint32 *length ) -{ - REGERR err = REGERR_OK; - - // Attempt to get string into our fixed buffer - PR_Lock(mregLock); - err = NR_RegGetEntryString( mReg,(RKEY)baseKey,(char*)path, buf, *length ); - PR_Unlock(mregLock); - - // Convert status. - nsresult rv = regerr2nsresult( err ); - - if (rv == NS_ERROR_REG_BUFFER_TOO_SMALL) { - // fill length with the actual length - nsresult rv1 = GetValueLength( baseKey, path, length ); - if(NS_FAILED(rv1)) - return rv1; - } - - return rv; -} - -/*--------------------------- nsRegistry::SetString ---------------------------- -| Simply sets the registry contents using NR_RegSetEntryString. | -------------------------------------------------------------------------------*/ -NS_IMETHODIMP nsRegistry::SetStringUTF8( nsRegistryKey baseKey, const char *path, const char *value ) { - REGERR err = REGERR_OK; - // Set the contents. - PR_Lock(mregLock); - err = NR_RegSetEntryString( mReg,(RKEY)baseKey,(char*)path,(char*)value ); - PR_Unlock(mregLock); - // Convert result. - return regerr2nsresult( err ); -} - -/*---------------------------- nsRegistry::GetBytesUTF8 ------------------------------ -| This function is just shorthand for fetching a char array. We | -| implement it "manually" using NR_RegGetEntry | -------------------------------------------------------------------------------*/ -NS_IMETHODIMP nsRegistry::GetBytesUTF8( nsRegistryKey baseKey, const char *path, PRUint32* length, PRUint8** result) { - nsresult rv = NS_OK; - REGERR err = REGERR_OK; - - if ( !result ) - return NS_ERROR_NULL_POINTER; - - char regStr[MAXREGPATHLEN]; - - // initialize the return value - *length = 0; - *result = 0; - - // Get info about the requested entry. - PRUint32 type; - rv = GetValueType( baseKey, path, &type ); - // See if that worked. - if( rv == NS_OK ) - { - // Make sure the entry is an PRInt8 array. - if( type == Bytes ) - { - // Attempt to get string into our fixed buffer - PR_Lock(mregLock); - uint32 length2 = sizeof regStr; - err = NR_RegGetEntry( mReg,(RKEY)baseKey,NS_CONST_CAST(char*,path), regStr, &length2); - PR_Unlock(mregLock); - - if ( err == REGERR_OK ) - { - *length = length2; - *result = (PRUint8*)(nsCRT::strdup(regStr)); - if (!*result) - { - rv = NS_ERROR_OUT_OF_MEMORY; - *length = 0; - } - else - { - *length = length2; - } - } - else if ( err == REGERR_BUFTOOSMALL ) - { - // find the real size and malloc it - rv = GetValueLength( baseKey, path, length ); - // See if that worked. - if( rv == NS_OK ) - { - *result = NS_REINTERPRET_CAST(PRUint8*,nsMemory::Alloc( *length )); - if( *result ) - { - // Get bytes from registry into result field. - PR_Lock(mregLock); - length2 = *length; - err = NR_RegGetEntry( mReg,(RKEY)baseKey,NS_CONST_CAST(char*,path), *result, &length2); - *length = length2; - PR_Unlock(mregLock); - // Convert status. - rv = regerr2nsresult( err ); - if ( rv != NS_OK ) - { - // Didn't get result, free buffer - nsCRT::free( NS_REINTERPRET_CAST(char*, *result) ); - *result = 0; - *length = 0; - } - } - else - { - rv = NS_ERROR_OUT_OF_MEMORY; - } - } - } - } - else - { - // They asked for the wrong type of value. - rv = NS_ERROR_REG_BADTYPE; - } - } - return rv; -} - -NS_IMETHODIMP -nsRegistry::GetBytesUTF8IntoBuffer( nsRegistryKey baseKey, const char *path, - PRUint8 *buf, PRUint32* length ) -{ - REGERR err = REGERR_OK; - - // Get info about the requested entry. - PRUint32 type; - nsresult rv = GetValueType( baseKey, path, &type ); - // See if that worked. - if(NS_FAILED(rv)) - return rv; - // Make sure we are dealing with bytes - if (type != Bytes) - return NS_ERROR_REG_BADTYPE; - - // Attempt to get bytes into our fixed buffer - PR_Lock(mregLock); - err = NR_RegGetEntry( mReg,(RKEY)baseKey,NS_CONST_CAST(char*,path), - buf, (uint32 *)length ); - PR_Unlock(mregLock); - - rv = regerr2nsresult(rv); - - if (rv == NS_ERROR_REG_BUFFER_TOO_SMALL) { - // fill length with the actual length - nsresult rv1 = GetValueLength( baseKey, path, length ); - if(NS_FAILED(rv1)) - return rv1; - } - - - return rv; -} - -/*---------------------------- nsRegistry::GetInt ------------------------------ -| This function is just shorthand for fetching a 1-element PRInt32 array. We | -| implement it "manually" using NR_RegGetEntry | -------------------------------------------------------------------------------*/ -NS_IMETHODIMP nsRegistry::GetInt( nsRegistryKey baseKey, const char *path, PRInt32 *result ) { - nsresult rv = NS_OK; - REGERR err = REGERR_OK; - - // Make sure caller gave us place for result. - if( result ) { - // Get info about the requested entry. - PRUint32 type; - rv = GetValueType( baseKey, path, &type ); - // See if that worked. - if( rv == NS_OK ) { - // Make sure the entry is an PRInt32 array. - if( type == Int32 ) { - uint32 len = sizeof *result; - // Get int from registry into result field. - PR_Lock(mregLock); - err = NR_RegGetEntry( mReg,(RKEY)baseKey,(char*)path, result, &len ); - PR_Unlock(mregLock); - // Convert status. - rv = regerr2nsresult( err ); - } else { - // They asked for the wrong type of value. - rv = NS_ERROR_REG_BADTYPE; - } - } - } else { - rv = NS_ERROR_NULL_POINTER; - } - return rv; -} - - -/*---------------------------- nsRegistry::GetLongLong-------------------------- -| This function is just shorthand for fetching a 1-element PRInt64 array. We | -| implement it "manually" using NR_RegGetEntry | -------------------------------------------------------------------------------*/ -NS_IMETHODIMP nsRegistry::GetLongLong( nsRegistryKey baseKey, const char *path, PRInt64 *result ) { - REGERR err = REGERR_OK; - - PR_Lock(mregLock); - - uint32 length = sizeof(PRInt64); - err = NR_RegGetEntry( mReg,(RKEY)baseKey,(char*)path,(void*)result,&length); - - PR_Unlock(mregLock); - - // Convert status. - return regerr2nsresult( err ); -} -/*---------------------------- nsRegistry::SetBytesUTF8 ------------------------------ -| Write out the value as a char array, using NR_RegSetEntry. | -------------------------------------------------------------------------------*/ -NS_IMETHODIMP nsRegistry::SetBytesUTF8( nsRegistryKey baseKey, const char *path, PRUint32 length, PRUint8* value) { - REGERR err = REGERR_OK; - // Set the contents. - PR_Lock(mregLock); - err = NR_RegSetEntry( mReg, - (RKEY)baseKey, - (char*)path, - REGTYPE_ENTRY_BYTES, - (char*)value, - length); - PR_Unlock(mregLock); - // Convert result. - return regerr2nsresult( err ); -} - -/*---------------------------- nsRegistry::SetInt ------------------------------ -| Write out the value as a one-element PRInt32 array, using NR_RegSetEntry. | -------------------------------------------------------------------------------*/ -NS_IMETHODIMP nsRegistry::SetInt( nsRegistryKey baseKey, const char *path, PRInt32 value ) { - REGERR err = REGERR_OK; - // Set the contents. - PR_Lock(mregLock); - err = NR_RegSetEntry( mReg, - (RKEY)baseKey, - (char*)path, - REGTYPE_ENTRY_INT32_ARRAY, - &value, - sizeof value ); - PR_Unlock(mregLock); - // Convert result. - return regerr2nsresult( err ); -} - - - -/*---------------------------- nsRegistry::SetLongLong--------------------------- -| Write out the value as a one-element PRInt64 array, using NR_RegSetEntry. | -------------------------------------------------------------------------------*/ -NS_IMETHODIMP nsRegistry::SetLongLong( nsRegistryKey baseKey, const char *path, PRInt64* value ) { - REGERR err = REGERR_OK; - // Set the contents. - PR_Lock(mregLock); - - err = NR_RegSetEntry( mReg, - (RKEY)baseKey, - (char*)path, - REGTYPE_ENTRY_BYTES, - (void*)value, - sizeof(PRInt64) ); - - PR_Unlock(mregLock); - // Convert result. - return regerr2nsresult( err ); -} - -/*-------------------------- nsRegistry::AddSubtree ---------------------------- -| Add a new registry subkey with the specified name, using NR_RegAddKey. | -------------------------------------------------------------------------------*/ -NS_IMETHODIMP nsRegistry::AddSubtree( nsRegistryKey baseKey, const char *path, nsRegistryKey *result ) { - REGERR err = REGERR_OK; - // Add the subkey. - PR_Lock(mregLock); - err = NR_RegAddKey( mReg,(RKEY)baseKey,(char*)path,(RKEY*)result ); - PR_Unlock(mregLock); - // Convert result. - return regerr2nsresult( err ); -} - -/*-------------------------- nsRegistry::AddSubtreeRaw-------------------------- -| Add a new registry subkey with the specified name, using NR_RegAddKeyRaw | -------------------------------------------------------------------------------*/ -NS_IMETHODIMP nsRegistry::AddSubtreeRaw( nsRegistryKey baseKey, const char *path, nsRegistryKey *result ) { - REGERR err = REGERR_OK; - // Add the subkey. - PR_Lock(mregLock); - err = NR_RegAddKeyRaw( mReg,(RKEY)baseKey,(char*)path,(RKEY*)result ); - PR_Unlock(mregLock); - // Convert result. - return regerr2nsresult( err ); -} - - -/*------------------------- nsRegistry::RemoveSubtree -------------------------- -| Deletes the subtree at a given location using NR_RegDeleteKey. | -------------------------------------------------------------------------------*/ -NS_IMETHODIMP nsRegistry::RemoveSubtree( nsRegistryKey baseKey, const char *path ) { - nsresult rv = NS_OK; - REGERR err = REGERR_OK; - - // libreg doesn't delete keys if there are subkeys under the key - // Hence we have to recurse through to delete the subtree - - RKEY key; - - PR_Lock(mregLock); - err = NR_RegGetKey(mReg, baseKey, (char *)path, &key); - PR_Unlock(mregLock); - if (err != REGERR_OK) - { - rv = regerr2nsresult( err ); - return rv; - } - - // Now recurse through and delete all keys under hierarchy - - char subkeyname[MAXREGPATHLEN+1]; - REGENUM state = 0; - subkeyname[0] = '\0'; - while (NR_RegEnumSubkeys(mReg, key, &state, subkeyname, sizeof(subkeyname), - REGENUM_NORMAL) == REGERR_OK) - { -#ifdef DEBUG_dp - printf("...recursing into %s\n", subkeyname); -#endif /* DEBUG_dp */ - // Even though this is not a "Raw" API the subkeys may still, in fact, - // *be* raw. Since we're recursively deleting this will work either way. - // If we were guaranteed none would be raw then a depth-first enumeration - // would be much more efficient. - err = RemoveSubtreeRaw(key, subkeyname); - if (err != REGERR_OK) break; - } - - // If success in deleting all subkeys, delete this key too - if (err == REGERR_OK) - { -#ifdef DEBUG_dp - printf("...deleting %s\n", path); -#endif /* DEBUG_dp */ - PR_Lock(mregLock); - err = NR_RegDeleteKey(mReg, baseKey, (char *)path); - PR_Unlock(mregLock); - } - - // Convert result. - rv = regerr2nsresult( err ); - return rv; -} - - -/*------------------------- nsRegistry::RemoveSubtreeRaw ----------------------- -| Deletes the subtree at a given location using NR_RegDeleteKeyRaw | -------------------------------------------------------------------------------*/ -NS_IMETHODIMP nsRegistry::RemoveSubtreeRaw( nsRegistryKey baseKey, const char *keyname ) { - nsresult rv = NS_OK; - REGERR err = REGERR_OK; - - // libreg doesn't delete keys if there are subkeys under the key - // Hence we have to recurse through to delete the subtree - - RKEY key; - char subkeyname[MAXREGPATHLEN+1]; - int n = sizeof(subkeyname); - REGENUM state = 0; - - PR_Lock(mregLock); - err = NR_RegGetKeyRaw(mReg, baseKey, (char *)keyname, &key); - PR_Unlock(mregLock); - if (err != REGERR_OK) - { - rv = regerr2nsresult( err ); - return rv; - } - - // Now recurse through and delete all keys under hierarchy - - subkeyname[0] = '\0'; - while (NR_RegEnumSubkeys(mReg, key, &state, subkeyname, n, REGENUM_NORMAL) == REGERR_OK) - { -#ifdef DEBUG_dp - printf("...recursing into %s\n", subkeyname); -#endif /* DEBUG_dp */ - err = RemoveSubtreeRaw(key, subkeyname); - if (err != REGERR_OK) break; - } - - // If success in deleting all subkeys, delete this key too - if (err == REGERR_OK) - { -#ifdef DEBUG_dp - printf("...deleting %s\n", keyname); -#endif /* DEBUG_dp */ - PR_Lock(mregLock); - err = NR_RegDeleteKeyRaw(mReg, baseKey, (char *)keyname); - PR_Unlock(mregLock); - } - - // Convert result. - rv = regerr2nsresult( err ); - return rv; -} -/*-------------------------- nsRegistry::GetSubtree ---------------------------- -| Returns a nsRegistryKey(RKEY) for a given key/path. The key is | -| obtained using NR_RegGetKey. | -------------------------------------------------------------------------------*/ -NS_IMETHODIMP nsRegistry::GetSubtree( nsRegistryKey baseKey, const char *path, nsRegistryKey *result ) { - nsresult rv = NS_OK; - REGERR err = REGERR_OK; - // Make sure we have a place for the result. - if( result ) { - // Get key. - PR_Lock(mregLock); - err = NR_RegGetKey( mReg,(RKEY)baseKey,(char*)path,(RKEY*)result ); - PR_Unlock(mregLock); - // Convert result. - rv = regerr2nsresult( err ); - } else { - rv = NS_ERROR_NULL_POINTER; - } - return rv; -} - -/*-------------------------- nsRegistry::GetSubtreeRaw-------------------------- -| Returns a nsRegistryKey(RKEY) for a given key/path. The key is | -| obtained using NR_RegGetKeyRaw. | -------------------------------------------------------------------------------*/ -NS_IMETHODIMP nsRegistry::GetSubtreeRaw( nsRegistryKey baseKey, const char *path, nsRegistryKey *result ) { - nsresult rv = NS_OK; - REGERR err = REGERR_OK; - // Make sure we have a place for the result. - if( result ) { - // Get key. - PR_Lock(mregLock); - err = NR_RegGetKeyRaw( mReg,(RKEY)baseKey,(char*)path,(RKEY*)result ); - PR_Unlock(mregLock); - // Convert result. - rv = regerr2nsresult( err ); - } else { - rv = NS_ERROR_NULL_POINTER; - } - return rv; -} - - -/*----------------------- nsRegistry::EnumerateSubtrees ------------------------ -| Allocate a nsRegSubtreeEnumerator object and return it to the caller. | -| We construct the enumerator using the registry handle from this registry | -| object, the user-specified registry key, and indicate that we don't want | -| to recurse down subtrees. No libreg functions are invoked at this point | -|(that will happen when the enumerator member functions are called). | -------------------------------------------------------------------------------*/ -NS_IMETHODIMP nsRegistry::EnumerateSubtrees( nsRegistryKey baseKey, nsIEnumerator **result ) { - nsresult rv = NS_OK; - // Make sure we have a place to put the result. - if( result ) { - *result = new nsRegSubtreeEnumerator( mReg,(RKEY)baseKey, PR_FALSE ); - // Check for success. - if( *result ) { - // Bump refcnt on behalf of caller. - NS_ADDREF(*result); - } else { - // Unable to allocate space for the enumerator object. - rv = NS_ERROR_OUT_OF_MEMORY; - } - } else { - rv = NS_ERROR_NULL_POINTER; - } - return rv; -} - -/*--------------------- nsRegistry::EnumerateAllSubtrees ----------------------- -| Same as EnumerateSubtrees but we pass PR_TRUE to request that the | -| enumerator object descend subtrees when it is used. | -------------------------------------------------------------------------------*/ -NS_IMETHODIMP nsRegistry::EnumerateAllSubtrees( nsRegistryKey baseKey, nsIEnumerator **result ) { - nsresult rv = NS_OK; - // Make sure we have a place to put the result. - if( result ) { - *result = new nsRegSubtreeEnumerator( mReg,(RKEY)baseKey, PR_TRUE ); - // Check for success. - if( *result ) { - // Bump refcnt on behalf of caller. - NS_ADDREF(*result); - } else { - // Unable to allocate space for the enumerator object. - rv = NS_ERROR_OUT_OF_MEMORY; - } - } else { - rv = NS_ERROR_NULL_POINTER; - } - return rv; -} - -/*------------------------- nsRegistry::GetValueType --------------------------- -| Gets the type from the registry using the NR_GetEntryInfo libreg API. | -| The result is transferred to the PRUint32 value passed in (with conversion | -| to the appropriate nsIRegistry::DataType value). | -------------------------------------------------------------------------------*/ -NS_IMETHODIMP nsRegistry::GetValueType( nsRegistryKey baseKey, const char *path, PRUint32 *result ) { - nsresult rv = NS_OK; - REGERR err = REGERR_OK; - // Make sure we have a place to put the result. - if( result ) { - // Get registry info into local structure. - REGINFO info = { sizeof info, 0, 0 }; - PR_Lock(mregLock); - err = NR_RegGetEntryInfo( mReg,(RKEY)baseKey,(char*)path, &info ); - PR_Unlock(mregLock); - if( err == REGERR_OK ) { - // Copy info to user's result value. - reginfo2DataType( info, *result ); - } else { - rv = regerr2nsresult( err ); - } - } else { - rv = NS_ERROR_NULL_POINTER; - } - return rv; -} - -/*------------------------ nsRegistry::GetValueLength -------------------------- -| Gets the registry value info via NR_RegGetEntryInfo. The length is | -| converted to the proper "units" via reginfo2Length. | -------------------------------------------------------------------------------*/ -NS_IMETHODIMP nsRegistry::GetValueLength( nsRegistryKey baseKey, const char *path, PRUint32 *result ) { - nsresult rv = NS_OK; - REGERR err = REGERR_OK; - // Make sure we have a place to put the result. - if( result ) { - // Get registry info into local structure. - REGINFO info = { sizeof info, 0, 0 }; - PR_Lock(mregLock); - err = NR_RegGetEntryInfo( mReg,(RKEY)baseKey,(char*)path, &info ); - PR_Unlock(mregLock); - if( err == REGERR_OK ) { - // Copy info to user's result value. - reginfo2Length( info, *result ); - } else { - rv = regerr2nsresult( err ); - } - } else { - rv = NS_ERROR_NULL_POINTER; - } - return rv; -} - -/*-------------------------- nsRegistry::DeleteValue --------------------------- -| Remove the registry value with the specified name | -------------------------------------------------------------------------------*/ -NS_IMETHODIMP nsRegistry::DeleteValue( nsRegistryKey baseKey, const char *path) -{ - REGERR err = REGERR_OK; - // Delete the value - PR_Lock(mregLock); - err = NR_RegDeleteEntry( mReg,(RKEY)baseKey,(char*)path ); - PR_Unlock(mregLock); - // Convert result. - return regerr2nsresult( err ); -} - -/*------------------------ nsRegistry::EnumerateValues ------------------------- -| Allocates and returns an instance of nsRegValueEnumerator constructed in | -| a similar fashion as the nsRegSubtreeEnumerator is allocated/returned by | -| EnumerateSubtrees. | -------------------------------------------------------------------------------*/ -NS_IMETHODIMP nsRegistry::EnumerateValues( nsRegistryKey baseKey, nsIEnumerator **result ) { - nsresult rv = NS_OK; - // Make sure we have a place to put the result. - if( result ) { - *result = new nsRegValueEnumerator( mReg,(RKEY)baseKey ); - // Check for success. - if( *result ) { - // Bump refcnt on behalf of caller. - NS_ADDREF(*result); - } else { - // Unable to allocate space for the enumerator object. - rv = NS_ERROR_OUT_OF_MEMORY; - } - } else { - rv = NS_ERROR_NULL_POINTER; - } - return rv; -} - -/*---------------------- nsRegistry::GetCurrentUserName ------------------------ -| Simple wrapper for NR_RegGetUsername. | -------------------------------------------------------------------------------*/ -NS_IMETHODIMP nsRegistry::GetCurrentUserName( char **result ) { - nsresult rv = NS_OK; - REGERR err = REGERR_OK; - // Make sure we have a place to put the result. - if( result ) { - // Get the user name. - PR_Lock(mregLock); - err = NR_RegGetUsername( result ); - PR_Unlock(mregLock); - // Convert the result. - rv = regerr2nsresult( err ); - } else { - rv = NS_ERROR_NULL_POINTER; - } - return rv; -} - -/*---------------------- nsRegistry::SetCurrentUserName ------------------------ -| Simple wrapper for NR_RegSetUsername. | -------------------------------------------------------------------------------*/ -NS_IMETHODIMP nsRegistry::SetCurrentUserName( const char *name ) { - nsresult rv = NS_OK; - REGERR err = REGERR_OK; - // Set the user name. - PR_Lock(mregLock); - err = NR_RegSetUsername( name ); - PR_Unlock(mregLock); - // Convert result. - rv = regerr2nsresult( err ); - return rv; -} - -/*----------------------------- nsRegistry::Pack ------------------------------- -| Simple wrapper for NR_RegPack. We don't set up any callback. | -------------------------------------------------------------------------------*/ -NS_IMETHODIMP nsRegistry::Pack() { - nsresult rv = NS_OK; - REGERR err = REGERR_OK; - // Pack the registry. - PR_Lock(mregLock); - err = NR_RegPack( mReg, 0, 0 ); - PR_Unlock(mregLock); - // Convert result. - rv = regerr2nsresult( err ); - return rv; -} - -/*----------------------------- nsRegistry::EscapeKey ------------------------------- -| Escape a binary key so that the registry works OK, since it expects UTF8 -| with no slashes or control characters. This is probably better than raw. -| If no escaping is required, then the method is successful and a null is -| returned, indicating that the caller should use the original string. -------------------------------------------------------------------------------*/ -static const char sEscapeKeyHex[] = "0123456789abcdef0123456789ABCDEF"; -NS_IMETHODIMP nsRegistry::EscapeKey(PRUint8* key, PRUint32 termination, PRUint32* length, PRUint8** escaped) -{ - nsresult rv = NS_OK; - char* value = (char*)key; - char* b = value; - char* e = b + *length; - int escapees = 0; - while (b < e) // Count characters outside legal range or slash - { - int c = *b++; - if (c <= ' ' - || c > '~' - || c == '/' - || c == '%') - { - escapees++; - } - } - if (escapees == 0) // If no escapees, then no results - { - *length = 0; - *escaped = nsnull; - return NS_OK; - } - // New length includes two extra chars for escapees. - *length += escapees * 2; - *escaped = (PRUint8*)nsMemory::Alloc(*length + termination); - if (*escaped == nsnull) - { - *length = 0; - *escaped = nsnull; - return NS_ERROR_OUT_OF_MEMORY; - } - char* n = (char*)*escaped; - b = value; - while (escapees && b < e) - { - char c = *b++; - if (c < ' ' - || c > '~' - || c == '/' - || c == '%') - { - *(n++) = '%'; - *(n++) = sEscapeKeyHex[ 0xF & (c >> 4) ]; - *(n++) = sEscapeKeyHex[ 0xF & c ]; - escapees--; - } - else - { - *(n++) = c; - } - } - e += termination; - if (b < e) - { - strncpy(n, b, e - b); - } - return rv; -} - -/*----------------------------- nsRegistry::UnescapeKey ------------------------------- -| Unscape a binary key so that the registry works OK, since it expects UTF8 -| with no slashes or control characters. This is probably better than raw. -| If no escaping is required, then the method is successful and a null is -| returned, indicating that the caller should use the original string. -------------------------------------------------------------------------------*/ -NS_IMETHODIMP nsRegistry::UnescapeKey(PRUint8* escaped, PRUint32 termination, PRUint32* length, PRUint8** key) -{ - nsresult rv = NS_OK; - char* value = (char*)escaped; - char* b = value; - char* e = b + *length; - int escapees = 0; - while (b < e) // Count characters outside legal range or slash - { - if (*b++ == '%') - { - escapees++; - } - } - if (escapees == 0) // If no escapees, then no results - { - *length = 0; - *key = nsnull; - return NS_OK; - } - // New length includes two extra chars for escapees. - *length -= escapees * 2; - *key = (PRUint8*)nsMemory::Alloc(*length + termination); - if (*key == nsnull) - { - *length = 0; - *key = nsnull; - return NS_ERROR_OUT_OF_MEMORY; - } - char* n = (char*)*key; - b = value; - while (escapees && b < e) - { - char c = *(b++); - if (c == '%') - { - if (e - b >= 2) - { - const char* c1 = strchr(sEscapeKeyHex, *(b++)); - const char* c2 = strchr(sEscapeKeyHex, *(b++)); - if (c1 != nsnull - && c2 != nsnull) - { - *(n++) = ((c2 - sEscapeKeyHex) & 0xF) - | (((c1 - sEscapeKeyHex) & 0xF) << 4); - } - else - { - escapees = -1; - } - } - else - { - escapees = -1; - } - escapees--; - } - else - { - *(n++) = c; - } - } - if (escapees < 0) - { - nsMemory::Free(*key); - *length = 0; - *key = nsnull; - return NS_ERROR_INVALID_ARG; - } - e += termination; - if (b < e) - { - strncpy(n, b, e - b); - } - return rv; -} - - -/*-------------- nsRegistry::SetBufferSize------------------------------------- -| Sets the size of the file used for the registry's buffer size. | -------------------------------------------------------------------------------*/ -int nsRegistry::SetBufferSize( int bufsize ) -{ - int newSize; - // set the file buffer size - PR_Lock(mregLock); - newSize = NR_RegSetBufferSize( mReg, bufsize ); - PR_Unlock(mregLock); - return newSize; -} - - -/*-------------- nsRegSubtreeEnumerator::nsRegSubtreeEnumerator ---------------- -| The ctor simply stashes all the information that will be needed to enumerate | -| the subkeys. | -------------------------------------------------------------------------------*/ -nsRegSubtreeEnumerator::nsRegSubtreeEnumerator( HREG hReg, RKEY rKey, PRBool all ) - : mReg( hReg ), mKey( rKey ), mEnum( 0 ), mNext( 0 ), - mStyle( all ? REGENUM_DESCEND : REGENUM_CHILDREN ), mDone( PR_FALSE ) { - - mName[0] = '\0'; - -#ifdef EXTRA_THREADSAFE - // Create a registry lock - mregLock = PR_NewLock(); -#endif - return; -} - -nsRegSubtreeEnumerator::~nsRegSubtreeEnumerator() -{ -#ifdef EXTRA_THREADSAFE - if (mregLock) { - PR_DestroyLock(mregLock); - } -#endif -} - -/*----------------------- nsRegSubtreeEnumerator::First ------------------------ -| Set mEnum to 0; this will cause the next NR_RegEnum call to go to | -| the beginning. We then do a Next() call in order to do a "lookahead" to | -| properly detect an empty list (i.e., set the mDone flag). | -------------------------------------------------------------------------------*/ -NS_IMETHODIMP -nsRegSubtreeEnumerator::First() { - nsresult rv = NS_OK; - // Reset "done" flag. - mDone = PR_FALSE; - // Clear Name - mName[0] = '\0'; - // Go to beginning. - mEnum = mNext = 0; - // Lookahead so mDone flag gets set for empty list. - rv = Next(); - return rv; -} - -/*----------------------- nsRegSubtreeEnumerator::Next ------------------------- -| First, we check if we've already advanced to the end by checking the mDone | -| flag. | -| | -| We advance mEnum to the next enumeration value which is in the mNext | -| lookahead buffer. We must then call advance to lookahead and properly set | -| the isDone flag. | -------------------------------------------------------------------------------*/ -NS_IMETHODIMP -nsRegSubtreeEnumerator::Next() { - nsresult rv = NS_OK; - // Check for at end. - if ( !mDone ) { - // Advance to next spot. - mEnum = mNext; - // Lookahead so mDone is properly set (and to update mNext). - rv = advance(); - } else { - // Set result accordingly. - rv = regerr2nsresult( REGERR_NOMORE ); - } - return rv; -} - -/*---------------------- nsRegSubtreeEnumerator::advance ----------------------- -| Advance mNext to next subkey using NR_RegEnumSubkeys. We set mDone if | -| there are no more subkeys. | -------------------------------------------------------------------------------*/ -NS_IMETHODIMP nsRegSubtreeEnumerator::advance() { - REGERR err = REGERR_OK; - PR_Lock(mregLock); - err = NR_RegEnumSubkeys( mReg, mKey, &mNext, mName, sizeof mName, mStyle ); - // See if we ran off end. - if( err == REGERR_NOMORE ) { - // Remember we've run off end. - mDone = PR_TRUE; - } - PR_Unlock(mregLock); - // Convert result. - nsresult rv = regerr2nsresult( err ); - return rv; -}; - -/*-------------------- nsRegSubtreeEnumerator::CurrentItem --------------------- -| Allocates and returns a new instance of class nsRegistryNode. The node | -| object will hold the curent mEnum value so it can obtain its name from | -| the registry when asked. | -------------------------------------------------------------------------------*/ -NS_IMETHODIMP -nsRegSubtreeEnumerator::CurrentItem( nsISupports **result) { - nsresult rv = NS_OK; - // Make sure there is a place to put the result. - if( result ) { - *result = new nsRegistryNode( mReg, mName, (RKEY) mNext ); - if( *result ) { - NS_ADDREF(*result); - } else { - rv = NS_ERROR_OUT_OF_MEMORY; - } - } else { - rv = NS_ERROR_NULL_POINTER; - } - return rv; -} - -/*--------------nsRegSubtreeEnumerator::CurrentItemInPlaceUTF8----------------- -| An ugly name for an ugly function. Hands back a shared pointer to the | -| name (encoded as UTF-8), and the subkey identifier. | ------------------------------------------------------------------------------*/ -NS_IMETHODIMP -nsRegSubtreeEnumerator::CurrentItemInPlaceUTF8( nsRegistryKey *childKey , - const char **name ) -{ - *childKey = mNext; - /* [shared] */ - *name = mName; - return NS_OK; -} - -/*---------------------- nsRegSubtreeEnumerator::IsDone ------------------------ -| Simply return mDone. | -------------------------------------------------------------------------------*/ -NS_IMETHODIMP -nsRegSubtreeEnumerator::IsDone() { - nsresult rv = mDone ? NS_OK : NS_ENUMERATOR_FALSE; - return rv; -} - - -/*---------------- nsRegValueEnumerator::nsRegValueEnumerator ------------------ -| Delegates everything to the base class constructor. | -------------------------------------------------------------------------------*/ -nsRegValueEnumerator::nsRegValueEnumerator( HREG hReg, RKEY rKey ) - : nsRegSubtreeEnumerator( hReg, rKey, PR_FALSE ) { - return; -} - - -/*--------------------- nsRegValueEnumerator::CurrentItem ---------------------- -| As the nsRegSubtreeEnumerator counterpart, but allocates an object of | -| class nsRegistryValue. | -------------------------------------------------------------------------------*/ -NS_IMETHODIMP -nsRegValueEnumerator::CurrentItem( nsISupports **result ) { - nsresult rv = NS_OK; - // Make sure there is a place to put the result. - if( result ) { - *result = new nsRegistryValue( mReg, mKey, mEnum ); - if( *result ) { - NS_ADDREF(*result); - } else { - rv = NS_ERROR_OUT_OF_MEMORY; - } - } else { - rv = NS_ERROR_NULL_POINTER; - } - return rv; -} - -/*----------------------- nsRegValueEnumerator::advance ------------------------ -| Advance mNext to next subkey using NR_RegEnumEntries. We set mDone if | -| there are no more entries. | -------------------------------------------------------------------------------*/ -NS_IMETHODIMP nsRegValueEnumerator::advance() { - REGERR err = REGERR_OK; - char name[MAXREGNAMELEN]; - PRUint32 len = sizeof name; - REGINFO info = { sizeof info, 0, 0 }; - PR_Lock(mregLock); - err = NR_RegEnumEntries( mReg, mKey, &mNext, name, len, &info ); - // See if we ran off end. - if( err == REGERR_NOMORE ) { - // Remember we've run off end. - mDone = PR_TRUE; - } - PR_Unlock(mregLock); - // Convert result. - nsresult rv = regerr2nsresult( err ); - return rv; -}; - - -/*---------------------- nsRegistryNode::nsRegistryNode ------------------------ -| Store the arguments in the corresponding data members and initialize | -| the other data members. We defer the libreg calls till we're asked for | -| our name. We use mErr==-1 to indicate we haven't fetched the name yet. | -------------------------------------------------------------------------------*/ -nsRegistryNode::nsRegistryNode( HREG hReg, char *name, RKEY childKey ) - : mReg( hReg ), mChildKey( childKey ) { - - PR_ASSERT(name != nsnull); - strcpy(mName, name); - -#ifdef EXTRA_THREADSAFE - mregLock = PR_NewLock(); -#endif - - return; -} - -nsRegistryNode::~nsRegistryNode() -{ -#ifdef EXTRA_THREADSAFE - if (mregLock) { - PR_DestroyLock(mregLock); - } -#endif -} - -/*-------------------------- nsRegistryNode::GetName --------------------------- -| If we haven't fetched it yet, get the name of the corresponding subkey now, | -| using NR_RegEnumSubkeys. | -------------------------------------------------------------------------------*/ -NS_IMETHODIMP nsRegistryNode::GetName( PRUnichar **result ) { - if (result == nsnull) return NS_ERROR_NULL_POINTER; - // Make sure there is a place to put the result. - *result = nsTextFormatter::smprintf( widestrFormat, mName ); - if ( !*result ) return NS_ERROR_OUT_OF_MEMORY; - return NS_OK; -} - -/*-------------------------- nsRegistryNode::GetNameUTF8 ----------------------- -| If we haven't fetched it yet, get the name of the corresponding subkey now, | -| using NR_RegEnumSubkeys. | -------------------------------------------------------------------------------*/ -NS_IMETHODIMP nsRegistryNode::GetNameUTF8( char **result ) { - if (result == nsnull) return NS_ERROR_NULL_POINTER; - // Make sure there is a place to put the result. - *result = nsCRT::strdup( mName ); - if ( !*result ) return NS_ERROR_OUT_OF_MEMORY; - return NS_OK; -} - -/*-------------------------- nsRegistryNode::GetKey ---------------------------- -| Get the subkey corresponding to this node | -| using NR_RegEnumSubkeys. | -------------------------------------------------------------------------------*/ -NS_IMETHODIMP nsRegistryNode::GetKey( nsRegistryKey *r_key ) { - nsresult rv = NS_OK; - if (r_key == nsnull) return NS_ERROR_NULL_POINTER; - *r_key = mChildKey; - return rv; -} - - - -/*--------------------- nsRegistryValue::nsRegistryValue ----------------------- -| Implemented the same way as the nsRegistryNode ctor. | -------------------------------------------------------------------------------*/ -nsRegistryValue::nsRegistryValue( HREG hReg, RKEY key, REGENUM slot ) - : mReg( hReg ), mKey( key ), mEnum( slot ), mErr( -1 ) { -#ifdef EXTRA_THREADSAFE - mregLock = PR_NewLock(); -#endif - mInfo.size = sizeof(REGINFO); -} - -nsRegistryValue::~nsRegistryValue() -{ -#ifdef EXTRA_THREADSAFE - if (mregLock) { - PR_DestroyLock(mregLock); - } -#endif -} - -/*------------------------- nsRegistryValue::GetName --------------------------- -| See nsRegistryNode::GetName; we use NR_RegEnumEntries in this case. | -------------------------------------------------------------------------------*/ -NS_IMETHODIMP nsRegistryValue::GetName( PRUnichar **result ) { - nsresult rv = NS_OK; - // Make sure we have a place to put the result. - if( result ) { - // Ensure we've got the info we need. - rv = getInfo(); - if( rv == NS_OK || rv == NS_ERROR_REG_NO_MORE ) { - // worked, return actual result. - *result = nsTextFormatter::smprintf( widestrFormat, mName ); - if ( *result ) { - rv = NS_OK; - } else { - rv = NS_ERROR_OUT_OF_MEMORY; - } - } - } else { - rv = NS_ERROR_NULL_POINTER; - } - return rv; -} - -/*------------------------- nsRegistryValue::GetNameUTF8 ----------------------- -| See nsRegistryNode::GetName; we use NR_RegEnumEntries in this case. | -------------------------------------------------------------------------------*/ -NS_IMETHODIMP nsRegistryValue::GetNameUTF8( char **result ) { - nsresult rv = NS_OK; - // Make sure we have a place to put the result. - if( result ) { - // Ensure we've got the info we need. - rv = getInfo(); - if( rv == NS_OK || rv == NS_ERROR_REG_NO_MORE ) { - // worked, return actual result. - *result = nsCRT::strdup( mName ); - if ( *result ) { - rv = NS_OK; - } else { - rv = NS_ERROR_OUT_OF_MEMORY; - } - } - } else { - rv = NS_ERROR_NULL_POINTER; - } - return rv; -} - -/*----------------------- nsRegistryValue::GetType ------------------------ -| We test if we've got the info already. If not, we git it by calling | -| getInfo. We calculate the result by converting the REGINFO type field to | -| a nsIRegistry::DataType value (using reginfo2DataType). | -------------------------------------------------------------------------------*/ -NS_IMETHODIMP nsRegistryValue::GetType( PRUint32 *result ) { - nsresult rv = NS_OK; - // Make sure we have room for th result. - if( result ) { - // Make sure we've got the info we need. - rv = getInfo(); - // Check if it worked. - if( rv == NS_OK ) { - // Convert result from REGINFO to nsIRegistry::ValueInfo. - reginfo2DataType( mInfo, *result ); - } - } else { - rv = NS_ERROR_NULL_POINTER; - } - return rv; -} - -/*---------------------- nsRegistryValue::GetLength ----------------------- -| We test if we've got the info already. If not, we git it by calling | -| getInfo. We calculate the result by converting the REGINFO type field to | -| a nsIRegistry::DataType value (using reginfo2Length). | -------------------------------------------------------------------------------*/ -NS_IMETHODIMP nsRegistryValue::GetLength( PRUint32 *result ) { - nsresult rv = NS_OK; - // Make sure we have room for th result. - if( result ) { - // Make sure we've got the info we need. - rv = getInfo(); - // Check if it worked. - if( rv == NS_OK ) { - // Convert result from REGINFO to length. - reginfo2Length( mInfo, *result ); - } - } else { - rv = NS_ERROR_NULL_POINTER; - } - return rv; -} - -/*------------------------- nsRegistryValue::getInfo --------------------------- -| Call NR_RegEnumEntries to set the mInfo/mName data members. | -------------------------------------------------------------------------------*/ -nsresult nsRegistryValue::getInfo() { - nsresult rv = NS_OK; - // Test whether we haven't tried to get it yet. - if( mErr == -1 ) { - REGENUM temp = mEnum; - // Get name and info. - PR_Lock(mregLock); - mErr = NR_RegEnumEntries( mReg, mKey, &temp, mName, sizeof mName, &mInfo ); - // Convert result. - rv = regerr2nsresult( mErr ); - PR_Unlock(mregLock); - } - return rv; -} - - -nsRegistryFactory::nsRegistryFactory() { -} - -NS_IMPL_ISUPPORTS1(nsRegistryFactory, nsIFactory) - -NS_IMETHODIMP -nsRegistryFactory::CreateInstance(nsISupports *aOuter, - const nsIID &aIID, - void **aResult) { - nsresult rv = NS_OK; - nsRegistry* newRegistry; - - if(aResult == nsnull) { - return NS_ERROR_NULL_POINTER; - } else { - *aResult = nsnull; - } - - if(0 != aOuter) { - return NS_ERROR_NO_AGGREGATION; - } - - NS_NEWXPCOM(newRegistry, nsRegistry); - - if(newRegistry == nsnull) { - return NS_ERROR_OUT_OF_MEMORY; - } - - NS_ADDREF(newRegistry); - rv = newRegistry->QueryInterface(aIID, aResult); - NS_RELEASE(newRegistry); - - return rv; -} - -nsresult -nsRegistryFactory::LockFactory(PRBool aLock) -{ - // Not implemented in simplest case. - return NS_OK; -} - -// This is a temporary hack; needs work to support dynamic binding -// via nsComponentManager and support for multiple factories per DLL. -extern "C" NS_EXPORT nsresult -NS_RegistryGetFactory(nsIFactory** aFactory ) { - nsresult rv = NS_OK; - - if( aFactory == 0 ) { - return NS_ERROR_NULL_POINTER; - } else { - *aFactory = 0; - } - - nsIFactory* inst = new nsRegistryFactory(); - if(0 == inst) { - rv = NS_ERROR_OUT_OF_MEMORY; - } else { - NS_ADDREF(inst); - *aFactory = inst; - } - - return rv; -} diff --git a/mozilla/modules/libreg/xpcom/nsRegistry.h b/mozilla/modules/libreg/xpcom/nsRegistry.h deleted file mode 100644 index 26164cccfe6..00000000000 --- a/mozilla/modules/libreg/xpcom/nsRegistry.h +++ /dev/null @@ -1,75 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: NPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Netscape Public License - * Version 1.1 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * http://www.mozilla.org/NPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is mozilla.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): - * Edward Kandrot - * - * Alternatively, the contents of this file may be used under the terms of - * either the GNU General Public License Version 2 or later (the "GPL"), or - * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the NPL, 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 NPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ - - -#ifndef nsRegistry_h__ -#define nsRegistry_h__ - -#include "nsIRegistry.h" -#include "NSReg.h" -#include "nsIFile.h" -#include "nsCOMPtr.h" - -struct nsRegistry : public nsIRegistry, nsIRegistryGetter { - // This class implements the nsISupports interface functions. - NS_DECL_ISUPPORTS - - // This class implements the nsIRegistry interface functions. - NS_DECL_NSIREGISTRY - - // Fast registry getters - NS_DECL_NSIREGISTRYGETTER - - // ctor/dtor - nsRegistry(); - virtual ~nsRegistry(); - - int SetBufferSize( int bufsize ); // changes the file buffer size for this registry - -protected: - HREG mReg; // Registry handle. -#ifdef EXTRA_THREADSAFE - PRLock *mregLock; // libreg isn't threadsafe. Use locks to synchronize. -#endif - nsCOMPtr mCurRegFile; // these are to prevent open from opening the registry again - nsWellKnownRegistry mCurRegID; - - NS_IMETHOD Close(); -}; // nsRegistry - -#endif diff --git a/mozilla/modules/libreg/xpcom/regExport.cpp b/mozilla/modules/libreg/xpcom/regExport.cpp deleted file mode 100644 index 819a816b974..00000000000 --- a/mozilla/modules/libreg/xpcom/regExport.cpp +++ /dev/null @@ -1,357 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: NPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Netscape Public License - * Version 1.1 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * http://www.mozilla.org/NPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is mozilla.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 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 NPL, 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 NPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ - -#include - -#include "nsIServiceManager.h" -#include "nsIComponentManager.h" -#include "nsCOMPtr.h" -#include "nsIRegistry.h" -#include "nsIEnumerator.h" -#include "nsILocalFile.h" -#include "nsDependentString.h" -#include "prmem.h" -#include "plstr.h" -#include "nsMemory.h" - -static void display( nsIRegistry *reg, nsRegistryKey root, const char *name ); -static void displayValues( nsIRegistry *reg, nsRegistryKey root ); -static void printString( const char *value, int indent ); - -int main( int argc, char *argv[] ) { - - -#ifdef __MWERKS__ - // Hack in some arguments. A NULL registry name is supposed to tell libreg - // to use the default registry (which does seem to work). - argc = 1; - const char* myArgs[] = - { - "regExport" - }; - argv = const_cast(myArgs); -#endif - - nsresult rv; - - // Initialize XPCOM - nsIServiceManager *servMgr = NULL; - rv = NS_InitXPCOM2(&servMgr, NULL, NULL); - if (NS_FAILED(rv)) - { - // Cannot initialize XPCOM - printf("Cannot initialize XPCOM. Exit. [rv=0x%08X]\n", (int)rv); - exit(-1); - } - { - // Get the component manager - static NS_DEFINE_CID(kComponentManagerCID, NS_COMPONENTMANAGER_CID); - nsCOMPtr compMgr = do_GetService(kComponentManagerCID, &rv); - if (NS_FAILED(rv)) - { - // Cant get component manager - printf("Cannot get component manager from service manager.. Exit. [rv=0x%08X]\n", (int)rv); - exit(-1); - } - - nsIRegistry *reg; - - if (argc>1) { - // Create the registry - rv = compMgr->CreateInstanceByContractID(NS_REGISTRY_CONTRACTID, NULL, - NS_GET_IID(nsIRegistry), - (void **) ®); - // Check result. - if ( NS_FAILED(rv) ) - { - printf( "Error opening registry file %s, rv=0x%08X\n", argv[1] , (int)rv ); - return rv; - } - // Open it against the input file name. - nsCOMPtr regFile; - rv = NS_NewNativeLocalFile( nsDependentCString(argv[1]), PR_FALSE, getter_AddRefs(regFile) ); - if ( NS_FAILED(rv) ) { - printf( "Error instantiating local file for %s, rv=0x%08X\n", argv[1], (int)rv ); - return rv; - } - - rv = reg->Open( regFile ); - - if ( rv == NS_OK ) - { - printf( "Registry %s opened OK.\n", argv[1] ); - - // Recurse over all 3 branches. - display( reg, nsIRegistry::Common, "nsRegistry::Common" ); - display( reg, nsIRegistry::Users, "nsRegistry::Users" ); - } - NS_RELEASE(reg); - } - else - { - // Called with no arguments. Print both the default registry and - // the components registry. We already printed the default regsitry. - // So just do the component registry. - rv = compMgr->CreateInstanceByContractID(NS_REGISTRY_CONTRACTID, NULL, - NS_GET_IID(nsIRegistry), - (void **) ®); - - // Check result. - if ( NS_FAILED(rv) ) - { - printf( "Error opening creating registry instance, rv=0x%08X\n", (int)rv ); - return rv; - } - rv = reg->OpenWellKnownRegistry(nsIRegistry::ApplicationComponentRegistry); - if ( rv == NS_ERROR_REG_BADTYPE ) { - printf( "\n\n\nThere is no \n" ); - } - else if ( rv == NS_OK ) { - - printf( "\n\n\nRegistry %s opened OK.\n", "\n" ); - - // Recurse over all 3 branches. - display( reg, nsIRegistry::Common, "nsRegistry::Common" ); - display( reg, nsIRegistry::Users, "nsRegistry::Users" ); - } - NS_RELEASE(reg); - } - } - NS_ShutdownXPCOM( servMgr ); - - return rv; -} - -void display( nsIRegistry *reg, nsRegistryKey root, const char *rootName ) { - // Print out key name. - printf( "%s\n", rootName ); - - // Make sure it isn't a "root" key. - if ( root != nsIRegistry::Common - && - root != nsIRegistry::Users - && - root != nsIRegistry::CurrentUser ) { - // Print values stored under this key. - displayValues( reg, root ); - } - - // Enumerate all subkeys (immediately) under the given node. - nsIEnumerator *keys; - nsresult rv = reg->EnumerateSubtrees( root, &keys ); - - // Check result. - if ( rv == NS_OK ) { - // Set enumerator to beginning. - rv = keys->First(); - // Enumerate subkeys till done. - while( NS_SUCCEEDED( rv ) && (NS_OK != keys->IsDone()) ) { - nsISupports *base; - rv = keys->CurrentItem( &base ); - // Test result. - if ( rv == NS_OK ) { - // Get specific interface. - nsIRegistryNode *node; - nsIID nodeIID = NS_IREGISTRYNODE_IID; - rv = base->QueryInterface( nodeIID, (void**)&node ); - // Test that result. - if ( rv == NS_OK ) { - // Get node name. - char *name; - rv = node->GetNameUTF8( &name ); - // Test result. - if ( rv == NS_OK ) { - // Build complete name. - char *fullName = new char[ PL_strlen(rootName) + PL_strlen(name) + 5 ]; - PL_strcpy( fullName, rootName ); - PL_strcat( fullName, " - " ); - PL_strcat( fullName, name ); - // Display contents under this subkey. - nsRegistryKey key; - rv = reg->GetSubtreeRaw( root, name, &key ); - if ( rv == NS_OK ) { - display( reg, key, fullName ); - printf( "\n" ); - } else { - printf( "Error getting key, rv=0x%08X\n", (int)rv ); - } - delete [] fullName; - } else { - printf( "Error getting subtree name, rv=0x%08X\n", (int)rv ); - } - // Release node. - node->Release(); - } else { - printf( "Error converting base node ptr to nsIRegistryNode, rv=0x%08X\n", (int)rv ); - } - // Release item. - base->Release(); - - // Advance to next key. - rv = keys->Next(); - // Check result. - if ( NS_SUCCEEDED( rv ) ) { - } else { - printf( "Error advancing enumerator, rv=0x%08X\n", (int)rv ); - } - } else { - printf( "Error getting current item, rv=0x%08X\n", (int)rv ); - } - } - // Release key enumerator. - keys->Release(); - } else { - printf( "Error creating enumerator for %s, root=0x%08X, rv=0x%08X\n", - rootName, (int)root, (int)rv ); - } - return; -} - -static void displayValues( nsIRegistry *reg, nsRegistryKey root ) { - // Emumerate values at this registry location. - nsIEnumerator *values; - nsresult rv = reg->EnumerateValues( root, &values ); - - // Check result. - if ( rv == NS_OK ) { - // Go to beginning. - rv = values->First(); - - // Enumerate values till done. - while( rv == NS_OK && (NS_OK != values->IsDone()) ) { - nsISupports *base; - rv = values->CurrentItem( &base ); - // Test result. - if ( rv == NS_OK ) { - // Get specific interface. - nsIRegistryValue *value; - nsIID valueIID = NS_IREGISTRYVALUE_IID; - rv = base->QueryInterface( valueIID, (void**)&value ); - // Test that result. - if ( rv == NS_OK ) { - // Get node name. - char *name; - rv = value->GetNameUTF8( &name ); - // Test result. - if ( rv == NS_OK ) { - // Print name: - printf( "\t\t%s", name ); - // Get info about this value. - PRUint32 type; - rv = reg->GetValueType( root, name, &type ); - if ( rv == NS_OK ) { - // Print value contents. - switch ( type ) { - case nsIRegistry::String: { - char *strValue; - rv = reg->GetStringUTF8( root, name, &strValue ); - if ( rv == NS_OK ) { - printString( strValue, strlen(name) ); - nsMemory::Free( strValue ); - } else { - printf( "\t Error getting string value, rv=0x%08X", (int)rv ); - } - } - break; - - case nsIRegistry::Int32: - { - PRInt32 val = 0; - rv = reg->GetInt( root, name, &val ); - if (NS_SUCCEEDED(rv)) { - printf( "\t= Int32 [%d, 0x%x]", val, val); - } - else { - printf( "\t Error getting int32 value, rv=%08X", (int)rv); - } - } - break; - - case nsIRegistry::Bytes: - printf( "\t= Bytes" ); - break; - - case nsIRegistry::File: - printf( "\t= File (?)" ); - break; - - default: - printf( "\t= ? (unknown type=0x%02X)", (int)type ); - break; - } - } else { - printf( "\t= ? (error getting value, rv=0x%08X)", (int)rv ); - } - printf("\n"); - nsMemory::Free( name ); - } else { - printf( "Error getting value name, rv=0x%08X\n", (int)rv ); - } - // Release node. - value->Release(); - } else { - printf( "Error converting base node ptr to nsIRegistryNode, rv=0x%08X\n", (int)rv ); - } - // Release item. - base->Release(); - - // Advance to next key. - rv = values->Next(); - // Check result. - if ( NS_SUCCEEDED( rv ) ) { - } else { - printf( "Error advancing enumerator, rv=0x%08X\n", (int)rv ); - break; - } - } else { - printf( "Error getting current item, rv=0x%08X\n", (int)rv ); - break; - } - } - - values->Release(); - } else { - printf( "\t\tError enumerating values, rv=0x%08X\n", (int)rv ); - } - return; -} - -static void printString( const char *value, int /*indent*/ ) { - // For now, just dump contents. - printf( "\t = %s", value ); - return; -} diff --git a/mozilla/modules/plugin/base/src/ns4xPlugin.cpp b/mozilla/modules/plugin/base/src/ns4xPlugin.cpp index 5ff26b5b917..7594f2703fa 100644 --- a/mozilla/modules/plugin/base/src/ns4xPlugin.cpp +++ b/mozilla/modules/plugin/base/src/ns4xPlugin.cpp @@ -650,13 +650,16 @@ ns4xPlugin::CreatePlugin(nsIServiceManagerObsolete* aServiceMgr, #if defined(XP_MAC) || defined(XP_MACOSX) short appRefNum = ::CurResFile(); short pluginRefNum; - - nsFileSpec pluginPath(aFullPath); + + nsCOMPtr pluginPath; + NS_NewNativeLocalFile(nsDependentCString(aFullPath), PR_TRUE, + getter_AddRefs(pluginPath)); + nsPluginFile pluginFile(pluginPath); pluginRefNum = pluginFile.OpenPluginResource(); if (pluginRefNum == -1) return NS_ERROR_FAILURE; - + ns4xPlugin* plugin = new ns4xPlugin(nsnull, aLibrary, nsnull, aServiceMgr); if(plugin == NULL) return NS_ERROR_OUT_OF_MEMORY; diff --git a/mozilla/modules/plugin/base/src/nsPluginHostImpl.cpp b/mozilla/modules/plugin/base/src/nsPluginHostImpl.cpp index ac849919668..d3b8cf469ad 100644 --- a/mozilla/modules/plugin/base/src/nsPluginHostImpl.cpp +++ b/mozilla/modules/plugin/base/src/nsPluginHostImpl.cpp @@ -71,7 +71,7 @@ #include "nsIIOService.h" #include "nsIURL.h" #include "nsIChannel.h" -#include "nsIFileStream.h" // for nsISeekableStream +#include "nsISeekableStream.h" #include "nsNetUtil.h" #include "nsIProgressEventSink.h" #include "nsIDocument.h" @@ -122,8 +122,6 @@ #include "winbase.h" #endif -#include "nsFileSpec.h" - #include "nsPluginDocLoaderFactory.h" #include "nsIMIMEService.h" @@ -4238,23 +4236,28 @@ public: #endif } - nsFileSpec spec; + const char *name; + nsCString leafName; if (mPluginTag.mFullPath) { #if !(defined(XP_MAC) || defined(XP_MACOSX)) NS_ERROR("Only MAC should be using nsPluginTag::mFullPath!"); #endif - spec = mPluginTag.mFullPath; + char* spec = mPluginTag.mFullPath; + + nsCOMPtr pluginPath; + NS_NewNativeLocalFile(nsDependentCString(spec), PR_TRUE, + getter_AddRefs(pluginPath)); + + pluginPath->GetNativeLeafName(leafName); + name = leafName.get(); } else { - spec = mPluginTag.mFileName; + name = mPluginTag.mFileName; } - char* name = spec.GetLeafName(); nsresult rv = DoCharsetConversion(mUnicodeDecoder, name, aFilename); - if (name) - nsCRT::free(name); return rv; } @@ -4487,12 +4490,14 @@ NS_IMETHODIMP nsPluginHostImpl::GetPluginFactory(const char *aMimeType, nsIPlugi if (nsnull == pluginTag->mLibrary) // if we haven't done this yet { + + nsCOMPtr file = do_CreateInstance("@mozilla.org/file/local;1"); #if !(defined(XP_MAC) || defined(XP_MACOSX)) - nsFileSpec file(pluginTag->mFileName); + file->InitWithNativePath(nsDependentCString(pluginTag->mFileName)); #else if (nsnull == pluginTag->mFullPath) return NS_ERROR_FAILURE; - nsFileSpec file(pluginTag->mFullPath); + file->InitWithNativePath(nsDependentCString(pluginTag->mFullPath)); #endif nsPluginFile pluginFile(file); PRLibrary* pluginLibrary = NULL; @@ -4787,11 +4792,7 @@ nsresult nsPluginHostImpl::ScanPluginsDirectory(nsIFile * pluginsDir, if (NS_FAILED(rv)) continue; - nsFileSpec file(filePath.get()); - PRBool wasSymlink; - file.ResolveSymlink(wasSymlink); - - if (nsPluginsDir::IsPluginFile(file)) { + if (nsPluginsDir::IsPluginFile(dirEntry)) { pluginFileinDirectory * item = new pluginFileinDirectory(); if (!item) return NS_ERROR_OUT_OF_MEMORY; @@ -4801,7 +4802,7 @@ nsresult nsPluginHostImpl::ScanPluginsDirectory(nsIFile * pluginsDir, dirEntry->GetLastModifiedTime(&fileModTime); item->mModTime = fileModTime; - item->mFilename.AssignWithConversion(file.GetCString()); + item->mFilename.AssignWithConversion(filePath.get()); pluginFilesArray.AppendElement(item); } } // end round of up of plugin files @@ -4813,12 +4814,14 @@ nsresult nsPluginHostImpl::ScanPluginsDirectory(nsIFile * pluginsDir, // finally, go through the array, looking at each entry and continue processing it for (PRInt32 i = 0; i < pluginFilesArray.Count(); i++) { pluginFileinDirectory* pfd = NS_STATIC_CAST(pluginFileinDirectory*, pluginFilesArray[i]); - nsFileSpec file(pfd->mFilename); + nsCOMPtr file = do_CreateInstance("@mozilla.org/file/local;1"); + nsCOMPtr localfile = do_QueryInterface(file); + localfile->InitWithPath(pfd->mFilename); PRInt64 fileModTime = pfd->mModTime; - delete pfd; + //delete pfd; // Look for it in our cache - nsPluginTag *pluginTag = RemoveCachedPluginsInfo(file.GetCString()); + nsPluginTag *pluginTag = RemoveCachedPluginsInfo(NS_ConvertUCS2toUTF8(pfd->mFilename).get()); if (pluginTag) { // If plugin changed, delete cachedPluginTag and dont use cache @@ -6427,12 +6430,16 @@ nsPluginHostImpl::ScanForRealInComponentsFolder(nsIComponentManager * aCompManag return rv; // now make sure it's a plugin - nsFileSpec file(filePath.get()); - if (!nsPluginsDir::IsPluginFile(file)) + nsCOMPtr localfile; + NS_NewNativeLocalFile(filePath, + PR_TRUE, + getter_AddRefs(localfile)); + + if (!nsPluginsDir::IsPluginFile(localfile)) return rv; // try to get the mime info and descriptions out of the plugin - nsPluginFile pluginFile(file); + nsPluginFile pluginFile(localfile); nsPluginInfo info = { sizeof(info) }; if (NS_FAILED(pluginFile.GetPluginInfo(info))) return rv; diff --git a/mozilla/modules/plugin/base/src/nsPluginHostImpl.h b/mozilla/modules/plugin/base/src/nsPluginHostImpl.h index 094d1df261f..facee70537a 100644 --- a/mozilla/modules/plugin/base/src/nsPluginHostImpl.h +++ b/mozilla/modules/plugin/base/src/nsPluginHostImpl.h @@ -62,7 +62,6 @@ #include "nsPluginNativeWindow.h" class ns4xPlugin; -class nsFileSpec; class nsIComponentManager; class nsIFile; class nsIChannel; diff --git a/mozilla/modules/plugin/base/src/nsPluginInstancePeer.cpp b/mozilla/modules/plugin/base/src/nsPluginInstancePeer.cpp index aa5bf4040f2..f6e839603e5 100644 --- a/mozilla/modules/plugin/base/src/nsPluginInstancePeer.cpp +++ b/mozilla/modules/plugin/base/src/nsPluginInstancePeer.cpp @@ -44,8 +44,7 @@ #include "prthread.h" #include "plstr.h" #include "prprf.h" -#include "nsIFileStream.h" -#include "nsFileSpec.h" +#include "nsIFile.h" #include "nsCOMPtr.h" #include "nsIJVMManager.h" #include "nsIServiceManager.h" diff --git a/mozilla/modules/plugin/base/src/nsPluginsDir.h b/mozilla/modules/plugin/base/src/nsPluginsDir.h index c8e0616c906..5efe9ea4a3e 100644 --- a/mozilla/modules/plugin/base/src/nsPluginsDir.h +++ b/mozilla/modules/plugin/base/src/nsPluginsDir.h @@ -39,7 +39,7 @@ #define nsPluginsDir_h___ #include "nsError.h" -#include "nsFileSpec.h" +#include "nsIFile.h" /** * nsPluginsDir is nearly obsolete. Directory Service should be used instead. @@ -51,7 +51,7 @@ public: /** * Determines whether or not the given file is actually a plugin file. */ - static PRBool IsPluginFile(const nsFileSpec& fileSpec); + static PRBool IsPluginFile(nsIFile* file); }; struct PRLibrary; @@ -77,15 +77,16 @@ struct nsPluginInfo { * library. Insulates core nsIPluginHost implementations from these * details. */ -class nsPluginFile : public nsFileSpec { +class nsPluginFile { PRLibrary* pLibrary; + nsCOMPtr mPlugin; public: /** * If spec corresponds to a valid plugin file, constructs a reference * to a plugin file on disk. Plugins are typically located using the * nsPluginsDir class. */ - nsPluginFile(const nsFileSpec& spec); + nsPluginFile(nsIFile* spec); virtual ~nsPluginFile(); /** diff --git a/mozilla/modules/plugin/base/src/nsPluginsDirBeOS.cpp b/mozilla/modules/plugin/base/src/nsPluginsDirBeOS.cpp index 2ad6ac753ae..a00ad403ad6 100644 --- a/mozilla/modules/plugin/base/src/nsPluginsDirBeOS.cpp +++ b/mozilla/modules/plugin/base/src/nsPluginsDirBeOS.cpp @@ -115,14 +115,8 @@ static nsresult GetMimeExtensions(const char *mimeType, char *extensions, int ex /* nsPluginsDir implementation */ -PRBool nsPluginsDir::IsPluginFile(const nsFileSpec& fileSpec) +PRBool nsPluginsDir::IsPluginFile(nsIFile* file) { - const char* pathname = fileSpec.GetCString(); - -#ifdef NS_DEBUG - printf("IsPluginFile(%s)\n", pathname); -#endif - return PR_TRUE; } @@ -130,8 +124,8 @@ PRBool nsPluginsDir::IsPluginFile(const nsFileSpec& fileSpec) /* nsPluginFile implementation */ -nsPluginFile::nsPluginFile(const nsFileSpec& spec) - : nsFileSpec(spec) +nsPluginFile::nsPluginFile(nsIFile* spec) +: mPlugin(spec) { // nada } diff --git a/mozilla/modules/plugin/base/src/nsPluginsDirDarwin.cpp b/mozilla/modules/plugin/base/src/nsPluginsDirDarwin.cpp index 43993fc227d..68c77335d49 100644 --- a/mozilla/modules/plugin/base/src/nsPluginsDirDarwin.cpp +++ b/mozilla/modules/plugin/base/src/nsPluginsDirDarwin.cpp @@ -84,23 +84,24 @@ static CFBundleRef getPluginBundle(const char* path) return bundle; } -static OSErr toFSSpec(const nsFileSpec& inFileSpec, FSSpec& outSpec) +static OSErr toFSSpec(nsIFile* file, FSSpec& outSpec) { - FSRef ref; - OSErr err = FSPathMakeRef((const UInt8*)inFileSpec.GetCString(), &ref, NULL); - if (err == noErr) - err = FSGetCatalogInfo(&ref, kFSCatInfoNone, NULL, NULL, &outSpec, NULL); - return err; + nsCOMPtr lfm = do_QueryInterface(file); + if (!lfm) + return -1; + + lfm->GetFSSpec(outSpec); + return NS_OK; } -PRBool nsPluginsDir::IsPluginFile(const nsFileSpec& fileSpec) +PRBool nsPluginsDir::IsPluginFile(nsIFile* file) { #ifdef DEBUG printf("nsPluginsDir::IsPluginFile: checking %s\n", fileSpec.GetCString()); #endif // look at file's creator/type and make sure it is a code fragment, etc. FSSpec spec; - OSErr err = toFSSpec(fileSpec, spec); + OSErr err = toFSSpec(file, spec); if (err != noErr) return PR_FALSE; @@ -138,8 +139,8 @@ PRBool nsPluginsDir::IsPluginFile(const nsFileSpec& fileSpec) return PR_FALSE; } -nsPluginFile::nsPluginFile(const nsFileSpec& spec) - : nsFileSpec(spec) +nsPluginFile::nsPluginFile(nsIFile *spec) + : mPlugin(spec) { } @@ -151,7 +152,15 @@ nsPluginFile::~nsPluginFile() {} */ nsresult nsPluginFile::LoadPlugin(PRLibrary* &outLibrary) { - const char* path = this->GetCString(); + const char* path; + + if (!mPlugin) + return NS_ERROR_NULL_POINTER; + + nsCAutoString temp; + mPlugin->GetNativePath(temp); + path = temp.get(); + outLibrary = PR_LoadLibrary(path); pLibrary = outLibrary; if (!outLibrary) { diff --git a/mozilla/modules/plugin/base/src/nsPluginsDirOS2.cpp b/mozilla/modules/plugin/base/src/nsPluginsDirOS2.cpp index 1297550081b..44ad94857d6 100644 --- a/mozilla/modules/plugin/base/src/nsPluginsDirOS2.cpp +++ b/mozilla/modules/plugin/base/src/nsPluginsDirOS2.cpp @@ -1,4 +1,4 @@ - /* +/* * 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 @@ -122,32 +122,31 @@ static void FreeStringArray(PRUint32 variants, char ** array) // nsPluginsDir class -PRBool nsPluginsDir::IsPluginFile( const nsFileSpec &fileSpec) +PRBool nsPluginsDir::IsPluginFile(nsIFile* file) { - PRBool rc = PR_FALSE; + nsCAutoString leaf; + if (NS_FAILED(file->GetNativeLeafName(leaf))) + return PR_FALSE; - char *leafname = fileSpec.GetLeafName(); - - if( nsnull != leafname) - { + const char *leafname = leaf.get(); + + if( nsnull != leafname) + { int len = strlen( leafname); if( len > 6 && // np*.dll (0 == strnicmp( &(leafname[len - 4]), ".dll", 4)) && (0 == strnicmp( leafname, "np", 2))) { - rc = PR_TRUE; + rc = PR_TRUE; } - - delete [] leafname; - } - - return rc; + } + return PR_FALSE; } // nsPluginFile implementation -nsPluginFile::nsPluginFile( const nsFileSpec &spec) - : nsFileSpec(spec) +nsPluginFile::nsPluginFile(nsFile* spec) +: mPlugin(spec) {} nsPluginFile::~nsPluginFile() @@ -156,9 +155,14 @@ nsPluginFile::~nsPluginFile() // Loads the plugin into memory using NSPR's shared-library loading nsresult nsPluginFile::LoadPlugin( PRLibrary *&outLibrary) { - nsNSPRPath nsprpath( *this); - outLibrary = PR_LoadLibrary( nsprpath); - return outLibrary == nsnull ? NS_ERROR_FAILURE : NS_OK; + if (!mPlugin) + return NS_ERROR_NULL_POINTER; + + nsCAutoString temp; + mPlugin->GetNativePath(temp); + + outLibrary = PR_LoadLibrary(temp.get()); + return outLibrary == nsnull ? NS_ERROR_FAILURE : NS_OK; } // Obtains all of the information currently available for this plugin. diff --git a/mozilla/modules/plugin/base/src/nsPluginsDirUnix.cpp b/mozilla/modules/plugin/base/src/nsPluginsDirUnix.cpp index f9e6de8360c..3b3c3935684 100644 --- a/mozilla/modules/plugin/base/src/nsPluginsDirUnix.cpp +++ b/mozilla/modules/plugin/base/src/nsPluginsDirUnix.cpp @@ -56,7 +56,8 @@ #include "prenv.h" #include "prerror.h" #include - +#include "nsString.h" +#include "nsILocalFile.h" #include "nsIPref.h" static NS_DEFINE_CID(kPrefServiceCID, NS_PREF_CID); @@ -247,37 +248,33 @@ static void LoadExtraSharedLibs() /* nsPluginsDir implementation */ -PRBool nsPluginsDir::IsPluginFile(const nsFileSpec& fileSpec) +PRBool nsPluginsDir::IsPluginFile(nsIFile* file) { - const char* pathname = fileSpec.GetCString(); - PRBool ret = PR_FALSE; - if (pathname) { - int n = PL_strlen(pathname) - (sizeof(LOCAL_PLUGIN_DLL_SUFFIX) - 1); - if (n > 0 && !PL_strcmp(&pathname[n], LOCAL_PLUGIN_DLL_SUFFIX)) { - ret = PR_TRUE; // *.so or *.sl file - } -#ifdef LOCAL_PLUGIN_DLL_ALT_SUFFIX - if (PR_TRUE != ret) { - n = PL_strlen(pathname) - (sizeof(LOCAL_PLUGIN_DLL_ALT_SUFFIX) - 1); - if (n > 0 && !PL_strcmp(&pathname[n], LOCAL_PLUGIN_DLL_ALT_SUFFIX)) { - ret = PR_TRUE; - } - } -#endif + nsCAutoString filename; + if (NS_FAILED(file->GetNativeLeafName(filename))) + return PR_FALSE; -#ifdef NS_DEBUG - printf("IsPluginFile(%s) == %s\n", pathname, ret?"TRUE":"FALSE"); + int len = filename.Length(); + nsCAutoString suffix (LOCAL_PLUGIN_DLL_SUFFIX); + int slen = suffix.Length(); + if (len > slen && suffix.Equals(Substring(filename,len-slen,slen))) + return PR_TRUE; + +#ifdef LOCAL_PLUGIN_DLL_ALT_SUFFIX + suffix.Assign(LOCAL_PLUGIN_DLL_ALT_SUFFIX); + slen = suffix.Length(); + if (len > slen && suffix.Equals(Substring(filename,len-slen,slen))) + return PR_TRUE; #endif - } - return ret; + return PR_FALSE; } /////////////////////////////////////////////////////////////////////////// /* nsPluginFile implementation */ -nsPluginFile::nsPluginFile(const nsFileSpec& spec) - : nsFileSpec(spec) +nsPluginFile::nsPluginFile(nsIFile* file) +: mPlugin(file) { // nada } @@ -295,7 +292,18 @@ nsresult nsPluginFile::LoadPlugin(PRLibrary* &outLibrary) { PRLibSpec libSpec; libSpec.type = PR_LibSpec_Pathname; - libSpec.value.pathname = this->GetCString(); + PRBool exists = PR_FALSE; + mPlugin->Exists(&exists); + if (!exists) + return NS_ERROR_FILE_NOT_FOUND; + + nsresult rv; + nsCAutoString path; + rv = mPlugin->GetNativePath(path); + if (NS_FAILED(rv)) + return rv; + + libSpec.value.pathname = path.get(); pLibrary = outLibrary = PR_LoadLibraryWithFlags(libSpec, 0); @@ -375,10 +383,13 @@ nsresult nsPluginFile::GetPluginInfo(nsPluginInfo& info) #endif if (NS_FAILED(rv = ParsePluginMimeDescription(mimedescr, info))) return rv; - info.fFileName = PL_strdup(this->GetCString()); + nsCAutoString filename; + if (NS_FAILED(rv = mPlugin->GetNativeLeafName(filename))) + return rv; + info.fFileName = PL_strdup(filename.get()); plugin->GetValue(nsPluginVariable_NameString, &name); if (!name) - name = PL_strrchr(info.fFileName, '/') + 1; + name = info.fFileName; info.fName = PL_strdup(name); plugin->GetValue(nsPluginVariable_DescriptionString, &description); @@ -392,20 +403,20 @@ nsresult nsPluginFile::GetPluginInfo(nsPluginInfo& info) nsresult nsPluginFile::FreePluginInfo(nsPluginInfo& info) { - if(info.fName != nsnull) + if (info.fName != nsnull) PL_strfree(info.fName); - if(info.fDescription != nsnull) + if (info.fDescription != nsnull) PL_strfree(info.fDescription); - for(PRUint32 i = 0; i < info.fVariantCount; i++) { + for (PRUint32 i = 0; i < info.fVariantCount; i++) { if (info.fMimeTypeArray[i] != nsnull) PL_strfree(info.fMimeTypeArray[i]); if (info.fMimeDescriptionArray[i] != nsnull) PL_strfree(info.fMimeDescriptionArray[i]); - if(info.fExtensionArray[i] != nsnull) + if (info.fExtensionArray[i] != nsnull) PL_strfree(info.fExtensionArray[i]); } @@ -413,7 +424,7 @@ nsresult nsPluginFile::FreePluginInfo(nsPluginInfo& info) PR_FREEIF(info.fMimeDescriptionArray); PR_FREEIF(info.fExtensionArray); - if(info.fFileName != nsnull) + if (info.fFileName != nsnull) PL_strfree(info.fFileName); return NS_OK; diff --git a/mozilla/modules/plugin/base/src/nsPluginsDirWin.cpp b/mozilla/modules/plugin/base/src/nsPluginsDirWin.cpp index 40fb1eef8b9..78d58aa3c0f 100644 --- a/mozilla/modules/plugin/base/src/nsPluginsDirWin.cpp +++ b/mozilla/modules/plugin/base/src/nsPluginsDirWin.cpp @@ -52,7 +52,7 @@ #include "windows.h" #include "winbase.h" - +#include "nsString.h" /////////////////////////////////////////////////////////////////////////// @@ -164,13 +164,17 @@ static void FreeStringArray(PRUint32 variants, char ** array) /* nsPluginsDir implementation */ -PRBool nsPluginsDir::IsPluginFile(const nsFileSpec& fileSpec) +PRBool nsPluginsDir::IsPluginFile(nsIFile* file) { + PRBool ret = PR_FALSE; + nsCAutoString path; + if (NS_FAILED(file->GetNativePath(path))) + return PR_FALSE; + + const char *pathname = path.get(); const char* filename; char* extension; PRUint32 len; - const char* pathname = fileSpec.GetCString(); - // this is most likely a path, so skip to the filename filename = PL_strrchr(pathname, '\\'); if(filename) @@ -185,20 +189,19 @@ PRBool nsPluginsDir::IsPluginFile(const nsFileSpec& fileSpec) ++extension; if(len > 5) - { + { if(!PL_strncasecmp(filename, "np", 2) && !PL_strcasecmp(extension, "dll")) - return PR_TRUE; - } - - return PR_FALSE; + return PR_TRUE; + } + return ret; } /////////////////////////////////////////////////////////////////////////// /* nsPluginFile implementation */ -nsPluginFile::nsPluginFile(const nsFileSpec& spec) - : nsFileSpec(spec) +nsPluginFile::nsPluginFile(nsIFile* file) +: mPlugin(file) { // nada } @@ -215,34 +218,39 @@ nsPluginFile::~nsPluginFile() nsresult nsPluginFile::LoadPlugin(PRLibrary* &outLibrary) { // How can we convert to a full path names for using with NSPR? - const char* path = this->GetCString(); - char* index; - char* pluginFolderPath = PL_strdup(path); + if (!mPlugin) + return NS_ERROR_NULL_POINTER; - index = PL_strrchr(pluginFolderPath, '\\'); - *index = 0; + nsCAutoString temp; + mPlugin->GetNativePath(temp); + char* index; + char* pluginFolderPath = PL_strdup(temp.get()); + + index = PL_strrchr(pluginFolderPath, '\\'); + *index = 0; + BOOL restoreOrigDir = FALSE; char aOrigDir[MAX_PATH + 1]; DWORD dwCheck = ::GetCurrentDirectory(sizeof(aOrigDir), aOrigDir); NS_ASSERTION(dwCheck <= MAX_PATH + 1, "Error in Loading plugin"); if (dwCheck <= MAX_PATH + 1) - { + { restoreOrigDir = ::SetCurrentDirectory(pluginFolderPath); NS_ASSERTION(restoreOrigDir, "Error in Loading plugin"); - } - - outLibrary = PR_LoadLibrary(path); - + } + + outLibrary = PR_LoadLibrary(temp.get()); + if (restoreOrigDir) - { - BOOL bCheck = ::SetCurrentDirectory(aOrigDir); + { + BOOL bCheck = ::SetCurrentDirectory(aOrigDir); NS_ASSERTION(bCheck, "Error in Loading plugin"); - } - - PL_strfree(pluginFolderPath); - + } + + PL_strfree(pluginFolderPath); + return NS_OK; } @@ -251,20 +259,28 @@ nsresult nsPluginFile::LoadPlugin(PRLibrary* &outLibrary) */ nsresult nsPluginFile::GetPluginInfo(nsPluginInfo& info) { - nsresult res = NS_OK; + nsresult res = NS_OK; DWORD zerome, versionsize; char* verbuf = nsnull; - const char* path = this->GetCString(); - versionsize = ::GetFileVersionInfoSize((char*)path, &zerome); + const char* path; + + if (!mPlugin) + return NS_ERROR_NULL_POINTER; + + nsCAutoString temp; + mPlugin->GetNativePath(temp); + path = temp.get(); + + versionsize = ::GetFileVersionInfoSize((char*)path, &zerome); if (versionsize > 0) verbuf = (char *)PR_Malloc(versionsize); if(!verbuf) return NS_ERROR_OUT_OF_MEMORY; - + if(::GetFileVersionInfo((char*)path, NULL, versionsize, verbuf)) - { - info.fName = GetKeyValue(verbuf, "\\StringFileInfo\\040904E4\\ProductName"); + { + info.fName = GetKeyValue(verbuf, "\\StringFileInfo\\040904E4\\ProductName"); info.fDescription = GetKeyValue(verbuf, "\\StringFileInfo\\040904E4\\FileDescription"); char *mimeType = GetKeyValue(verbuf, "\\StringFileInfo\\040904E4\\MIMEType"); @@ -275,11 +291,11 @@ nsresult nsPluginFile::GetPluginInfo(nsPluginInfo& info) info.fMimeTypeArray = MakeStringArray(info.fVariantCount, mimeType); info.fMimeDescriptionArray = MakeStringArray(info.fVariantCount, mimeDescription); info.fExtensionArray = MakeStringArray(info.fVariantCount, extensions); - info.fFileName = PL_strdup(path); - - PL_strfree(mimeType); - PL_strfree(mimeDescription); - PL_strfree(extensions); + info.fFileName = PL_strdup(path); + + PL_strfree(mimeType); + PL_strfree(mimeDescription); + PL_strfree(extensions); } else res = NS_ERROR_FAILURE; diff --git a/mozilla/netwerk/protocol/jar/src/nsJARURI.cpp b/mozilla/netwerk/protocol/jar/src/nsJARURI.cpp index 232268f95d5..f4aa388f0fa 100644 --- a/mozilla/netwerk/protocol/jar/src/nsJARURI.cpp +++ b/mozilla/netwerk/protocol/jar/src/nsJARURI.cpp @@ -19,7 +19,6 @@ #include "nsJARURI.h" #include "nsNetUtil.h" #include "nsIIOService.h" -#include "nsFileSpec.h" #include "nsCRT.h" #include "nsIComponentManager.h" #include "nsIServiceManager.h" diff --git a/mozilla/netwerk/test/PropertiesTest.cpp b/mozilla/netwerk/test/PropertiesTest.cpp index afaad88f6f0..26dca4b492d 100644 --- a/mozilla/netwerk/test/PropertiesTest.cpp +++ b/mozilla/netwerk/test/PropertiesTest.cpp @@ -37,6 +37,7 @@ * ***** END LICENSE BLOCK ***** */ #include "nsXPCOM.h" +#include "nsString.h" #include "nsIEventQueueService.h" #include "nsIPersistentProperties2.h" #include "nsIServiceManager.h" @@ -50,7 +51,6 @@ #include //BAD DOG -- no biscuit! #include "nsReadableUtils.h" -#include "nsSpecialSystemDirectory.h" #define TEST_URL "resource:/res/test.properties" static NS_DEFINE_CID(kPersistentPropertiesCID, NS_IPERSISTENTPROPERTIES_CID); diff --git a/mozilla/netwerk/test/TestFileInput.cpp b/mozilla/netwerk/test/TestFileInput.cpp index c634c60b011..945c3fdd249 100644 --- a/mozilla/netwerk/test/TestFileInput.cpp +++ b/mozilla/netwerk/test/TestFileInput.cpp @@ -59,11 +59,21 @@ #include "nsCOMPtr.h" #include #include "nsInt64.h" -#include "nsFileSpec.h" static NS_DEFINE_CID(kFileTransportServiceCID, NS_FILETRANSPORTSERVICE_CID); static NS_DEFINE_CID(kEventQueueServiceCID, NS_EVENTQUEUESERVICE_CID); + +#if defined(XP_MAC) + #define FILE_PATH_SEPARATOR ":" +#elif defined(XP_WIN) || defined(XP_OS2) + #define FILE_PATH_SEPARATOR "\\" +#elif defined(XP_UNIX) || defined(XP_BEOS) + #define FILE_PATH_SEPARATOR "/" +#else + #error need_to_define_your_file_path_separator_and_illegal_characters +#endif + PRIntervalTime gDuration = 0; PRUint32 gVolume = 0; @@ -272,9 +282,11 @@ SerialReadTest(char* dirName) PRIntervalTime startTime = PR_IntervalNow(); PRDirEntry* entry; + while ((entry = PR_ReadDir(dir, PR_SKIP_BOTH)) != nsnull) { - nsFileSpec spec(dirName); - spec += entry->name; + char buffer[1024]; + + sprintf(buffer, "%s%s%s" dirName, FILE_PATH_SEPARATOR, entry->name); nsReader* reader = new nsReader(); NS_ASSERTION(reader, "out of memory"); @@ -293,7 +305,7 @@ SerialReadTest(char* dirName) reader->QueryInterface(NS_GET_IID(nsIStreamListener), (void**)&listener); NS_ASSERTION(listener, "QI failed"); - rv = Simulated_nsFileTransport_Run(reader, spec); + rv = Simulated_nsFileTransport_Run(reader, buffer); NS_ASSERTION(NS_SUCCEEDED(rv), "Simulated_nsFileTransport_Run failed"); // the reader thread will hang on to these objects until it quits diff --git a/mozilla/parser/htmlparser/public/nsHTMLTokens.h b/mozilla/parser/htmlparser/public/nsHTMLTokens.h index f546acf1e58..96dc519f9a4 100644 --- a/mozilla/parser/htmlparser/public/nsHTMLTokens.h +++ b/mozilla/parser/htmlparser/public/nsHTMLTokens.h @@ -128,9 +128,7 @@ class CStartToken: public CHTMLToken { virtual PRBool IsEmpty(void); virtual void SetEmpty(PRBool aValue); -#ifdef DEBUG - virtual void DebugDumpSource(nsOutputStream& out); -#endif + virtual const nsAString& GetStringValue(); virtual void GetSource(nsString& anOutputString); virtual void AppendSourceTo(nsAString& anOutputString); @@ -180,9 +178,7 @@ class CEndToken: public CHTMLToken { virtual PRInt32 GetTypeID(void); virtual const char* GetClassName(void); virtual PRInt32 GetTokenType(void); -#ifdef DEBUG - virtual void DebugDumpSource(nsOutputStream& out); -#endif + virtual const nsAString& GetStringValue(); virtual void GetSource(nsString& anOutputString); virtual void AppendSourceTo(nsAString& anOutputString); @@ -240,9 +236,7 @@ class CEntityToken : public CHTMLToken { virtual nsresult Consume(PRUnichar aChar,nsScanner& aScanner,PRInt32 aMode); static nsresult ConsumeEntity(PRUnichar aChar,nsString& aString,nsScanner& aScanner); static PRInt32 TranslateToUnicodeStr(PRInt32 aValue,nsString& aString); -#ifdef DEBUG - virtual void DebugDumpSource(nsOutputStream& out); -#endif + virtual const nsAString& GetStringValue(void); virtual void GetSource(nsString& anOutputString); virtual void AppendSourceTo(nsAString& anOutputString); @@ -372,15 +366,9 @@ class CAttributeToken: public CHTMLToken { virtual void BindKey(nsScanner* aScanner, nsReadingIterator& aStart, nsReadingIterator& aEnd); virtual const nsAString& GetValue(void) {return mTextValue;} virtual void SanitizeKey(); -#ifdef DEBUG - virtual void DebugDumpToken(nsOutputStream& out); -#endif virtual const nsAString& GetStringValue(void); virtual void GetSource(nsString& anOutputString); virtual void AppendSourceTo(nsAString& anOutputString); -#ifdef DEBUG - virtual void DebugDumpSource(nsOutputStream& out); -#endif PRPackedBool mHasEqualWithoutValue; protected: diff --git a/mozilla/parser/htmlparser/public/nsIParser.h b/mozilla/parser/htmlparser/public/nsIParser.h index 29b11b9dc88..86e7ad8b160 100644 --- a/mozilla/parser/htmlparser/public/nsIParser.h +++ b/mozilla/parser/htmlparser/public/nsIParser.h @@ -232,7 +232,7 @@ class nsIParser : public nsISupports { virtual PRBool IsComplete() =0; virtual nsresult Parse(nsIURI* aURL,nsIRequestObserver* aListener = nsnull,PRBool aEnableVerify=PR_FALSE, void* aKey=0,nsDTDMode aMode=eDTDMode_autodetect) = 0; - virtual nsresult Parse(nsIInputStream& aStream, const nsACString& aMimeType,PRBool aEnableVerify=PR_FALSE, void* aKey=0,nsDTDMode aMode=eDTDMode_autodetect) = 0; + virtual nsresult Parse(nsIInputStream* aStream, const nsACString& aMimeType,PRBool aEnableVerify=PR_FALSE, void* aKey=0,nsDTDMode aMode=eDTDMode_autodetect) = 0; virtual nsresult Parse(const nsAString& aSourceBuffer,void* aKey,const nsACString& aMimeType,PRBool aEnableVerify,PRBool aLastCall,nsDTDMode aMode=eDTDMode_autodetect) = 0; virtual nsresult Terminate(void) = 0; diff --git a/mozilla/parser/htmlparser/public/nsToken.h b/mozilla/parser/htmlparser/public/nsToken.h index 985e13519bb..3aa395d440c 100644 --- a/mozilla/parser/htmlparser/public/nsToken.h +++ b/mozilla/parser/htmlparser/public/nsToken.h @@ -72,7 +72,6 @@ #include "prtypes.h" #include "nsString.h" #include "nsError.h" -#include "nsFileSpec.h" #include "nsFixedSizeAllocator.h" #define NS_HTMLTOKENS_NOT_AN_ENTITY \ @@ -221,22 +220,6 @@ class CToken { */ virtual nsresult Consume(PRUnichar aChar,nsScanner& aScanner,PRInt32 aMode); -#ifdef DEBUG - /** - * Causes token to dump itself in debug form to given output stream - * @update gess5/11/98 - * @param out is the output stream where token should write itself - */ - virtual void DebugDumpToken(nsOutputStream& out); - - /** - * Causes token to dump itself in source form to given output stream - * @update gess5/11/98 - * @param out is the output stream where token should write itself - */ - virtual void DebugDumpSource(nsOutputStream& out); -#endif - /** * Getter which retrieves type of token * @update gess5/11/98 diff --git a/mozilla/parser/htmlparser/src/CNavDTD.cpp b/mozilla/parser/htmlparser/src/CNavDTD.cpp index 1cf2a05d87f..1c2070a1129 100644 --- a/mozilla/parser/htmlparser/src/CNavDTD.cpp +++ b/mozilla/parser/htmlparser/src/CNavDTD.cpp @@ -37,7 +37,6 @@ * ***** END LICENSE BLOCK ***** */ //#define ENABLE_CRC -//#define RICKG_DEBUG //#define ALLOW_TR_AS_CHILD_OF_TABLE //by setting this to true, TR is allowable directly in TABLE. #define ENABLE_RESIDUALSTYLE @@ -69,6 +68,7 @@ #include "nsReadableUtils.h" #include "nsUnicharUtils.h" #include "prmem.h" +#include "nsIServiceManager.h" #ifdef NS_DEBUG #include "nsLoggingSink.h" @@ -190,13 +190,6 @@ CNavDTD::CNavDTD() : nsIDTD(), #endif { mBodyContext=new nsDTDContext(); - -#ifdef RICKG_DEBUG - //DebugDumpContainmentRules2(*this,"c:/temp/DTDRules.new","New CNavDTD Containment Rules"); - nsHTMLElement::DebugDumpContainment("c:/temp/contain.new","ElementTable Rules"); - nsHTMLElement::DebugDumpMembership("c:/temp/membership.out"); - nsHTMLElement::DebugDumpContainType("c:/temp/ctnrules.out"); -#endif } /** @@ -1393,16 +1386,6 @@ nsresult CNavDTD::HandleDefaultStartToken(CToken* aToken,eHTMLTags aChildTag,nsC return result; } - - -#ifdef RICKG_DEBUG -void WriteTokenToLog(CToken* aToken) { - - static nsFileSpec fileSpec("c:\\temp\\tokenlog.html"); - static nsOutputFileStream outputStream(fileSpec); - aToken->DebugDumpSource(outputStream); //write token without close bracket... -} -#endif /** * This gets called before we've handled a given start tag. @@ -1689,10 +1672,6 @@ nsresult CNavDTD::HandleKeyGen(nsIParserNode* aNode) { nsresult CNavDTD::HandleStartToken(CToken* aToken) { NS_PRECONDITION(0!=aToken,kNullToken); - #ifdef RICKG_DEBUG - WriteTokenToLog(aToken); - #endif - //Begin by gathering up attributes... nsCParserNode* theNode=mNodeAllocator.CreateNode(aToken, mTokenAllocator); @@ -1947,10 +1926,6 @@ nsresult CNavDTD::HandleEndToken(CToken* aToken) { nsresult result=NS_OK; eHTMLTags theChildTag=(eHTMLTags)aToken->GetTypeID(); - #ifdef RICKG_DEBUG - WriteTokenToLog(aToken); - #endif - switch(theChildTag) { case eHTMLTag_script: @@ -2198,9 +2173,6 @@ nsresult CNavDTD::HandleEntityToken(CToken* aToken) { result=HandleOmittedTag(aToken,theCurrTag,theParentTag,theNode); } else { -#ifdef RICKG_DEBUG - WriteTokenToLog(aToken); -#endif result=AddLeaf(theNode); } IF_FREE(theNode, &mNodeAllocator); @@ -2227,10 +2199,6 @@ nsresult CNavDTD::HandleCommentToken(CToken* aToken) { if(theNode) { - #ifdef RICKG_DEBUG - WriteTokenToLog(aToken); - #endif - STOP_TIMER(); MOZ_TIMER_DEBUGLOG(("Stop: Parse Time: CNavDTD::HandleCommentToken(), this=%p\n", this)); @@ -2304,10 +2272,6 @@ nsresult CNavDTD::HandleProcessingInstructionToken(CToken* aToken){ nsCParserNode* theNode=mNodeAllocator.CreateNode(aToken, mTokenAllocator); if(theNode) { - #ifdef RICKG_DEBUG - WriteTokenToLog(aToken); - #endif - STOP_TIMER(); MOZ_TIMER_DEBUGLOG(("Stop: Parse Time: CNavDTD::HandleProcessingInstructionToken(), this=%p\n", this)); @@ -2335,10 +2299,6 @@ nsresult CNavDTD::HandleDocTypeDeclToken(CToken* aToken){ nsresult result=NS_OK; - #ifdef RICKG_DEBUG - WriteTokenToLog(aToken); - #endif - CDoctypeDeclToken* theToken = NS_STATIC_CAST(CDoctypeDeclToken*,aToken); nsAutoString docTypeStr(theToken->GetStringValue()); mLineNumber += docTypeStr.CountChar(kNewLine); @@ -2406,10 +2366,6 @@ nsresult CNavDTD::CollectAttributes(nsIParserNode& aNode,eHTMLTags aTag,PRInt32 ((CAttributeToken*)theToken)->SanitizeKey(); mLineNumber += theToken->GetNewlineCount(); - #ifdef RICKG_DEBUG - WriteTokenToLog(theToken); - #endif - aNode.AddAttribute(theToken); } } diff --git a/mozilla/parser/htmlparser/src/COtherDTD.cpp b/mozilla/parser/htmlparser/src/COtherDTD.cpp index aaf6fe09074..87cce9258a0 100644 --- a/mozilla/parser/htmlparser/src/COtherDTD.cpp +++ b/mozilla/parser/htmlparser/src/COtherDTD.cpp @@ -38,8 +38,6 @@ * ***** END LICENSE BLOCK ***** */ //#define ENABLE_CRC -//#define RICKG_DEBUG - #include "nsDebug.h" #include "nsIAtom.h" @@ -176,14 +174,6 @@ COtherDTD::COtherDTD() : nsIDTD() { if(!gElementTable) { gElementTable = new CElementTable(); } - -#ifdef RICKG_DEBUG - //DebugDumpContainmentRules2(*this,"c:/temp/DTDRules.new","New COtherDTD Containment Rules"); - nsHTMLElement::DebugDumpContainment("c:/temp/contain.new","ElementTable Rules"); - nsHTMLElement::DebugDumpMembership("c:/temp/membership.out"); - nsHTMLElement::DebugDumpContainType("c:/temp/ctnrules.out"); -#endif - } /** @@ -628,16 +618,6 @@ nsresult COtherDTD::DidHandleStartTag(nsIParserNode& aNode,eHTMLTags aChildTag){ return result; } - -#ifdef RICKG_DEBUG -void WriteTokenToLog(CToken* aToken) { - - static nsFileSpec fileSpec("c:\\temp\\tokenlog.html"); - static nsOutputFileStream outputStream(fileSpec); - aToken->DebugDumpSource(outputStream); //write token without close bracket... -} -#endif - /** * This gets called before we've handled a given start tag. * It's a generic hook to let us do pre processing. @@ -694,9 +674,6 @@ nsresult COtherDTD::WillHandleStartTag(CToken* aToken,eHTMLTags aTag,nsIParserNo * @return PR_TRUE if all went well; PR_FALSE if error occured */ nsresult COtherDTD::HandleStartToken(CToken* aToken) { - #ifdef RICKG_DEBUG - WriteTokenToLog(aToken); - #endif //Begin by gathering up attributes... @@ -767,10 +744,6 @@ nsresult COtherDTD::HandleEndToken(CToken* aToken) { nsresult result=NS_OK; eHTMLTags theChildTag=(eHTMLTags)aToken->GetTypeID(); - #ifdef RICKG_DEBUG - WriteTokenToLog(aToken); - #endif - switch(theChildTag) { case eHTMLTag_body: //we intentionally don't let the user close HTML or BODY @@ -826,10 +799,6 @@ nsresult COtherDTD::CollectAttributes(nsIParserNode& aNode,eHTMLTags aTag,PRInt3 // a legitimate "SELECTED" key. ((CAttributeToken*)theToken)->SanitizeKey(); - #ifdef RICKG_DEBUG - WriteTokenToLog(theToken); - #endif - aNode.AddAttribute(theToken); } } diff --git a/mozilla/parser/htmlparser/src/nsDTDUtils.cpp b/mozilla/parser/htmlparser/src/nsDTDUtils.cpp index aa6f63d01c7..f91f8cf8efa 100644 --- a/mozilla/parser/htmlparser/src/nsDTDUtils.cpp +++ b/mozilla/parser/htmlparser/src/nsDTDUtils.cpp @@ -1489,40 +1489,6 @@ nsCParserNode* nsNodeAllocator::CreateNode(CToken* aToken, #ifdef DEBUG void DebugDumpContainmentRules(nsIDTD& theDTD,const char* aFilename,const char* aTitle) { -#ifdef RICKG_DEBUG - -#include - - const char* prefix=" "; - fstream out(aFilename,ios::out); - out << "==================================================" << endl; - out << aTitle << endl; - out << "=================================================="; - int i,j=0; - int written; - for(i=1;i" << endl; - out << prefix; - written=0; - if(theDTD.IsContainer(i)) { - for(j=1;j -#endif - #ifdef DEBUG void nsHTMLElement::DebugDumpContainment(const char* aFilename,const char* aTitle){ -#ifdef RICKG_DEBUG - - PRBool t=CanContain(eHTMLTag_address,eHTMLTag_object); - - const char* prefix=" "; - fstream out(aFilename,ios::out); - out << "==================================================" << endl; - out << aTitle << endl; - out << "=================================================="; - int i,j=0; - int written; - int linenum=5; - for(i=1;i" << endl; - out << prefix; - linenum+=3; - written=0; - char startChar=0; - if(IsContainer((eHTMLTags)i)) { - for(j=1;j* aDTD) return PR_FALSE; } } - nsSpecialSystemDirectory dtdPath(nsSpecialSystemDirectory::OS_CurrentProcessDirectory); - dtdPath += PromiseFlatCString(nsDependentCString(kDTDDirectory) + fileName).get(); - if (dtdPath.Exists()) { + + nsCOMPtr dtdPath; + NS_GetSpecialDirectory(NS_OS_CURRENT_PROCESS_DIR, + getter_AddRefs(dtdPath)); + + if (!dtdPath) + return PR_FALSE; + + nsCOMPtr lfile = do_QueryInterface(dtdPath); + + nsCAutoString path; + path = NS_LITERAL_CSTRING(kDTDDirectory) + fileName; + lfile->AppendRelativeNativePath(path); + + PRBool exists; + dtdPath->Exists(&exists); + + if (exists) { // The DTD was found in the local DTD directory. - // Set aDTD to a file: url pointing to the local DTD - nsFileURL dtdFile(dtdPath); + // Set aDTD to a file: url pointing to the local DT nsCOMPtr dtdURI; - NS_NewURI(getter_AddRefs(dtdURI), dtdFile.GetURLString()); + NS_NewFileURI(getter_AddRefs(dtdURI), dtdPath); + if (dtdURI) { *aDTD = dtdURI; isLoadable = PR_TRUE; diff --git a/mozilla/parser/htmlparser/src/nsExpatDriver.h b/mozilla/parser/htmlparser/src/nsExpatDriver.h index 650f4c01942..cd68396dec7 100644 --- a/mozilla/parser/htmlparser/src/nsExpatDriver.h +++ b/mozilla/parser/htmlparser/src/nsExpatDriver.h @@ -43,7 +43,7 @@ #include "nsString.h" #include "nsIDTD.h" #include "nsITokenizer.h" -#include "nsFileSpec.h" +#include "nsIInputStream.h" class nsIExpatSink; struct nsCatalogData; diff --git a/mozilla/parser/htmlparser/src/nsHTMLTokens.cpp b/mozilla/parser/htmlparser/src/nsHTMLTokens.cpp index 4b09e80446b..87ddf261919 100644 --- a/mozilla/parser/htmlparser/src/nsHTMLTokens.cpp +++ b/mozilla/parser/htmlparser/src/nsHTMLTokens.cpp @@ -236,21 +236,6 @@ nsresult CStartToken::Consume(PRUnichar aChar, nsScanner& aScanner,PRInt32 aFlag } -#ifdef DEBUG -/* - * Dump contents of this token to givne output stream - * - * @update gess 3/25/98 - * @param out -- ostream to output content - * @return - */ -void CStartToken::DebugDumpSource(nsOutputStream& out) { - out << "<" << NS_LossyConvertUCS2toASCII(mTextValue).get(); - if(!mAttributed) - out << ">"; -} -#endif - const nsAString& CStartToken::GetStringValue() { if((eHTMLTag_unknown"; -} -#endif - const nsAString& CEndToken::GetStringValue() { if((eHTMLTag_unknown"; -} -#endif - void CAttributeToken::SetKey(const nsAString& aKey) { mTextKey.Rebind(aKey); @@ -2201,20 +2139,6 @@ PRInt32 CEntityToken::TranslateToUnicodeStr(nsString& aString) { return value; } -#ifdef DEBUG -/* - * Dump contents of this token to givne output stream - * - * @update gess 3/25/98 - * @param out -- ostream to output content - * @return - */ -void CEntityToken::DebugDumpSource(nsOutputStream& out) { - char* cp = ToNewCString(mTextValue); - out << "&" << *cp; - delete[] cp; -} -#endif const nsAString& CEntityToken::GetStringValue(void) { diff --git a/mozilla/parser/htmlparser/src/nsParser.cpp b/mozilla/parser/htmlparser/src/nsParser.cpp index 26faba90f5e..beb7a5bdf53 100644 --- a/mozilla/parser/htmlparser/src/nsParser.cpp +++ b/mozilla/parser/htmlparser/src/nsParser.cpp @@ -66,6 +66,7 @@ #include "nsIEventQueue.h" #include "nsIEventQueueService.h" #include "nsExpatDriver.h" +#include "nsIServiceManager.h" //#define rickgdebug #define NS_PARSER_FLAG_DTD_VERIFICATION 0x00000001 @@ -1517,8 +1518,7 @@ nsresult nsParser::Parse(nsIURI* aURL,nsIRequestObserver* aListener,PRBool aVeri * @param aStream is the i/o source * @return error code -- 0 if ok, non-zero if error. */ -nsresult nsParser::Parse(nsIInputStream& aStream,const nsACString& aMimeType,PRBool aVerifyEnabled, void* aKey,nsDTDMode aMode){ - +nsresult nsParser::Parse(nsIInputStream* aStream,const nsACString& aMimeType,PRBool aVerifyEnabled, void* aKey,nsDTDMode aMode){ if (aVerifyEnabled) { mFlags |= NS_PARSER_FLAG_DTD_VERIFICATION; } @@ -1531,9 +1531,9 @@ nsresult nsParser::Parse(nsIInputStream& aStream,const nsACString& aMimeType,PRB //ok, time to create our tokenizer and begin the process nsAutoString theUnknownFilename(NS_LITERAL_STRING("unknown")); - nsInputStream input(&aStream); + // references + nsScanner* theScanner=new nsScanner(theUnknownFilename,aStream,mCharset,mCharsetSource); - nsScanner* theScanner=new nsScanner(theUnknownFilename,input,mCharset,mCharsetSource); CParserContext* pc=new CParserContext(theScanner,aKey,mCommand,0); if(pc && theScanner) { PushContext(*pc); @@ -2606,23 +2606,6 @@ PRBool nsParser::DidTokenize(PRBool aIsFinalChunk){ return result; } -#ifdef DEBUG -void nsParser::DebugDumpSource(nsOutputStream& aStream) { - PRInt32 theIndex=-1; - - nsITokenizer* theTokenizer=0; - PRInt32 type = mParserContext && mParserContext->mDTD ? - mParserContext->mDTD->GetType() : NS_IPARSER_FLAG_HTML; - if(NS_SUCCEEDED(mParserContext->GetTokenizer(type, theTokenizer))){ - CToken* theToken; - while(nsnull != (theToken=theTokenizer->GetTokenAt(++theIndex))) { - // theToken->DebugDumpToken(out); - theToken->DebugDumpSource(aStream); - } - } -} -#endif - /** * Get the channel associated with this parser * @update harishd,gagan 07/17/01 diff --git a/mozilla/parser/htmlparser/src/nsParser.h b/mozilla/parser/htmlparser/src/nsParser.h index 6f7485606d8..d16b7aac6db 100644 --- a/mozilla/parser/htmlparser/src/nsParser.h +++ b/mozilla/parser/htmlparser/src/nsParser.h @@ -204,7 +204,7 @@ class nsParser : public nsIParser, * @param aStream is the i/o source * @return TRUE if all went well -- FALSE otherwise */ - virtual nsresult Parse(nsIInputStream& aStream,const nsACString& aMimeType,PRBool aEnableVerify=PR_FALSE,void* aKey=0,nsDTDMode aMode=eDTDMode_autodetect); + virtual nsresult Parse(nsIInputStream* aStream,const nsACString& aMimeType,PRBool aEnableVerify=PR_FALSE,void* aKey=0,nsDTDMode aMode=eDTDMode_autodetect); /** * @update gess5/11/98 @@ -273,10 +273,6 @@ class nsParser : public nsIParser, PRBool aIsFinalChunk = PR_FALSE, PRBool aCanInterrupt = PR_TRUE); -#ifdef DEBUG - void DebugDumpSource(nsOutputStream& anOutput); -#endif - //********************************************* // These methods are callback methods used by // net lib to let us know about our inputstream. diff --git a/mozilla/parser/htmlparser/src/nsScanner.cpp b/mozilla/parser/htmlparser/src/nsScanner.cpp index e3371fb683a..5e0a11cc382 100644 --- a/mozilla/parser/htmlparser/src/nsScanner.cpp +++ b/mozilla/parser/htmlparser/src/nsScanner.cpp @@ -43,8 +43,10 @@ #include "nsIServiceManager.h" #include "nsICharsetConverterManager.h" #include "nsICharsetAlias.h" -#include "nsFileSpec.h" #include "nsReadableUtils.h" +#include "nsIInputStream.h" +#include "nsILocalFile.h" +#include "nsNetUtil.h" static NS_DEFINE_CID(kCharsetAliasCID, NS_CHARSETALIAS_CID); @@ -118,8 +120,6 @@ nsScanner::nsScanner(const nsAString& anHTMLString, const nsString& aCharset, PR mSlidingBuffer->BeginReading(mCurrentPosition); mMarkPosition = mCurrentPosition; mIncremental=PR_FALSE; - mOwnsStream=PR_FALSE; - mInputStream=0; mUnicodeDecoder = 0; mCharsetSource = kCharsetUninitialized; SetDocumentCharset(aCharset, aSource); @@ -149,10 +149,15 @@ nsScanner::nsScanner(nsString& aFilename,PRBool aCreateStream, const nsString& a mIncremental=PR_TRUE; mCountRemaining = 0; mTotalRead=0; - mOwnsStream=aCreateStream; - mInputStream=0; + if(aCreateStream) { - mInputStream = new nsInputFileStream(nsFileSpec(aFilename)); + nsCOMPtr file; + nsCOMPtr fileStream; + + NS_NewLocalFile(aFilename, PR_TRUE, getter_AddRefs(file)); + if (file) + NS_NewLocalFileInputStream(getter_AddRefs(mInputStream), file); + } //if mUnicodeDecoder = 0; mCharsetSource = kCharsetUninitialized; @@ -168,7 +173,7 @@ nsScanner::nsScanner(nsString& aFilename,PRBool aCreateStream, const nsString& a * @param aFilename -- * @return */ -nsScanner::nsScanner(const nsAString& aFilename,nsInputStream& aStream,const nsString& aCharset, PRInt32 aSource) : +nsScanner::nsScanner(const nsAString& aFilename,nsIInputStream* aStream,const nsString& aCharset, PRInt32 aSource) : mFilename(aFilename) { MOZ_COUNT_CTOR(nsScanner); @@ -183,8 +188,7 @@ nsScanner::nsScanner(const nsAString& aFilename,nsInputStream& aStream,const nsS mIncremental=PR_FALSE; mCountRemaining = 0; mTotalRead=0; - mOwnsStream=PR_FALSE; - mInputStream=&aStream; + mInputStream=aStream; mUnicodeDecoder = 0; mCharsetSource = kCharsetUninitialized; SetDocumentCharset(aCharset, aSource); @@ -254,11 +258,10 @@ nsScanner::~nsScanner() { MOZ_COUNT_DTOR(nsScanner); if(mInputStream) { - mInputStream->close(); - if(mOwnsStream) - delete mInputStream; + mInputStream->Close(); + mInputStream = 0; } - mInputStream=0; + NS_IF_RELEASE(mUnicodeDecoder); } @@ -424,14 +427,13 @@ nsresult nsScanner::FillBuffer(void) { result=kEOF; } else { - PRInt32 numread=0; - char* buf = new char[kBufsize+1]; + PRUint32 numread=0; + char buf[kBufsize+1]; buf[kBufsize]=0; if(mInputStream) { - numread = mInputStream->read(buf, kBufsize); + result = mInputStream->Read(buf, kBufsize, &numread); if (0 == numread) { - delete [] buf; return kEOF; } } @@ -441,7 +443,6 @@ nsresult nsScanner::FillBuffer(void) { PRUnichar* unichars = ToNewUnicode(str); AppendToBuffer(unichars, unichars+numread, unichars+kBufsize+1); } - delete [] buf; mTotalRead+=numread; } diff --git a/mozilla/parser/htmlparser/src/nsScanner.h b/mozilla/parser/htmlparser/src/nsScanner.h index 9dcc9b3d609..994c597c491 100644 --- a/mozilla/parser/htmlparser/src/nsScanner.h +++ b/mozilla/parser/htmlparser/src/nsScanner.h @@ -52,12 +52,13 @@ #ifndef SCANNER #define SCANNER +#include "nsCOMPtr.h" #include "nsString.h" #include "nsIParser.h" #include "prtypes.h" #include "nsIUnicodeDecoder.h" -#include "nsFileStream.h" #include "nsSlidingString.h" +#include "nsIInputStream.h" class nsScannerString : public nsSlidingString { public: @@ -117,7 +118,7 @@ class nsScanner { * @param aMode represents the parser mode (nav, other) * @return */ - nsScanner(const nsAString& aFilename, nsInputStream& aStream, const nsString& aCharset, PRInt32 aSource); + nsScanner(const nsAString& aFilename, nsIInputStream* aStream, const nsString& aCharset, PRInt32 aSource); ~nsScanner(); @@ -382,7 +383,7 @@ class nsScanner { PRUnichar* aDataEnd, PRUnichar* aStorageEnd); - nsInputStream* mInputStream; + nsCOMPtr mInputStream; nsScannerString* mSlidingBuffer; nsReadingIterator mCurrentPosition; // The position we will next read from in the scanner buffer nsReadingIterator mMarkPosition; // The position last marked (we may rewind to here) @@ -391,7 +392,6 @@ class nsScanner { PRUint32 mCountRemaining; // The number of bytes still to be read // from the scanner buffer PRUint32 mTotalRead; - PRPackedBool mOwnsStream; PRPackedBool mIncremental; PRInt32 mCharsetSource; nsString mCharset; diff --git a/mozilla/parser/htmlparser/src/nsToken.cpp b/mozilla/parser/htmlparser/src/nsToken.cpp index 2eedff1650b..6cb6d9201a2 100644 --- a/mozilla/parser/htmlparser/src/nsToken.cpp +++ b/mozilla/parser/htmlparser/src/nsToken.cpp @@ -111,38 +111,6 @@ nsresult CToken::Consume(PRUnichar aChar,nsScanner& aScanner,PRInt32 aMode) { return result; } - -#ifdef DEBUG -/** - * This debug method causes the token to dump its content - * to the given stream (formated for debugging). - * - * @update gess 3/25/98 - * @param ostream -- output stream to accept output data - */ -void CToken::DebugDumpToken(nsOutputStream& anOutputStream) { - anOutputStream << "[" << GetClassName() << "] "; - PRUint32 i=0; - PRUint32 theLen=GetStringValue().Length(); - for(i=0;iExists(&exists); if (NS_FAILED(rv)) return rv; + if (!exists) { nsCOMPtr profileDefaultsDir; nsCOMPtr profileDirParent; @@ -363,7 +364,7 @@ nsProfileDirServiceProvider::InitProfileDir(nsIFile *profileDir) rv = profileDir->GetNativeLeafName(profileDirName); if (NS_FAILED(rv)) return rv; - + rv = NS_GetSpecialDirectory(NS_APP_PROFILE_DEFAULTS_50_DIR, getter_AddRefs(profileDefaultsDir)); if (NS_FAILED(rv)) { rv = NS_GetSpecialDirectory(NS_APP_PROFILE_DEFAULTS_NLOC_50_DIR, getter_AddRefs(profileDefaultsDir)); @@ -371,8 +372,13 @@ nsProfileDirServiceProvider::InitProfileDir(nsIFile *profileDir) return rv; } rv = profileDefaultsDir->CopyToNative(profileDirParent, profileDirName); - if (NS_FAILED(rv)) - return rv; + if (NS_FAILED(rv)) { + // if copying failed, lets just ensure that the profile directory exists. + profileDirParent->AppendNative(profileDirName); + rv = profileDirParent->Create(nsIFile::DIRECTORY_TYPE, 0700); + if (NS_FAILED(rv)) + return rv; + } #ifndef XP_MAC rv = profileDir->SetPermissions(0700); @@ -384,6 +390,7 @@ nsProfileDirServiceProvider::InitProfileDir(nsIFile *profileDir) else { PRBool isDir; rv = profileDir->IsDirectory(&isDir); + if (NS_FAILED(rv)) return rv; if (!isDir) diff --git a/mozilla/profile/pref-migrator/src/Makefile.in b/mozilla/profile/pref-migrator/src/Makefile.in index c5880022d02..7cda2163dd1 100644 --- a/mozilla/profile/pref-migrator/src/Makefile.in +++ b/mozilla/profile/pref-migrator/src/Makefile.in @@ -32,6 +32,7 @@ EXPORT_LIBRARY = 1 IS_COMPONENT = 1 MODULE_NAME = nsPrefMigrationModule REQUIRES = xpcom \ + xpcom_obsolete \ string \ pref \ intl \ @@ -57,6 +58,7 @@ EXPORTS = \ EXTRA_DSO_LDOPTS = \ $(LIBS_DIR) \ $(MOZ_COMPONENT_LIBS) \ + $(MOZ_XPCOM_OBSOLETE_LIBS) \ $(MOZ_JS_LIBS) \ $(NULL) diff --git a/mozilla/profile/src/Makefile.in b/mozilla/profile/src/Makefile.in index 03dc40e96b6..2fa58599cfe 100644 --- a/mozilla/profile/src/Makefile.in +++ b/mozilla/profile/src/Makefile.in @@ -29,7 +29,9 @@ include $(DEPTH)/config/autoconf.mk MODULE = profile LIBRARY_NAME = profile_s REQUIRES = xpcom \ - string \ + xpcom_obsolete \ + xpcom_obsolete \ + string \ chrome \ docshell \ webbrwsr \ @@ -45,7 +47,7 @@ REQUIRES = xpcom \ appshell \ uconv \ windowwatcher \ - profdirserviceprovider \ + profdirserviceprovider \ $(NULL) CPPSRCS = nsProfile.cpp \ diff --git a/mozilla/profile/src/nsProfile.cpp b/mozilla/profile/src/nsProfile.cpp index 1ec10918951..11c566fc479 100644 --- a/mozilla/profile/src/nsProfile.cpp +++ b/mozilla/profile/src/nsProfile.cpp @@ -49,7 +49,6 @@ #include "nsIComponentManager.h" #include "nsIEnumerator.h" #include "nsXPIDLString.h" -#include "nsIFileSpec.h" #include "nsEscape.h" #include "nsIURL.h" @@ -2401,8 +2400,6 @@ nsProfile::CreateDefaultProfile(void) { nsresult rv = NS_OK; - nsFileSpec profileDirSpec; - // Get the default user profiles folder nsCOMPtr profileRootDir; rv = NS_GetSpecialDirectory(NS_APP_USER_PROFILES_ROOT_DIR, getter_AddRefs(profileRootDir)); diff --git a/mozilla/profile/src/nsProfile.h b/mozilla/profile/src/nsProfile.h index 6d172e21175..76462d436de 100644 --- a/mozilla/profile/src/nsProfile.h +++ b/mozilla/profile/src/nsProfile.h @@ -42,7 +42,6 @@ #include "nsCOMPtr.h" #include "nsISupports.h" #include "nsIRegistry.h" -#include "nsFileSpec.h" #include "nsString.h" #include "nsICmdLineService.h" #include "nsProfileAccess.h" diff --git a/mozilla/profile/src/nsProfileAccess.cpp b/mozilla/profile/src/nsProfileAccess.cpp index ba9af5458c9..800f506a030 100644 --- a/mozilla/profile/src/nsProfileAccess.cpp +++ b/mozilla/profile/src/nsProfileAccess.cpp @@ -29,16 +29,16 @@ #include "nsIEnumerator.h" #include "prprf.h" -#include "nsSpecialSystemDirectory.h" #include "nsCOMPtr.h" #include "nsIComponentManager.h" -#include "nsFileStream.h" #include "nsEscape.h" #include "nsDirectoryServiceDefs.h" #include "nsAppDirectoryServiceDefs.h" #include "nsILocalFile.h" #include "nsReadableUtils.h" +#include "nsIFileSpec.h" + #if defined(XP_MAC) || defined(XP_MACOSX) #include #include diff --git a/mozilla/profile/src/nsProfileAccess.h b/mozilla/profile/src/nsProfileAccess.h index d50123f8b16..0af49a32ed8 100644 --- a/mozilla/profile/src/nsProfileAccess.h +++ b/mozilla/profile/src/nsProfileAccess.h @@ -25,7 +25,6 @@ #include "nsIRegistry.h" #include "nsXPIDLString.h" #include "nsVoidArray.h" -#include "nsIFileSpec.h" #include "nsIFile.h" #include "nsILocalFile.h" diff --git a/mozilla/rdf/chrome/src/nsChromeRegistry.cpp b/mozilla/rdf/chrome/src/nsChromeRegistry.cpp index dfc4f954b11..5f79bff8c92 100644 --- a/mozilla/rdf/chrome/src/nsChromeRegistry.cpp +++ b/mozilla/rdf/chrome/src/nsChromeRegistry.cpp @@ -44,8 +44,6 @@ #include #include "nsCOMPtr.h" -#include "nsIFileSpec.h" -#include "nsSpecialSystemDirectory.h" #include "nsIChromeRegistry.h" #include "nsChromeRegistry.h" #include "nsChromeUIDataSource.h" diff --git a/mozilla/rdf/datasource/src/nsFileSystemDataSource.cpp b/mozilla/rdf/datasource/src/nsFileSystemDataSource.cpp index 00ef14a90e5..c8d8fa7e119 100644 --- a/mozilla/rdf/datasource/src/nsFileSystemDataSource.cpp +++ b/mozilla/rdf/datasource/src/nsFileSystemDataSource.cpp @@ -60,10 +60,7 @@ #include "prprf.h" #include "prio.h" #include "rdf.h" -#include "nsFileSpec.h" -#include "nsFileStream.h" #include "nsIRDFFileSystem.h" -#include "nsSpecialSystemDirectory.h" #include "nsEnumeratorUtils.h" #include "nsIURL.h" #include "nsIFileURL.h" @@ -71,6 +68,7 @@ #include "nsIChannel.h" #include "nsIFile.h" #include "nsEscape.h" +#include "nsCRT.h" #ifdef XP_WIN #include "nsIUnicodeDecoder.h" @@ -79,6 +77,8 @@ #include "nsICharsetAlias.h" #include "windef.h" #include "winbase.h" +#include "nsDirectoryServiceDefs.h" +#include "nsILineInputStream.h" #endif #ifdef XP_BEOS @@ -285,30 +285,36 @@ FileSystemDataSource::FileSystemDataSource(void) PR_ASSERT(NS_SUCCEEDED(rv)); #ifdef XP_WIN - nsSpecialSystemDirectory ieFavoritesFolder(nsSpecialSystemDirectory::Win_Favorites); - nsFileURL ieFavoritesURLSpec(ieFavoritesFolder); - const char *ieFavoritesURI = ieFavoritesURLSpec.GetAsString(); + nsCOMPtr file; + NS_GetSpecialDirectory(NS_WIN_FAVORITES_DIR, getter_AddRefs(file)); + + nsCOMPtr furi; + NS_NewFileURI(getter_AddRefs(furi), file); + nsCAutoString favoritesDir; + file->GetNativePath(favoritesDir); + ieFavoritesDir = ToNewCString(favoritesDir); - if (ieFavoritesURI) - { - ieFavoritesDir = nsCRT::strdup(ieFavoritesURI); - } gRDFService->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "IEFavorite"), &kNC_IEFavoriteObject); gRDFService->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "IEFavoriteFolder"), &kNC_IEFavoriteFolder); + + #endif #ifdef XP_BEOS - nsSpecialSystemDirectory netPositiveFolder(nsSpecialSystemDirectory::BeOS_SettingsDirectory); - nsFileURL netPositiveURLSpec(netPositiveFolder); - netPositiveURLSpec += "NetPositive/Bookmarks/"; - const char *netPositiveURI = netPositiveURLSpec.GetAsString(); - if (netPositiveURI) - { - netPositiveDir = nsCRT::strdup(netPositiveURI); - } + nsCOMPtr file; + NS_GetSpecialDirectory(NS_BEOS_SETTINGS_DIR, getter_AddRefs(file)); + + file->Append(NS_LITERAL_CSTRING("NetPositive")); + file->Append(NS_LITERAL_CSTRING("Bookmarks")); + + nsCOMPtr furi; + NS_NewFileURI(getter_AddRefs(furi), file); + lf->GetSpec(ieFavoritesDir); + file->GetNativePath(&netPositiveDir) + #endif gRDFService->GetResource(NS_LITERAL_CSTRING("NC:FilesRoot"), @@ -376,11 +382,19 @@ FileSystemDataSource::~FileSystemDataSource (void) if (ieFavoritesDir) { - nsCRT::free(ieFavoritesDir); + nsMemory::Free(ieFavoritesDir); ieFavoritesDir = nsnull; } #endif +#ifdef BEOS + + if (netPositiveDir) + { + nsMemory::Free(netPositiveDir); + netPositiveDir = nsnull; + } +#endif #ifdef USE_NC_EXTENSION NS_RELEASE(kNC_extension); #endif @@ -1122,8 +1136,17 @@ FileSystemDataSource::GetVolumeList(nsISimpleEnumerator** aResult) pb.volumeParam.ioNamePtr = (StringPtr)fname; if (PBHGetVInfo(&pb,FALSE) != noErr) break; - nsFileSpec fss(pb.volumeParam.ioVRefNum, fsRtParID, fname); - rv = gRDFService->GetResource(nsDependentCString(nsFileURL(fss).GetAsString()), getter_AddRefs(vol)); + FSSpec fss(pb.volumeParam.ioVRefNum, fsRtParID, fname); + nsCOMPtr lf; + NS_NewLocalFileWithFSSpec(fss, true, getter_AddRefs(lf)); + + nsCOMPtr furi; + NS_NewFileURI(getter_AddRefs(furi), lf); + + nsXPIDLCString spec; + furi->GetSpec(getter_Copies(spec); + + rv = gRDFService->GetResource(spec, getter_AddRefs(vol)); if (NS_FAILED(rv)) return rv; volumes->AppendElement(vol); @@ -1571,13 +1594,13 @@ FileSystemDataSource::GetName(nsIRDFResource *source, nsIRDFLiteral **aResult) // under BEOS, try and get the "META:title" attribute (if its a file) if (strncmp(uri, netPositiveDir, strlen(netPositiveDir)) == 0) { - nsFileURL url(uri); - nsFilePath path(url); - nsFileSpec spec(path); -// if (spec.IsFile() && (!spec.IsHidden())) - if (spec.IsFile() || spec.IsDirectory()) + PRBool value; + if ((NS_SUCCEEDED(aFileLocal->IsFile(&value) && value) || + (NS_SUCCEEDED(aFileLocal->IsDirectory(&value) && value)) { - const char *nativeURI = spec.GetNativePathCString(); + nsXPIDLCString nativeURI; + aFileLocal->GetSpec(getter_Copies(spec)); + rv = NS_ERROR_FAILURE; if (nativeURI) { @@ -1643,23 +1666,24 @@ FileSystemDataSource::GetExtension(nsIRDFResource *source, nsIRDFLiteral **aResu } #endif - - #ifdef XP_WIN nsresult FileSystemDataSource::getIEFavoriteURL(nsIRDFResource *source, nsString aFileURL, nsIRDFLiteral **urlLiteral) { nsresult rv = NS_OK; - + *urlLiteral = nsnull; - nsFileURL url(aFileURL); - nsFileSpec uri(url); - if (uri.IsDirectory()) + nsCOMPtr f; + NS_GetFileFromURLSpec(NS_ConvertUCS2toUTF8(aFileURL), getter_AddRefs(f)); + + PRBool value; + + if (NS_SUCCEEDED(f->IsDirectory(&value)) && value) { if (isValidFolder(source)) return(NS_RDF_NO_VALUE); - uri += "desktop.ini"; + aFileURL += NS_LITERAL_STRING("desktop.ini"); } else if (aFileURL.Length() > 4) { @@ -1672,26 +1696,17 @@ FileSystemDataSource::getIEFavoriteURL(nsIRDFResource *source, nsString aFileURL } } - nsInputFileStream stream(uri); + nsCOMPtr strm; + NS_NewLocalFileInputStream(getter_AddRefs(strm),f); + nsCOMPtr linereader = do_QueryInterface(strm, &rv); - if (!stream.is_open()) - return(NS_RDF_NO_VALUE); - - char buffer[256]; nsAutoString line; - while(NS_SUCCEEDED(rv) && (!stream.eof()) && (!stream.failed())) + while(NS_SUCCEEDED(rv)) { - PRBool untruncated = stream.readline(buffer, sizeof(buffer)); + PRBool isEOF; + rv = linereader->ReadLine(line, &isEOF); - if (stream.failed()) - { - rv = NS_ERROR_FAILURE; - break; - } - - line.AppendWithConversion(buffer); - - if (untruncated || stream.eof()) + if (isEOF) { if (line.Find("URL=", PR_TRUE) == 0) { @@ -1707,7 +1722,6 @@ FileSystemDataSource::getIEFavoriteURL(nsIRDFResource *source, nsString aFileURL } line.Truncate(); } - } return(rv); @@ -1776,13 +1790,19 @@ FileSystemDataSource::getNetPositiveURL(nsIRDFResource *source, nsString aFileUR *urlLiteral = nsnull; - nsFileURL url(aFileURL); - nsFilePath path(url); - nsFileSpec uri(path); -// if (uri.IsFile() && (!uri.IsHidden())) - if (uri.IsFile()) + + nsCOMPtr f; + NS_GetFileFromURLSpec(NS_ConvertUCS2toUTF8(aFileURL), getter_AddRefs(f)); + + nsCOMPtr furi; + NS_NewFileURI(getter_AddRefs(furi), lf); + + nsXPIDLCString nativeURI; + furi->GetSpec(getter_Copies(spec); + + PRBool value; + if (NS_SUCCEEDED(f->IsFile(&value) && value) { - const char *nativeURI = uri.GetNativePathCString(); if (nativeURI) { BFile bf(nativeURI, B_READ_ONLY); diff --git a/mozilla/security/manager/ssl/src/nsPKCS12Blob.cpp b/mozilla/security/manager/ssl/src/nsPKCS12Blob.cpp index a0453595c84..313e22bbed5 100644 --- a/mozilla/security/manager/ssl/src/nsPKCS12Blob.cpp +++ b/mozilla/security/manager/ssl/src/nsPKCS12Blob.cpp @@ -31,14 +31,15 @@ * may use your version of this file under either the MPL or the * GPL. * - * $Id: nsPKCS12Blob.cpp,v 1.35 2003-02-04 01:37:22 kaie%netscape.com Exp $ + * $Id: nsPKCS12Blob.cpp,v 1.36 2003-03-15 01:03:55 dougt%netscape.com Exp $ */ #include "prmem.h" #include "prprf.h" #include "nsISupportsArray.h" -#include "nsIFileSpec.h" +#include "nsIFile.h" +#include "nsNetUtil.h" #include "nsILocalFile.h" #include "nsIDirectoryService.h" #include "nsIWindowWatcher.h" @@ -50,7 +51,6 @@ #include "nsPKCS12Blob.h" #include "nsString.h" #include "nsReadableUtils.h" -#include "nsFileStream.h" #include "nsXPIDLString.h" #include "nsDirectoryServiceDefs.h" #include "nsNSSHelper.h" @@ -59,7 +59,7 @@ #include "nsPK11TokenDB.h" #include "nsICertificateDialogs.h" #include "nsNSSShutDown.h" - +#include "nsCRT.h" #include "pk11func.h" #include "secerr.h" @@ -527,31 +527,29 @@ nsPKCS12Blob::inputToDecoder(SEC_PKCS12DecoderContext *dcx, nsILocalFile *file) nsresult rv; SECStatus srv; PRUint32 amount; - unsigned char buf[PIP_PKCS12_BUFFER_SIZE]; - // everybody else is doin' it - nsCOMPtr tempSpec; - rv = NS_NewFileSpecFromIFile(file, getter_AddRefs(tempSpec)); - if (NS_FAILED(rv)) return rv; - nsInputFileStream fileStream(tempSpec); + char buf[PIP_PKCS12_BUFFER_SIZE]; + + nsCOMPtr fileStream; + NS_NewLocalFileInputStream(getter_AddRefs(fileStream), file); + while (PR_TRUE) { - amount = fileStream.read(buf, PIP_PKCS12_BUFFER_SIZE); - if (amount < 0) { - fileStream.close(); - return NS_ERROR_FAILURE; + rv = fileStream->Read(buf, PIP_PKCS12_BUFFER_SIZE, &amount); + if (NS_FAILED(rv)) { + return rv; } // feed the file data into the decoder - srv = SEC_PKCS12DecoderUpdate(dcx, buf, amount); + srv = SEC_PKCS12DecoderUpdate(dcx, + (unsigned char*) buf, + amount); if (srv) { // don't allow the close call to overwrite our precious error code int pr_err = PORT_GetError(); - fileStream.close(); PORT_SetError(pr_err); return NS_ERROR_ABORT; } if (amount < PIP_PKCS12_BUFFER_SIZE) break; } - fileStream.close(); return NS_OK; } diff --git a/mozilla/uriloader/Makefile.in b/mozilla/uriloader/Makefile.in index c98c69ffe25..1ba303bdd49 100644 --- a/mozilla/uriloader/Makefile.in +++ b/mozilla/uriloader/Makefile.in @@ -30,7 +30,6 @@ DIRS = \ base \ exthandler \ prefetch \ - build \ $(NULL) include $(topsrcdir)/config/rules.mk diff --git a/mozilla/uriloader/exthandler/nsExternalHelperAppService.cpp b/mozilla/uriloader/exthandler/nsExternalHelperAppService.cpp index 6384626292c..fbe6a23f15f 100644 --- a/mozilla/uriloader/exthandler/nsExternalHelperAppService.cpp +++ b/mozilla/uriloader/exthandler/nsExternalHelperAppService.cpp @@ -25,8 +25,8 @@ #include "nsIURI.h" #include "nsIURL.h" #include "nsIFile.h" -#include "nsIChannel.h" #include "nsIFileURL.h" +#include "nsIChannel.h" #include "nsIDirectoryService.h" #include "nsAppDirectoryServiceDefs.h" #include "nsXPIDLString.h" @@ -47,7 +47,6 @@ #include "rdf.h" #include "nsIRDFService.h" #include "nsIRDFRemoteDataSource.h" -#include "nsIFileSpec.h" #include "nsHelperAppRDF.h" #include "nsIMIMEInfo.h" #include "nsDirectoryServiceDefs.h" @@ -86,6 +85,9 @@ #include "nsIPrefService.h" +#include "nsCRT.h" +#include "plstr.h" + const char *NEVER_ASK_PREF_BRANCH = "browser.helperApps.neverAsk."; const char *NEVER_ASK_FOR_SAVE_TO_DISK_PREF = "saveToDisk"; const char *NEVER_ASK_FOR_OPEN_FILE_PREF = "openFile"; diff --git a/mozilla/view/src/Makefile.in b/mozilla/view/src/Makefile.in index be32ea9ea59..29a79cdbe54 100644 --- a/mozilla/view/src/Makefile.in +++ b/mozilla/view/src/Makefile.in @@ -27,9 +27,9 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk MODULE = view -LIBRARY_NAME = gkview +LIBRARY_NAME = gkview_s EXPORT_LIBRARY = 1 -IS_COMPONENT = 1 +FORCE_STATIC_LIB = 1 MODULE_NAME = nsViewModule GRE_MODULE = 1 @@ -52,14 +52,7 @@ CPPSRCS = \ nsScrollingView.cpp \ nsScrollPortView.cpp \ nsViewManager.cpp \ - nsViewFactory.cpp \ $(NULL) -EXTRA_DSO_LDOPTS = \ - $(LIBS_DIR) \ - $(EXTRA_DSO_LIBS) \ - $(MOZ_COMPONENT_LIBS) \ - $(NULL) - include $(topsrcdir)/config/rules.mk diff --git a/mozilla/webshell/tests/viewer/nsBrowserWindow.h b/mozilla/webshell/tests/viewer/nsBrowserWindow.h index 08a7bcc0051..6917cbd231b 100644 --- a/mozilla/webshell/tests/viewer/nsBrowserWindow.h +++ b/mozilla/webshell/tests/viewer/nsBrowserWindow.h @@ -47,6 +47,8 @@ // Interfaces Needed #include "nsIBaseWindow.h" #include "nsIInterfaceRequestor.h" +#include "nsIFile.h" +#include "nsILocalFile.h" #include "nsIWebBrowser.h" #include "nsIStreamListener.h" @@ -57,7 +59,6 @@ #include "nsVoidArray.h" #include "nsCRT.h" #include "prtime.h" -#include "nsFileSpec.h" #include "nsIXPBaseWindow.h" #include "nsPrintSetupDialog.h" diff --git a/mozilla/webshell/tests/viewer/nsViewerApp.cpp b/mozilla/webshell/tests/viewer/nsViewerApp.cpp index 43e31463d20..e3a1720a54f 100644 --- a/mozilla/webshell/tests/viewer/nsViewerApp.cpp +++ b/mozilla/webshell/tests/viewer/nsViewerApp.cpp @@ -62,7 +62,6 @@ #include "nsIInterfaceRequestor.h" #include "nsIInterfaceRequestorUtils.h" #include "nsWebCrawler.h" -#include "nsSpecialSystemDirectory.h" // For exe dir #include "prprf.h" #include "plstr.h" #include "prenv.h" diff --git a/mozilla/widget/src/gtk/nsClipboard.cpp b/mozilla/widget/src/gtk/nsClipboard.cpp index 09fa7589b21..8c0193bda0a 100644 --- a/mozilla/widget/src/gtk/nsClipboard.cpp +++ b/mozilla/widget/src/gtk/nsClipboard.cpp @@ -29,7 +29,6 @@ #include #include "nsCOMPtr.h" -#include "nsFileSpec.h" #include "nsCRT.h" #include "nsISupportsArray.h" #include "nsXPCOM.h" @@ -590,12 +589,12 @@ nsClipboard::SelectionReceiver (GtkWidget *aWidget, g_print("\n XmbTextListToTextProperty failed. returned %d\n", status); g_print(" text is \"%s\"\n", tmpData[0]); #endif - numberOfBytes = nsCRT::strlen(NS_REINTERPRET_CAST(const char *, data)); + numberOfBytes = strlen(NS_REINTERPRET_CAST(const char *, data)); } else { if (foo > 0 && tmpData[0] != 0 && (*tmpData[0]) != 0) { data = tmpData[0]; } - numberOfBytes = nsCRT::strlen(NS_REINTERPRET_CAST(const char *, data)); + numberOfBytes = strlen(NS_REINTERPRET_CAST(const char *, data)); #ifdef DEBUG_CLIPBOARD g_print("\n XmbTextListToTextProperty succeeded\n"); g_print(" text is \"%s\"\n", data); diff --git a/mozilla/widget/src/gtk/nsGtkIMEHelper.cpp b/mozilla/widget/src/gtk/nsGtkIMEHelper.cpp index 79542895a83..7b2951af4f3 100644 --- a/mozilla/widget/src/gtk/nsGtkIMEHelper.cpp +++ b/mozilla/widget/src/gtk/nsGtkIMEHelper.cpp @@ -268,7 +268,7 @@ void nsIMEPreedit::SetPreeditString(const XIMText *aText, composeUniStringLen = nsGtkIMEHelper::GetSingleton()->MultiByteToUnicode( preeditStr, - nsCRT::strlen(preeditStr), + strlen(preeditStr), &(mCompositionUniString), &(mCompositionUniStringSize)); if (aText && aText->encoding_is_wchar) { @@ -709,7 +709,7 @@ void nsIMEStatus::resize(const char *aString) { Display *display = GDK_DISPLAY(); if (!aString || !aString[0]) return; - int len = nsCRT::strlen(aString); + int len = strlen(aString); int width = XmbTextEscapement(mFontset, aString, len); @@ -733,7 +733,7 @@ nsIMEStatus::show() { nsIMEGtkIC *xic = mAttachedWindow->IMEGetInputContext(PR_FALSE); - if (!xic || !xic->mStatusText || !nsCRT::strlen(xic->mStatusText)) { + if (!xic || !xic->mStatusText || !strlen(xic->mStatusText)) { // don't map if text is "" return; } @@ -806,7 +806,7 @@ nsIMEStatus::setText(const char *aText) { Display *display = GDK_DISPLAY(); if (!aText) return; - int len = nsCRT::strlen(aText); + int len = strlen(aText); if (mGC == 0) { XGCValues values; @@ -1375,7 +1375,7 @@ nsIMEGtkIC::ResetIC(PRUnichar **aUnichar, PRInt32 *aUnisize) PRInt32 uniCharSize = 0; char *uncommitted_text = XmbResetIC(mIC->xic); if (uncommitted_text && uncommitted_text[0]) { - PRInt32 uncommitted_len = nsCRT::strlen(uncommitted_text); + PRInt32 uncommitted_len = strlen(uncommitted_text); uniCharSize = nsGtkIMEHelper::GetSingleton()->MultiByteToUnicode( uncommitted_text, uncommitted_len, aUnichar, diff --git a/mozilla/widget/src/gtk/nsWindow.cpp b/mozilla/widget/src/gtk/nsWindow.cpp index 33036675848..a6265275832 100644 --- a/mozilla/widget/src/gtk/nsWindow.cpp +++ b/mozilla/widget/src/gtk/nsWindow.cpp @@ -78,7 +78,6 @@ #include "nsGtkUtils.h" // for nsGtkUtils::gdk_window_flash() -#include "nsSpecialSystemDirectory.h" #include "nsGtkMozRemoteHelper.h" #include "nsIDragService.h" diff --git a/mozilla/widget/src/gtk2/nsWindow.cpp b/mozilla/widget/src/gtk2/nsWindow.cpp index ec741d84fef..edd8a708ebf 100644 --- a/mozilla/widget/src/gtk2/nsWindow.cpp +++ b/mozilla/widget/src/gtk2/nsWindow.cpp @@ -59,10 +59,10 @@ #include "nsIServiceManager.h" /* For SetIcon */ -#include "nsSpecialSystemDirectory.h" #include "nsAppDirectoryServiceDefs.h" #include "nsXPIDLString.h" #include "nsIFile.h" +#include "nsILocalFile.h" /* utility functions */ static PRBool check_for_rollup(GdkWindow *aWindow, diff --git a/mozilla/widget/src/os2/nsWindow.cpp b/mozilla/widget/src/os2/nsWindow.cpp index 7aeadbe7928..dcb4be99388 100644 --- a/mozilla/widget/src/os2/nsWindow.cpp +++ b/mozilla/widget/src/os2/nsWindow.cpp @@ -55,7 +55,6 @@ #include "nsIServiceManager.h" // For SetIcon -#include "nsSpecialSystemDirectory.h" #include "nsAppDirectoryServiceDefs.h" #include "nsXPIDLString.h" #include "nsIFile.h" diff --git a/mozilla/widget/src/photon/nsClipboard.cpp b/mozilla/widget/src/photon/nsClipboard.cpp index 2fdb33b3f9c..3e39ed8b5cf 100644 --- a/mozilla/widget/src/photon/nsClipboard.cpp +++ b/mozilla/widget/src/photon/nsClipboard.cpp @@ -28,7 +28,6 @@ #include #include "nsCOMPtr.h" -#include "nsFileSpec.h" #include "nsCRT.h" #include "nsISupportsArray.h" #include "nsISupportsPrimitives.h" diff --git a/mozilla/widget/src/windows/nsWindow.cpp b/mozilla/widget/src/windows/nsWindow.cpp index c548c488861..cafb7c52a7f 100644 --- a/mozilla/widget/src/windows/nsWindow.cpp +++ b/mozilla/widget/src/windows/nsWindow.cpp @@ -109,7 +109,8 @@ #include "nsITheme.h" // For SetIcon -#include "nsSpecialSystemDirectory.h" +#include "nsILocalFile.h" +#include "nsCRT.h" #include "nsAppDirectoryServiceDefs.h" #include "nsXPIDLString.h" #include "nsIFile.h" diff --git a/mozilla/widget/src/xlib/nsClipboard.cpp b/mozilla/widget/src/xlib/nsClipboard.cpp index 0f337f5f1e9..32e2565dcf3 100644 --- a/mozilla/widget/src/xlib/nsClipboard.cpp +++ b/mozilla/widget/src/xlib/nsClipboard.cpp @@ -46,7 +46,6 @@ #include "nsClipboard.h" #include "nsCOMPtr.h" -#include "nsFileSpec.h" #include "nsCRT.h" #include "nsISupportsArray.h" #include "nsXPCOM.h" diff --git a/mozilla/widget/src/xpwidgets/nsTransferable.cpp b/mozilla/widget/src/xpwidgets/nsTransferable.cpp index caf641eb7c0..d1592069d07 100644 --- a/mozilla/widget/src/xpwidgets/nsTransferable.cpp +++ b/mozilla/widget/src/xpwidgets/nsTransferable.cpp @@ -60,12 +60,13 @@ Notes to self: #include "nsMemory.h" #include "nsPrimitiveHelpers.h" #include "nsXPIDLString.h" - -#include "nsIFileSpec.h" +#include "nsDirectoryServiceDefs.h" +#include "nsDirectoryService.h" +#include "nsCRT.h" +#include "nsNetUtil.h" #include "nsIOutputStream.h" #include "nsIInputStream.h" - -#include "nsSpecialSystemDirectory.h" +#include "nsIFile.h" NS_IMPL_ISUPPORTS1(nsTransferable, nsITransferable) @@ -84,7 +85,7 @@ struct DataStruct const nsCString& GetFlavor() const { return mFlavor; } void SetData( nsISupports* inData, PRUint32 inDataLen ); void GetData( nsISupports** outData, PRUint32 *outDataLen ); - nsIFileSpec * GetFileSpec(const char * aFileName); + nsIFile * GetFileSpec(const char * aFileName); PRBool IsDataAvilable() const { return (mData && mDataLen > 0) || (!mData && mCacheFileName); } protected: @@ -121,7 +122,8 @@ DataStruct* GetDataForFlavor (const nsVoidArray* pArray, const char* aDataFlavor //------------------------------------------------------------------------- DataStruct::~DataStruct() { - delete [] mCacheFileName; + if (mCacheFileName) nsCRT::free(mCacheFileName); + //nsIFileSpec * cacheFile = GetFileSpec(mCacheFileName); //cacheFile->Remove(); } @@ -171,35 +173,25 @@ DataStruct::GetData ( nsISupports** aData, PRUint32 *aDataLen ) //------------------------------------------------------------------------- -nsIFileSpec* +nsIFile* DataStruct::GetFileSpec(const char * aFileName) { - nsIFileSpec* cacheFile = nsnull; - nsresult rv = nsComponentManager::CreateInstance( NS_FILESPEC_CONTRACTID, nsnull, NS_GET_IID(nsIFileSpec), - NS_REINTERPRET_CAST(void**,&cacheFile)); - NS_ASSERTION(NS_SUCCEEDED(rv), "ERROR: Could not make a Clipboard Cache file spec."); - - // Get the system temp directory path - nsSpecialSystemDirectory *sysCacheFile = - new nsSpecialSystemDirectory(nsSpecialSystemDirectory::OS_TemporaryDirectory); + nsIFile* cacheFile; + NS_GetSpecialDirectory(NS_OS_TEMP_DIR, &cacheFile); + + if (cacheFile == nsnull) + return nsnull; // if the param aFileName contains a name we should use that // because the file probably already exists // otherwise create a unique name if (!aFileName) { - *sysCacheFile += "clipboardcache"; - sysCacheFile->MakeUnique(); + cacheFile->AppendNative(NS_LITERAL_CSTRING("clipboardcache")); + cacheFile->CreateUnique(nsIFile::NORMAL_FILE_TYPE, 0755); } else { - *sysCacheFile += aFileName; + cacheFile->AppendNative(nsDependentCString(aFileName)); } - - // now set the entire path for the nsIFileSpec - cacheFile->SetFromFileSpec(*sysCacheFile); - - // delete the temp for getting the system info - delete sysCacheFile; - - // return the nsIFileSpec. The addref comes from CreateInstance() + return cacheFile; } @@ -209,18 +201,25 @@ nsresult DataStruct::WriteCache(nsISupports* aData, PRUint32 aDataLen) { // Get a new path and file to the temp directory - nsCOMPtr cacheFile ( getter_AddRefs(GetFileSpec(mCacheFileName)) ); + nsCOMPtr cacheFile ( getter_AddRefs(GetFileSpec(mCacheFileName)) ); if (cacheFile) { // remember the file name - if (!mCacheFileName) - cacheFile->GetLeafName(&mCacheFileName); + if (!mCacheFileName) { + nsXPIDLCString fName; + cacheFile->GetNativeLeafName(fName); + mCacheFileName = nsCRT::strdup(fName); + } // write out the contents of the clipboard // to the file //PRUint32 bytes; nsCOMPtr outStr; - cacheFile->GetOutputStream( getter_AddRefs(outStr) ); - + + NS_NewLocalFileOutputStream(getter_AddRefs(outStr), + cacheFile); + + if (!outStr) return NS_ERROR_FAILURE; + void* buff = nsnull; nsPrimitiveHelpers::CreateDataFromPrimitive ( mFlavor.get(), aData, &buff, aDataLen ); if ( buff ) { @@ -243,10 +242,11 @@ DataStruct::ReadCache(nsISupports** aData, PRUint32* aDataLen) return NS_ERROR_FAILURE; // get the path and file name - nsCOMPtr cacheFile ( getter_AddRefs(GetFileSpec(mCacheFileName)) ); - if ( cacheFile && Exists(cacheFile)) { + nsCOMPtr cacheFile ( getter_AddRefs(GetFileSpec(mCacheFileName)) ); + PRBool exists; + if ( cacheFile && NS_SUCCEEDED(cacheFile->Exists(&exists)) && exists ) { // get the size of the file - PRUint32 fileSize; + PRInt64 fileSize; cacheFile->GetFileSize(&fileSize); // create new memory for the large clipboard data @@ -256,7 +256,11 @@ DataStruct::ReadCache(nsISupports** aData, PRUint32* aDataLen) // now read it all in nsCOMPtr inStr; - cacheFile->GetInputStream( getter_AddRefs(inStr) ); + NS_NewLocalFileInputStream( getter_AddRefs(inStr), + cacheFile); + + if (!cacheFile) return NS_ERROR_FAILURE; + nsresult rv = inStr->Read(data, fileSize, aDataLen); // make sure we got all the data ok diff --git a/mozilla/xpcom/build/Makefile.in b/mozilla/xpcom/build/Makefile.in index 58eb468bf60..30bcb9efd3e 100644 --- a/mozilla/xpcom/build/Makefile.in +++ b/mozilla/xpcom/build/Makefile.in @@ -67,7 +67,6 @@ SHARED_LIBRARY_LIBS = \ $(DIST)/lib/$(LIB_PREFIX)xptinfo.$(LIB_SUFFIX) \ $(DIST)/lib/$(LIB_PREFIX)xpt.$(LIB_SUFFIX) \ $(DIST)/lib/$(LIB_PREFIX)xptcmd.$(LIB_SUFFIX) \ - $(DIST)/lib/$(LIB_PREFIX)mozreg_s.$(LIB_SUFFIX) \ $(DIST)/lib/$(LIB_PREFIX)string_s.$(LIB_SUFFIX) \ $(DIST)/lib/$(LIB_PREFIX)string_obsolete_s.$(LIB_SUFFIX) \ $(DIST)/lib/$(LIB_PREFIX)xpcomglue_s.$(LIB_SUFFIX) \ diff --git a/mozilla/xpcom/build/dlldeps.cpp b/mozilla/xpcom/build/dlldeps.cpp index f77916999b9..e832d6843ed 100644 --- a/mozilla/xpcom/build/dlldeps.cpp +++ b/mozilla/xpcom/build/dlldeps.cpp @@ -41,13 +41,10 @@ #include "nsVoidArray.h" #include "nsValueArray.h" #include "nsIAtom.h" -#include "nsFileSpec.h" //#include "nsIBuffer.h" -//#include "nsIByteBufferInputStream.h" -#include "nsFileStream.h" +#include "nsIByteArrayInputStream.h" #include "nsFixedSizeAllocator.h" #include "nsRecyclingAllocator.h" -#include "nsSpecialSystemDirectory.h" #include "nsIThread.h" #include "nsDeque.h" #include "nsObserver.h" @@ -64,7 +61,6 @@ #include "nsProxyEventPrivate.h" #include "xpt_xdr.h" #include "xptcall.h" -#include "nsIFileSpec.h" #include "nsILocalFile.h" #include "nsIGenericFactory.h" #include "nsHashtableEnumerator.h" @@ -73,13 +69,11 @@ #include "nsCWeakReference.h" #include "nsWeakReference.h" #include "nsTextFormatter.h" -#include "nsStatistics.h" #include "nsIStorageStream.h" #include "nsLinebreakConverter.h" #include "nsIBinaryInputStream.h" #include "nsIInterfaceRequestor.h" #include "nsIInterfaceRequestorUtils.h" -#include "nsIByteArrayInputStream.h" #include "nsReadableUtils.h" #include "nsStaticNameTable.h" #include "nsProcess.h" @@ -92,11 +86,7 @@ #endif #include "pldhash.h" #include "nsVariant.h" - -#ifdef DEBUG -extern NS_COM void -TestSegmentedBuffer(); -#endif +#include "nsEscape.h" void XXXNeverCalled() { @@ -114,20 +104,15 @@ void XXXNeverCalled() nsValueArray(0); nsSupportsArray(); NS_GetNumberOfAtoms(); - nsFileURL(NULL); NS_NewPipe2(NULL, NULL, PR_FALSE, PR_FALSE, 0, 0, NULL); NS_NewInputStreamReadyEvent(NULL, NULL, NULL); NS_NewOutputStreamReadyEvent(NULL, NULL, NULL); NS_AsyncCopy(NULL, NULL, PR_TRUE, PR_TRUE, 0, 0, NULL); - nsFileSpec s; nsFixedSizeAllocator a; nsRecyclingAllocator recyclingAllocator(2); a.Init(0, 0, 0, 0, 0); a.Alloc(0); a.Free(0, 0); - NS_NewIOFileStream(NULL, s, 0, 0); - nsInputFileStream(s, 0, 0); - new nsSpecialSystemDirectory(nsSpecialSystemDirectory::OS_DriveDirectory); nsIThread::GetCurrent(NULL); nsDeque(NULL); NS_NewObserver(NULL, NULL); @@ -135,7 +120,6 @@ void XXXNeverCalled() NS_NewEmptyEnumerator(NULL); nsArrayEnumerator(NULL); NS_QuickSort(NULL, 0, 0, NULL, NULL); - nsStatistics("dummy"); nsString(); nsProxyObject(NULL, 0, NULL); XPT_DoString(NULL, NULL, NULL); @@ -144,7 +128,6 @@ void XXXNeverCalled() PurePrintf(0); #endif XPTC_InvokeByIndex(NULL, 0, 0, NULL); - NS_NewFileSpec(NULL); xptc_dummy(); xptc_dummy2(); XPTI_GetInterfaceInfoManager(); @@ -155,9 +138,7 @@ void XXXNeverCalled() nsCWeakReferent(0); NS_GetWeakReference(NULL); nsCOMPtr dummyFoo(do_GetInterface(nsnull)); -#ifdef DEBUG - TestSegmentedBuffer(); -#endif + NS_NewByteArrayInputStream(NULL, NULL, 0); NS_NewStorageStream(0,0, nsnull); nsString foo; nsPrintfCString bar(""); @@ -166,7 +147,6 @@ void XXXNeverCalled() NS_NewLocalFile(nsString(), PR_FALSE, NULL); NS_NewNativeLocalFile(nsCString(), PR_FALSE, NULL); nsProcess(); - NS_NewByteArrayInputStream (NULL, NULL, 0); nsStaticCaseInsensitiveNameTable(); nsAutoString str1; nsCAutoString str2; @@ -182,6 +162,8 @@ void XXXNeverCalled() NS_NewArray(nsnull, dummyArray); NS_NewArrayEnumerator(nsnull, dummyArray); nsVariant(); + nsUnescape(nsnull); + nsEscape(nsnull, url_XAlphas); nsStringArray array; NS_NewStringEnumerator(nsnull, &array); NS_NewAdoptingStringEnumerator(nsnull, &array); diff --git a/mozilla/xpcom/build/nsXPComInit.cpp b/mozilla/xpcom/build/nsXPComInit.cpp index eca1872b26e..c0b6acfde28 100644 --- a/mozilla/xpcom/build/nsXPComInit.cpp +++ b/mozilla/xpcom/build/nsXPComInit.cpp @@ -37,7 +37,6 @@ #include "nsXPCOM.h" #include "nsXPCOMPrivate.h" -#include "nsIRegistry.h" #include "nscore.h" #include "prlink.h" #include "nsCOMPtr.h" @@ -81,8 +80,6 @@ #include "nsThread.h" #include "nsProcess.h" -#include "nsFileSpecImpl.h" -#include "nsSpecialSystemDirectory.h" #include "nsEmptyEnumerator.h" #include "nsILocalFile.h" @@ -111,6 +108,7 @@ #endif #include "nsRecyclingAllocator.h" +#include "SpecialSystemDirectory.h" // Registry Factory creation function defined in nsRegistry.cpp // We hook into this function locally to create and register the registry @@ -351,8 +349,6 @@ static const nsModuleComponentInfo components[] = { #define NS_DIRECTORY_SERVICE_CLASSNAME "nsIFile Directory Service" COMPONENT(DIRECTORY_SERVICE, nsDirectoryService::Create), COMPONENT(PROCESS, nsProcessConstructor), - COMPONENT(FILESPEC, nsFileSpecImpl::Create), - COMPONENT(DIRECTORYITERATOR, nsDirectoryIteratorImpl::Create), COMPONENT(STRINGINPUTSTREAM, nsStringInputStreamConstructor), COMPONENT(MULTIPLEXINPUTSTREAM, nsMultiplexInputStreamConstructor), @@ -456,14 +452,6 @@ nsresult NS_COM NS_InitXPCOM2(nsIServiceManager* *result, gDirectoryService->Set(NS_XPCOM_INIT_CURRENT_PROCESS_DIR, binDirectory); binDirectory->Clone(getter_AddRefs(xpcomLib)); } - - //Since people are still using the nsSpecialSystemDirectory, we should init it. - nsCAutoString path; - binDirectory->GetNativePath(path); - nsFileSpec spec(path.get()); - - nsSpecialSystemDirectory::Set(nsSpecialSystemDirectory::Moz_BinDirectory, &spec); - } else { gDirectoryService->Get(NS_XPCOM_CURRENT_PROCESS_DIR, @@ -515,20 +503,6 @@ nsresult NS_COM NS_InitXPCOM2(nsIServiceManager* *result, // 2. Register the global services with the component manager so that // clients can create new objects. - // Registry - nsIFactory *registryFactory = NULL; - rv = NS_RegistryGetFactory(®istryFactory); - if (NS_FAILED(rv)) return rv; - - NS_DEFINE_CID(kRegistryCID, NS_REGISTRY_CID); - - rv = compMgr->RegisterFactory(kRegistryCID, - NS_REGISTRY_CLASSNAME, - NS_REGISTRY_CONTRACTID, - registryFactory, PR_TRUE); - NS_RELEASE(registryFactory); - if (NS_FAILED(rv)) return rv; - // Category Manager { nsCOMPtr categoryManagerFactory; diff --git a/mozilla/xpcom/components/MANIFEST b/mozilla/xpcom/components/MANIFEST index 0316261ce6b..0fc6d5f1f3b 100644 --- a/mozilla/xpcom/components/MANIFEST +++ b/mozilla/xpcom/components/MANIFEST @@ -1,4 +1,3 @@ -nsIRegistryUtils.h nsXPComFactory.h nsComponentManagerUtils.h nsCategoryManagerUtils.h diff --git a/mozilla/xpcom/components/MANIFEST_IDL b/mozilla/xpcom/components/MANIFEST_IDL index 4e4df83eb40..ebb7390b0ad 100644 --- a/mozilla/xpcom/components/MANIFEST_IDL +++ b/mozilla/xpcom/components/MANIFEST_IDL @@ -6,5 +6,4 @@ nsIComponentManager.idl nsIComponentManagerObsolete.idl nsIComponentRegistrar.idl nsIFactory.idl -nsIRegistry.idl nsIServiceManager.idl diff --git a/mozilla/xpcom/components/Makefile.in b/mozilla/xpcom/components/Makefile.in index 1498f15437a..5005178849d 100644 --- a/mozilla/xpcom/components/Makefile.in +++ b/mozilla/xpcom/components/Makefile.in @@ -40,7 +40,6 @@ CPPSRCS = \ nsComponentManager.cpp \ nsComponentManagerObsolete.cpp \ nsNativeComponentLoader.cpp \ - nsRegistry.cpp \ nsServiceManagerObsolete.cpp \ xcDll.cpp \ $(NULL) @@ -55,7 +54,6 @@ EXPORTS = \ nsCategoryManagerUtils.h \ nsComponentManagerUtils.h \ nsComponentManagerObsolete.h \ - nsIRegistryUtils.h \ nsIServiceManagerUtils.h \ nsIServiceManagerObsolete.h \ nsXPComFactory.h \ @@ -69,7 +67,6 @@ XPIDLSRCS = \ nsIComponentLoader.idl \ nsIComponentLoaderManager.idl \ nsIComponentManagerObsolete.idl \ - nsIRegistry.idl \ nsINativeComponentLoader.idl \ $(NULL) diff --git a/mozilla/xpcom/components/nsComponentManager.cpp b/mozilla/xpcom/components/nsComponentManager.cpp index dd0b4e08251..665e0ab8ec8 100644 --- a/mozilla/xpcom/components/nsComponentManager.cpp +++ b/mozilla/xpcom/components/nsComponentManager.cpp @@ -40,7 +40,6 @@ #define PL_ARENA_CONST_ALIGN_MASK 7 #define NS_CM_BLOCK_SIZE (1024 * 8) -#include "NSReg.h" #include "nsAutoLock.h" #include "nsCOMPtr.h" #include "nsComponentManager.h" @@ -60,7 +59,6 @@ #include "nsISupportsPrimitives.h" #include "nsLocalFile.h" #include "nsNativeComponentLoader.h" -#include "nsRegistry.h" #include "nsReadableUtils.h" #include "nsString.h" #include "nsXPIDLString.h" @@ -824,8 +822,6 @@ nsresult nsComponentManagerImpl::Init(void) mStaticComponentLoader->Init(this, nsnull); } #endif - NR_StartupRegistry(); - GetLocationFromDirectoryService(NS_XPCOM_COMPONENT_DIR, getter_AddRefs(mComponentsDir)); if (!mComponentsDir) return NS_ERROR_OUT_OF_MEMORY; @@ -908,8 +904,6 @@ nsresult nsComponentManagerImpl::Shutdown(void) // delete arena for strings and small objects PL_FinishArenaPool(&mArena); - // This is were the nsFileSpec was deleted, so I am - // going to assign zero to mComponentsDir = 0; mCategoryManager = 0; @@ -928,8 +922,6 @@ nsresult nsComponentManagerImpl::Shutdown(void) NS_IF_RELEASE(mStaticComponentLoader); #endif - NR_ShutdownRegistry(); - mShuttingDown = NS_SHUTDOWN_COMPLETE; PR_LOG(nsComponentManagerLog, PR_LOG_ALWAYS, ("nsComponentManager: Shutdown complete.")); diff --git a/mozilla/xpcom/ds/Makefile.in b/mozilla/xpcom/ds/Makefile.in index 3b8c35a6596..d0b7c0944d4 100644 --- a/mozilla/xpcom/ds/Makefile.in +++ b/mozilla/xpcom/ds/Makefile.in @@ -99,7 +99,6 @@ EXPORTS = \ nsQuickSort.h \ nsRecyclingAllocator.h \ nsStaticNameTable.h \ - nsStatistics.h \ nsSupportsArray.h \ nsSupportsPrimitives.h \ nsTime.h \ @@ -154,4 +153,5 @@ FORCE_USE_PIC = 1 include $(topsrcdir)/config/rules.mk + DEFINES += -D_IMPL_NS_COM diff --git a/mozilla/xpcom/ds/nsArrayEnumerator.h b/mozilla/xpcom/ds/nsArrayEnumerator.h index d252f4b08b4..da44b84c5b8 100644 --- a/mozilla/xpcom/ds/nsArrayEnumerator.h +++ b/mozilla/xpcom/ds/nsArrayEnumerator.h @@ -46,7 +46,7 @@ #include "nsISimpleEnumerator.h" #include "nsCOMPtr.h" -class NS_COM nsSimpleArrayEnumerator : public nsISimpleEnumerator +class nsSimpleArrayEnumerator : public nsISimpleEnumerator { public: // nsISupports interface diff --git a/mozilla/xpcom/ds/nsCRT.h b/mozilla/xpcom/ds/nsCRT.h index 71450daedc7..be299d8bedc 100644 --- a/mozilla/xpcom/ds/nsCRT.h +++ b/mozilla/xpcom/ds/nsCRT.h @@ -127,14 +127,6 @@ public: *** ***/ - /** Compute the string length of s - @param s the string in question - @return the length of s - */ - static PRUint32 strlen(const char* s) { - return PRUint32(::strlen(s)); - } - /// Compare s1 and s2. static PRInt32 strcmp(const char* s1, const char* s2) { return PRInt32(PL_strcmp(s1, s2)); diff --git a/mozilla/xpcom/ds/nsDeque.cpp b/mozilla/xpcom/ds/nsDeque.cpp index aab2ace9732..90c2c2253b8 100644 --- a/mozilla/xpcom/ds/nsDeque.cpp +++ b/mozilla/xpcom/ds/nsDeque.cpp @@ -380,6 +380,10 @@ nsDequeIterator nsDeque::End() const{ return nsDequeIterator(*this, mSize - 1); } +void* nsDeque::Last() const { + return End().GetCurrent(); +} + /** * Call this method when you want to iterate all the * members of the container, passing a functor along diff --git a/mozilla/xpcom/ds/nsDeque.h b/mozilla/xpcom/ds/nsDeque.h index 60c917bd44d..d174a45c9e9 100644 --- a/mozilla/xpcom/ds/nsDeque.h +++ b/mozilla/xpcom/ds/nsDeque.h @@ -184,6 +184,7 @@ class NS_COM nsDeque { */ nsDequeIterator End() const; + void* Last() const; /** * Call this method when you want to iterate all the * members of the container, passing a functor along @@ -244,7 +245,7 @@ private: * Here comes the nsDequeIterator class... ******************************************************/ -class NS_COM nsDequeIterator { +class nsDequeIterator { public: /** * DequeIterator is an object that knows how to iterate diff --git a/mozilla/xpcom/ds/nsEnumeratorUtils.cpp b/mozilla/xpcom/ds/nsEnumeratorUtils.cpp index fe69586abc3..3f6b9f8bb8a 100644 --- a/mozilla/xpcom/ds/nsEnumeratorUtils.cpp +++ b/mozilla/xpcom/ds/nsEnumeratorUtils.cpp @@ -162,93 +162,6 @@ NS_NewSingletonEnumerator(nsISimpleEnumerator* *result, return NS_OK; } -//////////////////////////////////////////////////////////////////////// - - -nsAdapterEnumerator::nsAdapterEnumerator(nsIEnumerator* aEnum) - : mEnum(aEnum), mCurrent(0), mStarted(PR_FALSE) -{ - NS_ADDREF(mEnum); -} - - -nsAdapterEnumerator::~nsAdapterEnumerator() -{ - NS_RELEASE(mEnum); - NS_IF_RELEASE(mCurrent); -} - - -NS_IMPL_ISUPPORTS1(nsAdapterEnumerator, nsISimpleEnumerator) - -NS_IMETHODIMP -nsAdapterEnumerator::HasMoreElements(PRBool* aResult) -{ - nsresult rv; - - if (mCurrent) { - *aResult = PR_TRUE; - return NS_OK; - } - - if (! mStarted) { - mStarted = PR_TRUE; - rv = mEnum->First(); - if (rv == NS_OK) { - mEnum->CurrentItem(&mCurrent); - *aResult = PR_TRUE; - } - else { - *aResult = PR_FALSE; - } - } - else { - *aResult = PR_FALSE; - - rv = mEnum->IsDone(); - if (rv != NS_OK) { - // We're not done. Advance to the next one. - rv = mEnum->Next(); - if (rv == NS_OK) { - mEnum->CurrentItem(&mCurrent); - *aResult = PR_TRUE; - } - } - } - return NS_OK; -} - - -NS_IMETHODIMP -nsAdapterEnumerator::GetNext(nsISupports** aResult) -{ - nsresult rv; - - PRBool hasMore; - rv = HasMoreElements(&hasMore); - if (NS_FAILED(rv)) return rv; - - if (! hasMore) - return NS_ERROR_UNEXPECTED; - - // No need to addref, we "transfer" the ownership to the caller. - *aResult = mCurrent; - mCurrent = 0; - return NS_OK; -} - -extern "C" NS_COM nsresult -NS_NewAdapterEnumerator(nsISimpleEnumerator* *result, - nsIEnumerator* enumerator) -{ - nsAdapterEnumerator* enumer = new nsAdapterEnumerator(enumerator); - if (enumer == nsnull) - return NS_ERROR_OUT_OF_MEMORY; - *result = enumer; - NS_ADDREF(*result); - return NS_OK; -} - //////////////////////////////////////////////////////////////////////////////// diff --git a/mozilla/xpcom/ds/nsEnumeratorUtils.h b/mozilla/xpcom/ds/nsEnumeratorUtils.h index c624d7fe061..03ee86c5cc7 100644 --- a/mozilla/xpcom/ds/nsEnumeratorUtils.h +++ b/mozilla/xpcom/ds/nsEnumeratorUtils.h @@ -87,30 +87,6 @@ extern "C" NS_COM nsresult NS_NewSingletonEnumerator(nsISimpleEnumerator* *result, nsISupports* singleton); -//////////////////////////////////////////////////////////////////////////////// - -class NS_COM nsAdapterEnumerator : public nsISimpleEnumerator -{ -public: - NS_DECL_ISUPPORTS - - // nsISimpleEnumerator methods - NS_IMETHOD HasMoreElements(PRBool* aResult); - NS_IMETHOD GetNext(nsISupports** aResult); - - nsAdapterEnumerator(nsIEnumerator* aEnum); - virtual ~nsAdapterEnumerator(); - -protected: - nsIEnumerator* mEnum; - nsISupports* mCurrent; - PRBool mStarted; -}; - -extern "C" NS_COM nsresult -NS_NewAdapterEnumerator(nsISimpleEnumerator* *result, - nsIEnumerator* enumerator); - //////////////////////////////////////////////////////////////////////// #endif /* nsEnumeratorUtils_h__ */ diff --git a/mozilla/xpcom/ds/nsHashtable.cpp b/mozilla/xpcom/ds/nsHashtable.cpp index 4c6fcaacae3..d875c391adb 100644 --- a/mozilla/xpcom/ds/nsHashtable.cpp +++ b/mozilla/xpcom/ds/nsHashtable.cpp @@ -714,103 +714,6 @@ nsStringKey::Write(nsIObjectOutputStream* aStream) const return aStream->WriteWStringZ(mStr); } -//////////////////////////////////////////////////////////////////////////////// - -// Copy Constructor -// We need to free mBuf if the object is passed with mOwnership as OWN. As the -// destructor here is freeing mBuf in that case, mBuf is NOT getting leaked. - -nsOpaqueKey::nsOpaqueKey(const nsOpaqueKey& aKey) - : mBuf(aKey.mBuf), mBufLen(aKey.mBufLen), mOwnership(aKey.mOwnership) -{ - if (mOwnership != NEVER_OWN) { - char* newBuf = NS_REINTERPRET_CAST(char*, nsMemory::Alloc(mBufLen)); - if (!newBuf) { - // Pray we don't dangle! - mOwnership = NEVER_OWN; - } else { - memcpy(newBuf, mBuf, mBufLen); - mBuf = newBuf; - mOwnership = OWN; - } - } -#ifdef DEBUG - mKeyType = OpaqueKey; -#endif - MOZ_COUNT_CTOR(nsOpaqueKey); - } - -nsOpaqueKey::nsOpaqueKey(const char* str, PRUint32 strLen, Ownership own) - : mBuf((char*)str), mBufLen(strLen), mOwnership(own) -{ - NS_ASSERTION(mBuf, "null buffer"); -#ifdef DEBUG - mKeyType = OpaqueKey; -#endif - MOZ_COUNT_CTOR(nsOpaqueKey); -} - -nsOpaqueKey::~nsOpaqueKey(void) -{ - if (mOwnership == OWN) - nsMemory::Free(mBuf); - MOZ_COUNT_DTOR(nsOpaqueKey); -} - -PRUint32 -nsOpaqueKey::HashCode(void) const -{ - return nsCRT::BufferHashCode(mBuf, mBufLen); -} - -PRBool -nsOpaqueKey::Equals(const nsHashKey* aKey) const -{ - NS_ASSERTION(aKey->GetKeyType() == OpaqueKey, "mismatched key types"); - nsOpaqueKey* other = (nsOpaqueKey*)aKey; - if (mBufLen != other->mBufLen) - return PR_FALSE; - return memcmp(mBuf, other->mBuf, mBufLen) == 0; -} - -nsHashKey* -nsOpaqueKey::Clone() const -{ - if (mOwnership == NEVER_OWN) - return new nsOpaqueKey(mBuf, mBufLen, NEVER_OWN); - - // Since this might hold binary data OR a string, we ensure that the - // clone string is zero terminated, but don't assume that the source - // string was so terminated. - - PRUint32 len = mBufLen * sizeof(char); - char* str = (char*)nsMemory::Alloc(len + sizeof(char)); - if (str == NULL) - return NULL; - memcpy(str, mBuf, len); - str[len] = 0; - return new nsOpaqueKey(str, mBufLen, OWN); -} - -nsOpaqueKey::nsOpaqueKey(nsIObjectInputStream* aStream, nsresult *aResult) - : mBuf(nsnull), mBufLen(0), mOwnership(OWN) -{ - nsresult rv = aStream->Read32(&mBufLen); - if (NS_SUCCEEDED(rv)) - rv = aStream->ReadBytes(mBufLen, &mBuf); - *aResult = rv; - MOZ_COUNT_CTOR(nsOpaqueKey); -} - -nsresult -nsOpaqueKey::Write(nsIObjectOutputStream* aStream) const -{ - nsresult rv = aStream->Write32(mBufLen); - if (NS_SUCCEEDED(rv)) - rv = aStream->WriteBytes(mBuf, mBufLen); - return rv; -} - //////////////////////////////////////////////////////////////////////////////// // nsObjectHashtable: an nsHashtable where the elements are C++ objects to be // deleted diff --git a/mozilla/xpcom/ds/nsHashtable.h b/mozilla/xpcom/ds/nsHashtable.h index 33e8a4fb9fa..be0062722d2 100644 --- a/mozilla/xpcom/ds/nsHashtable.h +++ b/mozilla/xpcom/ds/nsHashtable.h @@ -72,8 +72,7 @@ class NS_COM nsHashKey { VoidKey, IDKey, CStringKey, - StringKey, - OpaqueKey + StringKey }; nsHashKeyType GetKeyType() const { return mKeyType; } protected: @@ -426,38 +425,6 @@ class NS_COM nsStringKey : public nsHashKey { Ownership mOwnership; }; -// for opaque buffers of data which may contain nulls -class NS_COM nsOpaqueKey : public nsHashKey { - public: - - // NB: when serializing, NEVER_OWN keys are deserialized as OWN. - enum Ownership { - NEVER_OWN, // very long lived, even clones don't need to copy it. - OWN_CLONE, // as long lived as this key. But clones make a copy. - OWN // to be free'd in key dtor. Clones make their own copy. - }; - - nsOpaqueKey(const nsOpaqueKey& aKey); - nsOpaqueKey(const char* buf, PRUint32 bufLen, Ownership own = OWN_CLONE); - ~nsOpaqueKey(void); - - PRUint32 HashCode(void) const; - PRBool Equals(const nsHashKey* aKey) const; - nsHashKey* Clone() const; - nsOpaqueKey(nsIObjectInputStream* aStream, nsresult *aResult); - nsresult Write(nsIObjectOutputStream* aStream) const; - - // For when the owner of the hashtable wants to peek at the actual - // string in the key. No copy is made, so be careful. - const char* GetBuffer() const { return mBuf; } - PRUint32 GetBufferLength() const { return mBufLen; } - - protected: - char* mBuf; - PRUint32 mBufLen; - Ownership mOwnership; -}; - //////////////////////////////////////////////////////////////////////////////// #endif // nsHashtable_h__ diff --git a/mozilla/xpcom/ds/nsRecyclingAllocator.h b/mozilla/xpcom/ds/nsRecyclingAllocator.h index cbe7face04b..a7becbe838f 100644 --- a/mozilla/xpcom/ds/nsRecyclingAllocator.h +++ b/mozilla/xpcom/ds/nsRecyclingAllocator.h @@ -192,7 +192,7 @@ class NS_COM nsRecyclingAllocator { // ---------------------------------------------------------------------- // Wrapping the nsRecyclingAllocator with nsIMemory -class NS_COM nsRecyclingAllocatorImpl : public nsRecyclingAllocator, public nsIRecyclingAllocator { +class nsRecyclingAllocatorImpl : public nsRecyclingAllocator, public nsIRecyclingAllocator { public: NS_DECL_ISUPPORTS NS_DECL_NSIMEMORY diff --git a/mozilla/xpcom/ds/nsVariant.h b/mozilla/xpcom/ds/nsVariant.h index c3c6fc30807..717a762f217 100644 --- a/mozilla/xpcom/ds/nsVariant.h +++ b/mozilla/xpcom/ds/nsVariant.h @@ -41,7 +41,7 @@ * to the xpcom module. */ -struct NS_COM nsDiscriminatedUnion +struct nsDiscriminatedUnion { union { PRInt8 mInt8Value; diff --git a/mozilla/xpcom/io/Makefile.in b/mozilla/xpcom/io/Makefile.in index de80fa2ff7e..671ccf44d9f 100644 --- a/mozilla/xpcom/io/Makefile.in +++ b/mozilla/xpcom/io/Makefile.in @@ -45,11 +45,6 @@ CPPSRCS = \ nsEscape.cpp \ nsFastLoadFile.cpp \ nsFastLoadService.cpp \ - nsFileSpec.cpp \ - nsFileSpecImpl.cpp \ - nsFileStream.cpp \ - nsIFileStream.cpp \ - nsStringStream.cpp \ nsInputStreamTee.cpp \ nsLinebreakConverter.cpp \ nsLocalFileCommon.cpp \ @@ -58,8 +53,9 @@ CPPSRCS = \ nsStreamUtils.cpp \ nsScriptableInputStream.cpp \ nsSegmentedBuffer.cpp \ - nsSpecialSystemDirectory.cpp \ + SpecialSystemDirectory.cpp \ nsStorageStream.cpp \ + nsStringStream.cpp \ nsUnicharInputStream.cpp \ nsNativeCharsetUtils.cpp \ $(NULL) @@ -85,17 +81,14 @@ EXPORTS = \ nsEscape.h \ nsFastLoadPtr.h \ nsFastLoadService.h \ - nsFileSpec.h \ - nsFileStream.h \ - nsIFileStream.h \ nsIUnicharInputStream.h \ nsLinebreakConverter.h \ nsLocalFile.h \ nsMultiplexInputStream.h \ nsScriptableInputStream.h \ - nsSpecialSystemDirectory.h \ nsStorageStream.h \ nsStringIO.h \ + nsStringStream.h \ nsStreamUtils.h \ $(NULL) @@ -119,7 +112,6 @@ XPIDLSRCS = \ nsIByteArrayInputStream.idl \ nsIFastLoadFileControl.idl \ nsIFastLoadService.idl \ - nsIFileSpec.idl \ nsIInputStreamTee.idl \ nsILineInputStream.idl \ nsIMultiplexInputStream.idl \ @@ -128,14 +120,14 @@ XPIDLSRCS = \ nsIPipe.idl \ nsISeekableStream.idl \ nsIStorageStream.idl \ - nsIStreamBufferAccess.idl \ nsIStringStream.idl \ + nsIStreamBufferAccess.idl \ nsIAsyncInputStream.idl \ nsIAsyncOutputStream.idl \ $(NULL) ifneq (,$(filter mac cocoa,$(MOZ_WIDGET_TOOLKIT))) -XPIDLSRCS += nsILocalFileMac.idl +XPIDLSRCS += nsILocalFileMac.idl endif SDK_XPIDLSRCS = \ diff --git a/mozilla/xpcom/io/nsDirectoryService.cpp b/mozilla/xpcom/io/nsDirectoryService.cpp index fb166ff336e..fe2d0ebbf92 100644 --- a/mozilla/xpcom/io/nsDirectoryService.cpp +++ b/mozilla/xpcom/io/nsDirectoryService.cpp @@ -81,7 +81,7 @@ #include "prenv.h" #endif -#include "nsSpecialSystemDirectory.h" +#include "SpecialSystemDirectory.h" #include "nsAppFileLocationProvider.h" #if defined(XP_MAC) @@ -820,7 +820,8 @@ nsDirectoryService::GetFile(const char *prop, PRBool *persistent, nsIFile **_ret // check to see if it is one of our defaults - if (inAtom == nsDirectoryService::sCurrentProcess) + if (inAtom == nsDirectoryService::sCurrentProcess || + inAtom == nsDirectoryService::sOS_CurrentProcessDirectory ) { rv = GetCurrentProcessDirectory(getter_AddRefs(localFile)); } @@ -842,6 +843,9 @@ nsDirectoryService::GetFile(const char *prop, PRBool *persistent, nsIFile **_ret localFile->AppendNative(COMPONENT_DIRECTORY); localFile->AppendNative(XPTI_REGISTRY_NAME); } + + // Unless otherwise set, the core pieces of the GRE exist + // in the current process directory. else if (inAtom == nsDirectoryService::sGRE_Directory) { rv = GetCurrentProcessDirectory(getter_AddRefs(localFile)); @@ -851,7 +855,8 @@ nsDirectoryService::GetFile(const char *prop, PRBool *persistent, nsIFile **_ret rv = GetCurrentProcessDirectory(getter_AddRefs(localFile)); if (localFile) localFile->AppendNative(COMPONENT_DIRECTORY); - } + } + else if (inAtom == nsDirectoryService::sComponentDirectory) { rv = GetCurrentProcessDirectory(getter_AddRefs(localFile)); @@ -860,105 +865,85 @@ nsDirectoryService::GetFile(const char *prop, PRBool *persistent, nsIFile **_ret } else if (inAtom == nsDirectoryService::sOS_DriveDirectory) { - nsSpecialSystemDirectory fileSpec(nsSpecialSystemDirectory::OS_DriveDirectory); - rv = NS_FileSpecToIFile(&fileSpec, getter_AddRefs(localFile)); + rv = GetSpecialSystemDirectory(OS_DriveDirectory, getter_AddRefs(localFile)); } else if (inAtom == nsDirectoryService::sOS_TemporaryDirectory) { - nsSpecialSystemDirectory fileSpec(nsSpecialSystemDirectory::OS_TemporaryDirectory); - rv = NS_FileSpecToIFile(&fileSpec, getter_AddRefs(localFile)); + rv = GetSpecialSystemDirectory(OS_TemporaryDirectory, getter_AddRefs(localFile)); } else if (inAtom == nsDirectoryService::sOS_CurrentProcessDirectory) { - nsSpecialSystemDirectory fileSpec(nsSpecialSystemDirectory::OS_CurrentProcessDirectory); - rv = NS_FileSpecToIFile(&fileSpec, getter_AddRefs(localFile)); + rv = GetSpecialSystemDirectory(OS_CurrentProcessDirectory, getter_AddRefs(localFile)); } else if (inAtom == nsDirectoryService::sOS_CurrentWorkingDirectory) { - nsSpecialSystemDirectory fileSpec(nsSpecialSystemDirectory::OS_CurrentWorkingDirectory); - rv = NS_FileSpecToIFile(&fileSpec, getter_AddRefs(localFile)); + rv = GetSpecialSystemDirectory(OS_CurrentWorkingDirectory, getter_AddRefs(localFile)); } #if defined(XP_MAC) else if (inAtom == nsDirectoryService::sDirectory) { - nsSpecialSystemDirectory fileSpec(nsSpecialSystemDirectory::Mac_SystemDirectory); - rv = NS_FileSpecToIFile(&fileSpec, getter_AddRefs(localFile)); + rv = GetSpecialSystemDirectory(Mac_SystemDirectory, getter_AddRefs(localFile)); } else if (inAtom == nsDirectoryService::sDesktopDirectory) { - nsSpecialSystemDirectory fileSpec(nsSpecialSystemDirectory::Mac_DesktopDirectory); - rv = NS_FileSpecToIFile(&fileSpec, getter_AddRefs(localFile)); + rv = GetSpecialSystemDirectory(Mac_DesktopDirectory, getter_AddRefs(localFile)); } else if (inAtom == nsDirectoryService::sHomeDirectory) { - nsSpecialSystemDirectory fileSpec(nsSpecialSystemDirectory::Mac_DocumentsDirectory); - rv = NS_FileSpecToIFile(&fileSpec, getter_AddRefs(localFile)); + rv = GetSpecialSystemDirectory(Mac_DocumentsDirectory, getter_AddRefs(localFile)); } else if (inAtom == nsDirectoryService::sTrashDirectory) { - nsSpecialSystemDirectory fileSpec(nsSpecialSystemDirectory::Mac_TrashDirectory); - rv = NS_FileSpecToIFile(&fileSpec, getter_AddRefs(localFile)); + rv = GetSpecialSystemDirectory(Mac_TrashDirectory, getter_AddRefs(localFile)); } else if (inAtom == nsDirectoryService::sStartupDirectory) { - nsSpecialSystemDirectory fileSpec(nsSpecialSystemDirectory::Mac_StartupDirectory); - rv = NS_FileSpecToIFile(&fileSpec, getter_AddRefs(localFile)); + rv = GetSpecialSystemDirectory(Mac_StartupDirectory, getter_AddRefs(localFile)); } else if (inAtom == nsDirectoryService::sShutdownDirectory) { - nsSpecialSystemDirectory fileSpec(nsSpecialSystemDirectory::Mac_ShutdownDirectory); - rv = NS_FileSpecToIFile(&fileSpec, getter_AddRefs(localFile)); + rv = GetSpecialSystemDirectory(Mac_ShutdownDirectory, getter_AddRefs(localFile)); } else if (inAtom == nsDirectoryService::sAppleMenuDirectory) { - nsSpecialSystemDirectory fileSpec(nsSpecialSystemDirectory::Mac_AppleMenuDirectory); - rv = NS_FileSpecToIFile(&fileSpec, getter_AddRefs(localFile)); + rv = GetSpecialSystemDirectory(Mac_AppleMenuDirectory, getter_AddRefs(localFile)); } else if (inAtom == nsDirectoryService::sControlPanelDirectory) { - nsSpecialSystemDirectory fileSpec(nsSpecialSystemDirectory::Mac_ControlPanelDirectory); - rv = NS_FileSpecToIFile(&fileSpec, getter_AddRefs(localFile)); + rv = GetSpecialSystemDirectory(Mac_ControlPanelDirectory, getter_AddRefs(localFile)); } else if (inAtom == nsDirectoryService::sExtensionDirectory) { - nsSpecialSystemDirectory fileSpec(nsSpecialSystemDirectory::Mac_ExtensionDirectory); - rv = NS_FileSpecToIFile(&fileSpec, getter_AddRefs(localFile)); + rv = GetSpecialSystemDirectory(Mac_ExtensionDirectory, getter_AddRefs(localFile)); } else if (inAtom == nsDirectoryService::sFontsDirectory) { - nsSpecialSystemDirectory fileSpec(nsSpecialSystemDirectory::Mac_FontsDirectory); - rv = NS_FileSpecToIFile(&fileSpec, getter_AddRefs(localFile)); + rv = GetSpecialSystemDirectory(Mac_FontsDirectory, getter_AddRefs(localFile)); } else if (inAtom == nsDirectoryService::sClassicPreferencesDirectory) { - nsSpecialSystemDirectory fileSpec(nsSpecialSystemDirectory::Mac_ClassicPreferencesDirectory); - rv = NS_FileSpecToIFile(&fileSpec, getter_AddRefs(localFile)); + rv = GetSpecialSystemDirectory(Mac_ClassicPreferencesDirectory, getter_AddRefs(localFile)); } else if (inAtom == nsDirectoryService::sPreferencesDirectory) { - nsSpecialSystemDirectory fileSpec(nsSpecialSystemDirectory::Mac_PreferencesDirectory); - rv = NS_FileSpecToIFile(&fileSpec, getter_AddRefs(localFile)); + rv = GetSpecialSystemDirectory(Mac_PreferencesDirectory, getter_AddRefs(localFile)); } else if (inAtom == nsDirectoryService::sDocumentsDirectory) { - nsSpecialSystemDirectory fileSpec(nsSpecialSystemDirectory::Mac_DocumentsDirectory); - rv = NS_FileSpecToIFile(&fileSpec, getter_AddRefs(localFile)); + rv = GetSpecialSystemDirectory(Mac_DocumentsDirectory, getter_AddRefs(localFile)); } else if (inAtom == nsDirectoryService::sInternetSearchDirectory) { - nsSpecialSystemDirectory fileSpec(nsSpecialSystemDirectory::Mac_InternetSearchDirectory); - rv = NS_FileSpecToIFile(&fileSpec, getter_AddRefs(localFile)); + rv = GetSpecialSystemDirectory(Mac_InternetSearchDirectory, getter_AddRefs(localFile)); } else if (inAtom == nsDirectoryService::sDefaultDownloadDirectory) { - nsSpecialSystemDirectory fileSpec(nsSpecialSystemDirectory::Mac_DefaultDownloadDirectory); - rv = NS_FileSpecToIFile(&fileSpec, getter_AddRefs(localFile)); + rv = GetSpecialSystemDirectory(Mac_DefaultDownloadDirectory, getter_AddRefs(localFile)); } else if (inAtom == nsDirectoryService::sUserLibDirectory) { - nsSpecialSystemDirectory fileSpec(nsSpecialSystemDirectory::Mac_UserLibDirectory); - rv = NS_FileSpecToIFile(&fileSpec, getter_AddRefs(localFile)); + rv = GetSpecialSystemDirectory(Mac_UserLibDirectory, getter_AddRefs(localFile)); } #elif defined (XP_MACOSX) else if (inAtom == nsDirectoryService::sHomeDirectory) @@ -1014,197 +999,159 @@ nsDirectoryService::GetFile(const char *prop, PRBool *persistent, nsIFile **_ret #elif defined (XP_WIN) else if (inAtom == nsDirectoryService::sSystemDirectory) { - nsSpecialSystemDirectory fileSpec(nsSpecialSystemDirectory::Win_SystemDirectory); - rv = NS_FileSpecToIFile(&fileSpec, getter_AddRefs(localFile)); + rv = GetSpecialSystemDirectory(Win_SystemDirectory, getter_AddRefs(localFile)); } else if (inAtom == nsDirectoryService::sWindowsDirectory) { - nsSpecialSystemDirectory fileSpec(nsSpecialSystemDirectory::Win_WindowsDirectory); - rv = NS_FileSpecToIFile(&fileSpec, getter_AddRefs(localFile)); + rv = GetSpecialSystemDirectory(Win_WindowsDirectory, getter_AddRefs(localFile)); } else if (inAtom == nsDirectoryService::sHomeDirectory) { - nsSpecialSystemDirectory fileSpec(nsSpecialSystemDirectory::Win_HomeDirectory); - rv = NS_FileSpecToIFile(&fileSpec, getter_AddRefs(localFile)); + rv = GetSpecialSystemDirectory(Win_HomeDirectory, getter_AddRefs(localFile)); } else if (inAtom == nsDirectoryService::sDesktop) { - nsSpecialSystemDirectory fileSpec(nsSpecialSystemDirectory::Win_Desktop); - rv = NS_FileSpecToIFile(&fileSpec, getter_AddRefs(localFile)); + rv = GetSpecialSystemDirectory(Win_Desktop, getter_AddRefs(localFile)); } else if (inAtom == nsDirectoryService::sPrograms) { - nsSpecialSystemDirectory fileSpec(nsSpecialSystemDirectory::Win_Programs); - rv = NS_FileSpecToIFile(&fileSpec, getter_AddRefs(localFile)); + rv = GetSpecialSystemDirectory(Win_Programs, getter_AddRefs(localFile)); } else if (inAtom == nsDirectoryService::sControls) { - nsSpecialSystemDirectory fileSpec(nsSpecialSystemDirectory::Win_Controls); - rv = NS_FileSpecToIFile(&fileSpec, getter_AddRefs(localFile)); + rv = GetSpecialSystemDirectory(Win_Controls, getter_AddRefs(localFile)); } else if (inAtom == nsDirectoryService::sPrinters) { - nsSpecialSystemDirectory fileSpec(nsSpecialSystemDirectory::Win_Printers); - rv = NS_FileSpecToIFile(&fileSpec, getter_AddRefs(localFile)); + rv = GetSpecialSystemDirectory(Win_Printers, getter_AddRefs(localFile)); } else if (inAtom == nsDirectoryService::sPersonal) { - nsSpecialSystemDirectory fileSpec(nsSpecialSystemDirectory::Win_Personal); - rv = NS_FileSpecToIFile(&fileSpec, getter_AddRefs(localFile)); + rv = GetSpecialSystemDirectory(Win_Personal, getter_AddRefs(localFile)); } else if (inAtom == nsDirectoryService::sFavorites) { - nsSpecialSystemDirectory fileSpec(nsSpecialSystemDirectory::Win_Favorites); - rv = NS_FileSpecToIFile(&fileSpec, getter_AddRefs(localFile)); + rv = GetSpecialSystemDirectory(Win_Favorites, getter_AddRefs(localFile)); } else if (inAtom == nsDirectoryService::sStartup) { - nsSpecialSystemDirectory fileSpec(nsSpecialSystemDirectory::Win_Startup); - rv = NS_FileSpecToIFile(&fileSpec, getter_AddRefs(localFile)); + rv = GetSpecialSystemDirectory(Win_Startup, getter_AddRefs(localFile)); } else if (inAtom == nsDirectoryService::sRecent) { - nsSpecialSystemDirectory fileSpec(nsSpecialSystemDirectory::Win_Recent); - rv = NS_FileSpecToIFile(&fileSpec, getter_AddRefs(localFile)); + rv = GetSpecialSystemDirectory(Win_Recent, getter_AddRefs(localFile)); } else if (inAtom == nsDirectoryService::sSendto) { - nsSpecialSystemDirectory fileSpec(nsSpecialSystemDirectory::Win_Sendto); - rv = NS_FileSpecToIFile(&fileSpec, getter_AddRefs(localFile)); + rv = GetSpecialSystemDirectory(Win_Sendto, getter_AddRefs(localFile)); } else if (inAtom == nsDirectoryService::sBitbucket) { - nsSpecialSystemDirectory fileSpec(nsSpecialSystemDirectory::Win_Bitbucket); - rv = NS_FileSpecToIFile(&fileSpec, getter_AddRefs(localFile)); + rv = GetSpecialSystemDirectory(Win_Bitbucket, getter_AddRefs(localFile)); } else if (inAtom == nsDirectoryService::sStartmenu) { - nsSpecialSystemDirectory fileSpec(nsSpecialSystemDirectory::Win_Startmenu); - rv = NS_FileSpecToIFile(&fileSpec, getter_AddRefs(localFile)); + rv = GetSpecialSystemDirectory(Win_Startmenu, getter_AddRefs(localFile)); } else if (inAtom == nsDirectoryService::sDesktopdirectory) { - nsSpecialSystemDirectory fileSpec(nsSpecialSystemDirectory::Win_Desktopdirectory); - rv = NS_FileSpecToIFile(&fileSpec, getter_AddRefs(localFile)); + rv = GetSpecialSystemDirectory(Win_Desktopdirectory, getter_AddRefs(localFile)); } else if (inAtom == nsDirectoryService::sDrives) { - nsSpecialSystemDirectory fileSpec(nsSpecialSystemDirectory::Win_Drives); - rv = NS_FileSpecToIFile(&fileSpec, getter_AddRefs(localFile)); + rv = GetSpecialSystemDirectory(Win_Drives, getter_AddRefs(localFile)); } else if (inAtom == nsDirectoryService::sNetwork) { - nsSpecialSystemDirectory fileSpec(nsSpecialSystemDirectory::Win_Network); - rv = NS_FileSpecToIFile(&fileSpec, getter_AddRefs(localFile)); + rv = GetSpecialSystemDirectory(Win_Network, getter_AddRefs(localFile)); } else if (inAtom == nsDirectoryService::sNethood) { - nsSpecialSystemDirectory fileSpec(nsSpecialSystemDirectory::Win_Nethood); - rv = NS_FileSpecToIFile(&fileSpec, getter_AddRefs(localFile)); + rv = GetSpecialSystemDirectory(Win_Nethood, getter_AddRefs(localFile)); } else if (inAtom == nsDirectoryService::sFonts) { - nsSpecialSystemDirectory fileSpec(nsSpecialSystemDirectory::Win_Fonts); - rv = NS_FileSpecToIFile(&fileSpec, getter_AddRefs(localFile)); + rv = GetSpecialSystemDirectory(Win_Fonts, getter_AddRefs(localFile)); } else if (inAtom == nsDirectoryService::sTemplates) { - nsSpecialSystemDirectory fileSpec(nsSpecialSystemDirectory::Win_Templates); - rv = NS_FileSpecToIFile(&fileSpec, getter_AddRefs(localFile)); + rv = GetSpecialSystemDirectory(Win_Templates, getter_AddRefs(localFile)); } else if (inAtom == nsDirectoryService::sCommon_Startmenu) { - nsSpecialSystemDirectory fileSpec(nsSpecialSystemDirectory::Win_Common_Startmenu); - rv = NS_FileSpecToIFile(&fileSpec, getter_AddRefs(localFile)); + rv = GetSpecialSystemDirectory(Win_Common_Startmenu, getter_AddRefs(localFile)); } else if (inAtom == nsDirectoryService::sCommon_Programs) { - nsSpecialSystemDirectory fileSpec(nsSpecialSystemDirectory::Win_Common_Programs); - rv = NS_FileSpecToIFile(&fileSpec, getter_AddRefs(localFile)); + rv = GetSpecialSystemDirectory(Win_Common_Programs, getter_AddRefs(localFile)); } else if (inAtom == nsDirectoryService::sCommon_Startup) { - nsSpecialSystemDirectory fileSpec(nsSpecialSystemDirectory::Win_Common_Startup); - rv = NS_FileSpecToIFile(&fileSpec, getter_AddRefs(localFile)); + rv = GetSpecialSystemDirectory(Win_Common_Startup, getter_AddRefs(localFile)); } else if (inAtom == nsDirectoryService::sCommon_Desktopdirectory) { - nsSpecialSystemDirectory fileSpec(nsSpecialSystemDirectory::Win_Common_Desktopdirectory); - rv = NS_FileSpecToIFile(&fileSpec, getter_AddRefs(localFile)); + rv = GetSpecialSystemDirectory(Win_Common_Desktopdirectory, getter_AddRefs(localFile)); } else if (inAtom == nsDirectoryService::sAppdata) { - nsSpecialSystemDirectory fileSpec(nsSpecialSystemDirectory::Win_Appdata); - rv = NS_FileSpecToIFile(&fileSpec, getter_AddRefs(localFile)); + rv = GetSpecialSystemDirectory(Win_Appdata, getter_AddRefs(localFile)); } else if (inAtom == nsDirectoryService::sPrinthood) { - nsSpecialSystemDirectory fileSpec(nsSpecialSystemDirectory::Win_Printhood); - rv = NS_FileSpecToIFile(&fileSpec, getter_AddRefs(localFile)); + rv = GetSpecialSystemDirectory(Win_Printhood, getter_AddRefs(localFile)); } else if (inAtom == nsDirectoryService::sWinCookiesDirectory) { - nsSpecialSystemDirectory fileSpec(nsSpecialSystemDirectory::Win_Cookies); - rv = NS_FileSpecToIFile(&fileSpec, getter_AddRefs(localFile)); + rv = GetSpecialSystemDirectory(Win_Cookies, getter_AddRefs(localFile)); } #elif defined (XP_UNIX) else if (inAtom == nsDirectoryService::sLocalDirectory) { - nsSpecialSystemDirectory fileSpec(nsSpecialSystemDirectory::Unix_LocalDirectory); - rv = NS_FileSpecToIFile(&fileSpec, getter_AddRefs(localFile)); + rv = GetSpecialSystemDirectory(Unix_LocalDirectory, getter_AddRefs(localFile)); } else if (inAtom == nsDirectoryService::sLibDirectory) { - nsSpecialSystemDirectory fileSpec(nsSpecialSystemDirectory::Unix_LibDirectory); - rv = NS_FileSpecToIFile(&fileSpec, getter_AddRefs(localFile)); + rv = GetSpecialSystemDirectory(Unix_LibDirectory, getter_AddRefs(localFile)); } else if (inAtom == nsDirectoryService::sHomeDirectory) { - nsSpecialSystemDirectory fileSpec(nsSpecialSystemDirectory::Unix_HomeDirectory); - rv = NS_FileSpecToIFile(&fileSpec, getter_AddRefs(localFile)); + rv = GetSpecialSystemDirectory(Unix_HomeDirectory, getter_AddRefs(localFile)); } #elif defined (XP_OS2) else if (inAtom == nsDirectoryService::sSystemDirectory) { - nsSpecialSystemDirectory fileSpec(nsSpecialSystemDirectory::OS2_SystemDirectory); - rv = NS_FileSpecToIFile(&fileSpec, getter_AddRefs(localFile)); + rv = GetSpecialSystemDirectory(OS2_SystemDirectory, getter_AddRefs(localFile)); } else if (inAtom == nsDirectoryService::sOS2Directory) { - nsSpecialSystemDirectory fileSpec(nsSpecialSystemDirectory::OS2_OS2Directory); - rv = NS_FileSpecToIFile(&fileSpec, getter_AddRefs(localFile)); + rv = GetSpecialSystemDirectory(OS2_OS2Directory, getter_AddRefs(localFile)); } else if (inAtom == nsDirectoryService::sHomeDirectory) { - nsSpecialSystemDirectory fileSpec(nsSpecialSystemDirectory::OS2_HomeDirectory); - rv = NS_FileSpecToIFile(&fileSpec, getter_AddRefs(localFile)); + rv = GetSpecialSystemDirectory(OS2_HomeDirectory, getter_AddRefs(localFile)); } else if (inAtom == nsDirectoryService::sDesktopDirectory) { - nsSpecialSystemDirectory fileSpec(nsSpecialSystemDirectory::OS2_DesktopDirectory); - rv = NS_FileSpecToIFile(&fileSpec, getter_AddRefs(localFile)); + rv = GetSpecialSystemDirectory(OS2_DesktopDirectory, getter_AddRefs(localFile)); } #elif defined (XP_BEOS) else if (inAtom == nsDirectoryService::sSettingsDirectory) { - nsSpecialSystemDirectory fileSpec(nsSpecialSystemDirectory::BeOS_SettingsDirectory); - rv = NS_FileSpecToIFile(&fileSpec, getter_AddRefs(localFile)); + rv = GetSpecialSystemDirectory(BeOS_SettingsDirectory, getter_AddRefs(localFile)); } else if (inAtom == nsDirectoryService::sHomeDirectory) { - nsSpecialSystemDirectory fileSpec(nsSpecialSystemDirectory::BeOS_HomeDirectory); - rv = NS_FileSpecToIFile(&fileSpec, getter_AddRefs(localFile)); + rv = GetSpecialSystemDirectory(BeOS_HomeDirectory, getter_AddRefs(localFile)); } else if (inAtom == nsDirectoryService::sDesktopDirectory) { - nsSpecialSystemDirectory fileSpec(nsSpecialSystemDirectory::BeOS_DesktopDirectory); - rv = NS_FileSpecToIFile(&fileSpec, getter_AddRefs(localFile)); + rv = GetSpecialSystemDirectory(BeOS_DesktopDirectory, getter_AddRefs(localFile)); } else if (inAtom == nsDirectoryService::sSystemDirectory) { - nsSpecialSystemDirectory fileSpec(nsSpecialSystemDirectory::BeOS_SystemDirectory); - rv = NS_FileSpecToIFile(&fileSpec, getter_AddRefs(localFile)); + rv = GetSpecialSystemDirectory(BeOS_SystemDirectory, getter_AddRefs(localFile)); } #endif @@ -1213,7 +1160,9 @@ nsDirectoryService::GetFile(const char *prop, PRBool *persistent, nsIFile **_ret if (localFile && NS_SUCCEEDED(rv)) return localFile->QueryInterface(NS_GET_IID(nsIFile), (void**)_retval); - +#ifdef DEBUG_dougt + printf("Failed to find directory for key: %s\n", prop); +#endif return rv; } diff --git a/mozilla/xpcom/io/nsEscape.cpp b/mozilla/xpcom/io/nsEscape.cpp index 4e5f918ae8c..b90110d6ce8 100644 --- a/mozilla/xpcom/io/nsEscape.cpp +++ b/mozilla/xpcom/io/nsEscape.cpp @@ -73,16 +73,7 @@ const int netCharType[256] = #define HEX_ESCAPE '%' //---------------------------------------------------------------------------------------- -NS_COM char* nsEscape(const char * str, nsEscapeMask mask) -//---------------------------------------------------------------------------------------- -{ - if(!str) - return NULL; - return nsEscapeCount(str, (PRInt32)strlen(str), mask, NULL); -} - -//---------------------------------------------------------------------------------------- -NS_COM char* nsEscapeCount( +static char* nsEscapeCount( const char * str, PRInt32 len, nsEscapeMask mask, @@ -147,6 +138,15 @@ NS_COM char* nsEscapeCount( return result; } +//---------------------------------------------------------------------------------------- +NS_COM char* nsEscape(const char * str, nsEscapeMask mask) +//---------------------------------------------------------------------------------------- +{ + if(!str) + return NULL; + return nsEscapeCount(str, (PRInt32)strlen(str), mask, NULL); +} + //---------------------------------------------------------------------------------------- NS_COM char* nsUnescape(char * str) //---------------------------------------------------------------------------------------- @@ -348,24 +348,6 @@ const int EscapeChars[256] = esc_Forced = 1024 */ -NS_COM nsresult nsStdEscape(const char* str, PRInt16 mask, nsCString &result) -{ - result.Truncate(); - nsresult rv = NS_EscapeURL(str, -1, mask, result); - if (NS_SUCCEEDED(rv) && result.IsEmpty()) - result = str; - return rv; -} - -NS_COM nsresult nsStdUnescape(char *str, char **result) -{ - *result = nsCRT::strdup(str); - if (!*result) - return NS_ERROR_OUT_OF_MEMORY; - nsUnescape(*result); - return NS_OK; -} - NS_COM PRBool NS_EscapeURL(const char *part, PRInt32 partLen, PRInt16 mask, diff --git a/mozilla/xpcom/io/nsEscape.h b/mozilla/xpcom/io/nsEscape.h index 0be2d9875b5..c217e432381 100644 --- a/mozilla/xpcom/io/nsEscape.h +++ b/mozilla/xpcom/io/nsEscape.h @@ -63,11 +63,6 @@ NS_COM char * nsUnescape(char * str); * modifies the parameter, returns the same buffer */ -NS_COM char * nsEscapeCount(const char * str, PRInt32 len, nsEscapeMask mask, PRInt32* out_len); - /* Like nsEscape, but if out_len is non-null, return result string length - * in *out_len, and uses len instead of NUL termination. - * Caller must use nsCRT::free() on the result. - */ NS_COM PRInt32 nsUnescapeCount (char * str); /* decode % escaped hex codes into character values, * modifies the parameter buffer, returns the length of the result @@ -85,12 +80,6 @@ nsEscapeHTML2(const PRUnichar *aSourceBuffer, */ -/** - * DEPRECATED API: use NS_EscapeURL/NS_UnescapeURL instead - */ -NS_COM nsresult nsStdEscape(const char* str, PRInt16 mask, nsCString &result); -NS_COM nsresult nsStdUnescape(char* str, char **result); - #ifdef __cplusplus } #endif diff --git a/mozilla/xpcom/io/nsSegmentedBuffer.cpp b/mozilla/xpcom/io/nsSegmentedBuffer.cpp index 5983e9a7362..2592635939d 100644 --- a/mozilla/xpcom/io/nsSegmentedBuffer.cpp +++ b/mozilla/xpcom/io/nsSegmentedBuffer.cpp @@ -38,20 +38,6 @@ #include "nsSegmentedBuffer.h" #include "nsCRT.h" -nsSegmentedBuffer::nsSegmentedBuffer() - : mSegmentSize(0), mMaxSize(0), - mSegAllocator(nsnull), mSegmentArray(nsnull), - mSegmentArrayCount(0), - mFirstSegmentIndex(0), mLastSegmentIndex(0) -{ -} - -nsSegmentedBuffer::~nsSegmentedBuffer() -{ - Empty(); - NS_IF_RELEASE(mSegAllocator); -} - nsresult nsSegmentedBuffer::Init(PRUint32 segmentSize, PRUint32 maxSize, nsIMemory* allocator) diff --git a/mozilla/xpcom/io/nsSegmentedBuffer.h b/mozilla/xpcom/io/nsSegmentedBuffer.h index 299214b0f60..de1dcba6a1d 100644 --- a/mozilla/xpcom/io/nsSegmentedBuffer.h +++ b/mozilla/xpcom/io/nsSegmentedBuffer.h @@ -44,13 +44,22 @@ class nsSegmentedBuffer { public: - nsSegmentedBuffer(); - ~nsSegmentedBuffer(); + nsSegmentedBuffer() + : mSegmentSize(0), mMaxSize(0), + mSegAllocator(nsnull), mSegmentArray(nsnull), + mSegmentArrayCount(0), + mFirstSegmentIndex(0), mLastSegmentIndex(0) {} - nsresult Init(PRUint32 segmentSize, PRUint32 maxSize, + ~nsSegmentedBuffer() { + Empty(); + NS_IF_RELEASE(mSegAllocator); + } + + + NS_COM nsresult Init(PRUint32 segmentSize, PRUint32 maxSize, nsIMemory* allocator = nsnull); - char* AppendNewSegment(); // pushes at end + NS_COM char* AppendNewSegment(); // pushes at end // returns true if no more segments remain: PRBool DeleteFirstSegment(); // pops from beginning @@ -62,20 +71,20 @@ public: // consumption when data is not an exact multiple of segment size. PRBool ReallocLastSegment(size_t newSize); - void Empty(); // frees all segments + NS_COM void Empty(); // frees all segments - PRUint32 GetSegmentCount() { + NS_COM PRUint32 GetSegmentCount() { if (mFirstSegmentIndex <= mLastSegmentIndex) return mLastSegmentIndex - mFirstSegmentIndex; else return mSegmentArrayCount + mLastSegmentIndex - mFirstSegmentIndex; } - PRUint32 GetSegmentSize() { return mSegmentSize; } + NS_COM PRUint32 GetSegmentSize() { return mSegmentSize; } PRUint32 GetMaxSize() { return mMaxSize; } PRUint32 GetSize() { return GetSegmentCount() * mSegmentSize; } - char* GetSegment(PRUint32 indx) { + NS_COM char* GetSegment(PRUint32 indx) { NS_ASSERTION(indx < GetSegmentCount(), "index out of bounds"); PRInt32 i = ModSegArraySize(mFirstSegmentIndex + (PRInt32)indx); return mSegmentArray[i]; diff --git a/mozilla/xpcom/io/nsStringStream.cpp b/mozilla/xpcom/io/nsStringStream.cpp index b40289c2a16..981f00551ab 100644 --- a/mozilla/xpcom/io/nsStringStream.cpp +++ b/mozilla/xpcom/io/nsStringStream.cpp @@ -51,12 +51,24 @@ */ #include "nsStringStream.h" -#include "nsIFileStream.h" // for nsIRandomAccessStore #include "prerror.h" -#include "nsFileSpec.h" #include "plstr.h" #include "nsReadableUtils.h" +#include "nsCRT.h" +#include "nsISeekableStream.h" + +#define NS_FILE_RESULT(x) ns_file_convert_result((PRInt32)x) +#define NS_FILE_FAILURE NS_FILE_RESULT(-1) + +static nsresult ns_file_convert_result(PRInt32 nativeErr) +{ + return nativeErr ? + NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_FILES,((nativeErr)&0xFFFF)) + : NS_OK; +} + + //======================================================================================== class BasicStringImpl @@ -368,9 +380,9 @@ NS_IMPL_THREADSAFE_RELEASE(BasicStringImpl) NS_IMPL_QUERY_HEAD(BasicStringImpl) NS_IMPL_QUERY_BODY(nsISeekableStream) - NS_IMPL_QUERY_BODY(nsIRandomAccessStore) NS_IMPL_QUERY_BODY(nsIOutputStream) NS_IMPL_QUERY_BODY(nsIInputStream) + NS_IMPL_QUERY_BODY(nsIRandomAccessStore) NS_IMPL_QUERY_TAIL(nsIOutputStream) //---------------------------------------------------------------------------------------- diff --git a/mozilla/xpcom/io/nsStringStream.h b/mozilla/xpcom/io/nsStringStream.h index 87fa9d5e6ea..008764d5785 100644 --- a/mozilla/xpcom/io/nsStringStream.h +++ b/mozilla/xpcom/io/nsStringStream.h @@ -39,12 +39,34 @@ #ifndef nsStringStream_h__ #define nsStringStream_h__ +#include "nsISeekableStream.h" + +/* a6cf90e8-15b3-11d2-932e-00805f8add32 */ +#define NS_IRANDOMACCESS_IID \ +{ 0xa6cf90eb, 0x15b3, 0x11d2, \ + {0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32} } + +//======================================================================================== +class nsIRandomAccessStore +// Supports Seek, Tell etc. +//======================================================================================== +: public nsISeekableStream +{ +public: + NS_DEFINE_STATIC_IID_ACCESSOR(NS_IRANDOMACCESS_IID) + +/* "PROTECTED" */ + NS_IMETHOD GetAtEOF(PRBool* outAtEOF) = 0; + NS_IMETHOD SetAtEOF(PRBool inAtEOF) = 0; +}; // class nsIRandomAccessStore + #include "nsIStringStream.h" /** * nsStringInputStream : nsIStringInputStream * , nsIInputStream * , nsISeekableStream + * , nsIRandomAccessStore */ #define NS_STRINGINPUTSTREAM_CLASSNAME "nsStringInputStream" #define NS_STRINGINPUTSTREAM_CONTRACTID "@mozilla.org/io/string-input-stream;1" @@ -57,4 +79,6 @@ } extern NS_METHOD nsStringInputStreamConstructor(nsISupports *, REFNSIID, void **); + + #endif // nsStringStream_h__ diff --git a/mozilla/xpcom/proxy/tests/proxytests.cpp b/mozilla/xpcom/proxy/tests/proxytests.cpp index 1c3be999889..b79e64b1dfc 100644 --- a/mozilla/xpcom/proxy/tests/proxytests.cpp +++ b/mozilla/xpcom/proxy/tests/proxytests.cpp @@ -43,7 +43,6 @@ #include "nsIComponentRegistrar.h" #include "nsIServiceManager.h" #include "nsCOMPtr.h" -#include "nsSpecialSystemDirectory.h" // For exe dir #include "nscore.h" #include "nspr.h" diff --git a/mozilla/xpcom/tests/TestDeque.cpp b/mozilla/xpcom/tests/TestDeque.cpp index 03b4f137eac..b8adaba3677 100644 --- a/mozilla/xpcom/tests/TestDeque.cpp +++ b/mozilla/xpcom/tests/TestDeque.cpp @@ -51,7 +51,6 @@ public: nsresult OriginalTest(); nsresult OriginalFlaw(); nsresult AssignFlaw(); - nsresult StupidIterations(); }; static _TestDeque sTestDeque; @@ -73,7 +72,6 @@ int _TestDeque::SelfTest() { results+=OriginalTest(); results+=OriginalFlaw(); results+=AssignFlaw(); - results+=StupidIterations(); return results; } @@ -152,46 +150,6 @@ nsresult _TestDeque::AssignFlaw() { int count=sizeof(ints)/sizeof(int); int i=0; nsDeque src(new _Dealloc),dest(new _Dealloc); - /** - * Test 2. Assignment doesn't do the right things. - */ - printf("fill array\n"); - for (i=32; i; --i) - ints[i]=i*3+7; - printf("push 10 times\n"); //Capacity => 16 - for (i=0; i<10; i++) - src.Push(&ints[i]); - nsDequeIterator first(src.Begin()), second(src.End()); - nsDequeIterator third(dest.Begin()), fourth=dest.Begin(); - char sF[]="failure: "; - char s1[]="first [ src.Begin]"; - char s2[]="second[ src.End ]"; - char s3[]="third [dest.Begin]"; - char s4[]="fourth[dest.Begin]"; - if (first ==second) printf("%s%s==%s",sF, s1, s2); - if (first ==third ) printf("%s%s==%s",sF, s1, s3); - if (first ==fourth) printf("%s%s==%s",sF, s1, s4); - if (second==third ) printf("%s%s==%s",sF, s2, s3); - if (second==fourth) printf("%s%s==%s",sF, s2, s4); - if (third !=fourth) printf("%s%s!=%s",sF, s3, s4); - return NS_OK; -} - -nsresult _TestDeque::StupidIterations() { - /** - * Transaction manager defined a peek which insisted on - * (a) doing its own peek - * (b) peeking at an empty deque - */ - nsDeque stupid(new _Dealloc); - stupid.End()++; - ++stupid.End(); - stupid.End()--; - --stupid.End(); - stupid.Begin()++; - ++stupid.Begin(); - stupid.Begin()--; - --stupid.Begin(); return NS_OK; } diff --git a/mozilla/xpcom/tools/registry/Makefile.in b/mozilla/xpcom/tools/registry/Makefile.in index 65724584f34..eadc173d31e 100644 --- a/mozilla/xpcom/tools/registry/Makefile.in +++ b/mozilla/xpcom/tools/registry/Makefile.in @@ -27,14 +27,17 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk MODULE = xpcom -CPPSRCS = regExport.cpp regxpcom.cpp +CPPSRCS = regxpcom.cpp + REQUIRES = string \ - $(NULL) + embedstring \ + $(NULL) + SIMPLE_PROGRAMS = $(CPPSRCS:.cpp=$(BIN_SUFFIX)) -LIBS = \ - $(XPCOM_LIBS) \ +LIBS = \ + $(MOZ_COMPONENT_LIBS) \ $(NSPR_LIBS) \ $(NULL) diff --git a/mozilla/xpfe/Makefile.in b/mozilla/xpfe/Makefile.in index 58f08eb5f45..1f001841f16 100644 --- a/mozilla/xpfe/Makefile.in +++ b/mozilla/xpfe/Makefile.in @@ -26,11 +26,25 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk -DIRS = appshell browser components communicator global +DIRS = appshell browser components/shistory communicator global ifneq (,$(filter mac cocoa,$(MOZ_WIDGET_TOOLKIT))) DIRS := bootstrap/appleevents $(DIRS) endif +# Because of our great use of encapsulation, there are +# some header file in xpfe/components that are required +# by layout and the dom. This MOZ_XPFE_COMPONENTS, if +# unset, allows us to only export - not build - this +# stuff. +ifdef MOZ_XPFE_COMPONENTS +DIRS += components +endif + include $(topsrcdir)/config/rules.mk + +ifndef MOZ_XPFE_COMPONENTS +export:: + $(MAKE) -C components export +endif diff --git a/mozilla/xpfe/appshell/public/nsICmdLineHandler.idl b/mozilla/xpfe/appshell/public/nsICmdLineHandler.idl index 0849795cc79..7119182cfe7 100644 --- a/mozilla/xpfe/appshell/public/nsICmdLineHandler.idl +++ b/mozilla/xpfe/appshell/public/nsICmdLineHandler.idl @@ -47,7 +47,7 @@ #include "nsCOMPtr.h" #include "nsIComponentManager.h" #include "nsICategoryManager.h" -#include "nsIFileSpec.h" +#include "nsIFile.h" #include "nsXPIDLString.h" #include "nsReadableUtils.h" #include "nsIServiceManager.h" diff --git a/mozilla/xpfe/appshell/src/Makefile.in b/mozilla/xpfe/appshell/src/Makefile.in index 66de0e622fa..5088df9969e 100644 --- a/mozilla/xpfe/appshell/src/Makefile.in +++ b/mozilla/xpfe/appshell/src/Makefile.in @@ -30,12 +30,13 @@ IS_COMPONENT=1 MODULE_NAME = appshell MODULE = appshell LIBRARY_NAME = nsappshell -EXPORT_LIBRARY = 1 +Expcom_obsolete_LIBRARY = 1 SHORT_LIBNAME = appshell GRE_MODULE = 1 REQUIRES = xpcom \ string \ + xpcom_obsolete \ widget \ docshell \ webshell \ diff --git a/mozilla/xpfe/appshell/src/nsCommandLineService.cpp b/mozilla/xpfe/appshell/src/nsCommandLineService.cpp index 72f1741b289..878af374c52 100644 --- a/mozilla/xpfe/appshell/src/nsCommandLineService.cpp +++ b/mozilla/xpfe/appshell/src/nsCommandLineService.cpp @@ -42,6 +42,7 @@ #include "nsILocalFile.h" #include "nsString.h" #include "plstr.h" +#include "nsCRT.h" #include "nsNetUtil.h" #ifdef XP_MACOSX #include "nsCommandLineServiceMac.h" @@ -399,18 +400,3 @@ nsCmdLineService::PrintCmdArgs() } #endif -NS_EXPORT nsresult NS_NewCmdLineService(nsICmdLineService** aResult) -{ - if (nsnull == aResult) { - return NS_ERROR_NULL_POINTER; - } - - *aResult = new nsCmdLineService(); - if (nsnull == *aResult) { - return NS_ERROR_OUT_OF_MEMORY; - } - - NS_ADDREF(*aResult); - return NS_OK; -} - diff --git a/mozilla/xpfe/bootstrap/nsAppRunner.cpp b/mozilla/xpfe/bootstrap/nsAppRunner.cpp index 4d4f23f6d61..1a253135b48 100644 --- a/mozilla/xpfe/bootstrap/nsAppRunner.cpp +++ b/mozilla/xpfe/bootstrap/nsAppRunner.cpp @@ -65,7 +65,6 @@ #include "nsCRT.h" #include "nsIDirectoryService.h" #include "nsAppDirectoryServiceDefs.h" -#include "nsSpecialSystemDirectory.h" #include "nsIWindowMediator.h" #include "nsIDOMWindowInternal.h" #include "nsIClipboard.h" diff --git a/mozilla/xpfe/browser/src/nsBrowserInstance.cpp b/mozilla/xpfe/browser/src/nsBrowserInstance.cpp index abeea877b7b..2890e36ebfe 100644 --- a/mozilla/xpfe/browser/src/nsBrowserInstance.cpp +++ b/mozilla/xpfe/browser/src/nsBrowserInstance.cpp @@ -58,6 +58,7 @@ #include "pratom.h" #include "prprf.h" #include "nsIComponentManager.h" +#include "nsCRT.h" #include "nsIScriptContext.h" #include "nsIScriptGlobalObject.h" @@ -81,6 +82,7 @@ #include "nsIIOService.h" #include "nsIWidget.h" #include "plevent.h" +#include "plstr.h" #include "nsIAppShell.h" #include "nsIAppShellService.h" @@ -93,14 +95,12 @@ #include "nsIObserverService.h" #include "nsILocalFile.h" -#include "nsIFileStreams.h" #include "nsDirectoryServiceDefs.h" #include "nsNetUtil.h" #include "nsICmdLineService.h" // Stuff to implement file download dialog. -#include "nsFileStream.h" #include "nsIProxyObjectManager.h" #ifdef MOZ_PHOENIX diff --git a/mozilla/xpfe/components/bookmarks/src/Makefile.in b/mozilla/xpfe/components/bookmarks/src/Makefile.in index 32dd04562c9..de64bb524d7 100644 --- a/mozilla/xpfe/components/bookmarks/src/Makefile.in +++ b/mozilla/xpfe/components/bookmarks/src/Makefile.in @@ -28,7 +28,9 @@ include $(DEPTH)/config/autoconf.mk MODULE = appcomps LIBRARY_NAME = bookmarks_s + REQUIRES = xpcom \ + xpcom_obsolete \ string \ rdf \ appshell \ diff --git a/mozilla/xpfe/components/build/Makefile.in b/mozilla/xpfe/components/build/Makefile.in index 800fecc5571..de3dc10625b 100644 --- a/mozilla/xpfe/components/build/Makefile.in +++ b/mozilla/xpfe/components/build/Makefile.in @@ -33,6 +33,7 @@ IS_COMPONENT = 1 MODULE_NAME = application REQUIRES = xpcom \ + xpcom_obsolete \ string \ content \ rdf \ @@ -131,6 +132,7 @@ endif EXTRA_DSO_LDOPTS = \ $(MOZ_UNICHARUTIL_LIBS) \ $(MOZ_COMPONENT_LIBS) \ + $(MOZ_XPCOM_OBSOLETE_LIBS) \ $(EXTRA_DSO_LIBS) \ $(MOZ_JS_LIBS) \ $(NULL) diff --git a/mozilla/xpfe/components/history/src/nsGlobalHistory.cpp b/mozilla/xpfe/components/history/src/nsGlobalHistory.cpp index 158319bda57..54438b476f6 100644 --- a/mozilla/xpfe/components/history/src/nsGlobalHistory.cpp +++ b/mozilla/xpfe/components/history/src/nsGlobalHistory.cpp @@ -53,9 +53,7 @@ */ #include "nsNetUtil.h" #include "nsGlobalHistory.h" -#include "nsIFileSpec.h" #include "nsCRT.h" -#include "nsFileStream.h" #include "nsIEnumerator.h" #include "nsIServiceManager.h" #include "nsEnumeratorUtils.h" diff --git a/mozilla/xpfe/components/search/src/Makefile.in b/mozilla/xpfe/components/search/src/Makefile.in index cc2509836be..878dd67fecc 100755 --- a/mozilla/xpfe/components/search/src/Makefile.in +++ b/mozilla/xpfe/components/search/src/Makefile.in @@ -29,6 +29,7 @@ include $(DEPTH)/config/autoconf.mk MODULE = appcomps LIBRARY_NAME = search_s REQUIRES = xpcom \ + xpcom_obsolete \ string \ rdf \ necko \ diff --git a/mozilla/xpfe/components/shistory/public/nsISHistoryInternal.idl b/mozilla/xpfe/components/shistory/public/nsISHistoryInternal.idl index ae7af1354bb..5959d779806 100644 --- a/mozilla/xpfe/components/shistory/public/nsISHistoryInternal.idl +++ b/mozilla/xpfe/components/shistory/public/nsISHistoryInternal.idl @@ -40,9 +40,9 @@ #include "nsIFactory.idl" #include "nsISHEntry.idl" #include "nsISHTransaction.idl" -#include "nsIDocShell.idl" interface nsISHistoryListener; +interface nsIDocShell; %{C++ #define NS_SHISTORY_INTERNAL_CID \ diff --git a/mozilla/xpfe/components/shistory/src/Makefile.in b/mozilla/xpfe/components/shistory/src/Makefile.in index 8137f54a56b..3ae97ccb550 100644 --- a/mozilla/xpfe/components/shistory/src/Makefile.in +++ b/mozilla/xpfe/components/shistory/src/Makefile.in @@ -27,11 +27,9 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk MODULE = shistory -LIBRARY_NAME = shistory +LIBRARY_NAME = shistory_s EXPORT_LIBRARY = 1 -IS_COMPONENT = 1 -MODULE_NAME = Session_History_Module -GRE_MODULE = 1 +FORCE_STATIC_LIB = 1 REQUIRES = xpcom \ string \ @@ -44,7 +42,6 @@ REQUIRES = xpcom \ CPPSRCS = nsSHEntry.cpp \ nsSHTransaction.cpp \ - nsSHistoryModule.cpp \ nsSHistory.cpp \ $(NULL) diff --git a/mozilla/xpfe/components/shistory/src/nsSHistory.cpp b/mozilla/xpfe/components/shistory/src/nsSHistory.cpp index 36b0d77f9b9..836959ba8bd 100644 --- a/mozilla/xpfe/components/shistory/src/nsSHistory.cpp +++ b/mozilla/xpfe/components/shistory/src/nsSHistory.cpp @@ -29,6 +29,7 @@ // Interfaces Needed #include "nsILayoutHistoryState.h" +#include "nsIDocShell.h" #include "nsIDocShellLoadInfo.h" #include "nsISHContainer.h" #include "nsIDocShellTreeItem.h" diff --git a/mozilla/xpfe/components/startup/public/nsICmdLineHandler.idl b/mozilla/xpfe/components/startup/public/nsICmdLineHandler.idl index 0849795cc79..7119182cfe7 100644 --- a/mozilla/xpfe/components/startup/public/nsICmdLineHandler.idl +++ b/mozilla/xpfe/components/startup/public/nsICmdLineHandler.idl @@ -47,7 +47,7 @@ #include "nsCOMPtr.h" #include "nsIComponentManager.h" #include "nsICategoryManager.h" -#include "nsIFileSpec.h" +#include "nsIFile.h" #include "nsXPIDLString.h" #include "nsReadableUtils.h" #include "nsIServiceManager.h" diff --git a/mozilla/xpfe/components/startup/src/nsCommandLineService.cpp b/mozilla/xpfe/components/startup/src/nsCommandLineService.cpp index 72f1741b289..878af374c52 100644 --- a/mozilla/xpfe/components/startup/src/nsCommandLineService.cpp +++ b/mozilla/xpfe/components/startup/src/nsCommandLineService.cpp @@ -42,6 +42,7 @@ #include "nsILocalFile.h" #include "nsString.h" #include "plstr.h" +#include "nsCRT.h" #include "nsNetUtil.h" #ifdef XP_MACOSX #include "nsCommandLineServiceMac.h" @@ -399,18 +400,3 @@ nsCmdLineService::PrintCmdArgs() } #endif -NS_EXPORT nsresult NS_NewCmdLineService(nsICmdLineService** aResult) -{ - if (nsnull == aResult) { - return NS_ERROR_NULL_POINTER; - } - - *aResult = new nsCmdLineService(); - if (nsnull == *aResult) { - return NS_ERROR_OUT_OF_MEMORY; - } - - NS_ADDREF(*aResult); - return NS_OK; -} - diff --git a/mozilla/xpfe/components/winhooks/Makefile.in b/mozilla/xpfe/components/winhooks/Makefile.in index de2a954dda5..744b72ea48a 100644 --- a/mozilla/xpfe/components/winhooks/Makefile.in +++ b/mozilla/xpfe/components/winhooks/Makefile.in @@ -36,6 +36,7 @@ CPPSRCS = nsWindowsHooks.cpp REQUIRES = \ xpcom \ + xpcom_obsolete \ string \ dom \ windowwatcher \ diff --git a/mozilla/xpfe/components/winhooks/nsWindowsHooks.cpp b/mozilla/xpfe/components/winhooks/nsWindowsHooks.cpp index 3f34ed42cd3..2aaa343532e 100644 --- a/mozilla/xpfe/components/winhooks/nsWindowsHooks.cpp +++ b/mozilla/xpfe/components/winhooks/nsWindowsHooks.cpp @@ -76,7 +76,6 @@ #include "imgIContainer.h" #include "gfxIImageFrame.h" #include "nsIFileStream.h" -#include "nsFileSpec.h" #define RUNKEY "Software\\Microsoft\\Windows\\CurrentVersion\\Run" diff --git a/mozilla/xpfe/components/winhooks/nsWindowsHooksUtil.cpp b/mozilla/xpfe/components/winhooks/nsWindowsHooksUtil.cpp index 8951443553c..cc6cd2cae96 100644 --- a/mozilla/xpfe/components/winhooks/nsWindowsHooksUtil.cpp +++ b/mozilla/xpfe/components/winhooks/nsWindowsHooksUtil.cpp @@ -36,6 +36,7 @@ * * ***** END LICENSE BLOCK ***** */ #include +#include #include #include "nsString.h" diff --git a/mozilla/xpinstall/packager/Makefile.in b/mozilla/xpinstall/packager/Makefile.in index 3cad02c23ee..14307a30bc4 100644 --- a/mozilla/xpinstall/packager/Makefile.in +++ b/mozilla/xpinstall/packager/Makefile.in @@ -183,7 +183,7 @@ endif -exec $(STRIP) $(STRIP_FLAGS) {} >/dev/null 2>&1 \; ifeq (,$(filter mozilla phoenix,$(MOZ_PKG_APPNAME))) @echo "Creating start script $(MOZ_PKG_APPNAME)..." - cd $(DIST)/$(MOZ_PKG_APPNAME); cp mozilla $(MOZ_PKG_APPNAME) + cd $(DIST)/$(MOZ_PKG_APPNAME); if [ -f mozilla ]; then cp mozilla $(MOZ_PKG_APPNAME); fi endif @echo "Compressing..." cd $(DIST); $(MAKE_PACKAGE) diff --git a/mozilla/xpinstall/packager/mac/browser.jst b/mozilla/xpinstall/packager/mac/browser.jst index b6d9a85f8a0..73d6e08e582 100644 --- a/mozilla/xpinstall/packager/mac/browser.jst +++ b/mozilla/xpinstall/packager/mac/browser.jst @@ -29,6 +29,10 @@ function upgradeCleanup() deleteThisFile("Components", "Cache.shlb"); deleteThisFile("Components", "JSLoader.shlb"); deleteThisFile("Components", "content.shlb"); + deleteThisFile("Components", "jsurl.shlb"); + deleteThisFile("Components", "uriloader.shlb"); + deleteThisFile("Components", "shistory.shlb"); + deleteThisFile("Components", "view.shlb"); deleteThisFile("Program", "defaults/pref/config.js"); deleteThisFile("Program", "defaults/pref/initpref.js"); deleteThisFile("Program", "defaults/pref/macxprefs.js"); diff --git a/mozilla/xpinstall/packager/os2/browser.jst b/mozilla/xpinstall/packager/os2/browser.jst index 2179474062a..0a8c42bc3fd 100644 --- a/mozilla/xpinstall/packager/os2/browser.jst +++ b/mozilla/xpinstall/packager/os2/browser.jst @@ -26,7 +26,11 @@ function upgradeCleanup() deleteThisFile("Components", "nkcache.dll"); deleteThisFile("Components", "mozbrwsr.dll"); deleteThisFile("Components", "jsloader.dll"); - deleteThisFile("Components", "gkcontnt.dll"); + deleteThisFile("Components", "gkcontent.dll"); + deleteThisFile("Components" "urildr.dll"); + deleteThisFile("Components", "jsurl.dll"); + deleteThisFile("Components", "gkview.dll"); + deleteThisFile("Components", "shistory.dll"); deleteThisFile("Chrome", "chrome.rdf"); deleteThisFolder("Chrome", "overlayinfo"); deleteThisFile("Components", "gkhtml.dll"); diff --git a/mozilla/xpinstall/packager/packages-mac b/mozilla/xpinstall/packager/packages-mac index bdd3abddcf9..47999f76a8e 100644 --- a/mozilla/xpinstall/packager/packages-mac +++ b/mozilla/xpinstall/packager/packages-mac @@ -134,7 +134,6 @@ viewer:Components:htmlparser.shlb viewer:Components:jsconsole-clhandler.js viewer:Components:jsdService.shlb viewer:Components:jsdservice.xpt -viewer:Components:jsurl.shlb viewer:Components:jsurl.xpt viewer:Components:layout.shlb viewer:Components:layout.xpt @@ -170,7 +169,6 @@ viewer:Components:rdf.xpt viewer:Components:RDFLibrary.shlb viewer:Components:related.xpt viewer:Components:search.xpt -viewer:Components:shistory.shlb viewer:Components:shistory.xpt viewer:Components:tmbm.xpt viewer:Components:txtsvc.xpt @@ -178,10 +176,8 @@ viewer:Components:txmgr.xpt viewer:Components:uconv.shlb viewer:Components:uconv.xpt viewer:Components:unicharutil.xpt -viewer:Components:uriloader.shlb viewer:Components:uriloader.xpt viewer:Components:urlbarhistory.xpt -viewer:Components:view.shlb viewer:Components:Wallet.shlb viewer:Components:wallet.xpt viewer:Components:WalletViewers.shlb diff --git a/mozilla/xpinstall/packager/packages-os2 b/mozilla/xpinstall/packager/packages-os2 index 200abf80fc1..e0057075689 100644 --- a/mozilla/xpinstall/packager/packages-os2 +++ b/mozilla/xpinstall/packager/packages-os2 @@ -50,6 +50,8 @@ bin/xpcom.dll bin/xpistub.dll ;bin/zlib.dll bin/mozz.dll +bin/xpcom_compat.dll +bin/components/xpcom_compat_c.dll bin/components/jar50.dll bin/components/xpinstal.dll @@ -139,7 +141,6 @@ bin/components/xultmpl.xpt bin/components/gklayout.dll bin/components/gkparser.dll bin/components/gkplugin.dll -bin/components/gkview.dll bin/components/imgmng.dll bin/components/imglib2.dll bin/components/imglib2.xpt @@ -149,7 +150,6 @@ bin/components/intl.xpt bin/components/chardet.xpt bin/components/jar.xpt bin/components/jsconsole-clhandler.js -bin/components/jsurl.dll bin/components/jsurl.xpt bin/components/layout_base.xpt bin/components/layout_xul.xpt @@ -205,7 +205,6 @@ bin/components/mozuconv.dll bin/components/uconv.xpt bin/components/ucvmath.dll bin/components/unicharutil.xpt -bin/components/urildr.dll bin/components/uriloader.xpt bin/components/exthandler.xpt bin/components/util.xpt diff --git a/mozilla/xpinstall/packager/packages-static-unix b/mozilla/xpinstall/packager/packages-static-unix index 2cff3c7823a..4a06706e13b 100644 --- a/mozilla/xpinstall/packager/packages-static-unix +++ b/mozilla/xpinstall/packager/packages-static-unix @@ -45,6 +45,8 @@ bin/libxpcom.so bin/libxpistub.so bin/components/libxpinstall.so bin/components/libjar50.so +bin/libxpcom_compat.so +bin/components/libxpcom_compat_c.so [browser] bin/mozilla diff --git a/mozilla/xpinstall/packager/packages-static-win b/mozilla/xpinstall/packager/packages-static-win index 209f2e2493a..06a2c1a4ea9 100644 --- a/mozilla/xpinstall/packager/packages-static-win +++ b/mozilla/xpinstall/packager/packages-static-win @@ -53,6 +53,8 @@ bin\nspr4.dll bin\components\xpinstal.dll bin\components\jar50.dll bin\components\ucharuti.dll +bin\xpcom_compat.dll +bin\components\xpcom_compat_c.dll ;install\ren8dot3.exe,bin\ren8dot3.exe [browser] diff --git a/mozilla/xpinstall/packager/packages-unix b/mozilla/xpinstall/packager/packages-unix index 31c3d7e99bb..8eb0d8a6efa 100644 --- a/mozilla/xpinstall/packager/packages-unix +++ b/mozilla/xpinstall/packager/packages-unix @@ -47,6 +47,8 @@ bin/libxpistub.so bin/libmozz.so bin/components/libxpinstall.so bin/components/libjar50.so +bin/libxpcom_compat.so +bin/components/libxpcom_compat_c.so [browser] bin/mozilla @@ -121,7 +123,6 @@ bin/components/libgfxps.so bin/components/libgfxxprint.so bin/components/libimglib2.so bin/components/libimgmng.so -bin/components/libjsurl.so bin/components/libi18n.so bin/components/libmork.so bin/components/libmozfind.so @@ -135,13 +136,10 @@ bin/components/content_xslt.xpt bin/components/libgklayout.so bin/components/libgkplugin.so bin/components/libhtmlpars.so -bin/components/libgkview.so bin/components/librdf.so -bin/components/libshistory.so bin/components/libtxmgr.so bin/components/libuconv.so bin/components/libucvmath.so -bin/components/liburiloader.so bin/components/libwebbrwsr.so bin/components/webBrowser_core.xpt bin/components/libwallet.so diff --git a/mozilla/xpinstall/packager/unix/browser.jst b/mozilla/xpinstall/packager/unix/browser.jst index 5c26e0f6426..004c86fda62 100644 --- a/mozilla/xpinstall/packager/unix/browser.jst +++ b/mozilla/xpinstall/packager/unix/browser.jst @@ -31,6 +31,10 @@ function upgradeCleanup() deleteThisFile("Components", "libnkcache.so"); deleteThisFile("Components", "libjsloader.so"); deleteThisFile("Components", "libgkcontent.so"); + deleteThisFile("Components", "libjsurl.so"); + deleteThisFile("Components", "liburiloader.so"); + deleteThisFile("Components", "libgkview.so"); + deleteThisFile("Components", "libshistory.so"); deleteThisFile("Program", "defaults/pref/config.js"); deleteThisFile("Program", "defaults/pref/initpref.js"); deleteThisFile("Program", "defaults/wallet/URLFieldSchema.tbl"); diff --git a/mozilla/xpinstall/packager/xpcom-win.pkg b/mozilla/xpinstall/packager/xpcom-win.pkg index 8760cb29388..4c6965e033b 100644 --- a/mozilla/xpinstall/packager/xpcom-win.pkg +++ b/mozilla/xpinstall/packager/xpcom-win.pkg @@ -20,5 +20,7 @@ bin\xpistub.dll bin\mozz.dll bin\components\jar50.dll bin\components\xpinstal.dll +bin\xpcom_compat.dll +bin\components\xpcom_compat_c.dll ;install\ren8dot3.exe,bin\ren8dot3.exe diff --git a/mozilla/xpinstall/public/nsISoftwareUpdate.h b/mozilla/xpinstall/public/nsISoftwareUpdate.h index 81b32003ffa..5b700e91cb3 100644 --- a/mozilla/xpinstall/public/nsISoftwareUpdate.h +++ b/mozilla/xpinstall/public/nsISoftwareUpdate.h @@ -29,13 +29,12 @@ #include "nsISupports.h" #include "nsIFactory.h" #include "nsString.h" -#include "nsIFileSpec.h" #include "nsIXPINotifier.h" #include "nsCOMPtr.h" #include "nsIModule.h" #include "nsIGenericFactory.h" - +#include "nsILocalFile.h" #include "nsDirectoryServiceUtils.h" #include "nsDirectoryServiceDefs.h" diff --git a/mozilla/xpinstall/public/nsPIXPIStubHook.idl b/mozilla/xpinstall/public/nsPIXPIStubHook.idl index da413623683..21ad35e0387 100644 --- a/mozilla/xpinstall/public/nsPIXPIStubHook.idl +++ b/mozilla/xpinstall/public/nsPIXPIStubHook.idl @@ -23,8 +23,8 @@ */ #include "nsISupports.idl" -#include "nsIFileSpec.idl" -#include "nsIFile.idl" + +interface nsIFile; /** * nsPIXPIStubHook diff --git a/mozilla/xpinstall/src/Makefile.in b/mozilla/xpinstall/src/Makefile.in index 2b5f221fca1..0b9e4c1a3d2 100644 --- a/mozilla/xpinstall/src/Makefile.in +++ b/mozilla/xpinstall/src/Makefile.in @@ -39,6 +39,7 @@ MODULE_NAME = nsSoftwareUpdate GRE_MODULE = 1 REQUIRES = xpcom \ + xpcom_obsolete \ string \ jar \ caps \ @@ -115,6 +116,7 @@ EXTRA_DSO_LDOPTS = \ $(EXTRA_DSO_LIBS) \ $(MOZ_JS_LIBS) \ $(MOZ_COMPONENT_LIBS) \ + $(MOZ_XPCOM_OBSOLETE_LIBS) \ $(ZLIB_LIBS) \ $(NULL) diff --git a/mozilla/xpinstall/stub/xpistub.cpp b/mozilla/xpinstall/stub/xpistub.cpp index 1b724a2a34e..ffa24cf378e 100644 --- a/mozilla/xpinstall/stub/xpistub.cpp +++ b/mozilla/xpinstall/stub/xpistub.cpp @@ -29,7 +29,6 @@ #include "nsIComponentRegistrar.h" #include "nsIServiceManager.h" #include "nsCOMPtr.h" -#include "nsSpecialSystemDirectory.h" #include "nsILocalFile.h" #include "nscore.h" @@ -96,9 +95,6 @@ PR_PUBLIC_API(nsresult) XPI_Init( pfnXPIProgress progressCB ) { nsresult rv; - nsCOMPtr nsIfsDirectory; - nsFileSpec nsfsDirectory; - nsFileSpec nsfsRegFile; //-------------------------------------------------------------------- // Initialize XPCOM and AutoRegister() its components @@ -181,7 +177,6 @@ PR_PUBLIC_API(nsresult) XPI_Init( // is Mozilla. Use the given directory as the "Program" folder. //-------------------------------------------------------------------- nsCOMPtr hook = do_QueryInterface(gXPI); - nsFileSpec dirSpec( aProgramDir ); nsCOMPtr iDirSpec; #if XP_MAC @@ -252,9 +247,6 @@ PR_PUBLIC_API(PRInt32) XPI_Install( nsresult rv = NS_ERROR_NULL_POINTER; nsString args; args.AssignWithConversion(aArgs); nsCOMPtr iFile; - nsFileSpec file(aFile); - nsFileURL URL(file); - nsString URLstr; URLstr.AssignWithConversion(URL.GetURLString()); gInstallStatus = -322; // unique stub error code @@ -268,7 +260,7 @@ PR_PUBLIC_API(PRInt32) XPI_Install( if (iFile && gXPI) rv = gXPI->InstallJar( iFile, - URLstr.get(), + nsnull, args.get(), nsnull, (aFlags | XPI_NO_NEW_THREAD),