From 68651b31376aece8dec3961a90ff510467adfb9e Mon Sep 17 00:00:00 2001 From: Mitchell Field Date: Wed, 2 Jun 2010 01:56:00 -0400 Subject: [PATCH 01/30] Bug 542222 - Reduce recursion in netwerk makefiles. r=biesi --- netwerk/build/Makefile.in | 109 +++++++++--------- netwerk/cache/Makefile.in | 64 +++++++++- netwerk/cache/{src => }/nsCache.cpp | 0 netwerk/cache/{src => }/nsCache.h | 0 netwerk/cache/{src => }/nsCacheDevice.h | 0 netwerk/cache/{src => }/nsCacheEntry.cpp | 0 netwerk/cache/{src => }/nsCacheEntry.h | 0 .../{src => }/nsCacheEntryDescriptor.cpp | 0 .../cache/{src => }/nsCacheEntryDescriptor.h | 0 netwerk/cache/{src => }/nsCacheMetaData.cpp | 0 netwerk/cache/{src => }/nsCacheMetaData.h | 0 netwerk/cache/{src => }/nsCacheRequest.h | 0 netwerk/cache/{src => }/nsCacheService.cpp | 0 netwerk/cache/{src => }/nsCacheService.h | 0 netwerk/cache/{src => }/nsCacheSession.cpp | 0 netwerk/cache/{src => }/nsCacheSession.h | 0 netwerk/cache/{src => }/nsDeleteDir.cpp | 0 netwerk/cache/{src => }/nsDeleteDir.h | 0 netwerk/cache/{src => }/nsDiskCache.h | 0 .../cache/{src => }/nsDiskCacheBinding.cpp | 0 netwerk/cache/{src => }/nsDiskCacheBinding.h | 0 .../cache/{src => }/nsDiskCacheBlockFile.cpp | 0 .../cache/{src => }/nsDiskCacheBlockFile.h | 0 netwerk/cache/{src => }/nsDiskCacheDevice.cpp | 0 netwerk/cache/{src => }/nsDiskCacheDevice.h | 0 .../cache/{src => }/nsDiskCacheDeviceSQL.cpp | 0 .../cache/{src => }/nsDiskCacheDeviceSQL.h | 0 netwerk/cache/{src => }/nsDiskCacheEntry.cpp | 0 netwerk/cache/{src => }/nsDiskCacheEntry.h | 0 netwerk/cache/{src => }/nsDiskCacheMap.cpp | 0 netwerk/cache/{src => }/nsDiskCacheMap.h | 0 .../cache/{src => }/nsDiskCacheStreams.cpp | 0 netwerk/cache/{src => }/nsDiskCacheStreams.h | 0 netwerk/cache/{public => }/nsICache.idl | 0 .../{public => }/nsICacheEntryDescriptor.idl | 0 .../cache/{public => }/nsICacheListener.idl | 0 .../cache/{public => }/nsICacheService.idl | 0 .../cache/{public => }/nsICacheSession.idl | 0 .../cache/{public => }/nsICacheVisitor.idl | 0 .../cache/{src => }/nsMemoryCacheDevice.cpp | 0 netwerk/cache/{src => }/nsMemoryCacheDevice.h | 0 netwerk/cache/public/Makefile.in | 60 ---------- netwerk/cache/src/Makefile.in | 93 --------------- netwerk/cookie/Makefile.in | 33 +++++- netwerk/cookie/{src => }/nsCookie.cpp | 0 netwerk/cookie/{src => }/nsCookie.h | 0 netwerk/cookie/{src => }/nsCookieService.cpp | 0 netwerk/cookie/{src => }/nsCookieService.h | 0 netwerk/cookie/{public => }/nsICookie.idl | 0 netwerk/cookie/{public => }/nsICookie2.idl | 0 .../cookie/{public => }/nsICookieManager.idl | 0 .../cookie/{public => }/nsICookieManager2.idl | 0 .../{public => }/nsICookiePermission.idl | 0 .../cookie/{public => }/nsICookieService.idl | 0 netwerk/cookie/public/Makefile.in | 63 ---------- netwerk/cookie/src/Makefile.in | 57 --------- netwerk/dns/Makefile.in | 55 ++++++++- netwerk/dns/{src => }/effective_tld_names.dat | 0 netwerk/dns/{src => }/nameprep.c | 0 netwerk/dns/{src => }/nameprep_template.c | 0 netwerk/dns/{src => }/nameprepdata.c | 0 netwerk/dns/{src => }/nsDNSService2.cpp | 0 netwerk/dns/{src => }/nsDNSService2.h | 0 .../dns/{src => }/nsEffectiveTLDService.cpp | 0 netwerk/dns/{src => }/nsEffectiveTLDService.h | 0 netwerk/dns/{src => }/nsHostResolver.cpp | 0 netwerk/dns/{src => }/nsHostResolver.h | 0 netwerk/dns/{src => }/nsIDNKitInterface.h | 0 netwerk/dns/{public => }/nsIDNSListener.idl | 0 netwerk/dns/{public => }/nsIDNSRecord.idl | 0 netwerk/dns/{public => }/nsIDNSRequest.idl | 0 netwerk/dns/{public => }/nsIDNSService.idl | 0 netwerk/dns/{src => }/nsIDNService.cpp | 0 netwerk/dns/{src => }/nsIDNService.h | 0 .../{public => }/nsIEffectiveTLDService.idl | 0 netwerk/dns/{public => }/nsIIDNService.idl | 0 netwerk/dns/{public => }/nsPIDNSService.idl | 0 netwerk/dns/{src => }/prepare_tlds.py | 0 netwerk/dns/public/Makefile.in | 61 ---------- netwerk/dns/{src => }/punycode.c | 0 netwerk/dns/{src => }/punycode.h | 0 netwerk/dns/{src => }/race.c | 0 netwerk/dns/src/Makefile.in | 83 ------------- netwerk/mime/Makefile.in | 29 ++++- .../mime/{public => }/nsIMIMEHeaderParam.idl | 0 netwerk/mime/{public => }/nsIMIMEInfo.idl | 0 netwerk/mime/{public => }/nsIMIMEService.idl | 0 .../mime/{src => }/nsMIMEHeaderParamImpl.cpp | 0 .../mime/{src => }/nsMIMEHeaderParamImpl.h | 0 netwerk/mime/{public => }/nsMimeTypes.h | 0 netwerk/mime/public/Makefile.in | 60 ---------- netwerk/mime/src/Makefile.in | 60 ---------- netwerk/protocol/about/Makefile.in | 32 ++++- .../protocol/about/{src => }/nsAboutBlank.cpp | 0 .../protocol/about/{src => }/nsAboutBlank.h | 0 .../protocol/about/{src => }/nsAboutBloat.cpp | 0 .../protocol/about/{src => }/nsAboutBloat.h | 0 .../protocol/about/{src => }/nsAboutCache.cpp | 0 .../protocol/about/{src => }/nsAboutCache.h | 0 .../about/{src => }/nsAboutCacheEntry.cpp | 0 .../about/{src => }/nsAboutCacheEntry.h | 0 .../{src => }/nsAboutProtocolHandler.cpp | 0 .../about/{src => }/nsAboutProtocolHandler.h | 0 .../about/{public => }/nsAboutProtocolUtils.h | 0 .../about/{public => }/nsIAboutModule.idl | 0 netwerk/protocol/about/public/Makefile.in | 55 --------- netwerk/protocol/about/src/Makefile.in | 66 ----------- netwerk/protocol/data/Makefile.in | 24 +++- .../protocol/data/{src => }/nsDataChannel.cpp | 0 .../protocol/data/{src => }/nsDataChannel.h | 0 .../protocol/data/{src => }/nsDataHandler.cpp | 0 .../protocol/data/{src => }/nsDataHandler.h | 0 .../protocol/data/{src => }/nsDataModule.cpp | 0 netwerk/protocol/data/src/Makefile.in | 61 ---------- netwerk/protocol/file/Makefile.in | 31 ++++- .../protocol/file/{src => }/nsFileChannel.cpp | 0 .../protocol/file/{src => }/nsFileChannel.h | 0 .../file/{src => }/nsFileProtocolHandler.cpp | 0 .../file/{src => }/nsFileProtocolHandler.h | 0 .../file/{public => }/nsIFileChannel.idl | 0 .../{public => }/nsIFileProtocolHandler.idl | 0 netwerk/protocol/file/public/Makefile.in | 56 --------- netwerk/protocol/file/src/Makefile.in | 66 ----------- netwerk/protocol/ftp/Makefile.in | 49 +++++++- netwerk/protocol/ftp/{public => }/ftpCore.h | 0 .../protocol/ftp/{src => }/nsFTPChannel.cpp | 0 netwerk/protocol/ftp/{src => }/nsFTPChannel.h | 0 .../ftp/{src => }/nsFtpConnectionThread.cpp | 0 .../ftp/{src => }/nsFtpConnectionThread.h | 0 .../ftp/{src => }/nsFtpControlConnection.cpp | 0 .../ftp/{src => }/nsFtpControlConnection.h | 0 .../ftp/{src => }/nsFtpProtocolHandler.cpp | 0 .../ftp/{src => }/nsFtpProtocolHandler.h | 0 .../ftp/{public => }/nsIFTPChannel.idl | 0 netwerk/protocol/ftp/public/Makefile.in | 57 --------- netwerk/protocol/ftp/src/Makefile.in | 84 -------------- netwerk/protocol/gopher/Makefile.in | 24 +++- .../gopher/{src => }/nsGopherChannel.cpp | 0 .../gopher/{src => }/nsGopherChannel.h | 0 .../gopher/{src => }/nsGopherHandler.cpp | 0 .../gopher/{src => }/nsGopherHandler.h | 0 netwerk/protocol/gopher/src/Makefile.in | 62 ---------- netwerk/protocol/http/Makefile.in | 57 ++++++++- netwerk/protocol/http/{src => }/README | 0 .../http/{src => }/nsAHttpConnection.h | 0 .../http/{src => }/nsAHttpTransaction.h | 0 netwerk/protocol/http/{src => }/nsHttp.cpp | 0 netwerk/protocol/http/{src => }/nsHttp.h | 0 .../{src => }/nsHttpActivityDistributor.cpp | 0 .../{src => }/nsHttpActivityDistributor.h | 0 .../protocol/http/{src => }/nsHttpAtomList.h | 0 .../http/{src => }/nsHttpAuthCache.cpp | 0 .../protocol/http/{src => }/nsHttpAuthCache.h | 0 .../http/{src => }/nsHttpAuthManager.cpp | 0 .../http/{src => }/nsHttpAuthManager.h | 0 .../http/{src => }/nsHttpBasicAuth.cpp | 0 .../protocol/http/{src => }/nsHttpBasicAuth.h | 0 .../protocol/http/{src => }/nsHttpChannel.cpp | 0 .../protocol/http/{src => }/nsHttpChannel.h | 0 .../http/{src => }/nsHttpChunkedDecoder.cpp | 0 .../http/{src => }/nsHttpChunkedDecoder.h | 0 .../http/{src => }/nsHttpConnection.cpp | 0 .../http/{src => }/nsHttpConnection.h | 0 .../http/{src => }/nsHttpConnectionInfo.cpp | 0 .../http/{src => }/nsHttpConnectionInfo.h | 0 .../http/{src => }/nsHttpConnectionMgr.cpp | 0 .../http/{src => }/nsHttpConnectionMgr.h | 0 .../http/{src => }/nsHttpDigestAuth.cpp | 0 .../http/{src => }/nsHttpDigestAuth.h | 0 .../protocol/http/{src => }/nsHttpHandler.cpp | 0 .../protocol/http/{src => }/nsHttpHandler.h | 0 .../http/{src => }/nsHttpHeaderArray.cpp | 0 .../http/{src => }/nsHttpHeaderArray.h | 0 .../http/{src => }/nsHttpNTLMAuth.cpp | 0 .../protocol/http/{src => }/nsHttpNTLMAuth.h | 0 .../http/{src => }/nsHttpPipeline.cpp | 0 .../protocol/http/{src => }/nsHttpPipeline.h | 0 .../http/{src => }/nsHttpRequestHead.cpp | 0 .../http/{src => }/nsHttpRequestHead.h | 0 .../http/{src => }/nsHttpResponseHead.cpp | 0 .../http/{src => }/nsHttpResponseHead.h | 0 .../http/{src => }/nsHttpTransaction.cpp | 0 .../http/{src => }/nsHttpTransaction.h | 0 .../{public => }/nsIHttpActivityObserver.idl | 0 .../http/{public => }/nsIHttpAuthManager.idl | 0 .../{public => }/nsIHttpAuthenticator.idl | 0 .../http/{public => }/nsIHttpChannel.idl | 0 .../{public => }/nsIHttpChannelInternal.idl | 0 .../http/{public => }/nsIHttpEventSink.idl | 0 .../{public => }/nsIHttpHeaderVisitor.idl | 0 .../{public => }/nsIHttpProtocolHandler.idl | 0 netwerk/protocol/http/public/Makefile.in | 66 ----------- netwerk/protocol/http/src/Makefile.in | 79 ------------- netwerk/protocol/res/Makefile.in | 30 ++++- .../{public => }/nsIResProtocolHandler.idl | 0 .../res/{src => }/nsResProtocolHandler.cpp | 0 .../res/{src => }/nsResProtocolHandler.h | 0 netwerk/protocol/res/public/Makefile.in | 55 --------- netwerk/protocol/res/src/Makefile.in | 66 ----------- netwerk/protocol/viewsource/Makefile.in | 30 ++++- .../{public => }/nsIViewSourceChannel.idl | 0 .../{src => }/nsViewSourceChannel.cpp | 0 .../{src => }/nsViewSourceChannel.h | 0 .../{src => }/nsViewSourceHandler.cpp | 0 .../{src => }/nsViewSourceHandler.h | 0 .../protocol/viewsource/public/Makefile.in | 54 --------- netwerk/protocol/viewsource/src/Makefile.in | 62 ---------- netwerk/socket/Makefile.in | 30 ++++- netwerk/socket/base/Makefile.in | 73 ------------ .../socket/{base => }/nsISOCKSSocketInfo.idl | 0 .../socket/{base => }/nsISSLSocketControl.idl | 0 .../socket/{base => }/nsISocketProvider.idl | 0 .../{base => }/nsISocketProviderService.idl | 0 .../{base => }/nsITransportSecurityInfo.idl | 0 .../{base => }/nsSOCKS4SocketProvider.h | 0 netwerk/socket/{base => }/nsSOCKSIOLayer.cpp | 0 netwerk/socket/{base => }/nsSOCKSIOLayer.h | 0 .../{base => }/nsSOCKSSocketProvider.cpp | 0 .../socket/{base => }/nsSOCKSSocketProvider.h | 0 .../{base => }/nsSocketProviderService.cpp | 0 .../{base => }/nsSocketProviderService.h | 0 .../socket/{base => }/nsUDPSocketProvider.cpp | 0 .../socket/{base => }/nsUDPSocketProvider.h | 0 netwerk/test/Makefile.in | 2 +- netwerk/wifi/Makefile.in | 45 +++++++- .../wifi/{public => }/nsIWifiAccessPoint.idl | 0 netwerk/wifi/{public => }/nsIWifiListener.idl | 0 netwerk/wifi/{public => }/nsIWifiMonitor.idl | 0 netwerk/wifi/{src => }/nsWifiAccessPoint.cpp | 0 netwerk/wifi/{src => }/nsWifiAccessPoint.h | 0 netwerk/wifi/{src => }/nsWifiMonitor.cpp | 0 netwerk/wifi/{src => }/nsWifiMonitor.h | 0 netwerk/wifi/{src => }/nsWifiScannerMac.cpp | 0 .../wifi/{src => }/nsWifiScannerSolaris.cpp | 0 netwerk/wifi/{src => }/nsWifiScannerUnix.cpp | 0 netwerk/wifi/{src => }/nsWifiScannerWin.cpp | 0 netwerk/wifi/{src => }/osx_corewlan.mm | 0 netwerk/wifi/{src => }/osx_wifi.h | 0 netwerk/wifi/public/Makefile.in | 56 --------- netwerk/wifi/src/Makefile.in | 74 ------------ netwerk/wifi/{src => }/wlanapi.h | 0 toolkit/toolkit-makefiles.sh | 25 ---- 242 files changed, 512 insertions(+), 1786 deletions(-) rename netwerk/cache/{src => }/nsCache.cpp (100%) rename netwerk/cache/{src => }/nsCache.h (100%) rename netwerk/cache/{src => }/nsCacheDevice.h (100%) rename netwerk/cache/{src => }/nsCacheEntry.cpp (100%) rename netwerk/cache/{src => }/nsCacheEntry.h (100%) rename netwerk/cache/{src => }/nsCacheEntryDescriptor.cpp (100%) rename netwerk/cache/{src => }/nsCacheEntryDescriptor.h (100%) rename netwerk/cache/{src => }/nsCacheMetaData.cpp (100%) rename netwerk/cache/{src => }/nsCacheMetaData.h (100%) rename netwerk/cache/{src => }/nsCacheRequest.h (100%) rename netwerk/cache/{src => }/nsCacheService.cpp (100%) rename netwerk/cache/{src => }/nsCacheService.h (100%) rename netwerk/cache/{src => }/nsCacheSession.cpp (100%) rename netwerk/cache/{src => }/nsCacheSession.h (100%) rename netwerk/cache/{src => }/nsDeleteDir.cpp (100%) rename netwerk/cache/{src => }/nsDeleteDir.h (100%) rename netwerk/cache/{src => }/nsDiskCache.h (100%) rename netwerk/cache/{src => }/nsDiskCacheBinding.cpp (100%) rename netwerk/cache/{src => }/nsDiskCacheBinding.h (100%) rename netwerk/cache/{src => }/nsDiskCacheBlockFile.cpp (100%) rename netwerk/cache/{src => }/nsDiskCacheBlockFile.h (100%) rename netwerk/cache/{src => }/nsDiskCacheDevice.cpp (100%) rename netwerk/cache/{src => }/nsDiskCacheDevice.h (100%) rename netwerk/cache/{src => }/nsDiskCacheDeviceSQL.cpp (100%) rename netwerk/cache/{src => }/nsDiskCacheDeviceSQL.h (100%) rename netwerk/cache/{src => }/nsDiskCacheEntry.cpp (100%) rename netwerk/cache/{src => }/nsDiskCacheEntry.h (100%) rename netwerk/cache/{src => }/nsDiskCacheMap.cpp (100%) rename netwerk/cache/{src => }/nsDiskCacheMap.h (100%) rename netwerk/cache/{src => }/nsDiskCacheStreams.cpp (100%) rename netwerk/cache/{src => }/nsDiskCacheStreams.h (100%) rename netwerk/cache/{public => }/nsICache.idl (100%) rename netwerk/cache/{public => }/nsICacheEntryDescriptor.idl (100%) rename netwerk/cache/{public => }/nsICacheListener.idl (100%) rename netwerk/cache/{public => }/nsICacheService.idl (100%) rename netwerk/cache/{public => }/nsICacheSession.idl (100%) rename netwerk/cache/{public => }/nsICacheVisitor.idl (100%) rename netwerk/cache/{src => }/nsMemoryCacheDevice.cpp (100%) rename netwerk/cache/{src => }/nsMemoryCacheDevice.h (100%) delete mode 100644 netwerk/cache/public/Makefile.in delete mode 100644 netwerk/cache/src/Makefile.in rename netwerk/cookie/{src => }/nsCookie.cpp (100%) rename netwerk/cookie/{src => }/nsCookie.h (100%) rename netwerk/cookie/{src => }/nsCookieService.cpp (100%) rename netwerk/cookie/{src => }/nsCookieService.h (100%) rename netwerk/cookie/{public => }/nsICookie.idl (100%) rename netwerk/cookie/{public => }/nsICookie2.idl (100%) rename netwerk/cookie/{public => }/nsICookieManager.idl (100%) rename netwerk/cookie/{public => }/nsICookieManager2.idl (100%) rename netwerk/cookie/{public => }/nsICookiePermission.idl (100%) rename netwerk/cookie/{public => }/nsICookieService.idl (100%) delete mode 100644 netwerk/cookie/public/Makefile.in delete mode 100644 netwerk/cookie/src/Makefile.in rename netwerk/dns/{src => }/effective_tld_names.dat (100%) rename netwerk/dns/{src => }/nameprep.c (100%) rename netwerk/dns/{src => }/nameprep_template.c (100%) rename netwerk/dns/{src => }/nameprepdata.c (100%) rename netwerk/dns/{src => }/nsDNSService2.cpp (100%) rename netwerk/dns/{src => }/nsDNSService2.h (100%) rename netwerk/dns/{src => }/nsEffectiveTLDService.cpp (100%) rename netwerk/dns/{src => }/nsEffectiveTLDService.h (100%) rename netwerk/dns/{src => }/nsHostResolver.cpp (100%) rename netwerk/dns/{src => }/nsHostResolver.h (100%) rename netwerk/dns/{src => }/nsIDNKitInterface.h (100%) rename netwerk/dns/{public => }/nsIDNSListener.idl (100%) rename netwerk/dns/{public => }/nsIDNSRecord.idl (100%) rename netwerk/dns/{public => }/nsIDNSRequest.idl (100%) rename netwerk/dns/{public => }/nsIDNSService.idl (100%) rename netwerk/dns/{src => }/nsIDNService.cpp (100%) rename netwerk/dns/{src => }/nsIDNService.h (100%) rename netwerk/dns/{public => }/nsIEffectiveTLDService.idl (100%) rename netwerk/dns/{public => }/nsIIDNService.idl (100%) rename netwerk/dns/{public => }/nsPIDNSService.idl (100%) rename netwerk/dns/{src => }/prepare_tlds.py (100%) delete mode 100644 netwerk/dns/public/Makefile.in rename netwerk/dns/{src => }/punycode.c (100%) rename netwerk/dns/{src => }/punycode.h (100%) rename netwerk/dns/{src => }/race.c (100%) delete mode 100644 netwerk/dns/src/Makefile.in rename netwerk/mime/{public => }/nsIMIMEHeaderParam.idl (100%) rename netwerk/mime/{public => }/nsIMIMEInfo.idl (100%) rename netwerk/mime/{public => }/nsIMIMEService.idl (100%) rename netwerk/mime/{src => }/nsMIMEHeaderParamImpl.cpp (100%) rename netwerk/mime/{src => }/nsMIMEHeaderParamImpl.h (100%) rename netwerk/mime/{public => }/nsMimeTypes.h (100%) delete mode 100644 netwerk/mime/public/Makefile.in delete mode 100644 netwerk/mime/src/Makefile.in rename netwerk/protocol/about/{src => }/nsAboutBlank.cpp (100%) rename netwerk/protocol/about/{src => }/nsAboutBlank.h (100%) rename netwerk/protocol/about/{src => }/nsAboutBloat.cpp (100%) rename netwerk/protocol/about/{src => }/nsAboutBloat.h (100%) rename netwerk/protocol/about/{src => }/nsAboutCache.cpp (100%) rename netwerk/protocol/about/{src => }/nsAboutCache.h (100%) rename netwerk/protocol/about/{src => }/nsAboutCacheEntry.cpp (100%) rename netwerk/protocol/about/{src => }/nsAboutCacheEntry.h (100%) rename netwerk/protocol/about/{src => }/nsAboutProtocolHandler.cpp (100%) rename netwerk/protocol/about/{src => }/nsAboutProtocolHandler.h (100%) rename netwerk/protocol/about/{public => }/nsAboutProtocolUtils.h (100%) rename netwerk/protocol/about/{public => }/nsIAboutModule.idl (100%) delete mode 100644 netwerk/protocol/about/public/Makefile.in delete mode 100644 netwerk/protocol/about/src/Makefile.in rename netwerk/protocol/data/{src => }/nsDataChannel.cpp (100%) rename netwerk/protocol/data/{src => }/nsDataChannel.h (100%) rename netwerk/protocol/data/{src => }/nsDataHandler.cpp (100%) rename netwerk/protocol/data/{src => }/nsDataHandler.h (100%) rename netwerk/protocol/data/{src => }/nsDataModule.cpp (100%) delete mode 100644 netwerk/protocol/data/src/Makefile.in rename netwerk/protocol/file/{src => }/nsFileChannel.cpp (100%) rename netwerk/protocol/file/{src => }/nsFileChannel.h (100%) rename netwerk/protocol/file/{src => }/nsFileProtocolHandler.cpp (100%) rename netwerk/protocol/file/{src => }/nsFileProtocolHandler.h (100%) rename netwerk/protocol/file/{public => }/nsIFileChannel.idl (100%) rename netwerk/protocol/file/{public => }/nsIFileProtocolHandler.idl (100%) delete mode 100644 netwerk/protocol/file/public/Makefile.in delete mode 100644 netwerk/protocol/file/src/Makefile.in rename netwerk/protocol/ftp/{public => }/ftpCore.h (100%) rename netwerk/protocol/ftp/{src => }/nsFTPChannel.cpp (100%) rename netwerk/protocol/ftp/{src => }/nsFTPChannel.h (100%) rename netwerk/protocol/ftp/{src => }/nsFtpConnectionThread.cpp (100%) rename netwerk/protocol/ftp/{src => }/nsFtpConnectionThread.h (100%) rename netwerk/protocol/ftp/{src => }/nsFtpControlConnection.cpp (100%) rename netwerk/protocol/ftp/{src => }/nsFtpControlConnection.h (100%) rename netwerk/protocol/ftp/{src => }/nsFtpProtocolHandler.cpp (100%) rename netwerk/protocol/ftp/{src => }/nsFtpProtocolHandler.h (100%) rename netwerk/protocol/ftp/{public => }/nsIFTPChannel.idl (100%) delete mode 100644 netwerk/protocol/ftp/public/Makefile.in delete mode 100644 netwerk/protocol/ftp/src/Makefile.in rename netwerk/protocol/gopher/{src => }/nsGopherChannel.cpp (100%) rename netwerk/protocol/gopher/{src => }/nsGopherChannel.h (100%) rename netwerk/protocol/gopher/{src => }/nsGopherHandler.cpp (100%) rename netwerk/protocol/gopher/{src => }/nsGopherHandler.h (100%) delete mode 100644 netwerk/protocol/gopher/src/Makefile.in rename netwerk/protocol/http/{src => }/README (100%) rename netwerk/protocol/http/{src => }/nsAHttpConnection.h (100%) rename netwerk/protocol/http/{src => }/nsAHttpTransaction.h (100%) rename netwerk/protocol/http/{src => }/nsHttp.cpp (100%) rename netwerk/protocol/http/{src => }/nsHttp.h (100%) rename netwerk/protocol/http/{src => }/nsHttpActivityDistributor.cpp (100%) rename netwerk/protocol/http/{src => }/nsHttpActivityDistributor.h (100%) rename netwerk/protocol/http/{src => }/nsHttpAtomList.h (100%) rename netwerk/protocol/http/{src => }/nsHttpAuthCache.cpp (100%) rename netwerk/protocol/http/{src => }/nsHttpAuthCache.h (100%) rename netwerk/protocol/http/{src => }/nsHttpAuthManager.cpp (100%) rename netwerk/protocol/http/{src => }/nsHttpAuthManager.h (100%) rename netwerk/protocol/http/{src => }/nsHttpBasicAuth.cpp (100%) rename netwerk/protocol/http/{src => }/nsHttpBasicAuth.h (100%) rename netwerk/protocol/http/{src => }/nsHttpChannel.cpp (100%) rename netwerk/protocol/http/{src => }/nsHttpChannel.h (100%) rename netwerk/protocol/http/{src => }/nsHttpChunkedDecoder.cpp (100%) rename netwerk/protocol/http/{src => }/nsHttpChunkedDecoder.h (100%) rename netwerk/protocol/http/{src => }/nsHttpConnection.cpp (100%) rename netwerk/protocol/http/{src => }/nsHttpConnection.h (100%) rename netwerk/protocol/http/{src => }/nsHttpConnectionInfo.cpp (100%) rename netwerk/protocol/http/{src => }/nsHttpConnectionInfo.h (100%) rename netwerk/protocol/http/{src => }/nsHttpConnectionMgr.cpp (100%) rename netwerk/protocol/http/{src => }/nsHttpConnectionMgr.h (100%) rename netwerk/protocol/http/{src => }/nsHttpDigestAuth.cpp (100%) rename netwerk/protocol/http/{src => }/nsHttpDigestAuth.h (100%) rename netwerk/protocol/http/{src => }/nsHttpHandler.cpp (100%) rename netwerk/protocol/http/{src => }/nsHttpHandler.h (100%) rename netwerk/protocol/http/{src => }/nsHttpHeaderArray.cpp (100%) rename netwerk/protocol/http/{src => }/nsHttpHeaderArray.h (100%) rename netwerk/protocol/http/{src => }/nsHttpNTLMAuth.cpp (100%) rename netwerk/protocol/http/{src => }/nsHttpNTLMAuth.h (100%) rename netwerk/protocol/http/{src => }/nsHttpPipeline.cpp (100%) rename netwerk/protocol/http/{src => }/nsHttpPipeline.h (100%) rename netwerk/protocol/http/{src => }/nsHttpRequestHead.cpp (100%) rename netwerk/protocol/http/{src => }/nsHttpRequestHead.h (100%) rename netwerk/protocol/http/{src => }/nsHttpResponseHead.cpp (100%) rename netwerk/protocol/http/{src => }/nsHttpResponseHead.h (100%) rename netwerk/protocol/http/{src => }/nsHttpTransaction.cpp (100%) rename netwerk/protocol/http/{src => }/nsHttpTransaction.h (100%) rename netwerk/protocol/http/{public => }/nsIHttpActivityObserver.idl (100%) rename netwerk/protocol/http/{public => }/nsIHttpAuthManager.idl (100%) rename netwerk/protocol/http/{public => }/nsIHttpAuthenticator.idl (100%) rename netwerk/protocol/http/{public => }/nsIHttpChannel.idl (100%) rename netwerk/protocol/http/{public => }/nsIHttpChannelInternal.idl (100%) rename netwerk/protocol/http/{public => }/nsIHttpEventSink.idl (100%) rename netwerk/protocol/http/{public => }/nsIHttpHeaderVisitor.idl (100%) rename netwerk/protocol/http/{public => }/nsIHttpProtocolHandler.idl (100%) delete mode 100644 netwerk/protocol/http/public/Makefile.in delete mode 100644 netwerk/protocol/http/src/Makefile.in rename netwerk/protocol/res/{public => }/nsIResProtocolHandler.idl (100%) rename netwerk/protocol/res/{src => }/nsResProtocolHandler.cpp (100%) rename netwerk/protocol/res/{src => }/nsResProtocolHandler.h (100%) delete mode 100644 netwerk/protocol/res/public/Makefile.in delete mode 100644 netwerk/protocol/res/src/Makefile.in rename netwerk/protocol/viewsource/{public => }/nsIViewSourceChannel.idl (100%) rename netwerk/protocol/viewsource/{src => }/nsViewSourceChannel.cpp (100%) rename netwerk/protocol/viewsource/{src => }/nsViewSourceChannel.h (100%) rename netwerk/protocol/viewsource/{src => }/nsViewSourceHandler.cpp (100%) rename netwerk/protocol/viewsource/{src => }/nsViewSourceHandler.h (100%) delete mode 100644 netwerk/protocol/viewsource/public/Makefile.in delete mode 100644 netwerk/protocol/viewsource/src/Makefile.in delete mode 100644 netwerk/socket/base/Makefile.in rename netwerk/socket/{base => }/nsISOCKSSocketInfo.idl (100%) rename netwerk/socket/{base => }/nsISSLSocketControl.idl (100%) rename netwerk/socket/{base => }/nsISocketProvider.idl (100%) rename netwerk/socket/{base => }/nsISocketProviderService.idl (100%) rename netwerk/socket/{base => }/nsITransportSecurityInfo.idl (100%) rename netwerk/socket/{base => }/nsSOCKS4SocketProvider.h (100%) rename netwerk/socket/{base => }/nsSOCKSIOLayer.cpp (100%) rename netwerk/socket/{base => }/nsSOCKSIOLayer.h (100%) rename netwerk/socket/{base => }/nsSOCKSSocketProvider.cpp (100%) rename netwerk/socket/{base => }/nsSOCKSSocketProvider.h (100%) rename netwerk/socket/{base => }/nsSocketProviderService.cpp (100%) rename netwerk/socket/{base => }/nsSocketProviderService.h (100%) rename netwerk/socket/{base => }/nsUDPSocketProvider.cpp (100%) rename netwerk/socket/{base => }/nsUDPSocketProvider.h (100%) rename netwerk/wifi/{public => }/nsIWifiAccessPoint.idl (100%) rename netwerk/wifi/{public => }/nsIWifiListener.idl (100%) rename netwerk/wifi/{public => }/nsIWifiMonitor.idl (100%) rename netwerk/wifi/{src => }/nsWifiAccessPoint.cpp (100%) rename netwerk/wifi/{src => }/nsWifiAccessPoint.h (100%) rename netwerk/wifi/{src => }/nsWifiMonitor.cpp (100%) rename netwerk/wifi/{src => }/nsWifiMonitor.h (100%) rename netwerk/wifi/{src => }/nsWifiScannerMac.cpp (100%) rename netwerk/wifi/{src => }/nsWifiScannerSolaris.cpp (100%) rename netwerk/wifi/{src => }/nsWifiScannerUnix.cpp (100%) rename netwerk/wifi/{src => }/nsWifiScannerWin.cpp (100%) rename netwerk/wifi/{src => }/osx_corewlan.mm (100%) rename netwerk/wifi/{src => }/osx_wifi.h (100%) delete mode 100644 netwerk/wifi/public/Makefile.in delete mode 100644 netwerk/wifi/src/Makefile.in rename netwerk/wifi/{src => }/wlanapi.h (100%) diff --git a/netwerk/build/Makefile.in b/netwerk/build/Makefile.in index 3d22e55d29c..42fa6dd48aa 100644 --- a/netwerk/build/Makefile.in +++ b/netwerk/build/Makefile.in @@ -35,37 +35,36 @@ # # ***** END LICENSE BLOCK ***** -DEPTH = ../.. -topsrcdir = @top_srcdir@ -srcdir = @srcdir@ -VPATH = @srcdir@ +DEPTH = ../.. +topsrcdir = @top_srcdir@ +srcdir = @srcdir@ +VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk -MODULE = necko -LIBRARY_NAME = necko +MODULE = necko +LIBRARY_NAME = necko EXPORT_LIBRARY = 1 -IS_COMPONENT = 1 -MODULE_NAME = necko -GRE_MODULE = 1 +IS_COMPONENT = 1 +MODULE_NAME = necko +GRE_MODULE = 1 LIBXUL_LIBRARY = 1 - -CPPSRCS = nsNetModule.cpp -EXPORTS = nsNetCID.h +CPPSRCS = nsNetModule.cpp +EXPORTS = nsNetCID.h SHARED_LIBRARY_LIBS = \ - ../base/src/$(LIB_PREFIX)neckobase_s.$(LIB_SUFFIX) \ - ../dns/src/$(LIB_PREFIX)neckodns_s.$(LIB_SUFFIX) \ - ../socket/base/$(LIB_PREFIX)neckosocket_s.$(LIB_SUFFIX) \ - ../streamconv/src/$(LIB_PREFIX)nkconv_s.$(LIB_SUFFIX) \ - ../streamconv/converters/$(LIB_PREFIX)nkcnvts_s.$(LIB_SUFFIX) \ - ../mime/src/$(LIB_PREFIX)nkmime_s.$(LIB_SUFFIX) \ - ../cache/src/$(LIB_PREFIX)nkcache_s.$(LIB_SUFFIX) \ - ../protocol/about/src/$(LIB_PREFIX)nkabout_s.$(LIB_SUFFIX) \ - $(foreach d,$(filter-out about,$(NECKO_PROTOCOLS)), \ - ../protocol/$(d)/src/$(LIB_PREFIX)nk$(d)_s.$(LIB_SUFFIX)) \ - $(NULL) + ../base/src/$(LIB_PREFIX)neckobase_s.$(LIB_SUFFIX) \ + ../dns/$(LIB_PREFIX)neckodns_s.$(LIB_SUFFIX) \ + ../socket/$(LIB_PREFIX)neckosocket_s.$(LIB_SUFFIX) \ + ../streamconv/src/$(LIB_PREFIX)nkconv_s.$(LIB_SUFFIX) \ + ../streamconv/converters/$(LIB_PREFIX)nkcnvts_s.$(LIB_SUFFIX) \ + ../mime/$(LIB_PREFIX)nkmime_s.$(LIB_SUFFIX) \ + ../cache/$(LIB_PREFIX)nkcache_s.$(LIB_SUFFIX) \ + ../protocol/about/$(LIB_PREFIX)nkabout_s.$(LIB_SUFFIX) \ + $(foreach d,$(filter-out about,$(NECKO_PROTOCOLS)), \ + ../protocol/$(d)/$(LIB_PREFIX)nk$(d)_s.$(LIB_SUFFIX)) \ + $(NULL) ifeq ($(OS_ARCH),WINNT) SHARED_LIBRARY_LIBS += \ @@ -87,18 +86,18 @@ ifdef MOZ_ENABLE_LIBCONIC ../system/maemo/$(LIB_PREFIX)neckosystem_s.$(LIB_SUFFIX) endif -LOCAL_INCLUDES = \ - -I$(srcdir)/../base/src \ - -I$(srcdir)/../dns/src \ - -I$(srcdir)/../socket/base \ - -I$(srcdir)/../streamconv/src \ - -I$(srcdir)/../streamconv/converters \ - -I$(srcdir)/../mime/src \ - -I$(srcdir)/../cache/src \ - -I$(srcdir)/../protocol/about/src \ - $(foreach d,$(filter-out about,$(NECKO_PROTOCOLS)), \ - -I$(srcdir)/../protocol/$(d)/src) \ - $(NULL) +LOCAL_INCLUDES = \ + -I$(srcdir)/../base/src \ + -I$(srcdir)/../dns \ + -I$(srcdir)/../socket \ + -I$(srcdir)/../streamconv/src \ + -I$(srcdir)/../streamconv/converters \ + -I$(srcdir)/../mime \ + -I$(srcdir)/../cache \ + -I$(srcdir)/../protocol/about \ + $(foreach d,$(filter-out about,$(NECKO_PROTOCOLS)), \ + -I$(srcdir)/../protocol/$(d)) \ + $(NULL) ifeq ($(OS_ARCH),WINNT) LOCAL_INCLUDES += -I$(srcdir)/../system/win32 @@ -118,16 +117,16 @@ endif ifdef NECKO_COOKIES SHARED_LIBRARY_LIBS += \ - ../cookie/src/$(LIB_PREFIX)neckocookie_s.$(LIB_SUFFIX) \ - $(NULL) -LOCAL_INCLUDES += -I$(srcdir)/../cookie/src + ../cookie/$(LIB_PREFIX)neckocookie_s.$(LIB_SUFFIX) \ + $(NULL) +LOCAL_INCLUDES += -I$(srcdir)/../cookie endif ifdef NECKO_WIFI SHARED_LIBRARY_LIBS += \ - ../wifi/src/$(LIB_PREFIX)neckowifi_s.$(LIB_SUFFIX) \ - $(NULL) -LOCAL_INCLUDES += -I$(srcdir)/../wifi/src + ../wifi/$(LIB_PREFIX)neckowifi_s.$(LIB_SUFFIX) \ + $(NULL) +LOCAL_INCLUDES += -I$(srcdir)/../wifi ifeq ($(OS_ARCH),SunOS) OS_LIBS += $(GLIB_LIBS) @@ -141,25 +140,25 @@ DEFINES += -DNECKO_OFFLINE_CACHE endif EXTRA_DSO_LDOPTS = \ - $(LIBS_DIR) \ - $(EXTRA_DSO_LIBS) \ - $(MOZ_UNICHARUTIL_LIBS) \ - $(MOZ_COMPONENT_LIBS) \ - $(ZLIB_LIBS) \ - $(NULL) + $(LIBS_DIR) \ + $(EXTRA_DSO_LIBS) \ + $(MOZ_UNICHARUTIL_LIBS) \ + $(MOZ_COMPONENT_LIBS) \ + $(ZLIB_LIBS) \ + $(NULL) ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT)) EXTRA_DSO_LDOPTS += \ - -framework SystemConfiguration \ - $(TK_LIBS) \ - $(NULL) + -framework SystemConfiguration \ + $(TK_LIBS) \ + $(NULL) endif ifdef MOZ_ENABLE_LIBCONIC EXTRA_DSO_LDOPTS += \ - $(LIBCONIC_LIBS) \ - $(MOZ_DBUS_LIBS) \ - $(NULL) + $(LIBCONIC_LIBS) \ + $(MOZ_DBUS_LIBS) \ + $(NULL) endif ifeq ($(OS_ARCH),AIX) @@ -169,11 +168,11 @@ endif include $(topsrcdir)/config/rules.mk ifeq ($(OS_ARCH),WINNT) -OS_LIBS += $(call EXPAND_LIBNAME,ole32 shell32) +OS_LIBS += $(call EXPAND_LIBNAME,ole32 shell32) endif ifeq ($(OS_ARCH),WINCE) -OS_LIBS += $(call EXPAND_LIBNAME,cellcore ws2) +OS_LIBS += $(call EXPAND_LIBNAME,cellcore ws2) endif DEFINES += -DIMPL_NS_NET diff --git a/netwerk/cache/Makefile.in b/netwerk/cache/Makefile.in index db709a3a56b..65923351f70 100644 --- a/netwerk/cache/Makefile.in +++ b/netwerk/cache/Makefile.in @@ -35,15 +35,67 @@ # # ***** END LICENSE BLOCK ***** -DEPTH = ../.. -topsrcdir = @top_srcdir@ -srcdir = @srcdir@ -VPATH = @srcdir@ +DEPTH = ../.. +topsrcdir = @top_srcdir@ +srcdir = @srcdir@ +VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk -MODULE = nkcache -DIRS = public src +MODULE = nkcache +LIBRARY_NAME = nkcache_s +LIBXUL_LIBRARY = 1 +XPIDL_MODULE = necko_cache +GRE_MODULE = 1 + +FORCE_STATIC_LIB = 1 + +XPIDLSRCS = \ + nsICache.idl \ + nsICacheEntryDescriptor.idl \ + nsICacheListener.idl \ + nsICacheService.idl \ + nsICacheSession.idl \ + nsICacheVisitor.idl \ + $(NULL) + +EXPORTS = \ + nsCacheService.h \ + $(NULL) + +CPPSRCS = \ + nsCache.cpp \ + nsCacheEntry.cpp \ + nsCacheEntryDescriptor.cpp \ + nsCacheMetaData.cpp \ + nsCacheService.cpp \ + nsCacheSession.cpp \ + nsMemoryCacheDevice.cpp \ + $(NULL) + +ifdef NECKO_DISK_CACHE +CPPSRCS += \ + nsDiskCacheBinding.cpp \ + nsDiskCacheBlockFile.cpp \ + nsDiskCacheDevice.cpp \ + nsDiskCacheEntry.cpp \ + nsDiskCacheMap.cpp \ + nsDiskCacheStreams.cpp \ + nsDeleteDir.cpp \ + $(NULL) +endif + +ifdef MOZ_STORAGE +CPPSRCS += \ + nsDiskCacheDeviceSQL.cpp \ + $(NULL) + +DEFINES += -DNECKO_OFFLINE_CACHE +endif + +LOCAL_INCLUDES = \ + -I$(srcdir)/../base/src \ + $(NULL) include $(topsrcdir)/config/rules.mk diff --git a/netwerk/cache/src/nsCache.cpp b/netwerk/cache/nsCache.cpp similarity index 100% rename from netwerk/cache/src/nsCache.cpp rename to netwerk/cache/nsCache.cpp diff --git a/netwerk/cache/src/nsCache.h b/netwerk/cache/nsCache.h similarity index 100% rename from netwerk/cache/src/nsCache.h rename to netwerk/cache/nsCache.h diff --git a/netwerk/cache/src/nsCacheDevice.h b/netwerk/cache/nsCacheDevice.h similarity index 100% rename from netwerk/cache/src/nsCacheDevice.h rename to netwerk/cache/nsCacheDevice.h diff --git a/netwerk/cache/src/nsCacheEntry.cpp b/netwerk/cache/nsCacheEntry.cpp similarity index 100% rename from netwerk/cache/src/nsCacheEntry.cpp rename to netwerk/cache/nsCacheEntry.cpp diff --git a/netwerk/cache/src/nsCacheEntry.h b/netwerk/cache/nsCacheEntry.h similarity index 100% rename from netwerk/cache/src/nsCacheEntry.h rename to netwerk/cache/nsCacheEntry.h diff --git a/netwerk/cache/src/nsCacheEntryDescriptor.cpp b/netwerk/cache/nsCacheEntryDescriptor.cpp similarity index 100% rename from netwerk/cache/src/nsCacheEntryDescriptor.cpp rename to netwerk/cache/nsCacheEntryDescriptor.cpp diff --git a/netwerk/cache/src/nsCacheEntryDescriptor.h b/netwerk/cache/nsCacheEntryDescriptor.h similarity index 100% rename from netwerk/cache/src/nsCacheEntryDescriptor.h rename to netwerk/cache/nsCacheEntryDescriptor.h diff --git a/netwerk/cache/src/nsCacheMetaData.cpp b/netwerk/cache/nsCacheMetaData.cpp similarity index 100% rename from netwerk/cache/src/nsCacheMetaData.cpp rename to netwerk/cache/nsCacheMetaData.cpp diff --git a/netwerk/cache/src/nsCacheMetaData.h b/netwerk/cache/nsCacheMetaData.h similarity index 100% rename from netwerk/cache/src/nsCacheMetaData.h rename to netwerk/cache/nsCacheMetaData.h diff --git a/netwerk/cache/src/nsCacheRequest.h b/netwerk/cache/nsCacheRequest.h similarity index 100% rename from netwerk/cache/src/nsCacheRequest.h rename to netwerk/cache/nsCacheRequest.h diff --git a/netwerk/cache/src/nsCacheService.cpp b/netwerk/cache/nsCacheService.cpp similarity index 100% rename from netwerk/cache/src/nsCacheService.cpp rename to netwerk/cache/nsCacheService.cpp diff --git a/netwerk/cache/src/nsCacheService.h b/netwerk/cache/nsCacheService.h similarity index 100% rename from netwerk/cache/src/nsCacheService.h rename to netwerk/cache/nsCacheService.h diff --git a/netwerk/cache/src/nsCacheSession.cpp b/netwerk/cache/nsCacheSession.cpp similarity index 100% rename from netwerk/cache/src/nsCacheSession.cpp rename to netwerk/cache/nsCacheSession.cpp diff --git a/netwerk/cache/src/nsCacheSession.h b/netwerk/cache/nsCacheSession.h similarity index 100% rename from netwerk/cache/src/nsCacheSession.h rename to netwerk/cache/nsCacheSession.h diff --git a/netwerk/cache/src/nsDeleteDir.cpp b/netwerk/cache/nsDeleteDir.cpp similarity index 100% rename from netwerk/cache/src/nsDeleteDir.cpp rename to netwerk/cache/nsDeleteDir.cpp diff --git a/netwerk/cache/src/nsDeleteDir.h b/netwerk/cache/nsDeleteDir.h similarity index 100% rename from netwerk/cache/src/nsDeleteDir.h rename to netwerk/cache/nsDeleteDir.h diff --git a/netwerk/cache/src/nsDiskCache.h b/netwerk/cache/nsDiskCache.h similarity index 100% rename from netwerk/cache/src/nsDiskCache.h rename to netwerk/cache/nsDiskCache.h diff --git a/netwerk/cache/src/nsDiskCacheBinding.cpp b/netwerk/cache/nsDiskCacheBinding.cpp similarity index 100% rename from netwerk/cache/src/nsDiskCacheBinding.cpp rename to netwerk/cache/nsDiskCacheBinding.cpp diff --git a/netwerk/cache/src/nsDiskCacheBinding.h b/netwerk/cache/nsDiskCacheBinding.h similarity index 100% rename from netwerk/cache/src/nsDiskCacheBinding.h rename to netwerk/cache/nsDiskCacheBinding.h diff --git a/netwerk/cache/src/nsDiskCacheBlockFile.cpp b/netwerk/cache/nsDiskCacheBlockFile.cpp similarity index 100% rename from netwerk/cache/src/nsDiskCacheBlockFile.cpp rename to netwerk/cache/nsDiskCacheBlockFile.cpp diff --git a/netwerk/cache/src/nsDiskCacheBlockFile.h b/netwerk/cache/nsDiskCacheBlockFile.h similarity index 100% rename from netwerk/cache/src/nsDiskCacheBlockFile.h rename to netwerk/cache/nsDiskCacheBlockFile.h diff --git a/netwerk/cache/src/nsDiskCacheDevice.cpp b/netwerk/cache/nsDiskCacheDevice.cpp similarity index 100% rename from netwerk/cache/src/nsDiskCacheDevice.cpp rename to netwerk/cache/nsDiskCacheDevice.cpp diff --git a/netwerk/cache/src/nsDiskCacheDevice.h b/netwerk/cache/nsDiskCacheDevice.h similarity index 100% rename from netwerk/cache/src/nsDiskCacheDevice.h rename to netwerk/cache/nsDiskCacheDevice.h diff --git a/netwerk/cache/src/nsDiskCacheDeviceSQL.cpp b/netwerk/cache/nsDiskCacheDeviceSQL.cpp similarity index 100% rename from netwerk/cache/src/nsDiskCacheDeviceSQL.cpp rename to netwerk/cache/nsDiskCacheDeviceSQL.cpp diff --git a/netwerk/cache/src/nsDiskCacheDeviceSQL.h b/netwerk/cache/nsDiskCacheDeviceSQL.h similarity index 100% rename from netwerk/cache/src/nsDiskCacheDeviceSQL.h rename to netwerk/cache/nsDiskCacheDeviceSQL.h diff --git a/netwerk/cache/src/nsDiskCacheEntry.cpp b/netwerk/cache/nsDiskCacheEntry.cpp similarity index 100% rename from netwerk/cache/src/nsDiskCacheEntry.cpp rename to netwerk/cache/nsDiskCacheEntry.cpp diff --git a/netwerk/cache/src/nsDiskCacheEntry.h b/netwerk/cache/nsDiskCacheEntry.h similarity index 100% rename from netwerk/cache/src/nsDiskCacheEntry.h rename to netwerk/cache/nsDiskCacheEntry.h diff --git a/netwerk/cache/src/nsDiskCacheMap.cpp b/netwerk/cache/nsDiskCacheMap.cpp similarity index 100% rename from netwerk/cache/src/nsDiskCacheMap.cpp rename to netwerk/cache/nsDiskCacheMap.cpp diff --git a/netwerk/cache/src/nsDiskCacheMap.h b/netwerk/cache/nsDiskCacheMap.h similarity index 100% rename from netwerk/cache/src/nsDiskCacheMap.h rename to netwerk/cache/nsDiskCacheMap.h diff --git a/netwerk/cache/src/nsDiskCacheStreams.cpp b/netwerk/cache/nsDiskCacheStreams.cpp similarity index 100% rename from netwerk/cache/src/nsDiskCacheStreams.cpp rename to netwerk/cache/nsDiskCacheStreams.cpp diff --git a/netwerk/cache/src/nsDiskCacheStreams.h b/netwerk/cache/nsDiskCacheStreams.h similarity index 100% rename from netwerk/cache/src/nsDiskCacheStreams.h rename to netwerk/cache/nsDiskCacheStreams.h diff --git a/netwerk/cache/public/nsICache.idl b/netwerk/cache/nsICache.idl similarity index 100% rename from netwerk/cache/public/nsICache.idl rename to netwerk/cache/nsICache.idl diff --git a/netwerk/cache/public/nsICacheEntryDescriptor.idl b/netwerk/cache/nsICacheEntryDescriptor.idl similarity index 100% rename from netwerk/cache/public/nsICacheEntryDescriptor.idl rename to netwerk/cache/nsICacheEntryDescriptor.idl diff --git a/netwerk/cache/public/nsICacheListener.idl b/netwerk/cache/nsICacheListener.idl similarity index 100% rename from netwerk/cache/public/nsICacheListener.idl rename to netwerk/cache/nsICacheListener.idl diff --git a/netwerk/cache/public/nsICacheService.idl b/netwerk/cache/nsICacheService.idl similarity index 100% rename from netwerk/cache/public/nsICacheService.idl rename to netwerk/cache/nsICacheService.idl diff --git a/netwerk/cache/public/nsICacheSession.idl b/netwerk/cache/nsICacheSession.idl similarity index 100% rename from netwerk/cache/public/nsICacheSession.idl rename to netwerk/cache/nsICacheSession.idl diff --git a/netwerk/cache/public/nsICacheVisitor.idl b/netwerk/cache/nsICacheVisitor.idl similarity index 100% rename from netwerk/cache/public/nsICacheVisitor.idl rename to netwerk/cache/nsICacheVisitor.idl diff --git a/netwerk/cache/src/nsMemoryCacheDevice.cpp b/netwerk/cache/nsMemoryCacheDevice.cpp similarity index 100% rename from netwerk/cache/src/nsMemoryCacheDevice.cpp rename to netwerk/cache/nsMemoryCacheDevice.cpp diff --git a/netwerk/cache/src/nsMemoryCacheDevice.h b/netwerk/cache/nsMemoryCacheDevice.h similarity index 100% rename from netwerk/cache/src/nsMemoryCacheDevice.h rename to netwerk/cache/nsMemoryCacheDevice.h diff --git a/netwerk/cache/public/Makefile.in b/netwerk/cache/public/Makefile.in deleted file mode 100644 index eba0aec6322..00000000000 --- a/netwerk/cache/public/Makefile.in +++ /dev/null @@ -1,60 +0,0 @@ -# -# ***** BEGIN LICENSE BLOCK ***** -# Version: MPL 1.1/GPL 2.0/LGPL 2.1 -# -# The contents of this file are subject to the Mozilla Public License Version -# 1.1 (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# http://www.mozilla.org/MPL/ -# -# Software distributed under the License is distributed on an "AS IS" basis, -# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License -# for the specific language governing rights and limitations under the -# License. -# -# The Original Code is mozilla.org code. -# -# The Initial Developer of the Original Code is -# Netscape Communications Corporation. -# Portions created by the Initial Developer are Copyright (C) 1998 -# the Initial Developer. All Rights Reserved. -# -# Contributor(s): -# -# Alternatively, the contents of this file may be used under the terms of -# either the GNU General Public License Version 2 or later (the "GPL"), or -# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), -# in which case the provisions of the GPL or the LGPL are applicable instead -# of those above. If you wish to allow use of your version of this file only -# under the terms of either the GPL or the LGPL, and not to allow others to -# use your version of this file under the terms of the MPL, indicate your -# decision by deleting the provisions above and replace them with the notice -# and other provisions required by the GPL or the LGPL. If you do not delete -# the provisions above, a recipient may use your version of this file under -# the terms of any one of the MPL, the GPL or the LGPL. -# -# ***** END LICENSE BLOCK ***** - -DEPTH = ../../.. -topsrcdir = @top_srcdir@ -srcdir = @srcdir@ -VPATH = @srcdir@ - -MODULE = nkcache -XPIDL_MODULE = necko_cache -GRE_MODULE = 1 - -include $(DEPTH)/config/autoconf.mk - -XPIDLSRCS = \ - nsICache.idl \ - nsICacheEntryDescriptor.idl \ - nsICacheListener.idl \ - nsICacheService.idl \ - nsICacheSession.idl \ - nsICacheVisitor.idl \ - $(NULL) - -include $(topsrcdir)/config/rules.mk - -DEFINES += -DIMPL_NS_NET diff --git a/netwerk/cache/src/Makefile.in b/netwerk/cache/src/Makefile.in deleted file mode 100644 index 38d9095d516..00000000000 --- a/netwerk/cache/src/Makefile.in +++ /dev/null @@ -1,93 +0,0 @@ -# vim:set ts=8 sw=8 sts=8 noet: -# -# ***** BEGIN LICENSE BLOCK ***** -# Version: MPL 1.1/GPL 2.0/LGPL 2.1 -# -# The contents of this file are subject to the Mozilla Public License Version -# 1.1 (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# http://www.mozilla.org/MPL/ -# -# Software distributed under the License is distributed on an "AS IS" basis, -# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License -# for the specific language governing rights and limitations under the -# License. -# -# The Original Code is mozilla.org code. -# -# The Initial Developer of the Original Code is -# Netscape Communications Corporation. -# Portions created by the Initial Developer are Copyright (C) 2001 -# the Initial Developer. All Rights Reserved. -# -# Contributor(s): -# -# Alternatively, the contents of this file may be used under the terms of -# either the GNU General Public License Version 2 or later (the "GPL"), or -# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), -# in which case the provisions of the GPL or the LGPL are applicable instead -# of those above. If you wish to allow use of your version of this file only -# under the terms of either the GPL or the LGPL, and not to allow others to -# use your version of this file under the terms of the MPL, indicate your -# decision by deleting the provisions above and replace them with the notice -# and other provisions required by the GPL or the LGPL. If you do not delete -# the provisions above, a recipient may use your version of this file under -# the terms of any one of the MPL, the GPL or the LGPL. -# -# ***** END LICENSE BLOCK ***** - -DEPTH = ../../.. -topsrcdir = @top_srcdir@ -srcdir = @srcdir@ -VPATH = @srcdir@ - -include $(DEPTH)/config/autoconf.mk - -MODULE = nkcache -LIBRARY_NAME = nkcache_s -FORCE_STATIC_LIB = 1 -LIBXUL_LIBRARY = 1 - - -EXPORTS = \ - nsCacheService.h \ - $(NULL) - -CPPSRCS = \ - nsCache.cpp \ - nsCacheEntry.cpp \ - nsCacheEntryDescriptor.cpp \ - nsCacheMetaData.cpp \ - nsCacheService.cpp \ - nsCacheSession.cpp \ - nsMemoryCacheDevice.cpp \ - $(NULL) - -ifdef NECKO_DISK_CACHE -CPPSRCS += \ - nsDiskCacheBinding.cpp \ - nsDiskCacheBlockFile.cpp \ - nsDiskCacheDevice.cpp \ - nsDiskCacheEntry.cpp \ - nsDiskCacheMap.cpp \ - nsDiskCacheStreams.cpp \ - nsDeleteDir.cpp \ - $(NULL) -endif - -ifdef MOZ_STORAGE -CPPSRCS += \ - nsDiskCacheDeviceSQL.cpp \ - $(NULL) - -DEFINES += -DNECKO_OFFLINE_CACHE -endif - -LOCAL_INCLUDES=-I$(srcdir)/../../base/src - -include $(topsrcdir)/config/config.mk - - -include $(topsrcdir)/config/rules.mk - -DEFINES += -DIMPL_NS_NET diff --git a/netwerk/cookie/Makefile.in b/netwerk/cookie/Makefile.in index 45d3d014eaa..07b3aa9d328 100644 --- a/netwerk/cookie/Makefile.in +++ b/netwerk/cookie/Makefile.in @@ -20,6 +20,7 @@ # the Initial Developer. All Rights Reserved. # # Contributor(s): +# IBM Corp. # # 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 @@ -35,18 +36,38 @@ # # ***** END LICENSE BLOCK ***** -DEPTH = ../.. -topsrcdir = @top_srcdir@ -srcdir = @srcdir@ -VPATH = @srcdir@ +DEPTH = ../.. +topsrcdir = @top_srcdir@ +srcdir = @srcdir@ +VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk # export required interfaces, even if --disable-cookies has been given -DIRS = public +MODULE = necko +XPIDL_MODULE = necko_cookie +GRE_MODULE = 1 + +SDK_XPIDLSRCS = \ + nsICookie.idl \ + nsICookieManager.idl \ + $(NULL) + +XPIDLSRCS = \ + nsICookie2.idl \ + nsICookieManager2.idl \ + nsICookiePermission.idl \ + nsICookieService.idl \ + $(NULL) ifdef NECKO_COOKIES -DIRS += src +LIBRARY_NAME = neckocookie_s +LIBXUL_LIBRARY = 1 +FORCE_STATIC_LIB = 1 +CPPSRCS = \ + nsCookie.cpp \ + nsCookieService.cpp \ + $(NULL) endif include $(topsrcdir)/config/rules.mk diff --git a/netwerk/cookie/src/nsCookie.cpp b/netwerk/cookie/nsCookie.cpp similarity index 100% rename from netwerk/cookie/src/nsCookie.cpp rename to netwerk/cookie/nsCookie.cpp diff --git a/netwerk/cookie/src/nsCookie.h b/netwerk/cookie/nsCookie.h similarity index 100% rename from netwerk/cookie/src/nsCookie.h rename to netwerk/cookie/nsCookie.h diff --git a/netwerk/cookie/src/nsCookieService.cpp b/netwerk/cookie/nsCookieService.cpp similarity index 100% rename from netwerk/cookie/src/nsCookieService.cpp rename to netwerk/cookie/nsCookieService.cpp diff --git a/netwerk/cookie/src/nsCookieService.h b/netwerk/cookie/nsCookieService.h similarity index 100% rename from netwerk/cookie/src/nsCookieService.h rename to netwerk/cookie/nsCookieService.h diff --git a/netwerk/cookie/public/nsICookie.idl b/netwerk/cookie/nsICookie.idl similarity index 100% rename from netwerk/cookie/public/nsICookie.idl rename to netwerk/cookie/nsICookie.idl diff --git a/netwerk/cookie/public/nsICookie2.idl b/netwerk/cookie/nsICookie2.idl similarity index 100% rename from netwerk/cookie/public/nsICookie2.idl rename to netwerk/cookie/nsICookie2.idl diff --git a/netwerk/cookie/public/nsICookieManager.idl b/netwerk/cookie/nsICookieManager.idl similarity index 100% rename from netwerk/cookie/public/nsICookieManager.idl rename to netwerk/cookie/nsICookieManager.idl diff --git a/netwerk/cookie/public/nsICookieManager2.idl b/netwerk/cookie/nsICookieManager2.idl similarity index 100% rename from netwerk/cookie/public/nsICookieManager2.idl rename to netwerk/cookie/nsICookieManager2.idl diff --git a/netwerk/cookie/public/nsICookiePermission.idl b/netwerk/cookie/nsICookiePermission.idl similarity index 100% rename from netwerk/cookie/public/nsICookiePermission.idl rename to netwerk/cookie/nsICookiePermission.idl diff --git a/netwerk/cookie/public/nsICookieService.idl b/netwerk/cookie/nsICookieService.idl similarity index 100% rename from netwerk/cookie/public/nsICookieService.idl rename to netwerk/cookie/nsICookieService.idl diff --git a/netwerk/cookie/public/Makefile.in b/netwerk/cookie/public/Makefile.in deleted file mode 100644 index ba0201cc321..00000000000 --- a/netwerk/cookie/public/Makefile.in +++ /dev/null @@ -1,63 +0,0 @@ -# -# ***** BEGIN LICENSE BLOCK ***** -# Version: MPL 1.1/GPL 2.0/LGPL 2.1 -# -# The contents of this file are subject to the Mozilla Public License Version -# 1.1 (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# http://www.mozilla.org/MPL/ -# -# Software distributed under the License is distributed on an "AS IS" basis, -# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License -# for the specific language governing rights and limitations under the -# License. -# -# The Original Code is mozilla.org code. -# -# The Initial Developer of the Original Code is -# Netscape Communications Corporation. -# Portions created by the Initial Developer are Copyright (C) 1998 -# the Initial Developer. All Rights Reserved. -# -# Contributor(s): -# -# Alternatively, the contents of this file may be used under the terms of -# either the GNU General Public License Version 2 or later (the "GPL"), or -# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), -# in which case the provisions of the GPL or the LGPL are applicable instead -# of those above. If you wish to allow use of your version of this file only -# under the terms of either the GPL or the LGPL, and not to allow others to -# use your version of this file under the terms of the MPL, indicate your -# decision by deleting the provisions above and replace them with the notice -# and other provisions required by the GPL or the LGPL. If you do not delete -# the provisions above, a recipient may use your version of this file under -# the terms of any one of the MPL, the GPL or the LGPL. -# -# ***** END LICENSE BLOCK ***** - -DEPTH = ../../.. -topsrcdir = @top_srcdir@ -srcdir = @srcdir@ -VPATH = @srcdir@ - -include $(DEPTH)/config/autoconf.mk - -MODULE = necko -XPIDL_MODULE = necko_cookie -GRE_MODULE = 1 - -SDK_XPIDLSRCS = \ - nsICookieManager.idl \ - nsICookie.idl \ - $(NULL) - -XPIDLSRCS = \ - nsICookieService.idl \ - nsICookie2.idl \ - nsICookieManager2.idl \ - nsICookiePermission.idl \ - $(NULL) - -include $(topsrcdir)/config/rules.mk - -DEFINES += -DIMPL_NS_NET diff --git a/netwerk/cookie/src/Makefile.in b/netwerk/cookie/src/Makefile.in deleted file mode 100644 index 7bea2517511..00000000000 --- a/netwerk/cookie/src/Makefile.in +++ /dev/null @@ -1,57 +0,0 @@ -# ***** BEGIN LICENSE BLOCK ***** -# Version: MPL 1.1/GPL 2.0/LGPL 2.1 -# -# The contents of this file are subject to the Mozilla Public License Version -# 1.1 (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# http://www.mozilla.org/MPL/ -# -# Software distributed under the License is distributed on an "AS IS" basis, -# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License -# for the specific language governing rights and limitations under the -# License. -# -# The Original Code is Mozilla. -# -# The Initial Developer of the Original Code is IBM Corporation. -# Portions created by IBM Corporation are Copyright (C) 2003 -# IBM Corporation. All Rights Reserved. -# -# Contributor(s): -# IBM Corp. -# -# Alternatively, the contents of this file may be used under the terms of -# either the GNU General Public License Version 2 or later (the "GPL"), or -# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), -# in which case the provisions of the GPL or the LGPL are applicable instead -# of those above. If you wish to allow use of your version of this file only -# under the terms of either the GPL or the LGPL, and not to allow others to -# use your version of this file under the terms of the MPL, indicate your -# decision by deleting the provisions above and replace them with the notice -# and other provisions required by the GPL or the LGPL. If you do not delete -# the provisions above, a recipient may use your version of this file under -# the terms of any one of the MPL, the GPL or the LGPL. -# -# ***** END LICENSE BLOCK ***** - -DEPTH = ../../.. -topsrcdir = @top_srcdir@ -srcdir = @srcdir@ -VPATH = @srcdir@ - -include $(DEPTH)/config/autoconf.mk - -MODULE = necko -LIBRARY_NAME = neckocookie_s -FORCE_STATIC_LIB = 1 -LIBXUL_LIBRARY = 1 - - -CPPSRCS = \ - nsCookie.cpp \ - nsCookieService.cpp \ - $(NULL) - -include $(topsrcdir)/config/rules.mk - -DEFINES += -DIMPL_NS_NET diff --git a/netwerk/dns/Makefile.in b/netwerk/dns/Makefile.in index 7cb9e164e6b..0ad34151015 100644 --- a/netwerk/dns/Makefile.in +++ b/netwerk/dns/Makefile.in @@ -35,15 +35,60 @@ # # ***** END LICENSE BLOCK ***** -DEPTH = ../.. -topsrcdir = @top_srcdir@ -srcdir = @srcdir@ -VPATH = @srcdir@ +DEPTH = ../.. +topsrcdir = @top_srcdir@ +srcdir = @srcdir@ +VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk -DIRS = public src +MODULE = necko +LIBRARY_NAME = neckodns_s +LIBXUL_LIBRARY = 1 +XPIDL_MODULE = necko_dns +GRE_MODULE = 1 + +XPIDLSRCS = \ + nsIDNSListener.idl \ + nsIDNSRecord.idl \ + nsIDNSService.idl \ + nsIEffectiveTLDService.idl \ + nsIIDNService.idl \ + nsPIDNSService.idl \ + $(NULL) + +CPPSRCS = \ + nsIDNService.cpp \ + nsDNSService2.cpp \ + nsHostResolver.cpp \ + nsEffectiveTLDService.cpp \ + $(NULL) + +CSRCS = \ + race.c \ + nameprep.c \ + punycode.c \ + $(NULL) + +# we don't want the shared lib, but we want to force the creation of a +# static lib. +FORCE_STATIC_LIB = 1 + +# need to include etld_data.inc +LOCAL_INCLUDES = \ + -I$(srcdir)/../base/src \ + -I. \ + $(NULL) include $(topsrcdir)/config/rules.mk DEFINES += -DIMPL_NS_NET + +# Generate the include file containing compact, static definitions +# for effective TLD data. +nsEffectiveTLDService.$(OBJ_SUFFIX): etld_data.inc + +etld_data.inc: $(srcdir)/prepare_tlds.py $(srcdir)/effective_tld_names.dat + $(PYTHON) $(srcdir)/prepare_tlds.py $(srcdir)/effective_tld_names.dat > etld_data.inc + +GARBAGE += etld_data.inc diff --git a/netwerk/dns/src/effective_tld_names.dat b/netwerk/dns/effective_tld_names.dat similarity index 100% rename from netwerk/dns/src/effective_tld_names.dat rename to netwerk/dns/effective_tld_names.dat diff --git a/netwerk/dns/src/nameprep.c b/netwerk/dns/nameprep.c similarity index 100% rename from netwerk/dns/src/nameprep.c rename to netwerk/dns/nameprep.c diff --git a/netwerk/dns/src/nameprep_template.c b/netwerk/dns/nameprep_template.c similarity index 100% rename from netwerk/dns/src/nameprep_template.c rename to netwerk/dns/nameprep_template.c diff --git a/netwerk/dns/src/nameprepdata.c b/netwerk/dns/nameprepdata.c similarity index 100% rename from netwerk/dns/src/nameprepdata.c rename to netwerk/dns/nameprepdata.c diff --git a/netwerk/dns/src/nsDNSService2.cpp b/netwerk/dns/nsDNSService2.cpp similarity index 100% rename from netwerk/dns/src/nsDNSService2.cpp rename to netwerk/dns/nsDNSService2.cpp diff --git a/netwerk/dns/src/nsDNSService2.h b/netwerk/dns/nsDNSService2.h similarity index 100% rename from netwerk/dns/src/nsDNSService2.h rename to netwerk/dns/nsDNSService2.h diff --git a/netwerk/dns/src/nsEffectiveTLDService.cpp b/netwerk/dns/nsEffectiveTLDService.cpp similarity index 100% rename from netwerk/dns/src/nsEffectiveTLDService.cpp rename to netwerk/dns/nsEffectiveTLDService.cpp diff --git a/netwerk/dns/src/nsEffectiveTLDService.h b/netwerk/dns/nsEffectiveTLDService.h similarity index 100% rename from netwerk/dns/src/nsEffectiveTLDService.h rename to netwerk/dns/nsEffectiveTLDService.h diff --git a/netwerk/dns/src/nsHostResolver.cpp b/netwerk/dns/nsHostResolver.cpp similarity index 100% rename from netwerk/dns/src/nsHostResolver.cpp rename to netwerk/dns/nsHostResolver.cpp diff --git a/netwerk/dns/src/nsHostResolver.h b/netwerk/dns/nsHostResolver.h similarity index 100% rename from netwerk/dns/src/nsHostResolver.h rename to netwerk/dns/nsHostResolver.h diff --git a/netwerk/dns/src/nsIDNKitInterface.h b/netwerk/dns/nsIDNKitInterface.h similarity index 100% rename from netwerk/dns/src/nsIDNKitInterface.h rename to netwerk/dns/nsIDNKitInterface.h diff --git a/netwerk/dns/public/nsIDNSListener.idl b/netwerk/dns/nsIDNSListener.idl similarity index 100% rename from netwerk/dns/public/nsIDNSListener.idl rename to netwerk/dns/nsIDNSListener.idl diff --git a/netwerk/dns/public/nsIDNSRecord.idl b/netwerk/dns/nsIDNSRecord.idl similarity index 100% rename from netwerk/dns/public/nsIDNSRecord.idl rename to netwerk/dns/nsIDNSRecord.idl diff --git a/netwerk/dns/public/nsIDNSRequest.idl b/netwerk/dns/nsIDNSRequest.idl similarity index 100% rename from netwerk/dns/public/nsIDNSRequest.idl rename to netwerk/dns/nsIDNSRequest.idl diff --git a/netwerk/dns/public/nsIDNSService.idl b/netwerk/dns/nsIDNSService.idl similarity index 100% rename from netwerk/dns/public/nsIDNSService.idl rename to netwerk/dns/nsIDNSService.idl diff --git a/netwerk/dns/src/nsIDNService.cpp b/netwerk/dns/nsIDNService.cpp similarity index 100% rename from netwerk/dns/src/nsIDNService.cpp rename to netwerk/dns/nsIDNService.cpp diff --git a/netwerk/dns/src/nsIDNService.h b/netwerk/dns/nsIDNService.h similarity index 100% rename from netwerk/dns/src/nsIDNService.h rename to netwerk/dns/nsIDNService.h diff --git a/netwerk/dns/public/nsIEffectiveTLDService.idl b/netwerk/dns/nsIEffectiveTLDService.idl similarity index 100% rename from netwerk/dns/public/nsIEffectiveTLDService.idl rename to netwerk/dns/nsIEffectiveTLDService.idl diff --git a/netwerk/dns/public/nsIIDNService.idl b/netwerk/dns/nsIIDNService.idl similarity index 100% rename from netwerk/dns/public/nsIIDNService.idl rename to netwerk/dns/nsIIDNService.idl diff --git a/netwerk/dns/public/nsPIDNSService.idl b/netwerk/dns/nsPIDNSService.idl similarity index 100% rename from netwerk/dns/public/nsPIDNSService.idl rename to netwerk/dns/nsPIDNSService.idl diff --git a/netwerk/dns/src/prepare_tlds.py b/netwerk/dns/prepare_tlds.py similarity index 100% rename from netwerk/dns/src/prepare_tlds.py rename to netwerk/dns/prepare_tlds.py diff --git a/netwerk/dns/public/Makefile.in b/netwerk/dns/public/Makefile.in deleted file mode 100644 index 1f688beb6d2..00000000000 --- a/netwerk/dns/public/Makefile.in +++ /dev/null @@ -1,61 +0,0 @@ -# vim: noexpandtab ts=8 sw=8 -# -# ***** BEGIN LICENSE BLOCK ***** -# Version: MPL 1.1/GPL 2.0/LGPL 2.1 -# -# The contents of this file are subject to the Mozilla Public License Version -# 1.1 (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# http://www.mozilla.org/MPL/ -# -# Software distributed under the License is distributed on an "AS IS" basis, -# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License -# for the specific language governing rights and limitations under the -# License. -# -# The Original Code is mozilla.org code. -# -# The Initial Developer of the Original Code is -# Netscape Communications Corporation. -# Portions created by the Initial Developer are Copyright (C) 1998 -# the Initial Developer. All Rights Reserved. -# -# Contributor(s): -# -# Alternatively, the contents of this file may be used under the terms of -# either the GNU General Public License Version 2 or later (the "GPL"), or -# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), -# in which case the provisions of the GPL or the LGPL are applicable instead -# of those above. If you wish to allow use of your version of this file only -# under the terms of either the GPL or the LGPL, and not to allow others to -# use your version of this file under the terms of the MPL, indicate your -# decision by deleting the provisions above and replace them with the notice -# and other provisions required by the GPL or the LGPL. If you do not delete -# the provisions above, a recipient may use your version of this file under -# the terms of any one of the MPL, the GPL or the LGPL. -# -# ***** END LICENSE BLOCK ***** - -DEPTH = ../../.. -topsrcdir = @top_srcdir@ -srcdir = @srcdir@ -VPATH = @srcdir@ - -include $(DEPTH)/config/autoconf.mk - -MODULE = necko -XPIDL_MODULE = necko_dns -GRE_MODULE = 1 - -XPIDLSRCS = \ - nsPIDNSService.idl \ - nsIDNSService.idl \ - nsIDNSListener.idl \ - nsIDNSRecord.idl \ - nsIIDNService.idl \ - nsIEffectiveTLDService.idl \ - $(NULL) - -include $(topsrcdir)/config/rules.mk - -DEFINES += -DIMPL_NS_NET diff --git a/netwerk/dns/src/punycode.c b/netwerk/dns/punycode.c similarity index 100% rename from netwerk/dns/src/punycode.c rename to netwerk/dns/punycode.c diff --git a/netwerk/dns/src/punycode.h b/netwerk/dns/punycode.h similarity index 100% rename from netwerk/dns/src/punycode.h rename to netwerk/dns/punycode.h diff --git a/netwerk/dns/src/race.c b/netwerk/dns/race.c similarity index 100% rename from netwerk/dns/src/race.c rename to netwerk/dns/race.c diff --git a/netwerk/dns/src/Makefile.in b/netwerk/dns/src/Makefile.in deleted file mode 100644 index 6cba69e4806..00000000000 --- a/netwerk/dns/src/Makefile.in +++ /dev/null @@ -1,83 +0,0 @@ -# vim: noexpandtab ts=8 sw=8 -# -# ***** BEGIN LICENSE BLOCK ***** -# Version: MPL 1.1/GPL 2.0/LGPL 2.1 -# -# The contents of this file are subject to the Mozilla Public License Version -# 1.1 (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# http://www.mozilla.org/MPL/ -# -# Software distributed under the License is distributed on an "AS IS" basis, -# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License -# for the specific language governing rights and limitations under the -# License. -# -# The Original Code is mozilla.org code. -# -# The Initial Developer of the Original Code is -# Netscape Communications Corporation. -# Portions created by the Initial Developer are Copyright (C) 1998 -# the Initial Developer. All Rights Reserved. -# -# Contributor(s): -# -# Alternatively, the contents of this file may be used under the terms of -# either the GNU General Public License Version 2 or later (the "GPL"), or -# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), -# in which case the provisions of the GPL or the LGPL are applicable instead -# of those above. If you wish to allow use of your version of this file only -# under the terms of either the GPL or the LGPL, and not to allow others to -# use your version of this file under the terms of the MPL, indicate your -# decision by deleting the provisions above and replace them with the notice -# and other provisions required by the GPL or the LGPL. If you do not delete -# the provisions above, a recipient may use your version of this file under -# the terms of any one of the MPL, the GPL or the LGPL. -# -# ***** END LICENSE BLOCK ***** - -DEPTH = ../../.. -topsrcdir = @top_srcdir@ -srcdir = @srcdir@ -VPATH = @srcdir@ - -include $(DEPTH)/config/autoconf.mk - -MODULE = necko -LIBRARY_NAME = neckodns_s -LIBXUL_LIBRARY = 1 - - -CPPSRCS = nsIDNService.cpp \ - nsDNSService2.cpp \ - nsHostResolver.cpp \ - nsEffectiveTLDService.cpp \ - $(NULL) - -CSRCS = race.c \ - nameprep.c \ - punycode.c \ - $(NULL) - -# we don't want the shared lib, but we want to force the creation of a -# static lib. -FORCE_STATIC_LIB = 1 - -# need to include etld_data.inc -LOCAL_INCLUDES = \ - -I$(srcdir)/../../base/src \ - -I. \ - $(NULL) - -include $(topsrcdir)/config/rules.mk - -DEFINES += -DIMPL_NS_NET - -# Generate the include file containing compact, static definitions -# for effective TLD data. -nsEffectiveTLDService.$(OBJ_SUFFIX): etld_data.inc - -etld_data.inc: $(srcdir)/prepare_tlds.py $(srcdir)/effective_tld_names.dat - $(PYTHON) $(srcdir)/prepare_tlds.py $(srcdir)/effective_tld_names.dat > etld_data.inc - -GARBAGE += etld_data.inc diff --git a/netwerk/mime/Makefile.in b/netwerk/mime/Makefile.in index 69a202dab12..ebd01e09863 100644 --- a/netwerk/mime/Makefile.in +++ b/netwerk/mime/Makefile.in @@ -35,15 +35,32 @@ # # ***** END LICENSE BLOCK ***** -DEPTH = ../.. -topsrcdir = @top_srcdir@ -srcdir = @srcdir@ -VPATH = @srcdir@ +DEPTH = ../.. +topsrcdir = @top_srcdir@ +srcdir = @srcdir@ +VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk -MODULE = mimetype -DIRS = public src +MODULE = mimetype +LIBRARY_NAME = nkmime_s +LIBXUL_LIBRARY = 1 + +FORCE_STATIC_LIB = 1 + +EXPORTS = \ + nsMimeTypes.h \ + $(NULL) + +XPIDLSRCS = \ + nsIMIMEHeaderParam.idl \ + nsIMIMEInfo.idl \ + nsIMIMEService.idl \ + $(NULL) + +CPPSRCS = \ + nsMIMEHeaderParamImpl.cpp \ + $(NULL) include $(topsrcdir)/config/rules.mk diff --git a/netwerk/mime/public/nsIMIMEHeaderParam.idl b/netwerk/mime/nsIMIMEHeaderParam.idl similarity index 100% rename from netwerk/mime/public/nsIMIMEHeaderParam.idl rename to netwerk/mime/nsIMIMEHeaderParam.idl diff --git a/netwerk/mime/public/nsIMIMEInfo.idl b/netwerk/mime/nsIMIMEInfo.idl similarity index 100% rename from netwerk/mime/public/nsIMIMEInfo.idl rename to netwerk/mime/nsIMIMEInfo.idl diff --git a/netwerk/mime/public/nsIMIMEService.idl b/netwerk/mime/nsIMIMEService.idl similarity index 100% rename from netwerk/mime/public/nsIMIMEService.idl rename to netwerk/mime/nsIMIMEService.idl diff --git a/netwerk/mime/src/nsMIMEHeaderParamImpl.cpp b/netwerk/mime/nsMIMEHeaderParamImpl.cpp similarity index 100% rename from netwerk/mime/src/nsMIMEHeaderParamImpl.cpp rename to netwerk/mime/nsMIMEHeaderParamImpl.cpp diff --git a/netwerk/mime/src/nsMIMEHeaderParamImpl.h b/netwerk/mime/nsMIMEHeaderParamImpl.h similarity index 100% rename from netwerk/mime/src/nsMIMEHeaderParamImpl.h rename to netwerk/mime/nsMIMEHeaderParamImpl.h diff --git a/netwerk/mime/public/nsMimeTypes.h b/netwerk/mime/nsMimeTypes.h similarity index 100% rename from netwerk/mime/public/nsMimeTypes.h rename to netwerk/mime/nsMimeTypes.h diff --git a/netwerk/mime/public/Makefile.in b/netwerk/mime/public/Makefile.in deleted file mode 100644 index f8711bb922e..00000000000 --- a/netwerk/mime/public/Makefile.in +++ /dev/null @@ -1,60 +0,0 @@ -# -# ***** BEGIN LICENSE BLOCK ***** -# Version: MPL 1.1/GPL 2.0/LGPL 2.1 -# -# The contents of this file are subject to the Mozilla Public License Version -# 1.1 (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# http://www.mozilla.org/MPL/ -# -# Software distributed under the License is distributed on an "AS IS" basis, -# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License -# for the specific language governing rights and limitations under the -# License. -# -# The Original Code is mozilla.org code. -# -# The Initial Developer of the Original Code is -# Netscape Communications Corporation. -# Portions created by the Initial Developer are Copyright (C) 1998 -# the Initial Developer. All Rights Reserved. -# -# Contributor(s): -# -# Alternatively, the contents of this file may be used under the terms of -# either the GNU General Public License Version 2 or later (the "GPL"), or -# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), -# in which case the provisions of the GPL or the LGPL are applicable instead -# of those above. If you wish to allow use of your version of this file only -# under the terms of either the GPL or the LGPL, and not to allow others to -# use your version of this file under the terms of the MPL, indicate your -# decision by deleting the provisions above and replace them with the notice -# and other provisions required by the GPL or the LGPL. If you do not delete -# the provisions above, a recipient may use your version of this file under -# the terms of any one of the MPL, the GPL or the LGPL. -# -# ***** END LICENSE BLOCK ***** - -DEPTH = ../../.. -topsrcdir = @top_srcdir@ -srcdir = @srcdir@ -VPATH = @srcdir@ - -include $(DEPTH)/config/autoconf.mk - -MODULE = mimetype -XPIDL_MODULE = mimetype - -XPIDLSRCS = \ - nsIMIMEService.idl \ - nsIMIMEInfo.idl \ - nsIMIMEHeaderParam.idl \ - $(NULL) - -EXPORTS = \ - nsMimeTypes.h \ - $(NULL) - -include $(topsrcdir)/config/rules.mk - -DEFINES += -DIMPL_NS_NET diff --git a/netwerk/mime/src/Makefile.in b/netwerk/mime/src/Makefile.in deleted file mode 100644 index bf93437a993..00000000000 --- a/netwerk/mime/src/Makefile.in +++ /dev/null @@ -1,60 +0,0 @@ -# -# ***** BEGIN LICENSE BLOCK ***** -# Version: MPL 1.1/GPL 2.0/LGPL 2.1 -# -# The contents of this file are subject to the Mozilla Public License Version -# 1.1 (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# http://www.mozilla.org/MPL/ -# -# Software distributed under the License is distributed on an "AS IS" basis, -# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License -# for the specific language governing rights and limitations under the -# License. -# -# The Original Code is mozilla.org code. -# -# The Initial Developer of the Original Code is -# Netscape Communications Corporation. -# Portions created by the Initial Developer are Copyright (C) 1998 -# the Initial Developer. All Rights Reserved. -# -# Contributor(s): -# -# Alternatively, the contents of this file may be used under the terms of -# either the GNU General Public License Version 2 or later (the "GPL"), or -# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), -# in which case the provisions of the GPL or the LGPL are applicable instead -# of those above. If you wish to allow use of your version of this file only -# under the terms of either the GPL or the LGPL, and not to allow others to -# use your version of this file under the terms of the MPL, indicate your -# decision by deleting the provisions above and replace them with the notice -# and other provisions required by the GPL or the LGPL. If you do not delete -# the provisions above, a recipient may use your version of this file under -# the terms of any one of the MPL, the GPL or the LGPL. -# -# ***** END LICENSE BLOCK ***** - -DEPTH = ../../.. -topsrcdir = @top_srcdir@ -srcdir = @srcdir@ -VPATH = @srcdir@ - -include $(DEPTH)/config/autoconf.mk - -MODULE = mimetype -LIBRARY_NAME = nkmime_s -LIBXUL_LIBRARY = 1 - - -CPPSRCS = \ - nsMIMEHeaderParamImpl.cpp \ - $(NULL) - -# we don't want the shared lib, but we want to force the creation of a -# static lib. -FORCE_STATIC_LIB = 1 - -include $(topsrcdir)/config/rules.mk - -DEFINES += -DIMPL_NS_NET diff --git a/netwerk/protocol/about/Makefile.in b/netwerk/protocol/about/Makefile.in index ba7e16adccf..57fab223dd1 100644 --- a/netwerk/protocol/about/Makefile.in +++ b/netwerk/protocol/about/Makefile.in @@ -35,14 +35,36 @@ # # ***** END LICENSE BLOCK ***** -DEPTH = ../../.. -topsrcdir = @top_srcdir@ -srcdir = @srcdir@ -VPATH = @srcdir@ +DEPTH = ../../.. +topsrcdir = @top_srcdir@ +srcdir = @srcdir@ +VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk -DIRS = public src +MODULE = necko +LIBRARY_NAME = nkabout_s +LIBXUL_LIBRARY = 1 +XPIDL_MODULE = necko_about +GRE_MODULE = 1 + +FORCE_STATIC_LIB = 1 + +EXPORTS = nsAboutProtocolUtils.h + +XPIDLSRCS = nsIAboutModule.idl + +CPPSRCS = \ + nsAboutProtocolHandler.cpp \ + nsAboutBlank.cpp \ + nsAboutBloat.cpp \ + nsAboutCache.cpp \ + nsAboutCacheEntry.cpp \ + $(NULL) + +LOCAL_INCLUDES = \ + -I$(srcdir)/../../base/src \ + $(NULL) include $(topsrcdir)/config/rules.mk diff --git a/netwerk/protocol/about/src/nsAboutBlank.cpp b/netwerk/protocol/about/nsAboutBlank.cpp similarity index 100% rename from netwerk/protocol/about/src/nsAboutBlank.cpp rename to netwerk/protocol/about/nsAboutBlank.cpp diff --git a/netwerk/protocol/about/src/nsAboutBlank.h b/netwerk/protocol/about/nsAboutBlank.h similarity index 100% rename from netwerk/protocol/about/src/nsAboutBlank.h rename to netwerk/protocol/about/nsAboutBlank.h diff --git a/netwerk/protocol/about/src/nsAboutBloat.cpp b/netwerk/protocol/about/nsAboutBloat.cpp similarity index 100% rename from netwerk/protocol/about/src/nsAboutBloat.cpp rename to netwerk/protocol/about/nsAboutBloat.cpp diff --git a/netwerk/protocol/about/src/nsAboutBloat.h b/netwerk/protocol/about/nsAboutBloat.h similarity index 100% rename from netwerk/protocol/about/src/nsAboutBloat.h rename to netwerk/protocol/about/nsAboutBloat.h diff --git a/netwerk/protocol/about/src/nsAboutCache.cpp b/netwerk/protocol/about/nsAboutCache.cpp similarity index 100% rename from netwerk/protocol/about/src/nsAboutCache.cpp rename to netwerk/protocol/about/nsAboutCache.cpp diff --git a/netwerk/protocol/about/src/nsAboutCache.h b/netwerk/protocol/about/nsAboutCache.h similarity index 100% rename from netwerk/protocol/about/src/nsAboutCache.h rename to netwerk/protocol/about/nsAboutCache.h diff --git a/netwerk/protocol/about/src/nsAboutCacheEntry.cpp b/netwerk/protocol/about/nsAboutCacheEntry.cpp similarity index 100% rename from netwerk/protocol/about/src/nsAboutCacheEntry.cpp rename to netwerk/protocol/about/nsAboutCacheEntry.cpp diff --git a/netwerk/protocol/about/src/nsAboutCacheEntry.h b/netwerk/protocol/about/nsAboutCacheEntry.h similarity index 100% rename from netwerk/protocol/about/src/nsAboutCacheEntry.h rename to netwerk/protocol/about/nsAboutCacheEntry.h diff --git a/netwerk/protocol/about/src/nsAboutProtocolHandler.cpp b/netwerk/protocol/about/nsAboutProtocolHandler.cpp similarity index 100% rename from netwerk/protocol/about/src/nsAboutProtocolHandler.cpp rename to netwerk/protocol/about/nsAboutProtocolHandler.cpp diff --git a/netwerk/protocol/about/src/nsAboutProtocolHandler.h b/netwerk/protocol/about/nsAboutProtocolHandler.h similarity index 100% rename from netwerk/protocol/about/src/nsAboutProtocolHandler.h rename to netwerk/protocol/about/nsAboutProtocolHandler.h diff --git a/netwerk/protocol/about/public/nsAboutProtocolUtils.h b/netwerk/protocol/about/nsAboutProtocolUtils.h similarity index 100% rename from netwerk/protocol/about/public/nsAboutProtocolUtils.h rename to netwerk/protocol/about/nsAboutProtocolUtils.h diff --git a/netwerk/protocol/about/public/nsIAboutModule.idl b/netwerk/protocol/about/nsIAboutModule.idl similarity index 100% rename from netwerk/protocol/about/public/nsIAboutModule.idl rename to netwerk/protocol/about/nsIAboutModule.idl diff --git a/netwerk/protocol/about/public/Makefile.in b/netwerk/protocol/about/public/Makefile.in deleted file mode 100644 index 0d4e6d53f23..00000000000 --- a/netwerk/protocol/about/public/Makefile.in +++ /dev/null @@ -1,55 +0,0 @@ -# -# ***** BEGIN LICENSE BLOCK ***** -# Version: MPL 1.1/GPL 2.0/LGPL 2.1 -# -# The contents of this file are subject to the Mozilla Public License Version -# 1.1 (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# http://www.mozilla.org/MPL/ -# -# Software distributed under the License is distributed on an "AS IS" basis, -# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License -# for the specific language governing rights and limitations under the -# License. -# -# The Original Code is mozilla.org code. -# -# The Initial Developer of the Original Code is -# Netscape Communications Corporation. -# Portions created by the Initial Developer are Copyright (C) 1998 -# the Initial Developer. All Rights Reserved. -# -# Contributor(s): -# -# Alternatively, the contents of this file may be used under the terms of -# either the GNU General Public License Version 2 or later (the "GPL"), or -# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), -# in which case the provisions of the GPL or the LGPL are applicable instead -# of those above. If you wish to allow use of your version of this file only -# under the terms of either the GPL or the LGPL, and not to allow others to -# use your version of this file under the terms of the MPL, indicate your -# decision by deleting the provisions above and replace them with the notice -# and other provisions required by the GPL or the LGPL. If you do not delete -# the provisions above, a recipient may use your version of this file under -# the terms of any one of the MPL, the GPL or the LGPL. -# -# ***** END LICENSE BLOCK ***** - -DEPTH = ../../../.. -topsrcdir = @top_srcdir@ -srcdir = @srcdir@ -VPATH = @srcdir@ - -include $(DEPTH)/config/autoconf.mk - -MODULE = necko -XPIDL_MODULE = necko_about -GRE_MODULE = 1 - -XPIDLSRCS = nsIAboutModule.idl - -EXPORTS = nsAboutProtocolUtils.h - -include $(topsrcdir)/config/rules.mk - -DEFINES += -DIMPL_NS_NET diff --git a/netwerk/protocol/about/src/Makefile.in b/netwerk/protocol/about/src/Makefile.in deleted file mode 100644 index 115ac81ebb8..00000000000 --- a/netwerk/protocol/about/src/Makefile.in +++ /dev/null @@ -1,66 +0,0 @@ -# -# ***** BEGIN LICENSE BLOCK ***** -# Version: MPL 1.1/GPL 2.0/LGPL 2.1 -# -# The contents of this file are subject to the Mozilla Public License Version -# 1.1 (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# http://www.mozilla.org/MPL/ -# -# Software distributed under the License is distributed on an "AS IS" basis, -# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License -# for the specific language governing rights and limitations under the -# License. -# -# The Original Code is mozilla.org code. -# -# The Initial Developer of the Original Code is -# Netscape Communications Corporation. -# Portions created by the Initial Developer are Copyright (C) 1998 -# the Initial Developer. All Rights Reserved. -# -# Contributor(s): -# -# Alternatively, the contents of this file may be used under the terms of -# either the GNU General Public License Version 2 or later (the "GPL"), or -# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), -# in which case the provisions of the GPL or the LGPL are applicable instead -# of those above. If you wish to allow use of your version of this file only -# under the terms of either the GPL or the LGPL, and not to allow others to -# use your version of this file under the terms of the MPL, indicate your -# decision by deleting the provisions above and replace them with the notice -# and other provisions required by the GPL or the LGPL. If you do not delete -# the provisions above, a recipient may use your version of this file under -# the terms of any one of the MPL, the GPL or the LGPL. -# -# ***** END LICENSE BLOCK ***** - -DEPTH = ../../../.. -topsrcdir = @top_srcdir@ -srcdir = @srcdir@ -VPATH = @srcdir@ - -include $(DEPTH)/config/autoconf.mk - -MODULE = necko -LIBRARY_NAME = nkabout_s -LIBXUL_LIBRARY = 1 - - -CPPSRCS = \ - nsAboutProtocolHandler.cpp \ - nsAboutBlank.cpp \ - nsAboutBloat.cpp \ - nsAboutCache.cpp \ - nsAboutCacheEntry.cpp \ - $(NULL) - -LOCAL_INCLUDES=-I$(srcdir)/../../../base/src - -# we don't want the shared lib, but we want to force the creation of a -# static lib. -FORCE_STATIC_LIB = 1 - -include $(topsrcdir)/config/rules.mk - -DEFINES += -DIMPL_NS_NET diff --git a/netwerk/protocol/data/Makefile.in b/netwerk/protocol/data/Makefile.in index 7a1c4af94d7..21914f426a4 100644 --- a/netwerk/protocol/data/Makefile.in +++ b/netwerk/protocol/data/Makefile.in @@ -35,14 +35,26 @@ # # ***** END LICENSE BLOCK ***** -DEPTH = ../../.. -topsrcdir = @top_srcdir@ -srcdir = @srcdir@ -VPATH = @srcdir@ +DEPTH = ../../.. +topsrcdir = @top_srcdir@ +srcdir = @srcdir@ +VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk -DIRS = src +MODULE = necko +LIBRARY_NAME = nkdata_s +LIBXUL_LIBRARY = 1 + +FORCE_STATIC_LIB = 1 + +CPPSRCS = \ + nsDataHandler.cpp \ + nsDataChannel.cpp \ + $(NULL) + +LOCAL_INCLUDES = \ + -I$(srcdir)/../../base/src \ + $(NULL) include $(topsrcdir)/config/rules.mk - diff --git a/netwerk/protocol/data/src/nsDataChannel.cpp b/netwerk/protocol/data/nsDataChannel.cpp similarity index 100% rename from netwerk/protocol/data/src/nsDataChannel.cpp rename to netwerk/protocol/data/nsDataChannel.cpp diff --git a/netwerk/protocol/data/src/nsDataChannel.h b/netwerk/protocol/data/nsDataChannel.h similarity index 100% rename from netwerk/protocol/data/src/nsDataChannel.h rename to netwerk/protocol/data/nsDataChannel.h diff --git a/netwerk/protocol/data/src/nsDataHandler.cpp b/netwerk/protocol/data/nsDataHandler.cpp similarity index 100% rename from netwerk/protocol/data/src/nsDataHandler.cpp rename to netwerk/protocol/data/nsDataHandler.cpp diff --git a/netwerk/protocol/data/src/nsDataHandler.h b/netwerk/protocol/data/nsDataHandler.h similarity index 100% rename from netwerk/protocol/data/src/nsDataHandler.h rename to netwerk/protocol/data/nsDataHandler.h diff --git a/netwerk/protocol/data/src/nsDataModule.cpp b/netwerk/protocol/data/nsDataModule.cpp similarity index 100% rename from netwerk/protocol/data/src/nsDataModule.cpp rename to netwerk/protocol/data/nsDataModule.cpp diff --git a/netwerk/protocol/data/src/Makefile.in b/netwerk/protocol/data/src/Makefile.in deleted file mode 100644 index 8ffec4484c7..00000000000 --- a/netwerk/protocol/data/src/Makefile.in +++ /dev/null @@ -1,61 +0,0 @@ -# -# ***** BEGIN LICENSE BLOCK ***** -# Version: MPL 1.1/GPL 2.0/LGPL 2.1 -# -# The contents of this file are subject to the Mozilla Public License Version -# 1.1 (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# http://www.mozilla.org/MPL/ -# -# Software distributed under the License is distributed on an "AS IS" basis, -# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License -# for the specific language governing rights and limitations under the -# License. -# -# The Original Code is mozilla.org code. -# -# The Initial Developer of the Original Code is -# Netscape Communications Corporation. -# Portions created by the Initial Developer are Copyright (C) 1998 -# the Initial Developer. All Rights Reserved. -# -# Contributor(s): -# -# Alternatively, the contents of this file may be used under the terms of -# either the GNU General Public License Version 2 or later (the "GPL"), or -# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), -# in which case the provisions of the GPL or the LGPL are applicable instead -# of those above. If you wish to allow use of your version of this file only -# under the terms of either the GPL or the LGPL, and not to allow others to -# use your version of this file under the terms of the MPL, indicate your -# decision by deleting the provisions above and replace them with the notice -# and other provisions required by the GPL or the LGPL. If you do not delete -# the provisions above, a recipient may use your version of this file under -# the terms of any one of the MPL, the GPL or the LGPL. -# -# ***** END LICENSE BLOCK ***** - -DEPTH = ../../../.. -topsrcdir = @top_srcdir@ -srcdir = @srcdir@ -VPATH = @srcdir@ - -include $(DEPTH)/config/autoconf.mk - -MODULE = necko -LIBRARY_NAME = nkdata_s -LIBXUL_LIBRARY = 1 - - -CPPSRCS = \ - nsDataHandler.cpp \ - nsDataChannel.cpp \ - $(NULL) - -LOCAL_INCLUDES=-I$(srcdir)/../../../base/src - -# we don't want the shared lib, but we want to force the creation of a -# static lib. -FORCE_STATIC_LIB = 1 - -include $(topsrcdir)/config/rules.mk diff --git a/netwerk/protocol/file/Makefile.in b/netwerk/protocol/file/Makefile.in index ba7e16adccf..1fa24ea42b9 100644 --- a/netwerk/protocol/file/Makefile.in +++ b/netwerk/protocol/file/Makefile.in @@ -35,14 +35,35 @@ # # ***** END LICENSE BLOCK ***** -DEPTH = ../../.. -topsrcdir = @top_srcdir@ -srcdir = @srcdir@ -VPATH = @srcdir@ +DEPTH = ../../.. +topsrcdir = @top_srcdir@ +srcdir = @srcdir@ +VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk -DIRS = public src +MODULE = necko +LIBRARY_NAME = nkfile_s +LIBXUL_LIBRARY = 1 +XPIDL_MODULE = necko_file +GRE_MODULE = 1 + +FORCE_STATIC_LIB = 1 + +XPIDLSRCS = \ + nsIFileChannel.idl \ + nsIFileProtocolHandler.idl \ + $(NULL) + +CPPSRCS = \ + nsFileProtocolHandler.cpp \ + nsFileChannel.cpp \ + $(NULL) + +LOCAL_INCLUDES = \ + -I$(srcdir)/../../base/src \ + -I$(topsrcdir)/xpcom/ds \ + $(NULL) include $(topsrcdir)/config/rules.mk diff --git a/netwerk/protocol/file/src/nsFileChannel.cpp b/netwerk/protocol/file/nsFileChannel.cpp similarity index 100% rename from netwerk/protocol/file/src/nsFileChannel.cpp rename to netwerk/protocol/file/nsFileChannel.cpp diff --git a/netwerk/protocol/file/src/nsFileChannel.h b/netwerk/protocol/file/nsFileChannel.h similarity index 100% rename from netwerk/protocol/file/src/nsFileChannel.h rename to netwerk/protocol/file/nsFileChannel.h diff --git a/netwerk/protocol/file/src/nsFileProtocolHandler.cpp b/netwerk/protocol/file/nsFileProtocolHandler.cpp similarity index 100% rename from netwerk/protocol/file/src/nsFileProtocolHandler.cpp rename to netwerk/protocol/file/nsFileProtocolHandler.cpp diff --git a/netwerk/protocol/file/src/nsFileProtocolHandler.h b/netwerk/protocol/file/nsFileProtocolHandler.h similarity index 100% rename from netwerk/protocol/file/src/nsFileProtocolHandler.h rename to netwerk/protocol/file/nsFileProtocolHandler.h diff --git a/netwerk/protocol/file/public/nsIFileChannel.idl b/netwerk/protocol/file/nsIFileChannel.idl similarity index 100% rename from netwerk/protocol/file/public/nsIFileChannel.idl rename to netwerk/protocol/file/nsIFileChannel.idl diff --git a/netwerk/protocol/file/public/nsIFileProtocolHandler.idl b/netwerk/protocol/file/nsIFileProtocolHandler.idl similarity index 100% rename from netwerk/protocol/file/public/nsIFileProtocolHandler.idl rename to netwerk/protocol/file/nsIFileProtocolHandler.idl diff --git a/netwerk/protocol/file/public/Makefile.in b/netwerk/protocol/file/public/Makefile.in deleted file mode 100644 index fc5d916aa6d..00000000000 --- a/netwerk/protocol/file/public/Makefile.in +++ /dev/null @@ -1,56 +0,0 @@ -# -# ***** BEGIN LICENSE BLOCK ***** -# Version: MPL 1.1/GPL 2.0/LGPL 2.1 -# -# The contents of this file are subject to the Mozilla Public License Version -# 1.1 (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# http://www.mozilla.org/MPL/ -# -# Software distributed under the License is distributed on an "AS IS" basis, -# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License -# for the specific language governing rights and limitations under the -# License. -# -# The Original Code is mozilla.org code. -# -# The Initial Developer of the Original Code is -# Netscape Communications Corporation. -# Portions created by the Initial Developer are Copyright (C) 1998 -# the Initial Developer. All Rights Reserved. -# -# Contributor(s): -# -# Alternatively, the contents of this file may be used under the terms of -# either the GNU General Public License Version 2 or later (the "GPL"), or -# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), -# in which case the provisions of the GPL or the LGPL are applicable instead -# of those above. If you wish to allow use of your version of this file only -# under the terms of either the GPL or the LGPL, and not to allow others to -# use your version of this file under the terms of the MPL, indicate your -# decision by deleting the provisions above and replace them with the notice -# and other provisions required by the GPL or the LGPL. If you do not delete -# the provisions above, a recipient may use your version of this file under -# the terms of any one of the MPL, the GPL or the LGPL. -# -# ***** END LICENSE BLOCK ***** - -DEPTH = ../../../.. -topsrcdir = @top_srcdir@ -srcdir = @srcdir@ -VPATH = @srcdir@ - -include $(DEPTH)/config/autoconf.mk - -MODULE = necko -XPIDL_MODULE = necko_file -GRE_MODULE = 1 - -XPIDLSRCS = \ - nsIFileProtocolHandler.idl \ - nsIFileChannel.idl \ - $(NULL) - -include $(topsrcdir)/config/rules.mk - -DEFINES += -DIMPL_NS_NET diff --git a/netwerk/protocol/file/src/Makefile.in b/netwerk/protocol/file/src/Makefile.in deleted file mode 100644 index 263892642f5..00000000000 --- a/netwerk/protocol/file/src/Makefile.in +++ /dev/null @@ -1,66 +0,0 @@ -# -# ***** BEGIN LICENSE BLOCK ***** -# Version: MPL 1.1/GPL 2.0/LGPL 2.1 -# -# The contents of this file are subject to the Mozilla Public License Version -# 1.1 (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# http://www.mozilla.org/MPL/ -# -# Software distributed under the License is distributed on an "AS IS" basis, -# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License -# for the specific language governing rights and limitations under the -# License. -# -# The Original Code is mozilla.org code. -# -# The Initial Developer of the Original Code is -# Netscape Communications Corporation. -# Portions created by the Initial Developer are Copyright (C) 1998 -# the Initial Developer. All Rights Reserved. -# -# Contributor(s): -# -# Alternatively, the contents of this file may be used under the terms of -# either the GNU General Public License Version 2 or later (the "GPL"), or -# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), -# in which case the provisions of the GPL or the LGPL are applicable instead -# of those above. If you wish to allow use of your version of this file only -# under the terms of either the GPL or the LGPL, and not to allow others to -# use your version of this file under the terms of the MPL, indicate your -# decision by deleting the provisions above and replace them with the notice -# and other provisions required by the GPL or the LGPL. If you do not delete -# the provisions above, a recipient may use your version of this file under -# the terms of any one of the MPL, the GPL or the LGPL. -# -# ***** END LICENSE BLOCK ***** - -DEPTH = ../../../.. -topsrcdir = @top_srcdir@ -srcdir = @srcdir@ -VPATH = @srcdir@ - -include $(DEPTH)/config/autoconf.mk - -MODULE = necko -LIBRARY_NAME = nkfile_s -LIBXUL_LIBRARY = 1 - - -CPPSRCS = \ - nsFileProtocolHandler.cpp \ - nsFileChannel.cpp \ - $(NULL) - - -# we don't want the shared lib, but we want to force the creation of a -# static lib. -FORCE_STATIC_LIB = 1 - -LOCAL_INCLUDES = \ - -I$(srcdir)/../../../base/src \ - -I$(topsrcdir)/xpcom/ds \ - $(NULL) - -include $(topsrcdir)/config/rules.mk -DEFINES += -DIMPL_NS_NET diff --git a/netwerk/protocol/ftp/Makefile.in b/netwerk/protocol/ftp/Makefile.in index ba7e16adccf..1a035973ece 100644 --- a/netwerk/protocol/ftp/Makefile.in +++ b/netwerk/protocol/ftp/Makefile.in @@ -35,15 +35,54 @@ # # ***** END LICENSE BLOCK ***** -DEPTH = ../../.. -topsrcdir = @top_srcdir@ -srcdir = @srcdir@ -VPATH = @srcdir@ +DEPTH = ../../.. +topsrcdir = @top_srcdir@ +srcdir = @srcdir@ +VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk -DIRS = public src +MODULE = necko +LIBRARY_NAME = nkftp_s +LIBXUL_LIBRARY = 1 +XPIDL_MODULE = necko_ftp +GRE_MODULE = 1 + +FORCE_STATIC_LIB = 1 + +EXPORTS = ftpCore.h + +XPIDLSRCS = \ + nsIFTPChannel.idl \ + $(NULL) + +CPPSRCS = \ + nsFtpProtocolHandler.cpp \ + nsFTPChannel.cpp \ + nsFtpConnectionThread.cpp \ + nsFtpControlConnection.cpp \ + $(NULL) + +# Use -g for Irix mipspro builds as workaround for bug 92099 +ifneq (,$(filter IRIX IRIX64,$(OS_ARCH))) +ifndef GNU_CC +MODULE_OPTIMIZE_FLAGS=-O -g +endif +endif + +LOCAL_INCLUDES = \ + -I$(srcdir)/../../base/src \ + -I$(topsrcdir)/xpcom/ds \ + $(NULL) include $(topsrcdir)/config/rules.mk +ifeq ($(OS_ARCH),WINNT) +ifndef MOZ_DEBUG +ifndef NO_LOGGING +DEFINES += -DFORCE_PR_LOG +endif +endif +endif # WINNT + DEFINES += -DIMPL_NS_NET diff --git a/netwerk/protocol/ftp/public/ftpCore.h b/netwerk/protocol/ftp/ftpCore.h similarity index 100% rename from netwerk/protocol/ftp/public/ftpCore.h rename to netwerk/protocol/ftp/ftpCore.h diff --git a/netwerk/protocol/ftp/src/nsFTPChannel.cpp b/netwerk/protocol/ftp/nsFTPChannel.cpp similarity index 100% rename from netwerk/protocol/ftp/src/nsFTPChannel.cpp rename to netwerk/protocol/ftp/nsFTPChannel.cpp diff --git a/netwerk/protocol/ftp/src/nsFTPChannel.h b/netwerk/protocol/ftp/nsFTPChannel.h similarity index 100% rename from netwerk/protocol/ftp/src/nsFTPChannel.h rename to netwerk/protocol/ftp/nsFTPChannel.h diff --git a/netwerk/protocol/ftp/src/nsFtpConnectionThread.cpp b/netwerk/protocol/ftp/nsFtpConnectionThread.cpp similarity index 100% rename from netwerk/protocol/ftp/src/nsFtpConnectionThread.cpp rename to netwerk/protocol/ftp/nsFtpConnectionThread.cpp diff --git a/netwerk/protocol/ftp/src/nsFtpConnectionThread.h b/netwerk/protocol/ftp/nsFtpConnectionThread.h similarity index 100% rename from netwerk/protocol/ftp/src/nsFtpConnectionThread.h rename to netwerk/protocol/ftp/nsFtpConnectionThread.h diff --git a/netwerk/protocol/ftp/src/nsFtpControlConnection.cpp b/netwerk/protocol/ftp/nsFtpControlConnection.cpp similarity index 100% rename from netwerk/protocol/ftp/src/nsFtpControlConnection.cpp rename to netwerk/protocol/ftp/nsFtpControlConnection.cpp diff --git a/netwerk/protocol/ftp/src/nsFtpControlConnection.h b/netwerk/protocol/ftp/nsFtpControlConnection.h similarity index 100% rename from netwerk/protocol/ftp/src/nsFtpControlConnection.h rename to netwerk/protocol/ftp/nsFtpControlConnection.h diff --git a/netwerk/protocol/ftp/src/nsFtpProtocolHandler.cpp b/netwerk/protocol/ftp/nsFtpProtocolHandler.cpp similarity index 100% rename from netwerk/protocol/ftp/src/nsFtpProtocolHandler.cpp rename to netwerk/protocol/ftp/nsFtpProtocolHandler.cpp diff --git a/netwerk/protocol/ftp/src/nsFtpProtocolHandler.h b/netwerk/protocol/ftp/nsFtpProtocolHandler.h similarity index 100% rename from netwerk/protocol/ftp/src/nsFtpProtocolHandler.h rename to netwerk/protocol/ftp/nsFtpProtocolHandler.h diff --git a/netwerk/protocol/ftp/public/nsIFTPChannel.idl b/netwerk/protocol/ftp/nsIFTPChannel.idl similarity index 100% rename from netwerk/protocol/ftp/public/nsIFTPChannel.idl rename to netwerk/protocol/ftp/nsIFTPChannel.idl diff --git a/netwerk/protocol/ftp/public/Makefile.in b/netwerk/protocol/ftp/public/Makefile.in deleted file mode 100644 index c1fdcb30d85..00000000000 --- a/netwerk/protocol/ftp/public/Makefile.in +++ /dev/null @@ -1,57 +0,0 @@ -# -# ***** BEGIN LICENSE BLOCK ***** -# Version: MPL 1.1/GPL 2.0/LGPL 2.1 -# -# The contents of this file are subject to the Mozilla Public License Version -# 1.1 (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# http://www.mozilla.org/MPL/ -# -# Software distributed under the License is distributed on an "AS IS" basis, -# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License -# for the specific language governing rights and limitations under the -# License. -# -# The Original Code is mozilla.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 MPL, indicate your -# decision by deleting the provisions above and replace them with the notice -# and other provisions required by the GPL or the LGPL. If you do not delete -# the provisions above, a recipient may use your version of this file under -# the terms of any one of the MPL, the GPL or the LGPL. -# -# ***** END LICENSE BLOCK ***** - -DEPTH = ../../../.. -topsrcdir = @top_srcdir@ -srcdir = @srcdir@ -VPATH = @srcdir@ - -include $(DEPTH)/config/autoconf.mk - -MODULE = necko -XPIDL_MODULE = necko_ftp -GRE_MODULE = 1 - -XPIDLSRCS = \ - nsIFTPChannel.idl \ - $(NULL) - -EXPORTS = ftpCore.h - -include $(topsrcdir)/config/rules.mk - -DEFINES += -DIMPL_NS_NET diff --git a/netwerk/protocol/ftp/src/Makefile.in b/netwerk/protocol/ftp/src/Makefile.in deleted file mode 100644 index df6809631e8..00000000000 --- a/netwerk/protocol/ftp/src/Makefile.in +++ /dev/null @@ -1,84 +0,0 @@ -# -# ***** BEGIN LICENSE BLOCK ***** -# Version: MPL 1.1/GPL 2.0/LGPL 2.1 -# -# The contents of this file are subject to the Mozilla Public License Version -# 1.1 (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# http://www.mozilla.org/MPL/ -# -# Software distributed under the License is distributed on an "AS IS" basis, -# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License -# for the specific language governing rights and limitations under the -# License. -# -# The Original Code is 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 MPL, indicate your -# decision by deleting the provisions above and replace them with the notice -# and other provisions required by the GPL or the LGPL. If you do not delete -# the provisions above, a recipient may use your version of this file under -# the terms of any one of the MPL, the GPL or the LGPL. -# -# ***** END LICENSE BLOCK ***** - -DEPTH = ../../../.. -topsrcdir = @top_srcdir@ -srcdir = @srcdir@ -VPATH = @srcdir@ - -include $(DEPTH)/config/autoconf.mk - -MODULE = necko -LIBRARY_NAME = nkftp_s -LIBXUL_LIBRARY = 1 - - -CPPSRCS = \ - nsFtpProtocolHandler.cpp \ - nsFTPChannel.cpp \ - nsFtpConnectionThread.cpp \ - nsFtpControlConnection.cpp \ - $(NULL) - -# Use -g for Irix mipspro builds as workaround for bug 92099 -ifneq (,$(filter IRIX IRIX64,$(OS_ARCH))) -ifndef GNU_CC -MODULE_OPTIMIZE_FLAGS=-O -g -endif -endif - -LOCAL_INCLUDES = \ - -I$(srcdir)/../../../base/src \ - -I$(topsrcdir)/xpcom/ds \ - $(NULL) - - -# we don't want the shared lib, but we want to force the creation of a -# static lib. -FORCE_STATIC_LIB = 1 - -include $(topsrcdir)/config/rules.mk - -ifeq ($(OS_ARCH),WINNT) -ifndef MOZ_DEBUG -ifndef NO_LOGGING -DEFINES += -DFORCE_PR_LOG -endif -endif -endif # WINNT - -DEFINES += -DIMPL_NS_NET diff --git a/netwerk/protocol/gopher/Makefile.in b/netwerk/protocol/gopher/Makefile.in index 8be76246163..e5f17527d77 100644 --- a/netwerk/protocol/gopher/Makefile.in +++ b/netwerk/protocol/gopher/Makefile.in @@ -36,14 +36,26 @@ # # ***** END LICENSE BLOCK ***** -DEPTH = ../../.. -topsrcdir = @top_srcdir@ -srcdir = @srcdir@ -VPATH = @srcdir@ +DEPTH = ../../.. +topsrcdir = @top_srcdir@ +srcdir = @srcdir@ +VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk -MODULE = necko -DIRS = src +MODULE = necko +LIBRARY_NAME = nkgopher_s +LIBXUL_LIBRARY = 1 + +FORCE_STATIC_LIB = 1 + +CPPSRCS = \ + nsGopherHandler.cpp \ + nsGopherChannel.cpp \ + $(NULL) + +LOCAL_INCLUDES = \ + -I$(srcdir)/../../base/src \ + $(NULL) include $(topsrcdir)/config/rules.mk diff --git a/netwerk/protocol/gopher/src/nsGopherChannel.cpp b/netwerk/protocol/gopher/nsGopherChannel.cpp similarity index 100% rename from netwerk/protocol/gopher/src/nsGopherChannel.cpp rename to netwerk/protocol/gopher/nsGopherChannel.cpp diff --git a/netwerk/protocol/gopher/src/nsGopherChannel.h b/netwerk/protocol/gopher/nsGopherChannel.h similarity index 100% rename from netwerk/protocol/gopher/src/nsGopherChannel.h rename to netwerk/protocol/gopher/nsGopherChannel.h diff --git a/netwerk/protocol/gopher/src/nsGopherHandler.cpp b/netwerk/protocol/gopher/nsGopherHandler.cpp similarity index 100% rename from netwerk/protocol/gopher/src/nsGopherHandler.cpp rename to netwerk/protocol/gopher/nsGopherHandler.cpp diff --git a/netwerk/protocol/gopher/src/nsGopherHandler.h b/netwerk/protocol/gopher/nsGopherHandler.h similarity index 100% rename from netwerk/protocol/gopher/src/nsGopherHandler.h rename to netwerk/protocol/gopher/nsGopherHandler.h diff --git a/netwerk/protocol/gopher/src/Makefile.in b/netwerk/protocol/gopher/src/Makefile.in deleted file mode 100644 index 610ade15dac..00000000000 --- a/netwerk/protocol/gopher/src/Makefile.in +++ /dev/null @@ -1,62 +0,0 @@ -# -# ***** BEGIN LICENSE BLOCK ***** -# Version: MPL 1.1/GPL 2.0/LGPL 2.1 -# -# The contents of this file are subject to the Mozilla Public License Version -# 1.1 (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# http://www.mozilla.org/MPL/ -# -# Software distributed under the License is distributed on an "AS IS" basis, -# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License -# for the specific language governing rights and limitations under the -# License. -# -# The Original Code is mozilla.org code. -# -# The Initial Developer of the Original Code is -# Bradley Baetz. -# Portions created by the Initial Developer are Copyright (C) 2000 -# the Initial Developer. All Rights Reserved. -# -# Contributor(s): -# Bradley Baetz -# -# Alternatively, the contents of this file may be used under the terms of -# either the GNU General Public License Version 2 or later (the "GPL"), or -# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), -# in which case the provisions of the GPL or the LGPL are applicable instead -# of those above. If you wish to allow use of your version of this file only -# under the terms of either the GPL or the LGPL, and not to allow others to -# use your version of this file under the terms of the MPL, indicate your -# decision by deleting the provisions above and replace them with the notice -# and other provisions required by the GPL or the LGPL. If you do not delete -# the provisions above, a recipient may use your version of this file under -# the terms of any one of the MPL, the GPL or the LGPL. -# -# ***** END LICENSE BLOCK ***** - -DEPTH = ../../../.. -topsrcdir = @top_srcdir@ -srcdir = @srcdir@ -VPATH = @srcdir@ - -include $(DEPTH)/config/autoconf.mk - -MODULE = necko -LIBRARY_NAME = nkgopher_s -LIBXUL_LIBRARY = 1 - - -CPPSRCS = \ - nsGopherHandler.cpp \ - nsGopherChannel.cpp \ - $(NULL) - -LOCAL_INCLUDES=-I$(srcdir)/../../../base/src - -# we don't want the shared lib, but we want to force the creation of a -# static lib. -FORCE_STATIC_LIB = 1 - -include $(topsrcdir)/config/rules.mk diff --git a/netwerk/protocol/http/Makefile.in b/netwerk/protocol/http/Makefile.in index ba7e16adccf..d452de6e998 100644 --- a/netwerk/protocol/http/Makefile.in +++ b/netwerk/protocol/http/Makefile.in @@ -20,6 +20,7 @@ # the Initial Developer. All Rights Reserved. # # Contributor(s): +# Gagan Saksena # # 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 @@ -35,14 +36,60 @@ # # ***** END LICENSE BLOCK ***** -DEPTH = ../../.. -topsrcdir = @top_srcdir@ -srcdir = @srcdir@ -VPATH = @srcdir@ +DEPTH = ../../.. +topsrcdir = @top_srcdir@ +srcdir = @srcdir@ +VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk -DIRS = public src +MODULE = necko +LIBRARY_NAME = nkhttp_s +LIBXUL_LIBRARY = 1 +XPIDL_MODULE = necko_http +GRE_MODULE = 1 + +FORCE_STATIC_LIB = 1 + +SDK_XPIDLSRCS = \ + nsIHttpChannel.idl \ + nsIHttpHeaderVisitor.idl \ + $(NULL) + +XPIDLSRCS = \ + nsIHttpActivityObserver.idl \ + nsIHttpAuthManager.idl \ + nsIHttpAuthenticator.idl \ + nsIHttpChannelInternal.idl \ + nsIHttpEventSink.idl \ + nsIHttpProtocolHandler.idl \ + $(NULL) + +CPPSRCS = \ + nsHttp.cpp \ + nsHttpHeaderArray.cpp \ + nsHttpConnectionInfo.cpp \ + nsHttpConnection.cpp \ + nsHttpConnectionMgr.cpp \ + nsHttpRequestHead.cpp \ + nsHttpResponseHead.cpp \ + nsHttpChunkedDecoder.cpp \ + nsHttpAuthCache.cpp \ + nsHttpAuthManager.cpp \ + nsHttpBasicAuth.cpp \ + nsHttpDigestAuth.cpp \ + nsHttpNTLMAuth.cpp \ + nsHttpTransaction.cpp \ + nsHttpHandler.cpp \ + nsHttpChannel.cpp \ + nsHttpPipeline.cpp \ + nsHttpActivityDistributor.cpp \ + $(NULL) + +LOCAL_INCLUDES = \ + -I$(srcdir)/../../base/src \ + -I$(topsrcdir)/xpcom/ds \ + $(NULL) include $(topsrcdir)/config/rules.mk diff --git a/netwerk/protocol/http/src/README b/netwerk/protocol/http/README similarity index 100% rename from netwerk/protocol/http/src/README rename to netwerk/protocol/http/README diff --git a/netwerk/protocol/http/src/nsAHttpConnection.h b/netwerk/protocol/http/nsAHttpConnection.h similarity index 100% rename from netwerk/protocol/http/src/nsAHttpConnection.h rename to netwerk/protocol/http/nsAHttpConnection.h diff --git a/netwerk/protocol/http/src/nsAHttpTransaction.h b/netwerk/protocol/http/nsAHttpTransaction.h similarity index 100% rename from netwerk/protocol/http/src/nsAHttpTransaction.h rename to netwerk/protocol/http/nsAHttpTransaction.h diff --git a/netwerk/protocol/http/src/nsHttp.cpp b/netwerk/protocol/http/nsHttp.cpp similarity index 100% rename from netwerk/protocol/http/src/nsHttp.cpp rename to netwerk/protocol/http/nsHttp.cpp diff --git a/netwerk/protocol/http/src/nsHttp.h b/netwerk/protocol/http/nsHttp.h similarity index 100% rename from netwerk/protocol/http/src/nsHttp.h rename to netwerk/protocol/http/nsHttp.h diff --git a/netwerk/protocol/http/src/nsHttpActivityDistributor.cpp b/netwerk/protocol/http/nsHttpActivityDistributor.cpp similarity index 100% rename from netwerk/protocol/http/src/nsHttpActivityDistributor.cpp rename to netwerk/protocol/http/nsHttpActivityDistributor.cpp diff --git a/netwerk/protocol/http/src/nsHttpActivityDistributor.h b/netwerk/protocol/http/nsHttpActivityDistributor.h similarity index 100% rename from netwerk/protocol/http/src/nsHttpActivityDistributor.h rename to netwerk/protocol/http/nsHttpActivityDistributor.h diff --git a/netwerk/protocol/http/src/nsHttpAtomList.h b/netwerk/protocol/http/nsHttpAtomList.h similarity index 100% rename from netwerk/protocol/http/src/nsHttpAtomList.h rename to netwerk/protocol/http/nsHttpAtomList.h diff --git a/netwerk/protocol/http/src/nsHttpAuthCache.cpp b/netwerk/protocol/http/nsHttpAuthCache.cpp similarity index 100% rename from netwerk/protocol/http/src/nsHttpAuthCache.cpp rename to netwerk/protocol/http/nsHttpAuthCache.cpp diff --git a/netwerk/protocol/http/src/nsHttpAuthCache.h b/netwerk/protocol/http/nsHttpAuthCache.h similarity index 100% rename from netwerk/protocol/http/src/nsHttpAuthCache.h rename to netwerk/protocol/http/nsHttpAuthCache.h diff --git a/netwerk/protocol/http/src/nsHttpAuthManager.cpp b/netwerk/protocol/http/nsHttpAuthManager.cpp similarity index 100% rename from netwerk/protocol/http/src/nsHttpAuthManager.cpp rename to netwerk/protocol/http/nsHttpAuthManager.cpp diff --git a/netwerk/protocol/http/src/nsHttpAuthManager.h b/netwerk/protocol/http/nsHttpAuthManager.h similarity index 100% rename from netwerk/protocol/http/src/nsHttpAuthManager.h rename to netwerk/protocol/http/nsHttpAuthManager.h diff --git a/netwerk/protocol/http/src/nsHttpBasicAuth.cpp b/netwerk/protocol/http/nsHttpBasicAuth.cpp similarity index 100% rename from netwerk/protocol/http/src/nsHttpBasicAuth.cpp rename to netwerk/protocol/http/nsHttpBasicAuth.cpp diff --git a/netwerk/protocol/http/src/nsHttpBasicAuth.h b/netwerk/protocol/http/nsHttpBasicAuth.h similarity index 100% rename from netwerk/protocol/http/src/nsHttpBasicAuth.h rename to netwerk/protocol/http/nsHttpBasicAuth.h diff --git a/netwerk/protocol/http/src/nsHttpChannel.cpp b/netwerk/protocol/http/nsHttpChannel.cpp similarity index 100% rename from netwerk/protocol/http/src/nsHttpChannel.cpp rename to netwerk/protocol/http/nsHttpChannel.cpp diff --git a/netwerk/protocol/http/src/nsHttpChannel.h b/netwerk/protocol/http/nsHttpChannel.h similarity index 100% rename from netwerk/protocol/http/src/nsHttpChannel.h rename to netwerk/protocol/http/nsHttpChannel.h diff --git a/netwerk/protocol/http/src/nsHttpChunkedDecoder.cpp b/netwerk/protocol/http/nsHttpChunkedDecoder.cpp similarity index 100% rename from netwerk/protocol/http/src/nsHttpChunkedDecoder.cpp rename to netwerk/protocol/http/nsHttpChunkedDecoder.cpp diff --git a/netwerk/protocol/http/src/nsHttpChunkedDecoder.h b/netwerk/protocol/http/nsHttpChunkedDecoder.h similarity index 100% rename from netwerk/protocol/http/src/nsHttpChunkedDecoder.h rename to netwerk/protocol/http/nsHttpChunkedDecoder.h diff --git a/netwerk/protocol/http/src/nsHttpConnection.cpp b/netwerk/protocol/http/nsHttpConnection.cpp similarity index 100% rename from netwerk/protocol/http/src/nsHttpConnection.cpp rename to netwerk/protocol/http/nsHttpConnection.cpp diff --git a/netwerk/protocol/http/src/nsHttpConnection.h b/netwerk/protocol/http/nsHttpConnection.h similarity index 100% rename from netwerk/protocol/http/src/nsHttpConnection.h rename to netwerk/protocol/http/nsHttpConnection.h diff --git a/netwerk/protocol/http/src/nsHttpConnectionInfo.cpp b/netwerk/protocol/http/nsHttpConnectionInfo.cpp similarity index 100% rename from netwerk/protocol/http/src/nsHttpConnectionInfo.cpp rename to netwerk/protocol/http/nsHttpConnectionInfo.cpp diff --git a/netwerk/protocol/http/src/nsHttpConnectionInfo.h b/netwerk/protocol/http/nsHttpConnectionInfo.h similarity index 100% rename from netwerk/protocol/http/src/nsHttpConnectionInfo.h rename to netwerk/protocol/http/nsHttpConnectionInfo.h diff --git a/netwerk/protocol/http/src/nsHttpConnectionMgr.cpp b/netwerk/protocol/http/nsHttpConnectionMgr.cpp similarity index 100% rename from netwerk/protocol/http/src/nsHttpConnectionMgr.cpp rename to netwerk/protocol/http/nsHttpConnectionMgr.cpp diff --git a/netwerk/protocol/http/src/nsHttpConnectionMgr.h b/netwerk/protocol/http/nsHttpConnectionMgr.h similarity index 100% rename from netwerk/protocol/http/src/nsHttpConnectionMgr.h rename to netwerk/protocol/http/nsHttpConnectionMgr.h diff --git a/netwerk/protocol/http/src/nsHttpDigestAuth.cpp b/netwerk/protocol/http/nsHttpDigestAuth.cpp similarity index 100% rename from netwerk/protocol/http/src/nsHttpDigestAuth.cpp rename to netwerk/protocol/http/nsHttpDigestAuth.cpp diff --git a/netwerk/protocol/http/src/nsHttpDigestAuth.h b/netwerk/protocol/http/nsHttpDigestAuth.h similarity index 100% rename from netwerk/protocol/http/src/nsHttpDigestAuth.h rename to netwerk/protocol/http/nsHttpDigestAuth.h diff --git a/netwerk/protocol/http/src/nsHttpHandler.cpp b/netwerk/protocol/http/nsHttpHandler.cpp similarity index 100% rename from netwerk/protocol/http/src/nsHttpHandler.cpp rename to netwerk/protocol/http/nsHttpHandler.cpp diff --git a/netwerk/protocol/http/src/nsHttpHandler.h b/netwerk/protocol/http/nsHttpHandler.h similarity index 100% rename from netwerk/protocol/http/src/nsHttpHandler.h rename to netwerk/protocol/http/nsHttpHandler.h diff --git a/netwerk/protocol/http/src/nsHttpHeaderArray.cpp b/netwerk/protocol/http/nsHttpHeaderArray.cpp similarity index 100% rename from netwerk/protocol/http/src/nsHttpHeaderArray.cpp rename to netwerk/protocol/http/nsHttpHeaderArray.cpp diff --git a/netwerk/protocol/http/src/nsHttpHeaderArray.h b/netwerk/protocol/http/nsHttpHeaderArray.h similarity index 100% rename from netwerk/protocol/http/src/nsHttpHeaderArray.h rename to netwerk/protocol/http/nsHttpHeaderArray.h diff --git a/netwerk/protocol/http/src/nsHttpNTLMAuth.cpp b/netwerk/protocol/http/nsHttpNTLMAuth.cpp similarity index 100% rename from netwerk/protocol/http/src/nsHttpNTLMAuth.cpp rename to netwerk/protocol/http/nsHttpNTLMAuth.cpp diff --git a/netwerk/protocol/http/src/nsHttpNTLMAuth.h b/netwerk/protocol/http/nsHttpNTLMAuth.h similarity index 100% rename from netwerk/protocol/http/src/nsHttpNTLMAuth.h rename to netwerk/protocol/http/nsHttpNTLMAuth.h diff --git a/netwerk/protocol/http/src/nsHttpPipeline.cpp b/netwerk/protocol/http/nsHttpPipeline.cpp similarity index 100% rename from netwerk/protocol/http/src/nsHttpPipeline.cpp rename to netwerk/protocol/http/nsHttpPipeline.cpp diff --git a/netwerk/protocol/http/src/nsHttpPipeline.h b/netwerk/protocol/http/nsHttpPipeline.h similarity index 100% rename from netwerk/protocol/http/src/nsHttpPipeline.h rename to netwerk/protocol/http/nsHttpPipeline.h diff --git a/netwerk/protocol/http/src/nsHttpRequestHead.cpp b/netwerk/protocol/http/nsHttpRequestHead.cpp similarity index 100% rename from netwerk/protocol/http/src/nsHttpRequestHead.cpp rename to netwerk/protocol/http/nsHttpRequestHead.cpp diff --git a/netwerk/protocol/http/src/nsHttpRequestHead.h b/netwerk/protocol/http/nsHttpRequestHead.h similarity index 100% rename from netwerk/protocol/http/src/nsHttpRequestHead.h rename to netwerk/protocol/http/nsHttpRequestHead.h diff --git a/netwerk/protocol/http/src/nsHttpResponseHead.cpp b/netwerk/protocol/http/nsHttpResponseHead.cpp similarity index 100% rename from netwerk/protocol/http/src/nsHttpResponseHead.cpp rename to netwerk/protocol/http/nsHttpResponseHead.cpp diff --git a/netwerk/protocol/http/src/nsHttpResponseHead.h b/netwerk/protocol/http/nsHttpResponseHead.h similarity index 100% rename from netwerk/protocol/http/src/nsHttpResponseHead.h rename to netwerk/protocol/http/nsHttpResponseHead.h diff --git a/netwerk/protocol/http/src/nsHttpTransaction.cpp b/netwerk/protocol/http/nsHttpTransaction.cpp similarity index 100% rename from netwerk/protocol/http/src/nsHttpTransaction.cpp rename to netwerk/protocol/http/nsHttpTransaction.cpp diff --git a/netwerk/protocol/http/src/nsHttpTransaction.h b/netwerk/protocol/http/nsHttpTransaction.h similarity index 100% rename from netwerk/protocol/http/src/nsHttpTransaction.h rename to netwerk/protocol/http/nsHttpTransaction.h diff --git a/netwerk/protocol/http/public/nsIHttpActivityObserver.idl b/netwerk/protocol/http/nsIHttpActivityObserver.idl similarity index 100% rename from netwerk/protocol/http/public/nsIHttpActivityObserver.idl rename to netwerk/protocol/http/nsIHttpActivityObserver.idl diff --git a/netwerk/protocol/http/public/nsIHttpAuthManager.idl b/netwerk/protocol/http/nsIHttpAuthManager.idl similarity index 100% rename from netwerk/protocol/http/public/nsIHttpAuthManager.idl rename to netwerk/protocol/http/nsIHttpAuthManager.idl diff --git a/netwerk/protocol/http/public/nsIHttpAuthenticator.idl b/netwerk/protocol/http/nsIHttpAuthenticator.idl similarity index 100% rename from netwerk/protocol/http/public/nsIHttpAuthenticator.idl rename to netwerk/protocol/http/nsIHttpAuthenticator.idl diff --git a/netwerk/protocol/http/public/nsIHttpChannel.idl b/netwerk/protocol/http/nsIHttpChannel.idl similarity index 100% rename from netwerk/protocol/http/public/nsIHttpChannel.idl rename to netwerk/protocol/http/nsIHttpChannel.idl diff --git a/netwerk/protocol/http/public/nsIHttpChannelInternal.idl b/netwerk/protocol/http/nsIHttpChannelInternal.idl similarity index 100% rename from netwerk/protocol/http/public/nsIHttpChannelInternal.idl rename to netwerk/protocol/http/nsIHttpChannelInternal.idl diff --git a/netwerk/protocol/http/public/nsIHttpEventSink.idl b/netwerk/protocol/http/nsIHttpEventSink.idl similarity index 100% rename from netwerk/protocol/http/public/nsIHttpEventSink.idl rename to netwerk/protocol/http/nsIHttpEventSink.idl diff --git a/netwerk/protocol/http/public/nsIHttpHeaderVisitor.idl b/netwerk/protocol/http/nsIHttpHeaderVisitor.idl similarity index 100% rename from netwerk/protocol/http/public/nsIHttpHeaderVisitor.idl rename to netwerk/protocol/http/nsIHttpHeaderVisitor.idl diff --git a/netwerk/protocol/http/public/nsIHttpProtocolHandler.idl b/netwerk/protocol/http/nsIHttpProtocolHandler.idl similarity index 100% rename from netwerk/protocol/http/public/nsIHttpProtocolHandler.idl rename to netwerk/protocol/http/nsIHttpProtocolHandler.idl diff --git a/netwerk/protocol/http/public/Makefile.in b/netwerk/protocol/http/public/Makefile.in deleted file mode 100644 index 5eff2646d3a..00000000000 --- a/netwerk/protocol/http/public/Makefile.in +++ /dev/null @@ -1,66 +0,0 @@ -# -# ***** BEGIN LICENSE BLOCK ***** -# Version: MPL 1.1/GPL 2.0/LGPL 2.1 -# -# The contents of this file are subject to the Mozilla Public License Version -# 1.1 (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# http://www.mozilla.org/MPL/ -# -# Software distributed under the License is distributed on an "AS IS" basis, -# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License -# for the specific language governing rights and limitations under the -# License. -# -# The Original Code is mozilla.org code. -# -# The Initial Developer of the Original Code is -# Netscape Communications Corporation. -# Portions created by the Initial Developer are Copyright (C) 1998 -# the Initial Developer. All Rights Reserved. -# -# Contributor(s): -# Gagan Saksena -# -# Alternatively, the contents of this file may be used under the terms of -# either the GNU General Public License Version 2 or later (the "GPL"), or -# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), -# in which case the provisions of the GPL or the LGPL are applicable instead -# of those above. If you wish to allow use of your version of this file only -# under the terms of either the GPL or the LGPL, and not to allow others to -# use your version of this file under the terms of the MPL, indicate your -# decision by deleting the provisions above and replace them with the notice -# and other provisions required by the GPL or the LGPL. If you do not delete -# the provisions above, a recipient may use your version of this file under -# the terms of any one of the MPL, the GPL or the LGPL. -# -# ***** END LICENSE BLOCK ***** - -DEPTH = ../../../.. -topsrcdir = @top_srcdir@ -srcdir = @srcdir@ -VPATH = @srcdir@ - -include $(DEPTH)/config/autoconf.mk - -MODULE = necko -XPIDL_MODULE = necko_http -GRE_MODULE = 1 - -SDK_XPIDLSRCS = \ - nsIHttpChannel.idl \ - nsIHttpHeaderVisitor.idl \ - $(NULL) - -XPIDLSRCS = \ - nsIHttpChannelInternal.idl \ - nsIHttpProtocolHandler.idl \ - nsIHttpEventSink.idl \ - nsIHttpAuthenticator.idl \ - nsIHttpAuthManager.idl \ - nsIHttpActivityObserver.idl \ - $(NULL) - -include $(topsrcdir)/config/rules.mk - -DEFINES += -DIMPL_NS_NET diff --git a/netwerk/protocol/http/src/Makefile.in b/netwerk/protocol/http/src/Makefile.in deleted file mode 100644 index 5ac6d6b7d30..00000000000 --- a/netwerk/protocol/http/src/Makefile.in +++ /dev/null @@ -1,79 +0,0 @@ -# -# ***** BEGIN LICENSE BLOCK ***** -# Version: MPL 1.1/GPL 2.0/LGPL 2.1 -# -# The contents of this file are subject to the Mozilla Public License Version -# 1.1 (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# http://www.mozilla.org/MPL/ -# -# Software distributed under the License is distributed on an "AS IS" basis, -# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License -# for the specific language governing rights and limitations under the -# License. -# -# The Original Code is mozilla.org code. -# -# The Initial Developer of the Original Code is -# Netscape Communications Corporation. -# Portions created by the Initial Developer are Copyright (C) 1998 -# the Initial Developer. All Rights Reserved. -# -# Contributor(s): -# -# Alternatively, the contents of this file may be used under the terms of -# either the GNU General Public License Version 2 or later (the "GPL"), or -# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), -# in which case the provisions of the GPL or the LGPL are applicable instead -# of those above. If you wish to allow use of your version of this file only -# under the terms of either the GPL or the LGPL, and not to allow others to -# use your version of this file under the terms of the MPL, indicate your -# decision by deleting the provisions above and replace them with the notice -# and other provisions required by the GPL or the LGPL. If you do not delete -# the provisions above, a recipient may use your version of this file under -# the terms of any one of the MPL, the GPL or the LGPL. -# -# ***** END LICENSE BLOCK ***** - -DEPTH = ../../../.. -topsrcdir = @top_srcdir@ -srcdir = @srcdir@ -VPATH = @srcdir@ - -include $(DEPTH)/config/autoconf.mk - -MODULE = necko -LIBRARY_NAME = nkhttp_s -LIBXUL_LIBRARY = 1 - - -CPPSRCS = \ - nsHttp.cpp \ - nsHttpHeaderArray.cpp \ - nsHttpConnectionInfo.cpp \ - nsHttpConnection.cpp \ - nsHttpConnectionMgr.cpp \ - nsHttpRequestHead.cpp \ - nsHttpResponseHead.cpp \ - nsHttpChunkedDecoder.cpp \ - nsHttpAuthCache.cpp \ - nsHttpAuthManager.cpp \ - nsHttpBasicAuth.cpp \ - nsHttpDigestAuth.cpp \ - nsHttpNTLMAuth.cpp \ - nsHttpTransaction.cpp \ - nsHttpHandler.cpp \ - nsHttpChannel.cpp \ - nsHttpPipeline.cpp \ - nsHttpActivityDistributor.cpp \ - $(NULL) - -LOCAL_INCLUDES=-I$(srcdir)/../../../base/src -I$(topsrcdir)/xpcom/ds - -# we don't want the shared lib, but we want to force the creation of a -# static lib. -FORCE_STATIC_LIB = 1 - -include $(topsrcdir)/config/rules.mk - -DEFINES += -DIMPL_NS_NET diff --git a/netwerk/protocol/res/Makefile.in b/netwerk/protocol/res/Makefile.in index ba7e16adccf..3a7fbb912ad 100644 --- a/netwerk/protocol/res/Makefile.in +++ b/netwerk/protocol/res/Makefile.in @@ -35,14 +35,34 @@ # # ***** END LICENSE BLOCK ***** -DEPTH = ../../.. -topsrcdir = @top_srcdir@ -srcdir = @srcdir@ -VPATH = @srcdir@ +DEPTH = ../../.. +topsrcdir = @top_srcdir@ +srcdir = @srcdir@ +VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk -DIRS = public src +MODULE = necko +LIBRARY_NAME = nkres_s +LIBXUL_LIBRARY = 1 +XPIDL_MODULE = necko_res +GRE_MODULE = 1 + +FORCE_STATIC_LIB = 1 + +XPIDLSRCS = \ + nsIResProtocolHandler.idl \ + $(NULL) + +CPPSRCS = \ + nsResProtocolHandler.cpp \ + $(NULL) + +EXTRA_DSO_LDOPTS += $(MOZ_COMPONENT_LIBS) + +LOCAL_INCLUDES = \ + -I$(topsrcdir)/netwerk/base/src \ + $(NULL) include $(topsrcdir)/config/rules.mk diff --git a/netwerk/protocol/res/public/nsIResProtocolHandler.idl b/netwerk/protocol/res/nsIResProtocolHandler.idl similarity index 100% rename from netwerk/protocol/res/public/nsIResProtocolHandler.idl rename to netwerk/protocol/res/nsIResProtocolHandler.idl diff --git a/netwerk/protocol/res/src/nsResProtocolHandler.cpp b/netwerk/protocol/res/nsResProtocolHandler.cpp similarity index 100% rename from netwerk/protocol/res/src/nsResProtocolHandler.cpp rename to netwerk/protocol/res/nsResProtocolHandler.cpp diff --git a/netwerk/protocol/res/src/nsResProtocolHandler.h b/netwerk/protocol/res/nsResProtocolHandler.h similarity index 100% rename from netwerk/protocol/res/src/nsResProtocolHandler.h rename to netwerk/protocol/res/nsResProtocolHandler.h diff --git a/netwerk/protocol/res/public/Makefile.in b/netwerk/protocol/res/public/Makefile.in deleted file mode 100644 index 8064094017c..00000000000 --- a/netwerk/protocol/res/public/Makefile.in +++ /dev/null @@ -1,55 +0,0 @@ -# -# ***** BEGIN LICENSE BLOCK ***** -# Version: MPL 1.1/GPL 2.0/LGPL 2.1 -# -# The contents of this file are subject to the Mozilla Public License Version -# 1.1 (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# http://www.mozilla.org/MPL/ -# -# Software distributed under the License is distributed on an "AS IS" basis, -# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License -# for the specific language governing rights and limitations under the -# License. -# -# The Original Code is mozilla.org code. -# -# The Initial Developer of the Original Code is -# Netscape Communications Corporation. -# Portions created by the Initial Developer are Copyright (C) 1998 -# the Initial Developer. All Rights Reserved. -# -# Contributor(s): -# -# Alternatively, the contents of this file may be used under the terms of -# either the GNU General Public License Version 2 or later (the "GPL"), or -# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), -# in which case the provisions of the GPL or the LGPL are applicable instead -# of those above. If you wish to allow use of your version of this file only -# under the terms of either the GPL or the LGPL, and not to allow others to -# use your version of this file under the terms of the MPL, indicate your -# decision by deleting the provisions above and replace them with the notice -# and other provisions required by the GPL or the LGPL. If you do not delete -# the provisions above, a recipient may use your version of this file under -# the terms of any one of the MPL, the GPL or the LGPL. -# -# ***** END LICENSE BLOCK ***** - -DEPTH = ../../../.. -topsrcdir = @top_srcdir@ -srcdir = @srcdir@ -VPATH = @srcdir@ - -include $(DEPTH)/config/autoconf.mk - -MODULE = necko -XPIDL_MODULE = necko_res -GRE_MODULE = 1 - -XPIDLSRCS = \ - nsIResProtocolHandler.idl \ - $(NULL) - -include $(topsrcdir)/config/rules.mk - -DEFINES += -DIMPL_NS_NET diff --git a/netwerk/protocol/res/src/Makefile.in b/netwerk/protocol/res/src/Makefile.in deleted file mode 100644 index 999d22bc586..00000000000 --- a/netwerk/protocol/res/src/Makefile.in +++ /dev/null @@ -1,66 +0,0 @@ -# -# ***** BEGIN LICENSE BLOCK ***** -# Version: MPL 1.1/GPL 2.0/LGPL 2.1 -# -# The contents of this file are subject to the Mozilla Public License Version -# 1.1 (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# http://www.mozilla.org/MPL/ -# -# Software distributed under the License is distributed on an "AS IS" basis, -# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License -# for the specific language governing rights and limitations under the -# License. -# -# The Original Code is mozilla.org code. -# -# The Initial Developer of the Original Code is -# Netscape Communications Corporation. -# Portions created by the Initial Developer are Copyright (C) 1998 -# the Initial Developer. All Rights Reserved. -# -# Contributor(s): -# -# Alternatively, the contents of this file may be used under the terms of -# either the GNU General Public License Version 2 or later (the "GPL"), or -# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), -# in which case the provisions of the GPL or the LGPL are applicable instead -# of those above. If you wish to allow use of your version of this file only -# under the terms of either the GPL or the LGPL, and not to allow others to -# use your version of this file under the terms of the MPL, indicate your -# decision by deleting the provisions above and replace them with the notice -# and other provisions required by the GPL or the LGPL. If you do not delete -# the provisions above, a recipient may use your version of this file under -# the terms of any one of the MPL, the GPL or the LGPL. -# -# ***** END LICENSE BLOCK ***** - -DEPTH = ../../../.. -topsrcdir = @top_srcdir@ -srcdir = @srcdir@ -VPATH = @srcdir@ - -include $(DEPTH)/config/autoconf.mk - -MODULE = necko -LIBRARY_NAME = nkres_s -LIBXUL_LIBRARY = 1 - - -CPPSRCS = \ - nsResProtocolHandler.cpp \ - $(NULL) - -EXTRA_DSO_LDOPTS += $(MOZ_COMPONENT_LIBS) - -# we don't want the shared lib, but we want to force the creation of a -# static lib. -FORCE_STATIC_LIB = 1 - -LOCAL_INCLUDES = \ - -I$(topsrcdir)/netwerk/base/src \ - $(NULL) - -include $(topsrcdir)/config/rules.mk - -DEFINES += -DIMPL_NS_NET diff --git a/netwerk/protocol/viewsource/Makefile.in b/netwerk/protocol/viewsource/Makefile.in index d66691c48d1..d117d3e08b7 100644 --- a/netwerk/protocol/viewsource/Makefile.in +++ b/netwerk/protocol/viewsource/Makefile.in @@ -36,14 +36,32 @@ # # ***** END LICENSE BLOCK ***** -DEPTH = ../../.. -topsrcdir = @top_srcdir@ -srcdir = @srcdir@ -VPATH = @srcdir@ +DEPTH = ../../.. +topsrcdir = @top_srcdir@ +srcdir = @srcdir@ +VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk -MODULE = necko -DIRS = public src +MODULE = necko +LIBRARY_NAME = nkviewsource_s +LIBXUL_LIBRARY = 1 +XPIDL_MODULE = necko_viewsource +GRE_MODULE = 1 + +FORCE_STATIC_LIB = 1 + +XPIDLSRCS = \ + nsIViewSourceChannel.idl \ + $(NULL) + +CPPSRCS = \ + nsViewSourceHandler.cpp \ + nsViewSourceChannel.cpp \ + $(NULL) + +LOCAL_INCLUDES = \ + -I$(srcdir)/../../base/src \ + $(NULL) include $(topsrcdir)/config/rules.mk diff --git a/netwerk/protocol/viewsource/public/nsIViewSourceChannel.idl b/netwerk/protocol/viewsource/nsIViewSourceChannel.idl similarity index 100% rename from netwerk/protocol/viewsource/public/nsIViewSourceChannel.idl rename to netwerk/protocol/viewsource/nsIViewSourceChannel.idl diff --git a/netwerk/protocol/viewsource/src/nsViewSourceChannel.cpp b/netwerk/protocol/viewsource/nsViewSourceChannel.cpp similarity index 100% rename from netwerk/protocol/viewsource/src/nsViewSourceChannel.cpp rename to netwerk/protocol/viewsource/nsViewSourceChannel.cpp diff --git a/netwerk/protocol/viewsource/src/nsViewSourceChannel.h b/netwerk/protocol/viewsource/nsViewSourceChannel.h similarity index 100% rename from netwerk/protocol/viewsource/src/nsViewSourceChannel.h rename to netwerk/protocol/viewsource/nsViewSourceChannel.h diff --git a/netwerk/protocol/viewsource/src/nsViewSourceHandler.cpp b/netwerk/protocol/viewsource/nsViewSourceHandler.cpp similarity index 100% rename from netwerk/protocol/viewsource/src/nsViewSourceHandler.cpp rename to netwerk/protocol/viewsource/nsViewSourceHandler.cpp diff --git a/netwerk/protocol/viewsource/src/nsViewSourceHandler.h b/netwerk/protocol/viewsource/nsViewSourceHandler.h similarity index 100% rename from netwerk/protocol/viewsource/src/nsViewSourceHandler.h rename to netwerk/protocol/viewsource/nsViewSourceHandler.h diff --git a/netwerk/protocol/viewsource/public/Makefile.in b/netwerk/protocol/viewsource/public/Makefile.in deleted file mode 100644 index e4085bfcc56..00000000000 --- a/netwerk/protocol/viewsource/public/Makefile.in +++ /dev/null @@ -1,54 +0,0 @@ -# -# ***** BEGIN LICENSE BLOCK ***** -# Version: MPL 1.1/GPL 2.0/LGPL 2.1 -# -# The contents of this file are subject to the Mozilla Public License Version -# 1.1 (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# http://www.mozilla.org/MPL/ -# -# Software distributed under the License is distributed on an "AS IS" basis, -# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License -# for the specific language governing rights and limitations under the -# License. -# -# The Original Code is mozilla.org code. -# -# The Initial Developer of the Original Code is -# Netscape Communications Corporation. -# Portions created by the Initial Developer are Copyright (C) 1998 -# the Initial Developer. All Rights Reserved. -# -# Contributor(s): -# -# Alternatively, the contents of this file may be used under the terms of -# either the GNU General Public License Version 2 or later (the "GPL"), or -# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), -# in which case the provisions of the GPL or the LGPL are applicable instead -# of those above. If you wish to allow use of your version of this file only -# under the terms of either the GPL or the LGPL, and not to allow others to -# use your version of this file under the terms of the MPL, indicate your -# decision by deleting the provisions above and replace them with the notice -# and other provisions required by the GPL or the LGPL. If you do not delete -# the provisions above, a recipient may use your version of this file under -# the terms of any one of the MPL, the GPL or the LGPL. -# -# ***** END LICENSE BLOCK ***** - -DEPTH = ../../../.. -topsrcdir = @top_srcdir@ -srcdir = @srcdir@ -VPATH = @srcdir@ - -include $(DEPTH)/config/autoconf.mk - -MODULE = necko -XPIDL_MODULE = necko_viewsource -GRE_MODULE = 1 - -XPIDLSRCS = \ - nsIViewSourceChannel.idl \ - $(NULL) - -include $(topsrcdir)/config/rules.mk - diff --git a/netwerk/protocol/viewsource/src/Makefile.in b/netwerk/protocol/viewsource/src/Makefile.in deleted file mode 100644 index cdc1c54154f..00000000000 --- a/netwerk/protocol/viewsource/src/Makefile.in +++ /dev/null @@ -1,62 +0,0 @@ -# -# ***** BEGIN LICENSE BLOCK ***** -# Version: MPL 1.1/GPL 2.0/LGPL 2.1 -# -# The contents of this file are subject to the Mozilla Public License Version -# 1.1 (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# http://www.mozilla.org/MPL/ -# -# Software distributed under the License is distributed on an "AS IS" basis, -# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License -# for the specific language governing rights and limitations under the -# License. -# -# The Original Code is mozilla.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): -# Chak Nanga -# -# Alternatively, the contents of this file may be used under the terms of -# either the GNU General Public License Version 2 or later (the "GPL"), or -# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), -# in which case the provisions of the GPL or the LGPL are applicable instead -# of those above. If you wish to allow use of your version of this file only -# under the terms of either the GPL or the LGPL, and not to allow others to -# use your version of this file under the terms of the MPL, indicate your -# decision by deleting the provisions above and replace them with the notice -# and other provisions required by the GPL or the LGPL. If you do not delete -# the provisions above, a recipient may use your version of this file under -# the terms of any one of the MPL, the GPL or the LGPL. -# -# ***** END LICENSE BLOCK ***** - -DEPTH = ../../../.. -topsrcdir = @top_srcdir@ -srcdir = @srcdir@ -VPATH = @srcdir@ - -include $(DEPTH)/config/autoconf.mk - -MODULE = necko -LIBRARY_NAME = nkviewsource_s -LIBXUL_LIBRARY = 1 - - -CPPSRCS = \ - nsViewSourceHandler.cpp \ - nsViewSourceChannel.cpp \ - $(NULL) - -LOCAL_INCLUDES=-I$(srcdir)/../../../base/src - -# we don't want the shared lib, but we want to force the creation of a -# static lib. -FORCE_STATIC_LIB = 1 - -include $(topsrcdir)/config/rules.mk diff --git a/netwerk/socket/Makefile.in b/netwerk/socket/Makefile.in index e81c1e594ef..bc5854f18a1 100644 --- a/netwerk/socket/Makefile.in +++ b/netwerk/socket/Makefile.in @@ -35,14 +35,34 @@ # # ***** END LICENSE BLOCK ***** -DEPTH = ../.. -topsrcdir = @top_srcdir@ -srcdir = @srcdir@ -VPATH = @srcdir@ +DEPTH = ../.. +topsrcdir = @top_srcdir@ +srcdir = @srcdir@ +VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk -DIRS = base +MODULE = necko +XPIDL_MODULE = necko_socket +LIBRARY_NAME = neckosocket_s +LIBXUL_LIBRARY = 1 + +FORCE_STATIC_LIB = 1 + +XPIDLSRCS = \ + nsISocketProvider.idl \ + nsISocketProviderService.idl \ + nsISOCKSSocketInfo.idl \ + nsISSLSocketControl.idl \ + nsITransportSecurityInfo.idl \ + $(NULL) + +CPPSRCS = \ + nsSocketProviderService.cpp \ + nsSOCKSSocketProvider.cpp \ + nsSOCKSIOLayer.cpp \ + nsUDPSocketProvider.cpp \ + $(NULL) include $(topsrcdir)/config/rules.mk diff --git a/netwerk/socket/base/Makefile.in b/netwerk/socket/base/Makefile.in deleted file mode 100644 index 723bb280475..00000000000 --- a/netwerk/socket/base/Makefile.in +++ /dev/null @@ -1,73 +0,0 @@ -# vim: noexpandtab ts=4 sw=4 -# -# ***** BEGIN LICENSE BLOCK ***** -# Version: MPL 1.1/GPL 2.0/LGPL 2.1 -# -# The contents of this file are subject to the Mozilla Public License Version -# 1.1 (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# http://www.mozilla.org/MPL/ -# -# Software distributed under the License is distributed on an "AS IS" basis, -# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License -# for the specific language governing rights and limitations under the -# License. -# -# The Original Code is mozilla.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 MPL, indicate your -# decision by deleting the provisions above and replace them with the notice -# and other provisions required by the GPL or the LGPL. If you do not delete -# the provisions above, a recipient may use your version of this file under -# the terms of any one of the MPL, the GPL or the LGPL. -# -# ***** END LICENSE BLOCK ***** - -DEPTH = ../../.. -topsrcdir = @top_srcdir@ -srcdir = @srcdir@ -VPATH = @srcdir@ - -include $(DEPTH)/config/autoconf.mk - -MODULE = necko -XPIDL_MODULE = necko_socket -LIBRARY_NAME = neckosocket_s -LIBXUL_LIBRARY = 1 - - -CPPSRCS = \ - nsSocketProviderService.cpp \ - nsSOCKSSocketProvider.cpp \ - nsSOCKSIOLayer.cpp \ - nsUDPSocketProvider.cpp \ - $(NULL) - -XPIDLSRCS = \ - nsISocketProvider.idl \ - nsISocketProviderService.idl \ - nsISOCKSSocketInfo.idl \ - nsITransportSecurityInfo.idl \ - nsISSLSocketControl.idl \ - $(NULL) - -# we don't want the shared lib, but we want to force the creation of a -# static lib. -FORCE_STATIC_LIB = 1 - -include $(topsrcdir)/config/rules.mk - -DEFINES += -DIMPL_NS_NET diff --git a/netwerk/socket/base/nsISOCKSSocketInfo.idl b/netwerk/socket/nsISOCKSSocketInfo.idl similarity index 100% rename from netwerk/socket/base/nsISOCKSSocketInfo.idl rename to netwerk/socket/nsISOCKSSocketInfo.idl diff --git a/netwerk/socket/base/nsISSLSocketControl.idl b/netwerk/socket/nsISSLSocketControl.idl similarity index 100% rename from netwerk/socket/base/nsISSLSocketControl.idl rename to netwerk/socket/nsISSLSocketControl.idl diff --git a/netwerk/socket/base/nsISocketProvider.idl b/netwerk/socket/nsISocketProvider.idl similarity index 100% rename from netwerk/socket/base/nsISocketProvider.idl rename to netwerk/socket/nsISocketProvider.idl diff --git a/netwerk/socket/base/nsISocketProviderService.idl b/netwerk/socket/nsISocketProviderService.idl similarity index 100% rename from netwerk/socket/base/nsISocketProviderService.idl rename to netwerk/socket/nsISocketProviderService.idl diff --git a/netwerk/socket/base/nsITransportSecurityInfo.idl b/netwerk/socket/nsITransportSecurityInfo.idl similarity index 100% rename from netwerk/socket/base/nsITransportSecurityInfo.idl rename to netwerk/socket/nsITransportSecurityInfo.idl diff --git a/netwerk/socket/base/nsSOCKS4SocketProvider.h b/netwerk/socket/nsSOCKS4SocketProvider.h similarity index 100% rename from netwerk/socket/base/nsSOCKS4SocketProvider.h rename to netwerk/socket/nsSOCKS4SocketProvider.h diff --git a/netwerk/socket/base/nsSOCKSIOLayer.cpp b/netwerk/socket/nsSOCKSIOLayer.cpp similarity index 100% rename from netwerk/socket/base/nsSOCKSIOLayer.cpp rename to netwerk/socket/nsSOCKSIOLayer.cpp diff --git a/netwerk/socket/base/nsSOCKSIOLayer.h b/netwerk/socket/nsSOCKSIOLayer.h similarity index 100% rename from netwerk/socket/base/nsSOCKSIOLayer.h rename to netwerk/socket/nsSOCKSIOLayer.h diff --git a/netwerk/socket/base/nsSOCKSSocketProvider.cpp b/netwerk/socket/nsSOCKSSocketProvider.cpp similarity index 100% rename from netwerk/socket/base/nsSOCKSSocketProvider.cpp rename to netwerk/socket/nsSOCKSSocketProvider.cpp diff --git a/netwerk/socket/base/nsSOCKSSocketProvider.h b/netwerk/socket/nsSOCKSSocketProvider.h similarity index 100% rename from netwerk/socket/base/nsSOCKSSocketProvider.h rename to netwerk/socket/nsSOCKSSocketProvider.h diff --git a/netwerk/socket/base/nsSocketProviderService.cpp b/netwerk/socket/nsSocketProviderService.cpp similarity index 100% rename from netwerk/socket/base/nsSocketProviderService.cpp rename to netwerk/socket/nsSocketProviderService.cpp diff --git a/netwerk/socket/base/nsSocketProviderService.h b/netwerk/socket/nsSocketProviderService.h similarity index 100% rename from netwerk/socket/base/nsSocketProviderService.h rename to netwerk/socket/nsSocketProviderService.h diff --git a/netwerk/socket/base/nsUDPSocketProvider.cpp b/netwerk/socket/nsUDPSocketProvider.cpp similarity index 100% rename from netwerk/socket/base/nsUDPSocketProvider.cpp rename to netwerk/socket/nsUDPSocketProvider.cpp diff --git a/netwerk/socket/base/nsUDPSocketProvider.h b/netwerk/socket/nsUDPSocketProvider.h similarity index 100% rename from netwerk/socket/base/nsUDPSocketProvider.h rename to netwerk/socket/nsUDPSocketProvider.h diff --git a/netwerk/test/Makefile.in b/netwerk/test/Makefile.in index 4a8ff4d4577..77b2e94862b 100644 --- a/netwerk/test/Makefile.in +++ b/netwerk/test/Makefile.in @@ -113,5 +113,5 @@ install:: $(_RES_FILES) # up in the test directory. libs:: $(NSINSTALL) -D $(DEPTH)/_tests/xpcshell/$(MODULE)/unit/data - $(INSTALL) $(topsrcdir)/netwerk/dns/src/effective_tld_names.dat \ + $(INSTALL) $(topsrcdir)/netwerk/dns/effective_tld_names.dat \ $(DEPTH)/_tests/xpcshell/$(MODULE)/unit/ diff --git a/netwerk/wifi/Makefile.in b/netwerk/wifi/Makefile.in index 5c1f4e83572..f90acf56600 100644 --- a/netwerk/wifi/Makefile.in +++ b/netwerk/wifi/Makefile.in @@ -34,14 +34,49 @@ # # ***** END LICENSE BLOCK ***** -DEPTH = ../.. -topsrcdir = @top_srcdir@ -srcdir = @srcdir@ -VPATH = @srcdir@ +DEPTH = ../.. +topsrcdir = @top_srcdir@ +srcdir = @srcdir@ +VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk -DIRS = public src +MODULE = necko +LIBRARY_NAME = neckowifi_s +LIBXUL_LIBRARY = 1 +XPIDL_MODULE = necko_wifi +GRE_MODULE = 1 + +FORCE_STATIC_LIB = 1 + +XPIDLSRCS = \ + nsIWifiAccessPoint.idl \ + nsIWifiListener.idl \ + nsIWifiMonitor.idl \ + $(NULL) + +CPPSRCS = \ + nsWifiMonitor.cpp \ + nsWifiAccessPoint.cpp \ + $(NULL) + +ifeq ($(OS_ARCH),Darwin) +CPPSRCS += nsWifiScannerMac.cpp +CMMSRCS = osx_corewlan.mm +else +ifneq (,$(filter WINCE WINNT,$(OS_ARCH))) +CPPSRCS += nsWifiScannerWin.cpp +else +ifeq ($(OS_ARCH),Linux) +CPPSRCS += nsWifiScannerUnix.cpp +else +ifeq ($(OS_ARCH),SunOS) +CPPSRCS += nsWifiScannerSolaris.cpp +OS_INCLUDES += $(GLIB_CFLAGS) +endif # solaris +endif # linux +endif # windows +endif # mac include $(topsrcdir)/config/rules.mk diff --git a/netwerk/wifi/public/nsIWifiAccessPoint.idl b/netwerk/wifi/nsIWifiAccessPoint.idl similarity index 100% rename from netwerk/wifi/public/nsIWifiAccessPoint.idl rename to netwerk/wifi/nsIWifiAccessPoint.idl diff --git a/netwerk/wifi/public/nsIWifiListener.idl b/netwerk/wifi/nsIWifiListener.idl similarity index 100% rename from netwerk/wifi/public/nsIWifiListener.idl rename to netwerk/wifi/nsIWifiListener.idl diff --git a/netwerk/wifi/public/nsIWifiMonitor.idl b/netwerk/wifi/nsIWifiMonitor.idl similarity index 100% rename from netwerk/wifi/public/nsIWifiMonitor.idl rename to netwerk/wifi/nsIWifiMonitor.idl diff --git a/netwerk/wifi/src/nsWifiAccessPoint.cpp b/netwerk/wifi/nsWifiAccessPoint.cpp similarity index 100% rename from netwerk/wifi/src/nsWifiAccessPoint.cpp rename to netwerk/wifi/nsWifiAccessPoint.cpp diff --git a/netwerk/wifi/src/nsWifiAccessPoint.h b/netwerk/wifi/nsWifiAccessPoint.h similarity index 100% rename from netwerk/wifi/src/nsWifiAccessPoint.h rename to netwerk/wifi/nsWifiAccessPoint.h diff --git a/netwerk/wifi/src/nsWifiMonitor.cpp b/netwerk/wifi/nsWifiMonitor.cpp similarity index 100% rename from netwerk/wifi/src/nsWifiMonitor.cpp rename to netwerk/wifi/nsWifiMonitor.cpp diff --git a/netwerk/wifi/src/nsWifiMonitor.h b/netwerk/wifi/nsWifiMonitor.h similarity index 100% rename from netwerk/wifi/src/nsWifiMonitor.h rename to netwerk/wifi/nsWifiMonitor.h diff --git a/netwerk/wifi/src/nsWifiScannerMac.cpp b/netwerk/wifi/nsWifiScannerMac.cpp similarity index 100% rename from netwerk/wifi/src/nsWifiScannerMac.cpp rename to netwerk/wifi/nsWifiScannerMac.cpp diff --git a/netwerk/wifi/src/nsWifiScannerSolaris.cpp b/netwerk/wifi/nsWifiScannerSolaris.cpp similarity index 100% rename from netwerk/wifi/src/nsWifiScannerSolaris.cpp rename to netwerk/wifi/nsWifiScannerSolaris.cpp diff --git a/netwerk/wifi/src/nsWifiScannerUnix.cpp b/netwerk/wifi/nsWifiScannerUnix.cpp similarity index 100% rename from netwerk/wifi/src/nsWifiScannerUnix.cpp rename to netwerk/wifi/nsWifiScannerUnix.cpp diff --git a/netwerk/wifi/src/nsWifiScannerWin.cpp b/netwerk/wifi/nsWifiScannerWin.cpp similarity index 100% rename from netwerk/wifi/src/nsWifiScannerWin.cpp rename to netwerk/wifi/nsWifiScannerWin.cpp diff --git a/netwerk/wifi/src/osx_corewlan.mm b/netwerk/wifi/osx_corewlan.mm similarity index 100% rename from netwerk/wifi/src/osx_corewlan.mm rename to netwerk/wifi/osx_corewlan.mm diff --git a/netwerk/wifi/src/osx_wifi.h b/netwerk/wifi/osx_wifi.h similarity index 100% rename from netwerk/wifi/src/osx_wifi.h rename to netwerk/wifi/osx_wifi.h diff --git a/netwerk/wifi/public/Makefile.in b/netwerk/wifi/public/Makefile.in deleted file mode 100644 index bf7fc62cfdf..00000000000 --- a/netwerk/wifi/public/Makefile.in +++ /dev/null @@ -1,56 +0,0 @@ -# ***** BEGIN LICENSE BLOCK ***** -# Version: MPL 1.1/GPL 2.0/LGPL 2.1 -# -# The contents of this file are subject to the Mozilla Public License Version -# 1.1 (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# http://www.mozilla.org/MPL/ -# -# Software distributed under the License is distributed on an "AS IS" basis, -# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License -# for the specific language governing rights and limitations under the -# License. -# -# The Original Code is mozilla.org build system. -# -# The Initial Developer of the Original Code is Mozilla Foundation -# Portions created by the Initial Developer are Copyright (C) 2009 -# the Initial Developer. All Rights Reserved. -# -# Contributor(s): -# Doug Turner -# -# Alternatively, the contents of this file may be used under the terms of -# either the GNU General Public License Version 2 or later (the "GPL"), or -# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), -# in which case the provisions of the GPL or the LGPL are applicable instead -# of those above. If you wish to allow use of your version of this file only -# under the terms of either the GPL or the LGPL, and not to allow others to -# use your version of this file under the terms of the MPL, indicate your -# decision by deleting the provisions above and replace them with the notice -# and other provisions required by the GPL or the LGPL. If you do not delete -# the provisions above, a recipient may use your version of this file under -# the terms of any one of the MPL, the GPL or the LGPL. -# -# ***** END LICENSE BLOCK ***** - -DEPTH = ../../.. -topsrcdir = @top_srcdir@ -srcdir = @srcdir@ -VPATH = @srcdir@ - -include $(DEPTH)/config/autoconf.mk - -MODULE = necko -XPIDL_MODULE = necko_wifi -GRE_MODULE = 1 - -XPIDLSRCS = \ - nsIWifiMonitor.idl \ - nsIWifiListener.idl \ - nsIWifiAccessPoint.idl \ - $(NULL) - -include $(topsrcdir)/config/rules.mk - -DEFINES += -DIMPL_NS_NET diff --git a/netwerk/wifi/src/Makefile.in b/netwerk/wifi/src/Makefile.in deleted file mode 100644 index dad863f189b..00000000000 --- a/netwerk/wifi/src/Makefile.in +++ /dev/null @@ -1,74 +0,0 @@ -# ***** BEGIN LICENSE BLOCK ***** -# Version: MPL 1.1/GPL 2.0/LGPL 2.1 -# -# The contents of this file are subject to the Mozilla Public License Version -# 1.1 (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# http://www.mozilla.org/MPL/ -# -# Software distributed under the License is distributed on an "AS IS" basis, -# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License -# for the specific language governing rights and limitations under the -# License. -# -# The Original Code is mozilla.org build system. -# -# The Initial Developer of the Original Code is Mozilla Foundation -# Portions created by the Initial Developer are Copyright (C) 2009 -# the Initial Developer. All Rights Reserved. -# -# Contributor(s): -# Doug Turner -# -# Alternatively, the contents of this file may be used under the terms of -# either the GNU General Public License Version 2 or later (the "GPL"), or -# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), -# in which case the provisions of the GPL or the LGPL are applicable instead -# of those above. If you wish to allow use of your version of this file only -# under the terms of either the GPL or the LGPL, and not to allow others to -# use your version of this file under the terms of the MPL, indicate your -# decision by deleting the provisions above and replace them with the notice -# and other provisions required by the GPL or the LGPL. If you do not delete -# the provisions above, a recipient may use your version of this file under -# the terms of any one of the MPL, the GPL or the LGPL. -# -# ***** END LICENSE BLOCK ***** - -DEPTH = ../../.. -topsrcdir = @top_srcdir@ -srcdir = @srcdir@ -VPATH = @srcdir@ - -include $(DEPTH)/config/autoconf.mk - -MODULE = necko -LIBRARY_NAME = neckowifi_s -FORCE_STATIC_LIB = 1 -LIBXUL_LIBRARY = 1 - - -CPPSRCS = nsWifiMonitor.cpp \ - nsWifiAccessPoint.cpp \ - $(NULL) - -ifeq ($(OS_ARCH),Darwin) -CPPSRCS += nsWifiScannerMac.cpp -CMMSRCS = osx_corewlan.mm -else -ifneq (,$(filter WINCE WINNT,$(OS_ARCH))) -CPPSRCS += nsWifiScannerWin.cpp -else -ifeq ($(OS_ARCH),Linux) -CPPSRCS += nsWifiScannerUnix.cpp -else -ifeq ($(OS_ARCH),SunOS) -CPPSRCS += nsWifiScannerSolaris.cpp -OS_INCLUDES += $(GLIB_CFLAGS) -endif # solaris -endif # linux -endif # windows -endif # mac - -include $(topsrcdir)/config/rules.mk - -DEFINES += -DIMPL_NS_NET diff --git a/netwerk/wifi/src/wlanapi.h b/netwerk/wifi/wlanapi.h similarity index 100% rename from netwerk/wifi/src/wlanapi.h rename to netwerk/wifi/wlanapi.h diff --git a/toolkit/toolkit-makefiles.sh b/toolkit/toolkit-makefiles.sh index 0c0ca775aa5..bb9f9127a77 100644 --- a/toolkit/toolkit-makefiles.sh +++ b/toolkit/toolkit-makefiles.sh @@ -355,45 +355,20 @@ MAKEFILES_netwerk=" netwerk/base/src/Makefile netwerk/build/Makefile netwerk/cache/Makefile - netwerk/cache/public/Makefile - netwerk/cache/src/Makefile netwerk/cookie/Makefile - netwerk/cookie/public/Makefile - netwerk/cookie/src/Makefile netwerk/wifi/Makefile - netwerk/wifi/public/Makefile - netwerk/wifi/src/Makefile netwerk/dns/Makefile - netwerk/dns/public/Makefile - netwerk/dns/src/Makefile netwerk/protocol/Makefile netwerk/protocol/about/Makefile - netwerk/protocol/about/public/Makefile - netwerk/protocol/about/src/Makefile netwerk/protocol/data/Makefile - netwerk/protocol/data/src/Makefile netwerk/protocol/file/Makefile - netwerk/protocol/file/public/Makefile - netwerk/protocol/file/src/Makefile netwerk/protocol/ftp/Makefile - netwerk/protocol/ftp/public/Makefile - netwerk/protocol/ftp/src/Makefile netwerk/protocol/gopher/Makefile - netwerk/protocol/gopher/src/Makefile netwerk/protocol/http/Makefile - netwerk/protocol/http/public/Makefile - netwerk/protocol/http/src/Makefile netwerk/protocol/res/Makefile - netwerk/protocol/res/public/Makefile - netwerk/protocol/res/src/Makefile netwerk/protocol/viewsource/Makefile - netwerk/protocol/viewsource/public/Makefile - netwerk/protocol/viewsource/src/Makefile netwerk/mime/Makefile - netwerk/mime/public/Makefile - netwerk/mime/src/Makefile netwerk/socket/Makefile - netwerk/socket/base/Makefile netwerk/streamconv/Makefile netwerk/streamconv/converters/Makefile netwerk/streamconv/public/Makefile From f67757dd97cf0f8ff30f56301085ac539c62c375 Mon Sep 17 00:00:00 2001 From: Ben Parr Date: Wed, 26 May 2010 18:00:00 -0400 Subject: [PATCH 02/30] Bug 553483 - ""Language" category should not be visible if there are no language packs installed" [r=Unfocused] --- .../mozapps/extensions/content/extensions.js | 36 +++++++++++++++++++ .../mozapps/extensions/content/extensions.xul | 4 +-- 2 files changed, 38 insertions(+), 2 deletions(-) diff --git a/toolkit/mozapps/extensions/content/extensions.js b/toolkit/mozapps/extensions/content/extensions.js index 5c6aa6a34bf..03c581bdb52 100644 --- a/toolkit/mozapps/extensions/content/extensions.js +++ b/toolkit/mozapps/extensions/content/extensions.js @@ -613,6 +613,42 @@ var gCategories = { gViewController.loadView(viewId); } }, false); + + var maybeHidden = ["addons://list/language", "addons://list/searchengine"]; + maybeHidden.forEach(function(aId) { + var type = gViewController.parseViewId(aId).param; + AddonManager.getAddonsByTypes([type], function(aAddonsList) { + self.get(aId).hidden = (aAddonsList.length == 0); + + if (aAddonsList.length > 0) + return; + + gEventManager.registerInstallListener({ + onNewInstall: function(aInstall) { + this._maybeShowCategory(aInstall); + }, + + onInstallStarted: function(aInstall) { + this._maybeShowCategory(aInstall); + }, + + onInstallEnded: function(aInstall, aAddon) { + this._maybeShowCategory(aAddon); + }, + + onExternalInstall: function(aAddon, aExistingAddon, aRequiresRestart) { + this._maybeShowCategory(aAddon); + }, + + _maybeShowCategory: function(aAddon) { + if (type == aAddon.type) { + self.get(aId).hidden = false; + gEventManager.unregisterInstallListener(this); + } + } + }); + }); + }); }, select: function(aId) { diff --git a/toolkit/mozapps/extensions/content/extensions.xul b/toolkit/mozapps/extensions/content/extensions.xul index 28313ddbe75..8c528caf4ba 100644 --- a/toolkit/mozapps/extensions/content/extensions.xul +++ b/toolkit/mozapps/extensions/content/extensions.xul @@ -108,11 +108,11 @@ name="&view.discover.label;"/> + name="&view.languages.label;" hidden="true"/> + name="&view.searchengines.label;" hidden="true"/> From 13a1c79b09dfe8472af291698320308171f0fd7b Mon Sep 17 00:00:00 2001 From: Chiaki Ishikawa Date: Tue, 25 May 2010 09:01:00 -0400 Subject: [PATCH 03/30] Bug 559833 - "Should fix incorrect indentation of nsHelperAppDlg.js" [r=paolo] --- toolkit/mozapps/downloads/nsHelperAppDlg.js | 1929 ++++++++++--------- 1 file changed, 966 insertions(+), 963 deletions(-) diff --git a/toolkit/mozapps/downloads/nsHelperAppDlg.js b/toolkit/mozapps/downloads/nsHelperAppDlg.js index ab7395c5501..5280212a5cc 100644 --- a/toolkit/mozapps/downloads/nsHelperAppDlg.js +++ b/toolkit/mozapps/downloads/nsHelperAppDlg.js @@ -1,5 +1,6 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim: set ts=2 et sw=2 tw=80: */ /* -# -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- # ***** BEGIN LICENSE BLOCK ***** # Version: MPL 1.1/GPL 2.0/LGPL 2.1 # @@ -83,904 +84,906 @@ Components.utils.import("resource://gre/modules/DownloadPaths.jsm"); /* ctor */ function nsUnknownContentTypeDialog() { - // Initialize data properties. - this.mLauncher = null; - this.mContext = null; - this.mSourcePath = null; - this.chosenApp = null; - this.givenDefaultApp = false; - this.updateSelf = true; - this.mTitle = ""; + // Initialize data properties. + this.mLauncher = null; + this.mContext = null; + this.mSourcePath = null; + this.chosenApp = null; + this.givenDefaultApp = false; + this.updateSelf = true; + this.mTitle = ""; } nsUnknownContentTypeDialog.prototype = { - nsIMIMEInfo : Components.interfaces.nsIMIMEInfo, + nsIMIMEInfo : Components.interfaces.nsIMIMEInfo, - QueryInterface: function (iid) { - if (!iid.equals(Components.interfaces.nsIHelperAppLauncherDialog) && - !iid.equals(Components.interfaces.nsITimerCallback) && - !iid.equals(Components.interfaces.nsISupports)) { - throw Components.results.NS_ERROR_NO_INTERFACE; - } - return this; - }, + QueryInterface: function (iid) { + if (!iid.equals(Components.interfaces.nsIHelperAppLauncherDialog) && + !iid.equals(Components.interfaces.nsITimerCallback) && + !iid.equals(Components.interfaces.nsISupports)) { + throw Components.results.NS_ERROR_NO_INTERFACE; + } + return this; + }, - // ---------- nsIHelperAppLauncherDialog methods ---------- + // ---------- nsIHelperAppLauncherDialog methods ---------- - // show: Open XUL dialog using window watcher. Since the dialog is not - // modal, it needs to be a top level window and the way to open - // one of those is via that route). - show: function(aLauncher, aContext, aReason) { - this.mLauncher = aLauncher; - this.mContext = aContext; + // show: Open XUL dialog using window watcher. Since the dialog is not + // modal, it needs to be a top level window and the way to open + // one of those is via that route). + show: function(aLauncher, aContext, aReason) { + this.mLauncher = aLauncher; + this.mContext = aContext; - const nsITimer = Components.interfaces.nsITimer; - this._showTimer = Components.classes["@mozilla.org/timer;1"] - .createInstance(nsITimer); - this._showTimer.initWithCallback(this, 0, nsITimer.TYPE_ONE_SHOT); - }, + const nsITimer = Components.interfaces.nsITimer; + this._showTimer = Components.classes["@mozilla.org/timer;1"] + .createInstance(nsITimer); + this._showTimer.initWithCallback(this, 0, nsITimer.TYPE_ONE_SHOT); + }, - // When opening from new tab, if tab closes while dialog is opening, - // (which is a race condition on the XUL file being cached and the timer - // in nsExternalHelperAppService), the dialog gets a blur and doesn't - // activate the OK button. So we wait a bit before doing opening it. - reallyShow: function() { - try { - var ir = this.mContext.QueryInterface(Components.interfaces.nsIInterfaceRequestor); - var dwi = ir.getInterface(Components.interfaces.nsIDOMWindowInternal); - var ww = Components.classes["@mozilla.org/embedcomp/window-watcher;1"] - .getService(Components.interfaces.nsIWindowWatcher); - this.mDialog = ww.openWindow(dwi, - "chrome://mozapps/content/downloads/unknownContentType.xul", - null, - "chrome,centerscreen,titlebar,dialog=yes,dependent", - null); - } catch (ex) { - // The containing window may have gone away. Break reference - // cycles and stop doing the download. - const NS_BINDING_ABORTED = 0x804b0002; - this.mLauncher.cancel(NS_BINDING_ABORTED); - return; - } + // When opening from new tab, if tab closes while dialog is opening, + // (which is a race condition on the XUL file being cached and the timer + // in nsExternalHelperAppService), the dialog gets a blur and doesn't + // activate the OK button. So we wait a bit before doing opening it. + reallyShow: function() { + try { + var ir = this.mContext.QueryInterface(Components.interfaces.nsIInterfaceRequestor); + var dwi = ir.getInterface(Components.interfaces.nsIDOMWindowInternal); + var ww = Components.classes["@mozilla.org/embedcomp/window-watcher;1"] + .getService(Components.interfaces.nsIWindowWatcher); + this.mDialog = ww.openWindow(dwi, + "chrome://mozapps/content/downloads/unknownContentType.xul", + null, + "chrome,centerscreen,titlebar,dialog=yes,dependent", + null); + } catch (ex) { + // The containing window may have gone away. Break reference + // cycles and stop doing the download. + const NS_BINDING_ABORTED = 0x804b0002; + this.mLauncher.cancel(NS_BINDING_ABORTED); + return; + } - // Hook this object to the dialog. - this.mDialog.dialog = this; + // Hook this object to the dialog. + this.mDialog.dialog = this; - // Hook up utility functions. - this.getSpecialFolderKey = this.mDialog.getSpecialFolderKey; + // Hook up utility functions. + this.getSpecialFolderKey = this.mDialog.getSpecialFolderKey; - // Watch for error notifications. - this.progressListener.helperAppDlg = this; - this.mLauncher.setWebProgressListener(this.progressListener); - }, + // Watch for error notifications. + this.progressListener.helperAppDlg = this; + this.mLauncher.setWebProgressListener(this.progressListener); + }, - // promptForSaveToFile: Display file picker dialog and return selected file. - // This is called by the External Helper App Service - // after the ucth dialog calls |saveToDisk| with a null - // target filename (no target, therefore user must pick). - // - // Alternatively, if the user has selected to have all - // files download to a specific location, return that - // location and don't ask via the dialog. - // - // Note - this function is called without a dialog, so it cannot access any part - // of the dialog XUL as other functions on this object do. - promptForSaveToFile: function(aLauncher, aContext, aDefaultFile, aSuggestedFileExtension, aForcePrompt) { - var result = null; - - this.mLauncher = aLauncher; + // promptForSaveToFile: Display file picker dialog and return selected file. + // This is called by the External Helper App Service + // after the ucth dialog calls |saveToDisk| with a null + // target filename (no target, therefore user must pick). + // + // Alternatively, if the user has selected to have all + // files download to a specific location, return that + // location and don't ask via the dialog. + // + // Note - this function is called without a dialog, so it cannot access any part + // of the dialog XUL as other functions on this object do. + promptForSaveToFile: function(aLauncher, aContext, aDefaultFile, aSuggestedFileExtension, aForcePrompt) { + var result = null; - let prefs = Components.classes["@mozilla.org/preferences-service;1"] - .getService(Components.interfaces.nsIPrefBranch); - let bundle = Components.classes["@mozilla.org/intl/stringbundle;1"]. - getService(Components.interfaces.nsIStringBundleService). - createBundle("chrome://mozapps/locale/downloads/unknownContentType.properties"); + this.mLauncher = aLauncher; - if (!aForcePrompt) { - // Check to see if the user wishes to auto save to the default download - // folder without prompting. Note that preference might not be set. - let autodownload = false; - try { - autodownload = prefs.getBoolPref(PREF_BD_USEDOWNLOADDIR); - } catch (e) { } - - if (autodownload) { - // Retrieve the user's default download directory - let dnldMgr = Components.classes["@mozilla.org/download-manager;1"] - .getService(Components.interfaces.nsIDownloadManager); - let defaultFolder = dnldMgr.userDownloadsDirectory; + let prefs = Components.classes["@mozilla.org/preferences-service;1"] + .getService(Components.interfaces.nsIPrefBranch); + let bundle = Components.classes["@mozilla.org/intl/stringbundle;1"]. + getService(Components.interfaces.nsIStringBundleService). + createBundle("chrome://mozapps/locale/downloads/unknownContentType.properties"); - try { - result = this.validateLeafName(defaultFolder, aDefaultFile, aSuggestedFileExtension); - } - catch (ex) { - if (ex.result == Components.results.NS_ERROR_FILE_ACCESS_DENIED) { - let prompter = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]. - getService(Components.interfaces.nsIPromptService); - - // Display error alert (using text supplied by back-end) - prompter.alert(this.dialog, - bundle.GetStringFromName("badPermissions.title"), - bundle.GetStringFromName("badPermissions")); - - return; - } - } - - // Check to make sure we have a valid directory, otherwise, prompt - if (result) - return result; - } - } - - // Use file picker to show dialog. - var nsIFilePicker = Components.interfaces.nsIFilePicker; - var picker = Components.classes["@mozilla.org/filepicker;1"].createInstance(nsIFilePicker); - var windowTitle = bundle.GetStringFromName("saveDialogTitle"); - var parent = aContext.QueryInterface(Components.interfaces.nsIInterfaceRequestor).getInterface(Components.interfaces.nsIDOMWindowInternal); - picker.init(parent, windowTitle, nsIFilePicker.modeSave); - picker.defaultString = aDefaultFile; - - if (aSuggestedFileExtension) { - // aSuggestedFileExtension includes the period, so strip it - picker.defaultExtension = aSuggestedFileExtension.substring(1); - } - else { - try { - picker.defaultExtension = this.mLauncher.MIMEInfo.primaryExtension; - } - catch (ex) { } - } - - var wildCardExtension = "*"; - if (aSuggestedFileExtension) { - wildCardExtension += aSuggestedFileExtension; - picker.appendFilter(this.mLauncher.MIMEInfo.description, wildCardExtension); - } - - picker.appendFilters( nsIFilePicker.filterAll ); - - // Default to lastDir if it is valid, otherwise use the user's default - // downloads directory. userDownloadsDirectory should always return a - // valid directory, so we can safely default to it. - var dnldMgr = Components.classes["@mozilla.org/download-manager;1"] - .getService(Components.interfaces.nsIDownloadManager); - picker.displayDirectory = dnldMgr.userDownloadsDirectory; - - // The last directory preference may not exist, which will throw. + if (!aForcePrompt) { + // Check to see if the user wishes to auto save to the default download + // folder without prompting. Note that preference might not be set. + let autodownload = false; try { - var lastDir = gDownloadLastDir.file; - if (isUsableDirectory(lastDir)) - picker.displayDirectory = lastDir; + autodownload = prefs.getBoolPref(PREF_BD_USEDOWNLOADDIR); + } catch (e) { } + + if (autodownload) { + // Retrieve the user's default download directory + let dnldMgr = Components.classes["@mozilla.org/download-manager;1"] + .getService(Components.interfaces.nsIDownloadManager); + let defaultFolder = dnldMgr.userDownloadsDirectory; + + try { + result = this.validateLeafName(defaultFolder, aDefaultFile, aSuggestedFileExtension); + } + catch (ex) { + if (ex.result == Components.results.NS_ERROR_FILE_ACCESS_DENIED) { + let prompter = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]. + getService(Components.interfaces.nsIPromptService); + + // Display error alert (using text supplied by back-end) + prompter.alert(this.dialog, + bundle.GetStringFromName("badPermissions.title"), + bundle.GetStringFromName("badPermissions")); + + return; + } + } + + // Check to make sure we have a valid directory, otherwise, prompt + if (result) + return result; + } + } + + // Use file picker to show dialog. + var nsIFilePicker = Components.interfaces.nsIFilePicker; + var picker = Components.classes["@mozilla.org/filepicker;1"].createInstance(nsIFilePicker); + var windowTitle = bundle.GetStringFromName("saveDialogTitle"); + var parent = aContext.QueryInterface(Components.interfaces.nsIInterfaceRequestor).getInterface(Components.interfaces.nsIDOMWindowInternal); + picker.init(parent, windowTitle, nsIFilePicker.modeSave); + picker.defaultString = aDefaultFile; + + if (aSuggestedFileExtension) { + // aSuggestedFileExtension includes the period, so strip it + picker.defaultExtension = aSuggestedFileExtension.substring(1); + } + else { + try { + picker.defaultExtension = this.mLauncher.MIMEInfo.primaryExtension; + } + catch (ex) { } + } + + var wildCardExtension = "*"; + if (aSuggestedFileExtension) { + wildCardExtension += aSuggestedFileExtension; + picker.appendFilter(this.mLauncher.MIMEInfo.description, wildCardExtension); + } + + picker.appendFilters( nsIFilePicker.filterAll ); + + // Default to lastDir if it is valid, otherwise use the user's default + // downloads directory. userDownloadsDirectory should always return a + // valid directory, so we can safely default to it. + var dnldMgr = Components.classes["@mozilla.org/download-manager;1"] + .getService(Components.interfaces.nsIDownloadManager); + picker.displayDirectory = dnldMgr.userDownloadsDirectory; + + // The last directory preference may not exist, which will throw. + try { + var lastDir = gDownloadLastDir.file; + if (isUsableDirectory(lastDir)) + picker.displayDirectory = lastDir; + } + catch (ex) { + } + + if (picker.show() == nsIFilePicker.returnCancel) { + // null result means user cancelled. + return null; + } + + // Be sure to save the directory the user chose through the Save As... + // dialog as the new browser.download.dir since the old one + // didn't exist. + result = picker.file; + + if (result) { + try { + // Remove the file so that it's not there when we ensure non-existence later; + // this is safe because for the file to exist, the user would have had to + // confirm that he wanted the file overwritten. + if (result.exists()) + result.remove(false); + } + catch (e) { } + var newDir = result.parent.QueryInterface(Components.interfaces.nsILocalFile); + + // Do not store the last save directory as a pref inside the private browsing mode + gDownloadLastDir.file = newDir; + + result = this.validateLeafName(newDir, result.leafName, null); + } + return result; + }, + + /** + * Ensures that a local folder/file combination does not already exist in + * the file system (or finds such a combination with a reasonably similar + * leaf name), creates the corresponding file, and returns it. + * + * @param aLocalFile + * the folder where the file resides + * @param aLeafName + * the string name of the file (may be empty if no name is known, + * in which case a name will be chosen) + * @param aFileExt + * the extension of the file, if one is known; this will be ignored + * if aLeafName is non-empty + * @returns nsILocalFile + * the created file + */ + validateLeafName: function (aLocalFile, aLeafName, aFileExt) + { + if (!(aLocalFile && isUsableDirectory(aLocalFile))) + return null; + + // Remove any leading periods, since we don't want to save hidden files + // automatically. + aLeafName = aLeafName.replace(/^\.+/, ""); + + if (aLeafName == "") + aLeafName = "unnamed" + (aFileExt ? "." + aFileExt : ""); + aLocalFile.append(aLeafName); + + var createdFile = DownloadPaths.createNiceUniqueFile(aLocalFile); + +#ifdef XP_WIN + let ext; + try { + // We can fail here if there's no primary extension set + ext = "." + this.mLauncher.MIMEInfo.primaryExtension; + } catch (e) { } + + // Append a file extension if it's an executable that doesn't have one + // but make sure we actually have an extension to add + let leaf = createdFile.leafName; + if (ext && leaf.slice(-ext.length) != ext && createdFile.isExecutable()) { + createdFile.remove(false); + aLocalFile.leafName = leaf + ext; + createdFile = DownloadPaths.createNiceUniqueFile(aLocalFile); + } +#endif + + return createdFile; + }, + + // ---------- implementation methods ---------- + + // Web progress listener so we can detect errors while mLauncher is + // streaming the data to a temporary file. + progressListener: { + // Implementation properties. + helperAppDlg: null, + + // nsIWebProgressListener methods. + // Look for error notifications and display alert to user. + onStatusChange: function( aWebProgress, aRequest, aStatus, aMessage ) { + if ( aStatus != Components.results.NS_OK ) { + // Get prompt service. + var prompter = Components.classes[ "@mozilla.org/embedcomp/prompt-service;1" ] + .getService( Components.interfaces.nsIPromptService ); + // Display error alert (using text supplied by back-end). + prompter.alert( this.dialog, this.helperAppDlg.mTitle, aMessage ); + + // Close the dialog. + this.helperAppDlg.onCancel(); + if ( this.helperAppDlg.mDialog ) { + this.helperAppDlg.mDialog.close(); + } + } + }, + + // Ignore onProgressChange, onProgressChange64, onStateChange, onLocationChange, onSecurityChange, and onRefreshAttempted notifications. + onProgressChange: function( aWebProgress, + aRequest, + aCurSelfProgress, + aMaxSelfProgress, + aCurTotalProgress, + aMaxTotalProgress ) { + }, + + onProgressChange64: function( aWebProgress, + aRequest, + aCurSelfProgress, + aMaxSelfProgress, + aCurTotalProgress, + aMaxTotalProgress ) { + }, + + + + onStateChange: function( aWebProgress, aRequest, aStateFlags, aStatus ) { + }, + + onLocationChange: function( aWebProgress, aRequest, aLocation ) { + }, + + onSecurityChange: function( aWebProgress, aRequest, state ) { + }, + + onRefreshAttempted: function( aWebProgress, aURI, aDelay, aSameURI ) { + return true; + } + }, + + // initDialog: Fill various dialog fields with initial content. + initDialog : function() { + // Put file name in window title. + var suggestedFileName = this.mLauncher.suggestedFileName; + + // Some URIs do not implement nsIURL, so we can't just QI. + var url = this.mLauncher.source; + var fname = ""; + var iconPath = "goat"; + this.mSourcePath = url.prePath; + if (url instanceof Components.interfaces.nsIURL) { + // A url, use file name from it. + fname = iconPath = url.fileName; + this.mSourcePath += url.directory; + } else { + // A generic uri, use path. + fname = url.path; + this.mSourcePath += url.path; + } + + if (suggestedFileName) + fname = iconPath = suggestedFileName; + + var displayName = fname.replace(/ +/g, " "); + + this.mTitle = this.dialogElement("strings").getFormattedString("title", [displayName]); + this.mDialog.document.title = this.mTitle; + + // Put content type, filename and location into intro. + this.initIntro(url, fname, displayName); + + var iconString = "moz-icon://" + iconPath + "?size=16&contentType=" + this.mLauncher.MIMEInfo.MIMEType; + this.dialogElement("contentTypeImage").setAttribute("src", iconString); + + // if always-save and is-executable and no-handler + // then set up simple ui + var mimeType = this.mLauncher.MIMEInfo.MIMEType; + var shouldntRememberChoice = (mimeType == "application/octet-stream" || + mimeType == "application/x-msdownload" || + this.mLauncher.targetFileIsExecutable); + if (shouldntRememberChoice && !this.openWithDefaultOK()) { + // hide featured choice + this.dialogElement("normalBox").collapsed = true; + // show basic choice + this.dialogElement("basicBox").collapsed = false; + // change button labels and icons; use "save" icon for the accept + // button since it's the only action possible + let acceptButton = this.mDialog.document.documentElement + .getButton("accept"); + acceptButton.label = this.dialogElement("strings") + .getString("unknownAccept.label"); + acceptButton.setAttribute("icon", "save"); + this.mDialog.document.documentElement.getButton("cancel").label = this.dialogElement("strings").getString("unknownCancel.label"); + // hide other handler + this.dialogElement("openHandler").collapsed = true; + // set save as the selected option + this.dialogElement("mode").selectedItem = this.dialogElement("save"); + } + else { + this.initAppAndSaveToDiskValues(); + + // Initialize "always ask me" box. This should always be disabled + // and set to true for the ambiguous type application/octet-stream. + // We don't also check for application/x-msdownload here since we + // want users to be able to autodownload .exe files. + var rememberChoice = this.dialogElement("rememberChoice"); + +#if 0 + // Just because we have a content-type of application/octet-stream + // here doesn't actually mean that the content is of that type. Many + // servers default to sending text/plain for file types they don't know + // about. To account for this, the uriloader does some checking to see + // if a file sent as text/plain contains binary characters, and if so (*) + // it morphs the content-type into application/octet-stream so that + // the file can be properly handled. Since this is not generic binary + // data, rather, a data format that the system probably knows about, + // we don't want to use the content-type provided by this dialog's + // opener, as that's the generic application/octet-stream that the + // uriloader has passed, rather we want to ask the MIME Service. + // This is so we don't needlessly disable the "autohandle" checkbox. + + // commented out to close the opening brace in the if statement. + // var mimeService = Components.classes["@mozilla.org/mime;1"].getService(Components.interfaces.nsIMIMEService); + // var type = mimeService.getTypeFromURI(this.mLauncher.source); + // this.realMIMEInfo = mimeService.getFromTypeAndExtension(type, ""); + + // if (type == "application/octet-stream") { +#endif + if (shouldntRememberChoice) { + rememberChoice.checked = false; + rememberChoice.disabled = true; + } + else { + rememberChoice.checked = !this.mLauncher.MIMEInfo.alwaysAskBeforeHandling; + } + this.toggleRememberChoice(rememberChoice); + + // XXXben - menulist won't init properly, hack. + var openHandler = this.dialogElement("openHandler"); + openHandler.parentNode.removeChild(openHandler); + var openHandlerBox = this.dialogElement("openHandlerBox"); + openHandlerBox.appendChild(openHandler); + } + + this.mDialog.setTimeout("dialog.postShowCallback()", 0); + + this.mDialog.document.documentElement.getButton("accept").disabled = true; + this._showTimer = Components.classes["@mozilla.org/timer;1"] + .createInstance(nsITimer); + this._showTimer.initWithCallback(this, 250, nsITimer.TYPE_ONE_SHOT); + }, + + notify: function (aTimer) { + if (aTimer == this._showTimer) { + if (!this.mDialog) { + this.reallyShow(); + } else { + // The user may have already canceled the dialog. + try { + if (!this._blurred) { + this.mDialog.document.documentElement.getButton("accept").disabled = false; + } + } catch (ex) {} + this._delayExpired = true; + } + // The timer won't release us, so we have to release it. + this._showTimer = null; + } + else if (aTimer == this._saveToDiskTimer) { + // Since saveToDisk may open a file picker and therefore block this routine, + // we should only call it once the dialog is closed. + this.mLauncher.saveToDisk(null, false); + this._saveToDiskTimer = null; + } + }, + + postShowCallback: function () { + this.mDialog.sizeToContent(); + + // Set initial focus + this.dialogElement("mode").focus(); + }, + + // initIntro: + initIntro: function(url, filename, displayname) { + this.dialogElement( "location" ).value = displayname; + this.dialogElement( "location" ).setAttribute("realname", filename); + this.dialogElement( "location" ).setAttribute("tooltiptext", displayname); + + // if mSourcePath is a local file, then let's use the pretty path name instead of an ugly + // url... + var pathString = this.mSourcePath; + try + { + var fileURL = url.QueryInterface(Components.interfaces.nsIFileURL); + if (fileURL) + { + var fileObject = fileURL.file; + if (fileObject) + { + var parentObject = fileObject.parent; + if (parentObject) + { + pathString = parentObject.path; + } + } + } + } catch(ex) {} + + if (pathString == this.mSourcePath) + { + // wasn't a fileURL + var tmpurl = url.clone(); // don't want to change the real url + try { + tmpurl.userPass = ""; + } catch (ex) {} + pathString = tmpurl.prePath; + } + + // Set the location text, which is separate from the intro text so it can be cropped + var location = this.dialogElement( "source" ); + location.value = pathString; + location.setAttribute("tooltiptext", this.mSourcePath); + + // Show the type of file. + var type = this.dialogElement("type"); + var mimeInfo = this.mLauncher.MIMEInfo; + + // 1. Try to use the pretty description of the type, if one is available. + var typeString = mimeInfo.description; + + if (typeString == "") { + // 2. If there is none, use the extension to identify the file, e.g. "ZIP file" + var primaryExtension = ""; + try { + primaryExtension = mimeInfo.primaryExtension; } catch (ex) { } + if (primaryExtension != "") + typeString = this.dialogElement("strings").getFormattedString("fileType", [primaryExtension.toUpperCase()]); + // 3. If we can't even do that, just give up and show the MIME type. + else + typeString = mimeInfo.MIMEType; + } - if (picker.show() == nsIFilePicker.returnCancel) { - // null result means user cancelled. - return null; - } + type.value = typeString; + }, - // Be sure to save the directory the user chose through the Save As... - // dialog as the new browser.download.dir since the old one - // didn't exist. - result = picker.file; + _blurred: false, + _delayExpired: false, + onBlur: function(aEvent) { + this._blurred = true; + this.mDialog.document.documentElement.getButton("accept").disabled = true; + }, - if (result) { - try { - // Remove the file so that it's not there when we ensure non-existence later; - // this is safe because for the file to exist, the user would have had to - // confirm that he wanted the file overwritten. - if (result.exists()) - result.remove(false); - } - catch (e) { } - var newDir = result.parent.QueryInterface(Components.interfaces.nsILocalFile); - - // Do not store the last save directory as a pref inside the private browsing mode - gDownloadLastDir.file = newDir; - - result = this.validateLeafName(newDir, result.leafName, null); - } - return result; - }, - - /** - * Ensures that a local folder/file combination does not already exist in - * the file system (or finds such a combination with a reasonably similar - * leaf name), creates the corresponding file, and returns it. - * - * @param aLocalFile - * the folder where the file resides - * @param aLeafName - * the string name of the file (may be empty if no name is known, - * in which case a name will be chosen) - * @param aFileExt - * the extension of the file, if one is known; this will be ignored - * if aLeafName is non-empty - * @returns nsILocalFile - * the created file - */ - validateLeafName: function (aLocalFile, aLeafName, aFileExt) - { - if (!(aLocalFile && isUsableDirectory(aLocalFile))) - return null; - - // Remove any leading periods, since we don't want to save hidden files - // automatically. - aLeafName = aLeafName.replace(/^\.+/, ""); - - if (aLeafName == "") - aLeafName = "unnamed" + (aFileExt ? "." + aFileExt : ""); - aLocalFile.append(aLeafName); - - var createdFile = DownloadPaths.createNiceUniqueFile(aLocalFile); + onFocus: function(aEvent) { + this._blurred = false; + if (this._delayExpired) { + var script = "document.documentElement.getButton('accept').disabled = false"; + this.mDialog.setTimeout(script, 250); + } + }, + // Returns true if opening the default application makes sense. + openWithDefaultOK: function() { + // The checking is different on Windows... #ifdef XP_WIN - let ext; - try { - // We can fail here if there's no primary extension set - ext = "." + this.mLauncher.MIMEInfo.primaryExtension; - } catch (e) { } + // Windows presents some special cases. + // We need to prevent use of "system default" when the file is + // executable (so the user doesn't launch nasty programs downloaded + // from the web), and, enable use of "system default" if it isn't + // executable (because we will prompt the user for the default app + // in that case). - // Append a file extension if it's an executable that doesn't have one - // but make sure we actually have an extension to add - let leaf = createdFile.leafName; - if (ext && leaf.slice(-ext.length) != ext && createdFile.isExecutable()) { - createdFile.remove(false); - aLocalFile.leafName = leaf + ext; - createdFile = DownloadPaths.createNiceUniqueFile(aLocalFile); - } -#endif - - return createdFile; - }, - - // ---------- implementation methods ---------- - - // Web progress listener so we can detect errors while mLauncher is - // streaming the data to a temporary file. - progressListener: { - // Implementation properties. - helperAppDlg: null, - - // nsIWebProgressListener methods. - // Look for error notifications and display alert to user. - onStatusChange: function( aWebProgress, aRequest, aStatus, aMessage ) { - if ( aStatus != Components.results.NS_OK ) { - // Get prompt service. - var prompter = Components.classes[ "@mozilla.org/embedcomp/prompt-service;1" ] - .getService( Components.interfaces.nsIPromptService ); - // Display error alert (using text supplied by back-end). - prompter.alert( this.dialog, this.helperAppDlg.mTitle, aMessage ); - - // Close the dialog. - this.helperAppDlg.onCancel(); - if ( this.helperAppDlg.mDialog ) { - this.helperAppDlg.mDialog.close(); - } - } - }, - - // Ignore onProgressChange, onProgressChange64, onStateChange, onLocationChange, onSecurityChange, and onRefreshAttempted notifications. - onProgressChange: function( aWebProgress, - aRequest, - aCurSelfProgress, - aMaxSelfProgress, - aCurTotalProgress, - aMaxTotalProgress ) { - }, - - onProgressChange64: function( aWebProgress, - aRequest, - aCurSelfProgress, - aMaxSelfProgress, - aCurTotalProgress, - aMaxTotalProgress ) { - }, - - - - onStateChange: function( aWebProgress, aRequest, aStateFlags, aStatus ) { - }, - - onLocationChange: function( aWebProgress, aRequest, aLocation ) { - }, - - onSecurityChange: function( aWebProgress, aRequest, state ) { - }, - - onRefreshAttempted: function( aWebProgress, aURI, aDelay, aSameURI ) { - return true; - } - }, - - // initDialog: Fill various dialog fields with initial content. - initDialog : function() { - // Put file name in window title. - var suggestedFileName = this.mLauncher.suggestedFileName; - - // Some URIs do not implement nsIURL, so we can't just QI. - var url = this.mLauncher.source; - var fname = ""; - var iconPath = "goat"; - this.mSourcePath = url.prePath; - if (url instanceof Components.interfaces.nsIURL) { - // A url, use file name from it. - fname = iconPath = url.fileName; - this.mSourcePath += url.directory; - } else { - // A generic uri, use path. - fname = url.path; - this.mSourcePath += url.path; - } - - if (suggestedFileName) - fname = iconPath = suggestedFileName; - - var displayName = fname.replace(/ +/g, " "); - - this.mTitle = this.dialogElement("strings").getFormattedString("title", [displayName]); - this.mDialog.document.title = this.mTitle; - - // Put content type, filename and location into intro. - this.initIntro(url, fname, displayName); - - var iconString = "moz-icon://" + iconPath + "?size=16&contentType=" + this.mLauncher.MIMEInfo.MIMEType; - this.dialogElement("contentTypeImage").setAttribute("src", iconString); - - // if always-save and is-executable and no-handler - // then set up simple ui - var mimeType = this.mLauncher.MIMEInfo.MIMEType; - var shouldntRememberChoice = (mimeType == "application/octet-stream" || - mimeType == "application/x-msdownload" || - this.mLauncher.targetFileIsExecutable); - if (shouldntRememberChoice && !this.openWithDefaultOK()) { - // hide featured choice - this.dialogElement("normalBox").collapsed = true; - // show basic choice - this.dialogElement("basicBox").collapsed = false; - // change button labels and icons; use "save" icon for the accept - // button since it's the only action possible - let acceptButton = this.mDialog.document.documentElement - .getButton("accept"); - acceptButton.label = this.dialogElement("strings") - .getString("unknownAccept.label"); - acceptButton.setAttribute("icon", "save"); - this.mDialog.document.documentElement.getButton("cancel").label = this.dialogElement("strings").getString("unknownCancel.label"); - // hide other handler - this.dialogElement("openHandler").collapsed = true; - // set save as the selected option - this.dialogElement("mode").selectedItem = this.dialogElement("save"); - } - else { - this.initAppAndSaveToDiskValues(); - - // Initialize "always ask me" box. This should always be disabled - // and set to true for the ambiguous type application/octet-stream. - // We don't also check for application/x-msdownload here since we - // want users to be able to autodownload .exe files. - var rememberChoice = this.dialogElement("rememberChoice"); - -#if 0 - // Just because we have a content-type of application/octet-stream - // here doesn't actually mean that the content is of that type. Many - // servers default to sending text/plain for file types they don't know - // about. To account for this, the uriloader does some checking to see - // if a file sent as text/plain contains binary characters, and if so (*) - // it morphs the content-type into application/octet-stream so that - // the file can be properly handled. Since this is not generic binary - // data, rather, a data format that the system probably knows about, - // we don't want to use the content-type provided by this dialog's - // opener, as that's the generic application/octet-stream that the - // uriloader has passed, rather we want to ask the MIME Service. - // This is so we don't needlessly disable the "autohandle" checkbox. - var mimeService = Components.classes["@mozilla.org/mime;1"].getService(Components.interfaces.nsIMIMEService); - var type = mimeService.getTypeFromURI(this.mLauncher.source); - this.realMIMEInfo = mimeService.getFromTypeAndExtension(type, ""); - - if (type == "application/octet-stream") { -#endif - if (shouldntRememberChoice) { - rememberChoice.checked = false; - rememberChoice.disabled = true; - } - else { - rememberChoice.checked = !this.mLauncher.MIMEInfo.alwaysAskBeforeHandling; - } - this.toggleRememberChoice(rememberChoice); - - // XXXben - menulist won't init properly, hack. - var openHandler = this.dialogElement("openHandler"); - openHandler.parentNode.removeChild(openHandler); - var openHandlerBox = this.dialogElement("openHandlerBox"); - openHandlerBox.appendChild(openHandler); - } - - this.mDialog.setTimeout("dialog.postShowCallback()", 0); - - this.mDialog.document.documentElement.getButton("accept").disabled = true; - this._showTimer = Components.classes["@mozilla.org/timer;1"] - .createInstance(nsITimer); - this._showTimer.initWithCallback(this, 250, nsITimer.TYPE_ONE_SHOT); - }, - - notify: function (aTimer) { - if (aTimer == this._showTimer) { - if (!this.mDialog) { - this.reallyShow(); - } else { - // The user may have already canceled the dialog. - try { - if (!this._blurred) { - this.mDialog.document.documentElement.getButton("accept").disabled = false; - } - } catch (ex) {} - this._delayExpired = true; - } - // The timer won't release us, so we have to release it. - this._showTimer = null; - } - else if (aTimer == this._saveToDiskTimer) { - // Since saveToDisk may open a file picker and therefore block this routine, - // we should only call it once the dialog is closed. - this.mLauncher.saveToDisk(null, false); - this._saveToDiskTimer = null; - } - }, - - postShowCallback: function () { - this.mDialog.sizeToContent(); - - // Set initial focus - this.dialogElement("mode").focus(); - }, - - // initIntro: - initIntro: function(url, filename, displayname) { - this.dialogElement( "location" ).value = displayname; - this.dialogElement( "location" ).setAttribute("realname", filename); - this.dialogElement( "location" ).setAttribute("tooltiptext", displayname); - - // if mSourcePath is a local file, then let's use the pretty path name instead of an ugly - // url... - var pathString = this.mSourcePath; - try - { - var fileURL = url.QueryInterface(Components.interfaces.nsIFileURL); - if (fileURL) - { - var fileObject = fileURL.file; - if (fileObject) - { - var parentObject = fileObject.parent; - if (parentObject) - { - pathString = parentObject.path; - } - } - } - } catch(ex) {} - - if (pathString == this.mSourcePath) - { - // wasn't a fileURL - var tmpurl = url.clone(); // don't want to change the real url - try { - tmpurl.userPass = ""; - } catch (ex) {} - pathString = tmpurl.prePath; - } - - // Set the location text, which is separate from the intro text so it can be cropped - var location = this.dialogElement( "source" ); - location.value = pathString; - location.setAttribute("tooltiptext", this.mSourcePath); - - // Show the type of file. - var type = this.dialogElement("type"); - var mimeInfo = this.mLauncher.MIMEInfo; - - // 1. Try to use the pretty description of the type, if one is available. - var typeString = mimeInfo.description; - - if (typeString == "") { - // 2. If there is none, use the extension to identify the file, e.g. "ZIP file" - var primaryExtension = ""; - try { - primaryExtension = mimeInfo.primaryExtension; - } - catch (ex) { - } - if (primaryExtension != "") - typeString = this.dialogElement("strings").getFormattedString("fileType", [primaryExtension.toUpperCase()]); - // 3. If we can't even do that, just give up and show the MIME type. - else - typeString = mimeInfo.MIMEType; - } - - type.value = typeString; - }, - - _blurred: false, - _delayExpired: false, - onBlur: function(aEvent) { - this._blurred = true; - this.mDialog.document.documentElement.getButton("accept").disabled = true; - }, - - onFocus: function(aEvent) { - this._blurred = false; - if (this._delayExpired) { - var script = "document.documentElement.getButton('accept').disabled = false"; - this.mDialog.setTimeout(script, 250); - } - }, - - // Returns true if opening the default application makes sense. - openWithDefaultOK: function() { - // The checking is different on Windows... -#ifdef XP_WIN - // Windows presents some special cases. - // We need to prevent use of "system default" when the file is - // executable (so the user doesn't launch nasty programs downloaded - // from the web), and, enable use of "system default" if it isn't - // executable (because we will prompt the user for the default app - // in that case). - - // Default is Ok if the file isn't executable (and vice-versa). - return !this.mLauncher.targetFileIsExecutable; + // Default is Ok if the file isn't executable (and vice-versa). + return !this.mLauncher.targetFileIsExecutable; #else - // On other platforms, default is Ok if there is a default app. - // Note that nsIMIMEInfo providers need to ensure that this holds true - // on each platform. - return this.mLauncher.MIMEInfo.hasDefaultHandler; + // On other platforms, default is Ok if there is a default app. + // Note that nsIMIMEInfo providers need to ensure that this holds true + // on each platform. + return this.mLauncher.MIMEInfo.hasDefaultHandler; #endif - }, - - // Set "default" application description field. - initDefaultApp: function() { - // Use description, if we can get one. - var desc = this.mLauncher.MIMEInfo.defaultDescription; - if (desc) { - var defaultApp = this.dialogElement("strings").getFormattedString("defaultApp", [desc]); - this.dialogElement("defaultHandler").label = defaultApp; - } - else { - this.dialogElement("modeDeck").setAttribute("selectedIndex", "1"); - // Hide the default handler item too, in case the user picks a - // custom handler at a later date which triggers the menulist to show. - this.dialogElement("defaultHandler").hidden = true; - } - }, + }, - // getPath: - getPath: function (aFile) { + // Set "default" application description field. + initDefaultApp: function() { + // Use description, if we can get one. + var desc = this.mLauncher.MIMEInfo.defaultDescription; + if (desc) { + var defaultApp = this.dialogElement("strings").getFormattedString("defaultApp", [desc]); + this.dialogElement("defaultHandler").label = defaultApp; + } + else { + this.dialogElement("modeDeck").setAttribute("selectedIndex", "1"); + // Hide the default handler item too, in case the user picks a + // custom handler at a later date which triggers the menulist to show. + this.dialogElement("defaultHandler").hidden = true; + } + }, + + // getPath: + getPath: function (aFile) { #ifdef XP_MACOSX - return aFile.leafName || aFile.path; + return aFile.leafName || aFile.path; #else - return aFile.path; + return aFile.path; #endif - }, + }, - // initAppAndSaveToDiskValues: - initAppAndSaveToDiskValues: function() { - var modeGroup = this.dialogElement("mode"); + // initAppAndSaveToDiskValues: + initAppAndSaveToDiskValues: function() { + var modeGroup = this.dialogElement("mode"); - // We don't let users open .exe files or random binary data directly - // from the browser at the moment because of security concerns. - var openWithDefaultOK = this.openWithDefaultOK(); - var mimeType = this.mLauncher.MIMEInfo.MIMEType; - if (this.mLauncher.targetFileIsExecutable || ( - (mimeType == "application/octet-stream" || - mimeType == "application/x-msdownload") && - !openWithDefaultOK)) { - this.dialogElement("open").disabled = true; - var openHandler = this.dialogElement("openHandler"); - openHandler.disabled = true; - openHandler.selectedItem = null; - modeGroup.selectedItem = this.dialogElement("save"); - return; - } - - // Fill in helper app info, if there is any. - try { - this.chosenApp = - this.mLauncher.MIMEInfo.preferredApplicationHandler - .QueryInterface(Components.interfaces.nsILocalHandlerApp); - } catch (e) { - this.chosenApp = null; - } - // Initialize "default application" field. - this.initDefaultApp(); + // We don't let users open .exe files or random binary data directly + // from the browser at the moment because of security concerns. + var openWithDefaultOK = this.openWithDefaultOK(); + var mimeType = this.mLauncher.MIMEInfo.MIMEType; + if (this.mLauncher.targetFileIsExecutable || ( + (mimeType == "application/octet-stream" || + mimeType == "application/x-msdownload") && + !openWithDefaultOK)) { + this.dialogElement("open").disabled = true; + var openHandler = this.dialogElement("openHandler"); + openHandler.disabled = true; + openHandler.selectedItem = null; + modeGroup.selectedItem = this.dialogElement("save"); + return; + } - var otherHandler = this.dialogElement("otherHandler"); - - // Fill application name textbox. - if (this.chosenApp && this.chosenApp.executable && - this.chosenApp.executable.path) { - otherHandler.setAttribute("path", - this.getPath(this.chosenApp.executable)); + // Fill in helper app info, if there is any. + try { + this.chosenApp = + this.mLauncher.MIMEInfo.preferredApplicationHandler + .QueryInterface(Components.interfaces.nsILocalHandlerApp); + } catch (e) { + this.chosenApp = null; + } + // Initialize "default application" field. + this.initDefaultApp(); + + var otherHandler = this.dialogElement("otherHandler"); + + // Fill application name textbox. + if (this.chosenApp && this.chosenApp.executable && + this.chosenApp.executable.path) { + otherHandler.setAttribute("path", + this.getPath(this.chosenApp.executable)); #if XP_MACOSX - this.chosenApp.executable.QueryInterface(Components.interfaces.nsILocalFileMac); - otherHandler.label = this.chosenApp.executable.bundleDisplayName; + this.chosenApp.executable.QueryInterface(Components.interfaces.nsILocalFileMac); + otherHandler.label = this.chosenApp.executable.bundleDisplayName; #else - otherHandler.label = this.chosenApp.executable.leafName; + otherHandler.label = this.chosenApp.executable.leafName; #endif - otherHandler.hidden = false; - } + otherHandler.hidden = false; + } - var useDefault = this.dialogElement("useSystemDefault"); - var openHandler = this.dialogElement("openHandler"); - openHandler.selectedIndex = 0; + var useDefault = this.dialogElement("useSystemDefault"); + var openHandler = this.dialogElement("openHandler"); + openHandler.selectedIndex = 0; - if (this.mLauncher.MIMEInfo.preferredAction == this.nsIMIMEInfo.useSystemDefault) { - // Open (using system default). - modeGroup.selectedItem = this.dialogElement("open"); - } else if (this.mLauncher.MIMEInfo.preferredAction == this.nsIMIMEInfo.useHelperApp) { - // Open with given helper app. - modeGroup.selectedItem = this.dialogElement("open"); + if (this.mLauncher.MIMEInfo.preferredAction == this.nsIMIMEInfo.useSystemDefault) { + // Open (using system default). + modeGroup.selectedItem = this.dialogElement("open"); + } else if (this.mLauncher.MIMEInfo.preferredAction == this.nsIMIMEInfo.useHelperApp) { + // Open with given helper app. + modeGroup.selectedItem = this.dialogElement("open"); + openHandler.selectedIndex = 1; + } else { + // Save to disk. + modeGroup.selectedItem = this.dialogElement("save"); + } + + // If we don't have a "default app" then disable that choice. + if (!openWithDefaultOK) { + var useDefault = this.dialogElement("defaultHandler"); + var isSelected = useDefault.selected; + + // Disable that choice. + useDefault.hidden = true; + // If that's the default, then switch to "save to disk." + if (isSelected) { openHandler.selectedIndex = 1; - } else { - // Save to disk. modeGroup.selectedItem = this.dialogElement("save"); } - - // If we don't have a "default app" then disable that choice. - if (!openWithDefaultOK) { - var useDefault = this.dialogElement("defaultHandler"); - var isSelected = useDefault.selected; - - // Disable that choice. - useDefault.hidden = true; - // If that's the default, then switch to "save to disk." - if (isSelected) { - openHandler.selectedIndex = 1; - modeGroup.selectedItem = this.dialogElement("save"); - } - } - - otherHandler.nextSibling.hidden = otherHandler.nextSibling.nextSibling.hidden = false; - this.updateOKButton(); - }, + } - // Returns the user-selected application - helperAppChoice: function() { - return this.chosenApp; - }, - - get saveToDisk() { - return this.dialogElement("save").selected; - }, - - get useOtherHandler() { - return this.dialogElement("open").selected && this.dialogElement("openHandler").selectedIndex == 1; - }, - - get useSystemDefault() { - return this.dialogElement("open").selected && this.dialogElement("openHandler").selectedIndex == 0; - }, - - toggleRememberChoice: function (aCheckbox) { - this.dialogElement("settingsChange").hidden = !aCheckbox.checked; - this.mDialog.sizeToContent(); - }, - - openHandlerCommand: function () { - var openHandler = this.dialogElement("openHandler"); - if (openHandler.selectedItem.id == "choose") - this.chooseApp(); - else - openHandler.setAttribute("lastSelectedItemID", openHandler.selectedItem.id); - }, + otherHandler.nextSibling.hidden = otherHandler.nextSibling.nextSibling.hidden = false; + this.updateOKButton(); + }, - updateOKButton: function() { - var ok = false; - if (this.dialogElement("save").selected) { - // This is always OK. + // Returns the user-selected application + helperAppChoice: function() { + return this.chosenApp; + }, + + get saveToDisk() { + return this.dialogElement("save").selected; + }, + + get useOtherHandler() { + return this.dialogElement("open").selected && this.dialogElement("openHandler").selectedIndex == 1; + }, + + get useSystemDefault() { + return this.dialogElement("open").selected && this.dialogElement("openHandler").selectedIndex == 0; + }, + + toggleRememberChoice: function (aCheckbox) { + this.dialogElement("settingsChange").hidden = !aCheckbox.checked; + this.mDialog.sizeToContent(); + }, + + openHandlerCommand: function () { + var openHandler = this.dialogElement("openHandler"); + if (openHandler.selectedItem.id == "choose") + this.chooseApp(); + else + openHandler.setAttribute("lastSelectedItemID", openHandler.selectedItem.id); + }, + + updateOKButton: function() { + var ok = false; + if (this.dialogElement("save").selected) { + // This is always OK. + ok = true; + } + else if (this.dialogElement("open").selected) { + switch (this.dialogElement("openHandler").selectedIndex) { + case 0: + // No app need be specified in this case. ok = true; - } - else if (this.dialogElement("open").selected) { - switch (this.dialogElement("openHandler").selectedIndex) { - case 0: - // No app need be specified in this case. - ok = true; - break; - case 1: - // only enable the OK button if we have a default app to use or if - // the user chose an app.... - ok = this.chosenApp || /\S/.test(this.dialogElement("otherHandler").getAttribute("path")); break; - } + case 1: + // only enable the OK button if we have a default app to use or if + // the user chose an app.... + ok = this.chosenApp || /\S/.test(this.dialogElement("otherHandler").getAttribute("path")); + break; } + } - // Enable Ok button if ok to press. - this.mDialog.document.documentElement.getButton("accept").disabled = !ok; - }, - - // Returns true iff the user-specified helper app has been modified. - appChanged: function() { - return this.helperAppChoice() != this.mLauncher.MIMEInfo.preferredApplicationHandler; - }, + // Enable Ok button if ok to press. + this.mDialog.document.documentElement.getButton("accept").disabled = !ok; + }, - updateMIMEInfo: function() { - var needUpdate = false; - // If current selection differs from what's in the mime info object, - // then we need to update. - if (this.saveToDisk) { - needUpdate = this.mLauncher.MIMEInfo.preferredAction != this.nsIMIMEInfo.saveToDisk; - if (needUpdate) - this.mLauncher.MIMEInfo.preferredAction = this.nsIMIMEInfo.saveToDisk; - } - else if (this.useSystemDefault) { - needUpdate = this.mLauncher.MIMEInfo.preferredAction != this.nsIMIMEInfo.useSystemDefault; - if (needUpdate) - this.mLauncher.MIMEInfo.preferredAction = this.nsIMIMEInfo.useSystemDefault; - } - else { - // For "open with", we need to check both preferred action and whether the user chose - // a new app. - needUpdate = this.mLauncher.MIMEInfo.preferredAction != this.nsIMIMEInfo.useHelperApp || this.appChanged(); - if (needUpdate) { - this.mLauncher.MIMEInfo.preferredAction = this.nsIMIMEInfo.useHelperApp; - // App may have changed - Update application - var app = this.helperAppChoice(); - this.mLauncher.MIMEInfo.preferredApplicationHandler = app; - } + // Returns true iff the user-specified helper app has been modified. + appChanged: function() { + return this.helperAppChoice() != this.mLauncher.MIMEInfo.preferredApplicationHandler; + }, + + updateMIMEInfo: function() { + var needUpdate = false; + // If current selection differs from what's in the mime info object, + // then we need to update. + if (this.saveToDisk) { + needUpdate = this.mLauncher.MIMEInfo.preferredAction != this.nsIMIMEInfo.saveToDisk; + if (needUpdate) + this.mLauncher.MIMEInfo.preferredAction = this.nsIMIMEInfo.saveToDisk; + } + else if (this.useSystemDefault) { + needUpdate = this.mLauncher.MIMEInfo.preferredAction != this.nsIMIMEInfo.useSystemDefault; + if (needUpdate) + this.mLauncher.MIMEInfo.preferredAction = this.nsIMIMEInfo.useSystemDefault; + } + else { + // For "open with", we need to check both preferred action and whether the user chose + // a new app. + needUpdate = this.mLauncher.MIMEInfo.preferredAction != this.nsIMIMEInfo.useHelperApp || this.appChanged(); + if (needUpdate) { + this.mLauncher.MIMEInfo.preferredAction = this.nsIMIMEInfo.useHelperApp; + // App may have changed - Update application + var app = this.helperAppChoice(); + this.mLauncher.MIMEInfo.preferredApplicationHandler = app; } - // We will also need to update if the "always ask" flag has changed. - needUpdate = needUpdate || this.mLauncher.MIMEInfo.alwaysAskBeforeHandling != (!this.dialogElement("rememberChoice").checked); + } + // We will also need to update if the "always ask" flag has changed. + needUpdate = needUpdate || this.mLauncher.MIMEInfo.alwaysAskBeforeHandling != (!this.dialogElement("rememberChoice").checked); - // One last special case: If the input "always ask" flag was false, then we always - // update. In that case we are displaying the helper app dialog for the first - // time for this mime type and we need to store the user's action in the mimeTypes.rdf - // data source (whether that action has changed or not; if it didn't change, then we need - // to store the "always ask" flag so the helper app dialog will or won't display - // next time, per the user's selection). - needUpdate = needUpdate || !this.mLauncher.MIMEInfo.alwaysAskBeforeHandling; + // One last special case: If the input "always ask" flag was false, then we always + // update. In that case we are displaying the helper app dialog for the first + // time for this mime type and we need to store the user's action in the mimeTypes.rdf + // data source (whether that action has changed or not; if it didn't change, then we need + // to store the "always ask" flag so the helper app dialog will or won't display + // next time, per the user's selection). + needUpdate = needUpdate || !this.mLauncher.MIMEInfo.alwaysAskBeforeHandling; - // Make sure mime info has updated setting for the "always ask" flag. - this.mLauncher.MIMEInfo.alwaysAskBeforeHandling = !this.dialogElement("rememberChoice").checked; + // Make sure mime info has updated setting for the "always ask" flag. + this.mLauncher.MIMEInfo.alwaysAskBeforeHandling = !this.dialogElement("rememberChoice").checked; - return needUpdate; - }, - - // See if the user changed things, and if so, update the - // mimeTypes.rdf entry for this mime type. - updateHelperAppPref: function() { - var ha = new this.mDialog.HelperApps(); - ha.updateTypeInfo(this.mLauncher.MIMEInfo); - ha.destroy(); - }, - - // onOK: - onOK: function() { - // Verify typed app path, if necessary. - if (this.useOtherHandler) { - var helperApp = this.helperAppChoice(); - if (!helperApp || !helperApp.executable || - !helperApp.executable.exists()) { - // Show alert and try again. - var bundle = this.dialogElement("strings"); - var msg = bundle.getFormattedString("badApp", [this.dialogElement("otherHandler").getAttribute("path")]); - var svc = Components.classes["@mozilla.org/embedcomp/prompt-service;1"].getService(Components.interfaces.nsIPromptService); - svc.alert(this.mDialog, bundle.getString("badApp.title"), msg); + return needUpdate; + }, - // Disable the OK button. - this.mDialog.document.documentElement.getButton("accept").disabled = true; - this.dialogElement("mode").focus(); + // See if the user changed things, and if so, update the + // mimeTypes.rdf entry for this mime type. + updateHelperAppPref: function() { + var ha = new this.mDialog.HelperApps(); + ha.updateTypeInfo(this.mLauncher.MIMEInfo); + ha.destroy(); + }, - // Clear chosen application. - this.chosenApp = null; + // onOK: + onOK: function() { + // Verify typed app path, if necessary. + if (this.useOtherHandler) { + var helperApp = this.helperAppChoice(); + if (!helperApp || !helperApp.executable || + !helperApp.executable.exists()) { + // Show alert and try again. + var bundle = this.dialogElement("strings"); + var msg = bundle.getFormattedString("badApp", [this.dialogElement("otherHandler").getAttribute("path")]); + var svc = Components.classes["@mozilla.org/embedcomp/prompt-service;1"].getService(Components.interfaces.nsIPromptService); + svc.alert(this.mDialog, bundle.getString("badApp.title"), msg); - // Leave dialog up. - return false; - } + // Disable the OK button. + this.mDialog.document.documentElement.getButton("accept").disabled = true; + this.dialogElement("mode").focus(); + + // Clear chosen application. + this.chosenApp = null; + + // Leave dialog up. + return false; } - - // Remove our web progress listener (a progress dialog will be - // taking over). - this.mLauncher.setWebProgressListener(null); + } - // saveToDisk and launchWithApplication can return errors in - // certain circumstances (e.g. The user clicks cancel in the - // "Save to Disk" dialog. In those cases, we don't want to - // update the helper application preferences in the RDF file. - try { - var needUpdate = this.updateMIMEInfo(); - - if (this.dialogElement("save").selected) { - // If we're using a default download location, create a path - // for the file to be saved to to pass to |saveToDisk| - otherwise - // we must ask the user to pick a save name. + // Remove our web progress listener (a progress dialog will be + // taking over). + this.mLauncher.setWebProgressListener(null); + + // saveToDisk and launchWithApplication can return errors in + // certain circumstances (e.g. The user clicks cancel in the + // "Save to Disk" dialog. In those cases, we don't want to + // update the helper application preferences in the RDF file. + try { + var needUpdate = this.updateMIMEInfo(); + + if (this.dialogElement("save").selected) { + // If we're using a default download location, create a path + // for the file to be saved to to pass to |saveToDisk| - otherwise + // we must ask the user to pick a save name. #if 0 - var prefs = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch); - var targetFile = null; - try { - targetFile = prefs.getComplexValue("browser.download.defaultFolder", - Components.interfaces.nsILocalFile); - var leafName = this.dialogElement("location").getAttribute("realname"); - // Ensure that we don't overwrite any existing files here. - targetFile = this.validateLeafName(targetFile, leafName, null); - } - catch(e) { } + var prefs = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch); + var targetFile = null; + try { + targetFile = prefs.getComplexValue("browser.download.defaultFolder", + Components.interfaces.nsILocalFile); + var leafName = this.dialogElement("location").getAttribute("realname"); + // Ensure that we don't overwrite any existing files here. + targetFile = this.validateLeafName(targetFile, leafName, null); + } + catch(e) { } - this.mLauncher.saveToDisk(targetFile, false); + this.mLauncher.saveToDisk(targetFile, false); #endif - // see @notify - // we cannot use opener's setTimeout, see bug 420405 - this._saveToDiskTimer = Components.classes["@mozilla.org/timer;1"] - .createInstance(nsITimer); - this._saveToDiskTimer.initWithCallback(this, 0, - nsITimer.TYPE_ONE_SHOT); - } - else - this.mLauncher.launchWithApplication(null, false); - - // Update user pref for this mime type (if necessary). We do not - // store anything in the mime type preferences for the ambiguous - // type application/octet-stream. We do NOT do this for - // application/x-msdownload since we want users to be able to - // autodownload these to disk. - if (needUpdate && this.mLauncher.MIMEInfo.MIMEType != "application/octet-stream") - this.updateHelperAppPref(); - } catch(e) { } - - // Unhook dialog from this object. - this.mDialog.dialog = null; - - // Close up dialog by returning true. - return true; - }, - - // onCancel: - onCancel: function() { - // Remove our web progress listener. - this.mLauncher.setWebProgressListener(null); - - // Cancel app launcher. - try { - const NS_BINDING_ABORTED = 0x804b0002; - this.mLauncher.cancel(NS_BINDING_ABORTED); - } catch(exception) { + // see @notify + // we cannot use opener's setTimeout, see bug 420405 + this._saveToDiskTimer = Components.classes["@mozilla.org/timer;1"] + .createInstance(nsITimer); + this._saveToDiskTimer.initWithCallback(this, 0, + nsITimer.TYPE_ONE_SHOT); } + else + this.mLauncher.launchWithApplication(null, false); - // Unhook dialog from this object. - this.mDialog.dialog = null; + // Update user pref for this mime type (if necessary). We do not + // store anything in the mime type preferences for the ambiguous + // type application/octet-stream. We do NOT do this for + // application/x-msdownload since we want users to be able to + // autodownload these to disk. + if (needUpdate && this.mLauncher.MIMEInfo.MIMEType != "application/octet-stream") + this.updateHelperAppPref(); + } catch(e) { } - // Close up dialog by returning true. - return true; - }, + // Unhook dialog from this object. + this.mDialog.dialog = null; - // dialogElement: Convenience. - dialogElement: function(id) { - return this.mDialog.document.getElementById(id); - }, + // Close up dialog by returning true. + return true; + }, - // Retrieve the pretty description from the file - getFileDisplayName: function getFileDisplayName(file) - { + // onCancel: + onCancel: function() { + // Remove our web progress listener. + this.mLauncher.setWebProgressListener(null); + + // Cancel app launcher. + try { + const NS_BINDING_ABORTED = 0x804b0002; + this.mLauncher.cancel(NS_BINDING_ABORTED); + } catch(exception) { + } + + // Unhook dialog from this object. + this.mDialog.dialog = null; + + // Close up dialog by returning true. + return true; + }, + + // dialogElement: Convenience. + dialogElement: function(id) { + return this.mDialog.document.getElementById(id); + }, + + // Retrieve the pretty description from the file + getFileDisplayName: function getFileDisplayName(file) + { #ifdef XP_WIN - if (file instanceof Components.interfaces.nsILocalFileWin) { - try { - return file.getVersionInfoField("FileDescription"); - } catch (ex) { - } - } + if (file instanceof Components.interfaces.nsILocalFileWin) { + try { + return file.getVersionInfoField("FileDescription"); + } catch (ex) { + } + } #endif - return file.leafName; - }, + return file.leafName; + }, - // chooseApp: Open file picker and prompt user for application. - chooseApp: function() { + // chooseApp: Open file picker and prompt user for application. + chooseApp: function() { #ifdef XP_WIN - // Protect against the lack of an extension + // Protect against the lack of an extension var fileExtension = ""; try { - fileExtension = this.mLauncher.MIMEInfo.primaryExtension; + fileExtension = this.mLauncher.MIMEInfo.primaryExtension; } catch(ex) { } @@ -988,7 +991,7 @@ nsUnknownContentTypeDialog.prototype = { var typeString = this.mLauncher.MIMEInfo.description; if (!typeString) { - // If there is none, use the extension to + // If there is none, use the extension to // identify the file, e.g. "ZIP file" if (fileExtension) { typeString = @@ -1001,7 +1004,7 @@ nsUnknownContentTypeDialog.prototype = { } var params = {}; - params.title = + params.title = this.dialogElement("strings").getString("chooseAppFilePickerTitle"); params.description = typeString; params.filename = this.mLauncher.suggestedFileName; @@ -1015,166 +1018,166 @@ nsUnknownContentTypeDialog.prototype = { if (params.handlerApp && params.handlerApp.executable && params.handlerApp.executable.isFile()) { - // Show the "handler" menulist since we have a (user-specified) - // application now. - this.dialogElement("modeDeck").setAttribute("selectedIndex", "0"); + // Show the "handler" menulist since we have a (user-specified) + // application now. + this.dialogElement("modeDeck").setAttribute("selectedIndex", "0"); - // Remember the file they chose to run. - this.chosenApp = params.handlerApp; + // Remember the file they chose to run. + this.chosenApp = params.handlerApp; - // Update dialog - var otherHandler = this.dialogElement("otherHandler"); - otherHandler.removeAttribute("hidden"); - otherHandler.setAttribute("path", - this.getPath(this.chosenApp.executable)); - otherHandler.label = - this.getFileDisplayName(this.chosenApp.executable); - this.dialogElement("openHandler").selectedIndex = 1; - this.dialogElement("openHandler").setAttribute("lastSelectedItemID", - "otherHandler"); - this.dialogElement("mode").selectedItem = this.dialogElement("open"); + // Update dialog + var otherHandler = this.dialogElement("otherHandler"); + otherHandler.removeAttribute("hidden"); + otherHandler.setAttribute("path", + this.getPath(this.chosenApp.executable)); + otherHandler.label = + this.getFileDisplayName(this.chosenApp.executable); + this.dialogElement("openHandler").selectedIndex = 1; + this.dialogElement("openHandler").setAttribute("lastSelectedItemID", + "otherHandler"); + this.dialogElement("mode").selectedItem = this.dialogElement("open"); } else { - var openHandler = this.dialogElement("openHandler"); - var lastSelectedID = openHandler.getAttribute("lastSelectedItemID"); - if (!lastSelectedID) - lastSelectedID = "defaultHandler"; - openHandler.selectedItem = this.dialogElement(lastSelectedID); + var openHandler = this.dialogElement("openHandler"); + var lastSelectedID = openHandler.getAttribute("lastSelectedItemID"); + if (!lastSelectedID) + lastSelectedID = "defaultHandler"; + openHandler.selectedItem = this.dialogElement(lastSelectedID); } #else - var nsIFilePicker = Components.interfaces.nsIFilePicker; - var fp = Components.classes["@mozilla.org/filepicker;1"] - .createInstance(nsIFilePicker); - fp.init(this.mDialog, - this.dialogElement("strings").getString("chooseAppFilePickerTitle"), - nsIFilePicker.modeOpen); + var nsIFilePicker = Components.interfaces.nsIFilePicker; + var fp = Components.classes["@mozilla.org/filepicker;1"] + .createInstance(nsIFilePicker); + fp.init(this.mDialog, + this.dialogElement("strings").getString("chooseAppFilePickerTitle"), + nsIFilePicker.modeOpen); - fp.appendFilters(nsIFilePicker.filterApps); + fp.appendFilters(nsIFilePicker.filterApps); - if (fp.show() == nsIFilePicker.returnOK && fp.file) { - // Show the "handler" menulist since we have a (user-specified) - // application now. - this.dialogElement("modeDeck").setAttribute("selectedIndex", "0"); - - // Remember the file they chose to run. - var localHandlerApp = - Components.classes["@mozilla.org/uriloader/local-handler-app;1"]. - createInstance(Components.interfaces.nsILocalHandlerApp); - localHandlerApp.executable = fp.file; - this.chosenApp = localHandlerApp; - - // Update dialog. - var otherHandler = this.dialogElement("otherHandler"); - otherHandler.removeAttribute("hidden"); - otherHandler.setAttribute("path", this.getPath(this.chosenApp.executable)); + if (fp.show() == nsIFilePicker.returnOK && fp.file) { + // Show the "handler" menulist since we have a (user-specified) + // application now. + this.dialogElement("modeDeck").setAttribute("selectedIndex", "0"); + + // Remember the file they chose to run. + var localHandlerApp = + Components.classes["@mozilla.org/uriloader/local-handler-app;1"]. + createInstance(Components.interfaces.nsILocalHandlerApp); + localHandlerApp.executable = fp.file; + this.chosenApp = localHandlerApp; + + // Update dialog. + var otherHandler = this.dialogElement("otherHandler"); + otherHandler.removeAttribute("hidden"); + otherHandler.setAttribute("path", this.getPath(this.chosenApp.executable)); #ifdef XP_MACOSX - this.chosenApp.executable - .QueryInterface(Components.interfaces.nsILocalFileMac); - otherHandler.label = this.chosenApp.executable.bundleDisplayName; + this.chosenApp.executable + .QueryInterface(Components.interfaces.nsILocalFileMac); + otherHandler.label = this.chosenApp.executable.bundleDisplayName; #else - otherHandler.label = this.chosenApp.executable.leafName; + otherHandler.label = this.chosenApp.executable.leafName; #endif - this.dialogElement("openHandler").selectedIndex = 1; - this.dialogElement("openHandler").setAttribute("lastSelectedItemID", "otherHandler"); - - this.dialogElement("mode").selectedItem = this.dialogElement("open"); - } - else { - var openHandler = this.dialogElement("openHandler"); - var lastSelectedID = openHandler.getAttribute("lastSelectedItemID"); - if (!lastSelectedID) - lastSelectedID = "defaultHandler"; - openHandler.selectedItem = this.dialogElement(lastSelectedID); - } -#endif - }, + this.dialogElement("openHandler").selectedIndex = 1; + this.dialogElement("openHandler").setAttribute("lastSelectedItemID", "otherHandler"); - // Turn this on to get debugging messages. - debug: false, - - // Dump text (if debug is on). - dump: function( text ) { - if ( this.debug ) { - dump( text ); - } - }, - - // dumpObj: - dumpObj: function( spec ) { - var val = ""; - try { - val = eval( "this."+spec ).toString(); - } catch( exception ) { - } - this.dump( spec + "=" + val + "\n" ); - }, - - // dumpObjectProperties - dumpObjectProperties: function( desc, obj ) { - for( prop in obj ) { - this.dump( desc + "." + prop + "=" ); - var val = ""; - try { - val = obj[ prop ]; - } catch ( exception ) { - } - this.dump( val + "\n" ); - } + this.dialogElement("mode").selectedItem = this.dialogElement("open"); } + else { + var openHandler = this.dialogElement("openHandler"); + var lastSelectedID = openHandler.getAttribute("lastSelectedItemID"); + if (!lastSelectedID) + lastSelectedID = "defaultHandler"; + openHandler.selectedItem = this.dialogElement(lastSelectedID); + } +#endif + }, + + // Turn this on to get debugging messages. + debug: false, + + // Dump text (if debug is on). + dump: function( text ) { + if ( this.debug ) { + dump( text ); + } + }, + + // dumpObj: + dumpObj: function( spec ) { + var val = ""; + try { + val = eval( "this."+spec ).toString(); + } catch( exception ) { + } + this.dump( spec + "=" + val + "\n" ); + }, + + // dumpObjectProperties + dumpObjectProperties: function( desc, obj ) { + for( prop in obj ) { + this.dump( desc + "." + prop + "=" ); + var val = ""; + try { + val = obj[ prop ]; + } catch ( exception ) { + } + this.dump( val + "\n" ); + } + } } // This Component's module implementation. All the code below is used to get this // component registered and accessible via XPCOM. var module = { - // registerSelf: Register this component. - registerSelf: function (compMgr, fileSpec, location, type) { - compMgr = compMgr.QueryInterface(Components.interfaces.nsIComponentRegistrar); + // registerSelf: Register this component. + registerSelf: function (compMgr, fileSpec, location, type) { + compMgr = compMgr.QueryInterface(Components.interfaces.nsIComponentRegistrar); - compMgr.registerFactoryLocation( this.cid, - "Unknown Content Type Dialog", - this.contractId, - fileSpec, - location, - type ); - }, + compMgr.registerFactoryLocation( this.cid, + "Unknown Content Type Dialog", + this.contractId, + fileSpec, + location, + type ); + }, - // getClassObject: Return this component's factory object. - getClassObject: function (compMgr, cid, iid) { - if (!cid.equals(this.cid)) { - throw Components.results.NS_ERROR_NO_INTERFACE; - } - - if (!iid.equals(Components.interfaces.nsIFactory)) { - throw Components.results.NS_ERROR_NOT_IMPLEMENTED; - } - - return this.factory; - }, - - /* CID for this class */ - cid: Components.ID("{F68578EB-6EC2-4169-AE19-8C6243F0ABE1}"), - - /* Contract ID for this class */ - contractId: "@mozilla.org/helperapplauncherdialog;1", - - /* factory object */ - factory: { - // createInstance: Return a new nsProgressDialog object. - createInstance: function (outer, iid) { - if (outer != null) - throw Components.results.NS_ERROR_NO_AGGREGATION; - - return (new nsUnknownContentTypeDialog()).QueryInterface(iid); - } - }, - - // canUnload: n/a (returns true) - canUnload: function(compMgr) { - return true; + // getClassObject: Return this component's factory object. + getClassObject: function (compMgr, cid, iid) { + if (!cid.equals(this.cid)) { + throw Components.results.NS_ERROR_NO_INTERFACE; } + + if (!iid.equals(Components.interfaces.nsIFactory)) { + throw Components.results.NS_ERROR_NOT_IMPLEMENTED; + } + + return this.factory; + }, + + /* CID for this class */ + cid: Components.ID("{F68578EB-6EC2-4169-AE19-8C6243F0ABE1}"), + + /* Contract ID for this class */ + contractId: "@mozilla.org/helperapplauncherdialog;1", + + /* factory object */ + factory: { + // createInstance: Return a new nsProgressDialog object. + createInstance: function (outer, iid) { + if (outer != null) + throw Components.results.NS_ERROR_NO_AGGREGATION; + + return (new nsUnknownContentTypeDialog()).QueryInterface(iid); + } + }, + + // canUnload: n/a (returns true) + canUnload: function(compMgr) { + return true; + } }; // NSGetModule: Return the nsIModule object. function NSGetModule(compMgr, fileSpec) { - return module; + return module; } From 250a5b4b27a01d276e1d799bcdcf14df7c3c603a Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Wed, 2 Jun 2010 10:08:00 -0400 Subject: [PATCH 04/30] Bug 559854 - Compile target xpidl only if libIDL is configured when cross compiling. [r=ted] --- build/autoconf/libIDL.m4 | 44 +++--- configure.in | 250 ++++++++++++++++---------------- xpcom/typelib/xpidl/Makefile.in | 61 +++----- 3 files changed, 169 insertions(+), 186 deletions(-) diff --git a/build/autoconf/libIDL.m4 b/build/autoconf/libIDL.m4 index c558b0b3645..ff2b666c96e 100644 --- a/build/autoconf/libIDL.m4 +++ b/build/autoconf/libIDL.m4 @@ -18,14 +18,14 @@ AC_ARG_ENABLE(libIDLtest, [ --disable-libIDLtest Do not try to compile and r if test x$libIDL_config_exec_prefix != x ; then libIDL_config_args="$libIDL_config_args --exec-prefix=$libIDL_config_exec_prefix" - if test x${LIBIDL_CONFIG+set} != xset ; then - LIBIDL_CONFIG=$libIDL_config_exec_prefix/bin/libIDL-config + if test x${HOST_LIBIDL_CONFIG+set} != xset ; then + HOST_LIBIDL_CONFIG=$libIDL_config_exec_prefix/bin/libIDL-config fi fi if test x$libIDL_config_prefix != x ; then libIDL_config_args="$libIDL_config_args --prefix=$libIDL_config_prefix" - if test x${LIBIDL_CONFIG+set} != xset ; then - LIBIDL_CONFIG=$libIDL_config_prefix/bin/libIDL-config + if test x${HOST_LIBIDL_CONFIG+set} != xset ; then + HOST_LIBIDL_CONFIG=$libIDL_config_prefix/bin/libIDL-config fi fi @@ -34,30 +34,26 @@ AC_ARG_ENABLE(libIDLtest, [ --disable-libIDLtest Do not try to compile and r dnl Force a version check to keep upgraded versions from being overridden by the cached value. unset ac_cv_path_LIBIDL_CONFIG - AC_PATH_PROG(LIBIDL_CONFIG, libIDL-config, no) + AC_PATH_PROG(HOST_LIBIDL_CONFIG, libIDL-config, no) min_libIDL_version=ifelse([$1], ,0.6.0,$1) AC_MSG_CHECKING(for libIDL - version >= $min_libIDL_version) no_libIDL="" - if test "$LIBIDL_CONFIG" = "no" ; then + if test "$HOST_LIBIDL_CONFIG" = "no" ; then no_libIDL=yes else - LIBIDL_CFLAGS=`$LIBIDL_CONFIG $libIDL_config_args --cflags` - LIBIDL_LIBS=`$LIBIDL_CONFIG $libIDL_config_args --libs` - # hack to allow us to keep using libIDL 0.6.3-0.6.7. Anyone may remove - # this after we start requiring libIDL 0.6.8 or anything higher - LIBIDL_CFLAGS="$GLIB_CFLAGS $LIBIDL_CFLAGS" - LIBIDL_LIBS="$GLIB_LIBS $LIBIDL_LIBS" - libIDL_config_major_version=`$LIBIDL_CONFIG $libIDL_config_args --version | \ + HOST_LIBIDL_CFLAGS=`$HOST_LIBIDL_CONFIG $libIDL_config_args --cflags` + HOST_LIBIDL_LIBS=`$HOST_LIBIDL_CONFIG $libIDL_config_args --libs` + libIDL_config_major_version=`$HOST_LIBIDL_CONFIG $libIDL_config_args --version | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` - libIDL_config_minor_version=`$LIBIDL_CONFIG $libIDL_config_args --version | \ + libIDL_config_minor_version=`$HOST_LIBIDL_CONFIG $libIDL_config_args --version | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` - libIDL_config_micro_version=`$LIBIDL_CONFIG $libIDL_config_args --version | \ + libIDL_config_micro_version=`$HOST_LIBIDL_CONFIG $libIDL_config_args --version | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` if test "x$enable_libIDLtest" = "xyes" ; then ac_save_CFLAGS="$CFLAGS" ac_save_LIBS="$LIBS" - CFLAGS="$CFLAGS $LIBIDL_CFLAGS" - LIBS="$LIBIDL_LIBS $LIBS" + CFLAGS="$CFLAGS $HOST_LIBIDL_CFLAGS" + LIBS="$HOST_LIBIDL_LIBS $LIBS" dnl dnl Now check if the installed LIBIDL is sufficiently new. dnl @@ -154,7 +150,7 @@ main () ifelse([$2], , :, [$2]) else AC_MSG_RESULT(no) - if test "$LIBIDL_CONFIG" = "no" ; then + if test "$HOST_LIBIDL_CONFIG" = "no" ; then echo "*** The libIDL-config script installed by libIDL could not be found" echo "*** If libIDL was installed in PREFIX, make sure PREFIX/bin is in" echo "*** your path, or set the LIBIDL_CONFIG environment variable to the" @@ -164,8 +160,8 @@ main () : else echo "*** Could not run libIDL test program, checking why..." - CFLAGS="$CFLAGS $LIBIDL_CFLAGS" - LIBS="$LIBS $LIBIDL_LIBS" + CFLAGS="$CFLAGS $HOST_LIBIDL_CFLAGS" + LIBS="$LIBS $HOST_LIBIDL_LIBS" AC_TRY_LINK([ #include #include @@ -188,11 +184,11 @@ main () LIBS="$ac_save_LIBS" fi fi - LIBIDL_CFLAGS="" - LIBIDL_LIBS="" + HOST_LIBIDL_CFLAGS="" + HOST_LIBIDL_LIBS="" ifelse([$3], , :, [$3]) fi - AC_SUBST(LIBIDL_CFLAGS) - AC_SUBST(LIBIDL_LIBS) + AC_SUBST(HOST_LIBIDL_CFLAGS) + AC_SUBST(HOST_LIBIDL_LIBS) rm -f conf.libIDLtest ]) diff --git a/configure.in b/configure.in index 02d83531c65..34f43904734 100644 --- a/configure.in +++ b/configure.in @@ -2293,9 +2293,6 @@ ia64*-hpux*) XARGS=xargs XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/mozalloc.lib' ZIP=zip - LIBIDL_CFLAGS="-I$MOZ_TOOLS_DIR/include ${GLIB_CFLAGS}" - LIBIDL_LIBS="$MOZ_TOOLS_DIR/lib/libidl-0.6_s.lib $MOZ_TOOLS_DIR/lib/glib-1.2_s.lib" - STATIC_LIBIDL=1 MOZ_TREE_FREETYPE=1 AC_DEFINE(HAVE_SNPRINTF) @@ -2474,84 +2471,7 @@ ia64*-hpux*) AC_MSG_ERROR([\$MOZ_TOOLS\\bin must be in your path.]) fi MOZ_TOOLS_DIR=`$CYGPATH_W $MOZ_TOOLS_DIR | $CYGPATH_S` - - if test -n "$GLIB_PREFIX"; then - _GLIB_PREFIX_DIR=`cd $GLIB_PREFIX && pwd -W` - if test "$?" = "0"; then - if test `echo ${PATH}: | grep -ic "$_GLIB_PREFIX_DIR/bin:"` = 0; then - AC_MSG_ERROR([GLIB_PREFIX must be in your \$PATH.]) - fi - _GLIB_PREFIX_DIR=`$CYGPATH_W $_GLIB_PREFIX_DIR | $CYGPATH_S` - else - AC_MSG_ERROR([GLIB_PREFIX is set but "${GLIB_PREFIX}" is not a directory.]) - fi - else - _GLIB_PREFIX_DIR=$MOZ_TOOLS_DIR - fi - if test ! -f "${_GLIB_PREFIX_DIR}/include/glib.h"; then - AC_MSG_ERROR([Cannot find $_GLIB_PREFIX_DIR/include/glib.h .]) - fi - GLIB_CFLAGS="-I${_GLIB_PREFIX_DIR}/include" - if test -f "${_GLIB_PREFIX_DIR}/lib/glib-1.2_s.lib"; then - GLIB_LIBS="${_GLIB_PREFIX_DIR}/lib/glib-1.2_s.lib" - elif test -f "${_GLIB_PREFIX_DIR}/lib/glib-1.2.lib"; then - GLIB_LIBS="${_GLIB_PREFIX_DIR}/lib/glib-1.2.lib" - else - AC_MSG_ERROR([Cannot find $_GLIB_PREFIX_DIR/lib/glib-1.2.lib or $_GLIB_PREFIX_DIR/lib/glib-1.2_s.lib]) - fi - - if test -n "$LIBIDL_PREFIX"; then - _LIBIDL_PREFIX_DIR=`cd $LIBIDL_PREFIX && pwd -W` - if test "$?" = "0"; then - if test `echo ${PATH}: | grep -ic "$_LIBIDL_PREFIX_DIR/bin:"` = 0; then - AC_MSG_ERROR([LIBIDL_PREFIX must be in your \$PATH.]) - fi - _LIBIDL_PREFIX_DIR=`$CYGPATH_W $_LIBIDL_PREFIX_DIR | $CYGPATH_S` - else - AC_MSG_ERROR([LIBIDL_PREFIX is set but "${LIBIDL_PREFIX}" is not a directory.]) - fi - else - _LIBIDL_PREFIX_DIR=$MOZ_TOOLS_DIR - fi - if test ! -f "${_LIBIDL_PREFIX_DIR}/include/libIDL/IDL.h"; then - AC_MSG_ERROR([Cannot find $_LIBIDL_PREFIX_DIR/include/libIDL/IDL.h .]) - fi - LIBIDL_CFLAGS="-I${_LIBIDL_PREFIX_DIR}/include ${GLIB_CFLAGS}" - if test -f "${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6_s.lib"; then - LIBIDL_LIBS="${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6_s.lib" - STATIC_LIBIDL=1 - elif test -f "${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6.lib"; then - LIBIDL_LIBS="${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6.lib" - else - AC_MSG_ERROR([Cannot find $_LIBIDL_PREFIX_DIR/lib/libidl-0.6.lib or $_LIBIDL_PREFIX_DIR/lib/libidl-0.6_s.lib]) - fi - LIBIDL_LIBS="${LIBIDL_LIBS} ${GLIB_LIBS}" ;; - - *) # else cross-compiling - if test -n "$GLIB_PREFIX"; then - GLIB_CFLAGS="-I${GLIB_PREFIX}/include" - if test -f "${GLIB_PREFIX}/lib/glib-1.2_s.lib"; then - GLIB_LIBS="${GLIB_PREFIX}/lib/glib-1.2_s.lib" - elif test -f "${GLIB_PREFIX}/lib/glib-1.2.lib"; then - GLIB_LIBS="${GLIB_PREFIX}/lib/glib-1.2.lib" - else - AC_MSG_ERROR([Cannot find $GLIB_PREFIX/lib/glib-1.2.lib or $GLIB_PREFIX/lib/glib-1.2_s.lib]) - fi - fi - if test -n "$LIBIDL_PREFIX"; then - LIBIDL_CFLAGS="-I${LIBIDL_PREFIX}/include ${GLIB_CFLAGS}" - if test -f "${LIBIDL_PREFIX}/lib/libIDL-0.6_s.lib"; then - LIBIDL_LIBS="${LIBIDL_PREFIX}/lib/libIDL-0.6_s.lib" - STATIC_LIBIDL=1 - elif test -f "${LIBIDL_PREFIX}/lib/libIDL-0.6.lib"; then - LIBIDL_LIBS="${LIBIDL_PREFIX}/lib/libIDL-0.6.lib" - else - AC_MSG_ERROR([Cannot find $LIBIDL_PREFIX/lib/libIDL-0.6.lib or $LIBIDL_PREFIX/lib/libIDL-0.6_s.lib]) - fi - fi - LIBIDL_LIBS="${LIBIDL_LIBS} ${GLIB_LIBS}" - ;; esac @@ -7987,14 +7907,7 @@ MOZ_ARG_HEADER(Standalone module options (Not for building Mozilla)) dnl Check for GLib and libIDL. dnl ======================================================== -case "$target_os" in -msvc*|mks*|cygwin*|mingw*|wince*|winmo*) - SKIP_IDL_CHECK="yes" - ;; -*) - SKIP_IDL_CHECK="no" - ;; -esac +SKIP_IDL_CHECK="no" if test -z "$COMPILE_ENVIRONMENT"; then SKIP_IDL_CHECK="yes" @@ -8005,33 +7918,100 @@ MOZ_ARG_WITHOUT_BOOL(libIDL, [ --without-libIDL Skip check for libIDL (standalone modules only)], SKIP_IDL_CHECK="yes") +if test -z "$CROSS_COMPILE"; then + if test -z "$HOST_LIBIDL_CONFIG"; then + HOST_LIBIDL_CONFIG="$LIBIDL_CONFIG" + fi + if test -z "$HOST_LIBIDL_PREFIX"; then + HOST_LIBIDL_PREFIX="$LIBIDL_PREFIX" + fi +fi + if test "$SKIP_IDL_CHECK" = "no" then _LIBIDL_FOUND= - if test "$MACOS_SDK_DIR"; then - dnl xpidl, and therefore libIDL, is only needed on the build host. - dnl Don't build it against the SDK, as that causes problems. - _MACSAVE_CFLAGS="$CFLAGS" - _MACSAVE_LIBS="$LIBS" - _MACSAVE_LDFLAGS="$LDFLAGS" - _MACSAVE_NEXT_ROOT="$NEXT_ROOT" - changequote(,) - CFLAGS=`echo $CFLAGS|sed -E -e "s%((-I|-isystem )${MACOS_SDK_DIR}/usr/(include|lib/gcc)[^ ]*)|-F${MACOS_SDK_DIR}(/System)?/Library/Frameworks[^ ]*|-nostdinc[^ ]*|-isysroot ${MACOS_SDK_DIR}%%g"` - LIBS=`echo $LIBS|sed -e "s?-L${MACOS_SDK_DIR}/usr/lib[^ ]*??g"` - LDFLAGS=`echo $LDFLAGS|sed -e "s?-Wl,-syslibroot,${MACOS_SDK_DIR}??g"` - changequote([,]) - unset NEXT_ROOT + case "$host" in + *-mingw*|*-cygwin*|*-msvc*|*-mks*) + if test -n "$GLIB_PREFIX"; then + _GLIB_PREFIX_DIR=`cd $GLIB_PREFIX && pwd -W` + if test "$?" = "0"; then + if test `echo ${PATH}: | grep -ic "$_GLIB_PREFIX_DIR/bin:"` = 0; then + AC_MSG_ERROR([GLIB_PREFIX must be in your \$PATH.]) + fi + _GLIB_PREFIX_DIR=`$CYGPATH_W $_GLIB_PREFIX_DIR | $CYGPATH_S` + else + AC_MSG_ERROR([GLIB_PREFIX is set but "${GLIB_PREFIX}" is not a directory.]) + fi + else + _GLIB_PREFIX_DIR=$MOZ_TOOLS_DIR + fi + if test ! -f "${_GLIB_PREFIX_DIR}/include/glib.h"; then + AC_MSG_ERROR([Cannot find $_GLIB_PREFIX_DIR/include/glib.h .]) + fi + GLIB_CFLAGS="-I${_GLIB_PREFIX_DIR}/include" + if test -f "${_GLIB_PREFIX_DIR}/lib/glib-1.2_s.lib"; then + GLIB_LIBS="${_GLIB_PREFIX_DIR}/lib/glib-1.2_s.lib" + elif test -f "${_GLIB_PREFIX_DIR}/lib/glib-1.2.lib"; then + GLIB_LIBS="${_GLIB_PREFIX_DIR}/lib/glib-1.2.lib" + else + AC_MSG_ERROR([Cannot find $_GLIB_PREFIX_DIR/lib/glib-1.2.lib or $_GLIB_PREFIX_DIR/lib/glib-1.2_s.lib]) + fi + + if test -n "$HOST_LIBIDL_PREFIX"; then + _LIBIDL_PREFIX_DIR=`cd $HOST_LIBIDL_PREFIX && pwd -W` + if test "$?" = "0"; then + if test `echo ${PATH}: | grep -ic "$_LIBIDL_PREFIX_DIR/bin:"` = 0; then + AC_MSG_ERROR([LIBIDL_PREFIX must be in your \$PATH.]) + fi + _LIBIDL_PREFIX_DIR=`$CYGPATH_W $_LIBIDL_PREFIX_DIR | $CYGPATH_S` + else + AC_MSG_ERROR([LIBIDL_PREFIX is set but "${LIBIDL_PREFIX}" is not a directory.]) + fi + else + _LIBIDL_PREFIX_DIR=$MOZ_TOOLS_DIR + fi + if test ! -f "${_LIBIDL_PREFIX_DIR}/include/libIDL/IDL.h"; then + AC_MSG_ERROR([Cannot find $_LIBIDL_PREFIX_DIR/include/libIDL/IDL.h .]) + fi + HOST_LIBIDL_CFLAGS="-I${_LIBIDL_PREFIX_DIR}/include ${GLIB_CFLAGS}" + if test -f "${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6_s.lib"; then + HOST_LIBIDL_LIBS="${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6_s.lib" + STATIC_LIBIDL=1 + elif test -f "${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6.lib"; then + HOST_LIBIDL_LIBS="${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6.lib" + else + AC_MSG_ERROR([Cannot find $_LIBIDL_PREFIX_DIR/lib/libidl-0.6.lib or $_LIBIDL_PREFIX_DIR/lib/libidl-0.6_s.lib]) + fi + HOST_LIBIDL_LIBS="${HOST_LIBIDL_LIBS} ${GLIB_LIBS}" + _LIBIDL_FOUND=1 + ;; + esac + + if test -z "$_LIBIDL_FOUND"; then + if test "$MACOS_SDK_DIR"; then + dnl xpidl, and therefore libIDL, is only needed on the build host. + dnl Don't build it against the SDK, as that causes problems. + _MACSAVE_CFLAGS="$CFLAGS" + _MACSAVE_LIBS="$LIBS" + _MACSAVE_LDFLAGS="$LDFLAGS" + _MACSAVE_NEXT_ROOT="$NEXT_ROOT" + changequote(,) + CFLAGS=`echo $CFLAGS|sed -E -e "s%((-I|-isystem )${MACOS_SDK_DIR}/usr/(include|lib/gcc)[^ ]*)|-F${MACOS_SDK_DIR}(/System)?/Library/Frameworks[^ ]*|-nostdinc[^ ]*|-isysroot ${MACOS_SDK_DIR}%%g"` + LIBS=`echo $LIBS|sed -e "s?-L${MACOS_SDK_DIR}/usr/lib[^ ]*??g"` + LDFLAGS=`echo $LDFLAGS|sed -e "s?-Wl,-syslibroot,${MACOS_SDK_DIR}??g"` + changequote([,]) + unset NEXT_ROOT + fi + + PKG_CHECK_MODULES(HOST_LIBIDL, libIDL-2.0 >= 0.8.0 glib-2.0 gobject-2.0, _LIBIDL_FOUND=1,_LIBIDL_FOUND=) fi - if test "$MOZ_ENABLE_GTK2"; then - PKG_CHECK_MODULES(LIBIDL, libIDL-2.0 >= 0.8.0 glib-2.0 gobject-2.0, _LIBIDL_FOUND=1,_LIBIDL_FOUND=) - fi dnl if no gtk/libIDL1 or gtk2/libIDL2 combination was found, fall back dnl to either libIDL1 or libIDL2. if test -z "$_LIBIDL_FOUND"; then AM_PATH_LIBIDL($LIBIDL_VERSION,_LIBIDL_FOUND=1) if test -z "$_LIBIDL_FOUND"; then - PKG_CHECK_MODULES(LIBIDL, libIDL-2.0 >= 0.8.0,_LIBIDL_FOUND=1) + PKG_CHECK_MODULES(HOST_LIBIDL, libIDL-2.0 >= 0.8.0,_LIBIDL_FOUND=1) fi fi dnl @@ -8046,13 +8026,13 @@ then _ORBIT_LIBS=`${ORBIT_CONFIG} client --libs` _ORBIT_INC_PATH=`${PERL} -e '{ for $f (@ARGV) { print "$f " if ($f =~ m/^-I/); } }' -- ${_ORBIT_CFLAGS}` _ORBIT_LIB_PATH=`${PERL} -e '{ for $f (@ARGV) { print "$f " if ($f =~ m/^-L/); } }' -- ${_ORBIT_LIBS}` - LIBIDL_CFLAGS="$_ORBIT_INC_PATH" - LIBIDL_LIBS="$_ORBIT_LIB_PATH -lIDL -lglib" - LIBIDL_CONFIG= + HOST_LIBIDL_CFLAGS="$_ORBIT_INC_PATH" + HOST_LIBIDL_LIBS="$_ORBIT_LIB_PATH -lIDL -lglib" + HOST_LIBIDL_CONFIG= _SAVE_CFLAGS="$CFLAGS" _SAVE_LIBS="$LIBS" - CFLAGS="$LIBIDL_CFLAGS $CFLAGS" - LIBS="$LIBIDL_LIBS $LIBS" + CFLAGS="$HOST_LIBIDL_CFLAGS $CFLAGS" + LIBS="$HOST_LIBIDL_LIBS $LIBS" AC_TRY_RUN([ #include #include @@ -8066,8 +8046,8 @@ int main() { } ], [_LIBIDL_FOUND=1 result="yes"], - [LIBIDL_CFLAGS= - LIBIDL_LIBS= + [HOST_LIBIDL_CFLAGS= + HOST_LIBIDL_LIBS= result="no"], [_LIBIDL_FOUND=1 result="maybe"] ) @@ -8091,16 +8071,42 @@ int main() { fi if test -n "$CROSS_COMPILE"; then - if test -z "$HOST_LIBIDL_CONFIG"; then - HOST_LIBIDL_CONFIG="$LIBIDL_CONFIG" - fi - if test -n "$HOST_LIBIDL_CONFIG" && test "$HOST_LIBIDL_CONFIG" != "no"; then - HOST_LIBIDL_CFLAGS=`${HOST_LIBIDL_CONFIG} --cflags` - HOST_LIBIDL_LIBS=`${HOST_LIBIDL_CONFIG} --libs` - else - HOST_LIBIDL_CFLAGS="$LIBIDL_CFLAGS" - HOST_LIBIDL_LIBS="$LIBIDL_LIBS" - fi + case "$target" in + *-mingw*|*-cygwin*|*-msvc*|*-mks*) + if test -n "$GLIB_PREFIX"; then + GLIB_CFLAGS="-I${GLIB_PREFIX}/include" + if test -f "${GLIB_PREFIX}/lib/glib-1.2_s.lib"; then + GLIB_LIBS="${GLIB_PREFIX}/lib/glib-1.2_s.lib" + elif test -f "${GLIB_PREFIX}/lib/glib-1.2.lib"; then + GLIB_LIBS="${GLIB_PREFIX}/lib/glib-1.2.lib" + else + AC_MSG_ERROR([Cannot find $GLIB_PREFIX/lib/glib-1.2.lib or $GLIB_PREFIX/lib/glib-1.2_s.lib]) + fi + fi + + if test -n "$LIBIDL_PREFIX"; then + LIBIDL_CFLAGS="-I${LIBIDL_PREFIX}/include ${GLIB_CFLAGS}" + if test -f "${LIBIDL_PREFIX}/lib/libIDL-0.6_s.lib"; then + LIBIDL_LIBS="${LIBIDL_PREFIX}/lib/libIDL-0.6_s.lib" + STATIC_LIBIDL=1 + elif test -f "${LIBIDL_PREFIX}/lib/libIDL-0.6.lib"; then + LIBIDL_LIBS="${LIBIDL_PREFIX}/lib/libIDL-0.6.lib" + else + AC_MSG_ERROR([Cannot find $LIBIDL_PREFIX/lib/libIDL-0.6.lib or $LIBIDL_PREFIX/lib/libIDL-0.6_s.lib]) + fi + fi + LIBIDL_LIBS="${LIBIDL_LIBS} ${GLIB_LIBS}" + ;; + *) + if test -n "LIBIDL_CONFIG" && test "LIBIDL_CONFIG" != "no"; then + LIBIDL_CFLAGS=`${LIBIDL_CONFIG} --cflags` + LIBIDL_LIBS=`${LIBIDL_CONFIG} --libs` + fi + ;; + esac +else + LIBIDL_CFLAGS="$HOST_LIBIDL_CFLAGS" + LIBIDL_LIBS="$HOST_LIBIDL_LIBS" fi if test -z "$SKIP_PATH_CHECKS"; then diff --git a/xpcom/typelib/xpidl/Makefile.in b/xpcom/typelib/xpidl/Makefile.in index f79b269c791..70d48d683a5 100644 --- a/xpcom/typelib/xpidl/Makefile.in +++ b/xpcom/typelib/xpidl/Makefile.in @@ -44,20 +44,12 @@ include $(DEPTH)/config/autoconf.mk MODULE = xpcom -# there's no reason to build a target xpidl, why do we do this at all? -##ifneq (,$(filter-out WINCE SYMBIAN,$(OS_ARCH))) -### Sadly, the code here is too smart for the WinCE/Symbian compiler's brain -ifndef CROSS_COMPILE -PROGRAM = xpidl$(BIN_SUFFIX) -SDK_BINARY = $(PROGRAM) -endif - INTERNAL_TOOLS = 1 # glib and libIDL link against the non-debug msvcrt MOZ_NO_DEBUG_RTL=1 -CSRCS = \ +XPIDL_CSRCS = \ xpidl.c \ xpidl_idl.c \ xpidl_util.c \ @@ -68,11 +60,30 @@ CSRCS = \ $(NULL) ifdef CROSS_COMPILE + HOST_PROGRAM = host_xpidl$(HOST_BIN_SUFFIX) -HOST_CSRCS = $(CSRCS) +HOST_CSRCS = $(XPIDL_CSRCS) + ifdef WINCE HOST_LDFLAGS += -ladvapi32.lib endif + +ifdef LIBIDL_LIBS +BUILD_TARGET = 1 +endif + +else # CROSS_COMPILE + +BUILD_TARGET = 1 + +endif # CROSS_COMPILE + +ifdef BUILD_TARGET +PROGRAM = xpidl$(BIN_SUFFIX) +CSRCS = $(XPIDL_CSRCS) +SDK_BINARY = $(PROGRAM) +CFLAGS += LIBIDL_CFLAGS +LIBS += LIBIDL_LIBS endif USE_STATIC_LIBS = 1 @@ -84,37 +95,7 @@ ifeq ($(OS_ARCH),Darwin) # case in order to successfully link. Because the target xpidl isn't # currently built in a cross compile, though, this point is moot for the # time being. - -ifndef CROSS_COMPILE -# When doing a native build, don't build xpidl against the SDK. libIDL -# was most likely configured for the system headers, and bringing in the -# SDK's headers instead will cause problems. _STRIP_SDK = 1 -else - -# Cross-compiling - -# Don't build xpidl for the target. This is not intended to be a permanent -# solution. It's necessary because it is presently difficult to build -# xpidl's prerequisites (libIDL and glib) as fat and suitable for a cross. -# This will be fixed. -mm -PROGRAM= - -# Since only host_xpidl will be built for now, always strip out the SDK -# (as above). -_STRIP_SDK=1 - -# When fat xpidl prerequisites are available, the PROGRAM= and _STRIP_SDK=1 -# above are expected to disappear, and be replaced with the following -# conditonal. - -# ifeq (86_powerpc,$(findstring 86,$(host_cpu))_$(TARGET_CPU)) -# # When cross-compiling from x86 to ppc, an old (10.2-ish) SDK might be in -# # use, and libIDL will have been configured for new (10.4-ish) headers. -# _STRIP_SDK = 1 -# endif - -endif # CROSS_COMPILE ifneq (,$(_STRIP_SDK)$(MACOS_SDK_DIR)) # libIDL is configured for the system's headers, with no SDK involved. From e8d689713a83685edd4749223868c603ca433809 Mon Sep 17 00:00:00 2001 From: Mounir Lamouri Date: Wed, 19 May 2010 16:33:00 -0400 Subject: [PATCH 05/30] Bug 565611 - ""ASSERTION: How did that happen?: 'form == aThisForm'" with " [r=bz, sr=smaug] --- content/base/src/nsContentAreaDragDrop.cpp | 1 - content/html/content/public/nsIFormControl.h | 1 - .../html/content/src/nsGenericHTMLElement.cpp | 4 +- .../html/content/src/nsHTMLFormElement.cpp | 1 - .../html/content/src/nsHTMLLegendElement.cpp | 47 ++++++------------- dom/base/nsDOMClassInfo.cpp | 33 +++++++++---- .../browser/gtk/src/EmbedContextMenuInfo.cpp | 2 - 7 files changed, 40 insertions(+), 49 deletions(-) diff --git a/content/base/src/nsContentAreaDragDrop.cpp b/content/base/src/nsContentAreaDragDrop.cpp index 36318bb9bc6..a9ea2e50468 100644 --- a/content/base/src/nsContentAreaDragDrop.cpp +++ b/content/base/src/nsContentAreaDragDrop.cpp @@ -458,7 +458,6 @@ DragDataProducer::Produce(nsDOMDataTransfer* aDataTransfer, nsCOMPtr form(do_QueryInterface(findFormParent)); if (form && form->GetType() != NS_FORM_OBJECT && form->GetType() != NS_FORM_FIELDSET && - form->GetType() != NS_FORM_LEGEND && form->GetType() != NS_FORM_LABEL && form->GetType() != NS_FORM_OUTPUT) return NS_OK; diff --git a/content/html/content/public/nsIFormControl.h b/content/html/content/public/nsIFormControl.h index 61fdc290b4e..82c89d7c8f1 100644 --- a/content/html/content/public/nsIFormControl.h +++ b/content/html/content/public/nsIFormControl.h @@ -51,7 +51,6 @@ enum FormControlsTypes { NS_FORM_OPTION, NS_FORM_OPTGROUP, NS_FORM_OUTPUT, - NS_FORM_LEGEND, NS_FORM_SELECT, NS_FORM_TEXTAREA, NS_FORM_OBJECT, diff --git a/content/html/content/src/nsGenericHTMLElement.cpp b/content/html/content/src/nsGenericHTMLElement.cpp index 50e8dff9412..a03043a111a 100644 --- a/content/html/content/src/nsGenericHTMLElement.cpp +++ b/content/html/content/src/nsGenericHTMLElement.cpp @@ -2685,7 +2685,6 @@ nsGenericHTMLFormElement::CanBeDisabled() const // It's easier to test the types that _cannot_ be disabled return type != NS_FORM_LABEL && - type != NS_FORM_LEGEND && type != NS_FORM_FIELDSET && type != NS_FORM_OBJECT && type != NS_FORM_OUTPUT; @@ -2728,8 +2727,7 @@ nsGenericHTMLFormElement::IsLabelableControl() const type != NS_FORM_LABEL && type != NS_FORM_OPTION && type != NS_FORM_OPTGROUP && - type != NS_FORM_OBJECT && - type != NS_FORM_LEGEND; + type != NS_FORM_OBJECT; } PRInt32 diff --git a/content/html/content/src/nsHTMLFormElement.cpp b/content/html/content/src/nsHTMLFormElement.cpp index ad712d0f05c..c1573f62934 100644 --- a/content/html/content/src/nsHTMLFormElement.cpp +++ b/content/html/content/src/nsHTMLFormElement.cpp @@ -204,7 +204,6 @@ ShouldBeInElements(nsIFormControl* aFormControl) // NS_FORM_LABEL // NS_FORM_OPTION // NS_FORM_OPTGROUP - // NS_FORM_LEGEND return PR_FALSE; } diff --git a/content/html/content/src/nsHTMLLegendElement.cpp b/content/html/content/src/nsHTMLLegendElement.cpp index 42068e72853..3e25db9077a 100644 --- a/content/html/content/src/nsHTMLLegendElement.cpp +++ b/content/html/content/src/nsHTMLLegendElement.cpp @@ -49,7 +49,7 @@ #include "nsFocusManager.h" #include "nsIFrame.h" -class nsHTMLLegendElement : public nsGenericHTMLFormElement, +class nsHTMLLegendElement : public nsGenericHTMLElement, public nsIDOMHTMLLegendElement { public: @@ -60,23 +60,18 @@ public: NS_DECL_ISUPPORTS_INHERITED // nsIDOMNode - NS_FORWARD_NSIDOMNODE(nsGenericHTMLFormElement::) + NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::) // nsIDOMElement - NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLFormElement::) + NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::) // nsIDOMHTMLElement - NS_FORWARD_NSIDOMHTMLELEMENT(nsGenericHTMLFormElement::) + NS_FORWARD_NSIDOMHTMLELEMENT(nsGenericHTMLElement::) // nsIDOMHTMLLegendElement NS_DECL_NSIDOMHTMLLEGENDELEMENT - // nsIFormControl - NS_IMETHOD_(PRUint32) GetType() const { return NS_FORM_LEGEND; } - NS_IMETHOD Reset(); - NS_IMETHOD SubmitNamesValues(nsFormSubmission* aFormSubmission, - nsIContent* aSubmitElement); - + // nsGenericHTMLElement NS_IMETHODIMP Focus(); virtual void PerformAccesskey(PRBool aKeyCausesActivation, @@ -120,7 +115,7 @@ NS_IMPL_NS_NEW_HTML_ELEMENT(Legend) nsHTMLLegendElement::nsHTMLLegendElement(nsINodeInfo *aNodeInfo) - : nsGenericHTMLFormElement(aNodeInfo) + : nsGenericHTMLElement(aNodeInfo) { } @@ -139,7 +134,7 @@ DOMCI_DATA(HTMLLegendElement, nsHTMLLegendElement) NS_INTERFACE_TABLE_HEAD(nsHTMLLegendElement) NS_HTML_CONTENT_INTERFACE_TABLE1(nsHTMLLegendElement, nsIDOMHTMLLegendElement) NS_HTML_CONTENT_INTERFACE_TABLE_TO_MAP_SEGUE(nsHTMLLegendElement, - nsGenericHTMLFormElement) + nsGenericHTMLElement) NS_HTML_CONTENT_INTERFACE_TABLE_TAIL_CLASSINFO(HTMLLegendElement) @@ -204,7 +199,7 @@ nsHTMLLegendElement::GetAttributeChangeHint(const nsIAtom* aAttribute, PRInt32 aModType) const { nsChangeHint retval = - nsGenericHTMLFormElement::GetAttributeChangeHint(aAttribute, aModType); + nsGenericHTMLElement::GetAttributeChangeHint(aAttribute, aModType); if (aAttribute == nsGkAtoms::align) { NS_UpdateHint(retval, NS_STYLE_HINT_REFLOW); } @@ -222,8 +217,8 @@ nsHTMLLegendElement::SetAttr(PRInt32 aNameSpaceID, nsIAtom* aAttribute, UnregAccessKey(); } - nsresult rv = nsGenericHTMLFormElement::SetAttr(aNameSpaceID, aAttribute, - aPrefix, aValue, aNotify); + nsresult rv = nsGenericHTMLElement::SetAttr(aNameSpaceID, aAttribute, + aPrefix, aValue, aNotify); if (accesskey && !aValue.IsEmpty()) { SetFlags(NODE_HAS_ACCESSKEY); @@ -244,13 +239,7 @@ nsHTMLLegendElement::UnsetAttr(PRInt32 aNameSpaceID, nsIAtom* aAttribute, UnsetFlags(NODE_HAS_ACCESSKEY); } - return nsGenericHTMLFormElement::UnsetAttr(aNameSpaceID, aAttribute, aNotify); -} - -nsresult -nsHTMLLegendElement::Reset() -{ - return NS_OK; + return nsGenericHTMLElement::UnsetAttr(aNameSpaceID, aAttribute, aNotify); } nsresult @@ -258,9 +247,9 @@ nsHTMLLegendElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent, nsIContent* aBindingParent, PRBool aCompileEventHandlers) { - nsresult rv = nsGenericHTMLFormElement::BindToTree(aDocument, aParent, - aBindingParent, - aCompileEventHandlers); + nsresult rv = nsGenericHTMLElement::BindToTree(aDocument, aParent, + aBindingParent, + aCompileEventHandlers); NS_ENSURE_SUCCESS(rv, rv); if (aDocument) { @@ -277,7 +266,7 @@ nsHTMLLegendElement::UnbindFromTree(PRBool aDeep, PRBool aNullParent) UnregAccessKey(); } - nsGenericHTMLFormElement::UnbindFromTree(aDeep, aNullParent); + nsGenericHTMLElement::UnbindFromTree(aDeep, aNullParent); } NS_IMETHODIMP @@ -310,9 +299,3 @@ nsHTMLLegendElement::PerformAccesskey(PRBool aKeyCausesActivation, Focus(); } -NS_IMETHODIMP -nsHTMLLegendElement::SubmitNamesValues(nsFormSubmission* aFormSubmission, - nsIContent* aSubmitElement) -{ - return NS_OK; -} diff --git a/dom/base/nsDOMClassInfo.cpp b/dom/base/nsDOMClassInfo.cpp index 71789adaa84..95606a1dffa 100644 --- a/dom/base/nsDOMClassInfo.cpp +++ b/dom/base/nsDOMClassInfo.cpp @@ -7302,17 +7302,32 @@ nsNodeSH::PreCreate(nsISupports *nativeObj, JSContext *cx, JSObject *globalObj, native_parent = doc; // But for HTML form controls, use the form as scope parent. - if (nodeIsElement && - node->IsNodeOfType(nsINode::eHTML_FORM_CONTROL)) { - nsCOMPtr form_control(do_QueryInterface(node)); + if (nodeIsElement) { + if (node->IsNodeOfType(nsINode::eHTML_FORM_CONTROL)) { + nsCOMPtr form_control(do_QueryInterface(node)); - if (form_control) { - nsCOMPtr form; - form_control->GetForm(getter_AddRefs(form)); + if (form_control) { + nsCOMPtr form; + form_control->GetForm(getter_AddRefs(form)); - if (form) { - // Found a form, use it. - native_parent = form; + if (form) { + // Found a form, use it. + native_parent = form; + } + } + // Legend isn't an HTML form control but should have its fieldset form + // as scope parent at least for backward compatibility. + } else if (node->AsElement()->IsHTML() && + node->AsElement()->Tag() == nsGkAtoms::legend) { + nsCOMPtr legend(do_QueryInterface(node)); + + if (legend) { + nsCOMPtr form; + legend->GetForm(getter_AddRefs(form)); + + if (form) { + native_parent = form; + } } } } diff --git a/embedding/browser/gtk/src/EmbedContextMenuInfo.cpp b/embedding/browser/gtk/src/EmbedContextMenuInfo.cpp index 0a9791d1738..82576388dd2 100644 --- a/embedding/browser/gtk/src/EmbedContextMenuInfo.cpp +++ b/embedding/browser/gtk/src/EmbedContextMenuInfo.cpp @@ -228,8 +228,6 @@ EmbedContextMenuInfo::SetFormControlType(nsIDOMEventTarget *originalTarget) break; case NS_FORM_OPTGROUP: break; - case NS_FORM_LEGEND: - break; case NS_FORM_SELECT: break; case NS_FORM_TEXTAREA: From 717325985ef20046d737866eac41f7a0a3798d52 Mon Sep 17 00:00:00 2001 From: Mounir Lamouri Date: Thu, 27 May 2010 06:51:00 -0400 Subject: [PATCH 06/30] Bug 565904 - "HTMLOptGroupElement and HTMLOptionElement are not form controls but are listed in nsIFormControl" [r=smaug] --- content/html/content/public/nsIFormControl.h | 2 -- content/html/content/src/nsGenericHTMLElement.cpp | 2 -- content/html/content/src/nsHTMLFormElement.cpp | 2 -- embedding/browser/gtk/src/EmbedContextMenuInfo.cpp | 4 ---- 4 files changed, 10 deletions(-) diff --git a/content/html/content/public/nsIFormControl.h b/content/html/content/public/nsIFormControl.h index 82c89d7c8f1..2331ae422d6 100644 --- a/content/html/content/public/nsIFormControl.h +++ b/content/html/content/public/nsIFormControl.h @@ -48,8 +48,6 @@ class nsFormSubmission; enum FormControlsTypes { NS_FORM_FIELDSET = 1, NS_FORM_LABEL, - NS_FORM_OPTION, - NS_FORM_OPTGROUP, NS_FORM_OUTPUT, NS_FORM_SELECT, NS_FORM_TEXTAREA, diff --git a/content/html/content/src/nsGenericHTMLElement.cpp b/content/html/content/src/nsGenericHTMLElement.cpp index a03043a111a..89586d92c6b 100644 --- a/content/html/content/src/nsGenericHTMLElement.cpp +++ b/content/html/content/src/nsGenericHTMLElement.cpp @@ -2725,8 +2725,6 @@ nsGenericHTMLFormElement::IsLabelableControl() const PRInt32 type = GetType(); return type != NS_FORM_FIELDSET && type != NS_FORM_LABEL && - type != NS_FORM_OPTION && - type != NS_FORM_OPTGROUP && type != NS_FORM_OBJECT; } diff --git a/content/html/content/src/nsHTMLFormElement.cpp b/content/html/content/src/nsHTMLFormElement.cpp index c1573f62934..435f69ededb 100644 --- a/content/html/content/src/nsHTMLFormElement.cpp +++ b/content/html/content/src/nsHTMLFormElement.cpp @@ -202,8 +202,6 @@ ShouldBeInElements(nsIFormControl* aFormControl) // // NS_FORM_INPUT_IMAGE // NS_FORM_LABEL - // NS_FORM_OPTION - // NS_FORM_OPTGROUP return PR_FALSE; } diff --git a/embedding/browser/gtk/src/EmbedContextMenuInfo.cpp b/embedding/browser/gtk/src/EmbedContextMenuInfo.cpp index 82576388dd2..789e5d08acc 100644 --- a/embedding/browser/gtk/src/EmbedContextMenuInfo.cpp +++ b/embedding/browser/gtk/src/EmbedContextMenuInfo.cpp @@ -224,10 +224,6 @@ EmbedContextMenuInfo::SetFormControlType(nsIDOMEventTarget *originalTarget) break; case NS_FORM_LABEL: break; - case NS_FORM_OPTION: - break; - case NS_FORM_OPTGROUP: - break; case NS_FORM_SELECT: break; case NS_FORM_TEXTAREA: From 0057ffc70dfb030459c73648253ece809371d023 Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Fri, 21 May 2010 07:21:00 -0400 Subject: [PATCH 07/30] Bug 566467 - fixed compilation with --disable-ipc. [r=ted] --- toolkit/library/Makefile.in | 2 +- toolkit/library/libxul-config.mk | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/toolkit/library/Makefile.in b/toolkit/library/Makefile.in index 1a1f9d0345b..b06f4fd14bb 100644 --- a/toolkit/library/Makefile.in +++ b/toolkit/library/Makefile.in @@ -236,7 +236,7 @@ EXTRA_DSO_LDOPTS += -lelf -ldemangle endif ifeq ($(OS_ARCH),WINNT) -OS_LIBS += $(call EXPAND_LIBNAME,shell32 ole32 uuid version winspool comdlg32 imm32 winmm wsock32 msimg32 shlwapi) +OS_LIBS += $(call EXPAND_LIBNAME,shell32 ole32 uuid version winspool comdlg32 imm32 winmm wsock32 msimg32 shlwapi psapi) ifneq (,$(MOZ_DEBUG)$(NS_TRACE_MALLOC)) OS_LIBS += $(call EXPAND_LIBNAME,imagehlp) endif diff --git a/toolkit/library/libxul-config.mk b/toolkit/library/libxul-config.mk index 5599c92d74a..db59f989f95 100644 --- a/toolkit/library/libxul-config.mk +++ b/toolkit/library/libxul-config.mk @@ -107,7 +107,7 @@ ifeq (Linux,$(OS_ARCH)) OS_LIBS += -lrt endif ifeq (WINNT,$(OS_ARCH)) -OS_LIBS += psapi.lib dbghelp.lib +OS_LIBS += dbghelp.lib endif endif From 63db5e6a969ccd75c75fb06d92b1f201722026f9 Mon Sep 17 00:00:00 2001 From: Craig Topper Date: Wed, 19 May 2010 22:28:00 -0400 Subject: [PATCH 08/30] Bug 566808 - "DeCOMtaminate nsIStyleRule method signatures" [r=dbaron] --- content/base/src/nsMappedAttributes.cpp | 7 ++-- content/base/src/nsMappedAttributes.h | 4 +-- .../html/content/src/nsHTMLBodyElement.cpp | 12 +++---- content/svg/content/src/nsSVGElement.h | 1 + layout/style/nsCSSDataBlock.cpp | 6 ++-- layout/style/nsCSSDataBlock.h | 2 +- layout/style/nsCSSRule.cpp | 3 +- layout/style/nsCSSRule.h | 2 +- layout/style/nsCSSRules.cpp | 35 ++++++++----------- layout/style/nsCSSRules.h | 10 +++--- layout/style/nsCSSStyleRule.cpp | 23 ++++++------ layout/style/nsHTMLStyleSheet.cpp | 15 +++----- layout/style/nsHTMLStyleSheet.h | 10 +++--- layout/style/nsICSSGroupRule.h | 6 ++-- layout/style/nsICSSImportRule.h | 9 +++-- layout/style/nsICSSNameSpaceRule.h | 6 ++-- layout/style/nsICSSRule.h | 7 ++-- layout/style/nsICSSStyleRule.h | 9 +++-- layout/style/nsIStyleRule.h | 4 +-- layout/style/nsStyleSet.cpp | 6 ++-- layout/style/nsStyleSet.h | 4 +-- layout/style/nsTransitionManager.cpp | 30 ++++++++-------- 22 files changed, 92 insertions(+), 119 deletions(-) diff --git a/content/base/src/nsMappedAttributes.cpp b/content/base/src/nsMappedAttributes.cpp index a58e845cf9b..c12243fda12 100644 --- a/content/base/src/nsMappedAttributes.cpp +++ b/content/base/src/nsMappedAttributes.cpp @@ -195,17 +195,16 @@ nsMappedAttributes::SetStyleSheet(nsHTMLStyleSheet* aSheet) mSheet = aSheet; // not ref counted } -NS_IMETHODIMP +/* virtual */ void nsMappedAttributes::MapRuleInfoInto(nsRuleData* aRuleData) { if (mRuleMapper) { (*mRuleMapper)(this, aRuleData); } - return NS_OK; } #ifdef DEBUG -NS_IMETHODIMP +/* virtual */ void nsMappedAttributes::List(FILE* out, PRInt32 aIndent) const { nsAutoString buffer; @@ -228,8 +227,6 @@ nsMappedAttributes::List(FILE* out, PRInt32 aIndent) const fputs(NS_LossyConvertUTF16toASCII(buffer).get(), out); fputs("\n", out); } - - return NS_OK; } #endif diff --git a/content/base/src/nsMappedAttributes.h b/content/base/src/nsMappedAttributes.h index cb196b4efaf..7367779cd18 100644 --- a/content/base/src/nsMappedAttributes.h +++ b/content/base/src/nsMappedAttributes.h @@ -103,9 +103,9 @@ public: // nsIStyleRule - NS_IMETHOD MapRuleInfoInto(nsRuleData* aRuleData); + virtual void MapRuleInfoInto(nsRuleData* aRuleData); #ifdef DEBUG - NS_METHOD List(FILE* out = stdout, PRInt32 aIndent = 0) const; + virtual void List(FILE* out = stdout, PRInt32 aIndent = 0) const; #endif private: diff --git a/content/html/content/src/nsHTMLBodyElement.cpp b/content/html/content/src/nsHTMLBodyElement.cpp index 38b42114721..9d18b1b1c32 100644 --- a/content/html/content/src/nsHTMLBodyElement.cpp +++ b/content/html/content/src/nsHTMLBodyElement.cpp @@ -69,9 +69,9 @@ public: NS_DECL_ISUPPORTS // nsIStyleRule interface - NS_IMETHOD MapRuleInfoInto(nsRuleData* aRuleData); + virtual void MapRuleInfoInto(nsRuleData* aRuleData); #ifdef DEBUG - NS_IMETHOD List(FILE* out = stdout, PRInt32 aIndent = 0) const; + virtual void List(FILE* out = stdout, PRInt32 aIndent = 0) const; #endif nsHTMLBodyElement* mPart; // not ref-counted, cleared by content @@ -132,11 +132,11 @@ BodyRule::~BodyRule() NS_IMPL_ISUPPORTS1(BodyRule, nsIStyleRule) -NS_IMETHODIMP +/* virtual */ void BodyRule::MapRuleInfoInto(nsRuleData* aData) { if (!aData || !(aData->mSIDs & NS_STYLE_INHERIT_BIT(Margin)) || !aData->mMarginData || !mPart) - return NS_OK; // We only care about margins. + return; // We only care about margins. PRInt32 bodyMarginWidth = -1; PRInt32 bodyMarginHeight = -1; @@ -261,14 +261,12 @@ BodyRule::MapRuleInfoInto(nsRuleData* aData) } } } - return NS_OK; } #ifdef DEBUG -NS_IMETHODIMP +/* virtual */ void BodyRule::List(FILE* out, PRInt32 aIndent) const { - return NS_OK; } #endif diff --git a/content/svg/content/src/nsSVGElement.h b/content/svg/content/src/nsSVGElement.h index ea263cf53df..0d9e768c06d 100644 --- a/content/svg/content/src/nsSVGElement.h +++ b/content/svg/content/src/nsSVGElement.h @@ -70,6 +70,7 @@ struct nsSVGEnumMapping; class nsSVGViewBox; class nsSVGPreserveAspectRatio; class nsSVGString; +struct gfxMatrix; typedef nsStyledElement nsSVGElementBase; diff --git a/layout/style/nsCSSDataBlock.cpp b/layout/style/nsCSSDataBlock.cpp index bd64c589302..73907c51e82 100644 --- a/layout/style/nsCSSDataBlock.cpp +++ b/layout/style/nsCSSDataBlock.cpp @@ -218,7 +218,7 @@ ShouldStartImageLoads(nsRuleData *aRuleData, nsCSSProperty aProperty) nsCSSProps::PropHasFlags(aProperty, CSS_PROPERTY_START_IMAGE_LOADS); } -nsresult +void nsCSSCompressedDataBlock::MapRuleInfoInto(nsRuleData *aRuleData) const { // If we have no data for these structs, then return immediately. @@ -226,7 +226,7 @@ nsCSSCompressedDataBlock::MapRuleInfoInto(nsRuleData *aRuleData) const // have to worry much less (although still some) about the speed of // the rest of the function. if (!(aRuleData->mSIDs & mStyleBits)) - return NS_OK; + return; nsIDocument* doc = aRuleData->mPresContext->Document(); @@ -358,8 +358,6 @@ nsCSSCompressedDataBlock::MapRuleInfoInto(nsRuleData *aRuleData) const } } NS_ASSERTION(cursor == cursor_end, "inconsistent data"); - - return NS_OK; } const void* diff --git a/layout/style/nsCSSDataBlock.h b/layout/style/nsCSSDataBlock.h index 35d0af909cc..e65308005bc 100644 --- a/layout/style/nsCSSDataBlock.h +++ b/layout/style/nsCSSDataBlock.h @@ -72,7 +72,7 @@ public: * Do what |nsIStyleRule::MapRuleInfoInto| needs to do for a style * rule using this block for storage. */ - nsresult MapRuleInfoInto(nsRuleData *aRuleData) const; + void MapRuleInfoInto(nsRuleData *aRuleData) const; /** * Return the location at which the *value* for the property is diff --git a/layout/style/nsCSSRule.cpp b/layout/style/nsCSSRule.cpp index 660daadc47e..bdd36edb5d5 100644 --- a/layout/style/nsCSSRule.cpp +++ b/layout/style/nsCSSRule.cpp @@ -89,10 +89,9 @@ nsCSSRule::SetParentRule(nsICSSGroupRule* aRule) return NS_OK; } -NS_IMETHODIMP +/* virtual */ void nsCSSRule::MapRuleInfoInto(nsRuleData* aRuleData) { // The nsIStyleRule contract is not appropriate for all CSS rules. NS_NOTREACHED("nsCSSRule::MapRuleInfoInto"); - return NS_OK; } diff --git a/layout/style/nsCSSRule.h b/layout/style/nsCSSRule.h index c1394a730f1..104f36d1d78 100644 --- a/layout/style/nsCSSRule.h +++ b/layout/style/nsCSSRule.h @@ -68,7 +68,7 @@ public: // nsIStyleRule methods // The new mapping function. - NS_IMETHOD MapRuleInfoInto(nsRuleData* aRuleData); + virtual void MapRuleInfoInto(nsRuleData* aRuleData); protected: nsCSSStyleSheet* mSheet; diff --git a/layout/style/nsCSSRules.cpp b/layout/style/nsCSSRules.cpp index 57abc5237a3..14554f1239e 100644 --- a/layout/style/nsCSSRules.cpp +++ b/layout/style/nsCSSRules.cpp @@ -78,12 +78,12 @@ NS_IMETHODIMP _class::GetStyleSheet(nsIStyleSheet*& aSheet) const { return super NS_IMETHODIMP _class::SetStyleSheet(nsCSSStyleSheet* aSheet) { return super::SetStyleSheet(aSheet); } \ NS_IMETHODIMP _class::SetParentRule(nsICSSGroupRule* aRule) { return super::SetParentRule(aRule); } \ nsIDOMCSSRule* _class::GetDOMRuleWeak(nsresult *aResult) { *aResult = NS_OK; return this; } \ -NS_IMETHODIMP _class::MapRuleInfoInto(nsRuleData* aRuleData) { return NS_OK; } +/* virtual */ void _class::MapRuleInfoInto(nsRuleData* aRuleData) { } #define IMPL_STYLE_RULE_INHERIT2(_class, super) \ NS_IMETHODIMP _class::GetStyleSheet(nsIStyleSheet*& aSheet) const { return super::GetStyleSheet(aSheet); } \ NS_IMETHODIMP _class::SetParentRule(nsICSSGroupRule* aRule) { return super::SetParentRule(aRule); } \ -NS_IMETHODIMP _class::MapRuleInfoInto(nsRuleData* aRuleData) { return NS_OK; } +/* virtual */ void _class::MapRuleInfoInto(nsRuleData* aRuleData) { } // ------------------------------- // Style Rule List for group rules @@ -200,7 +200,7 @@ public: // nsIStyleRule methods #ifdef DEBUG - NS_IMETHOD List(FILE* out = stdout, PRInt32 aIndent = 0) const; + virtual void List(FILE* out = stdout, PRInt32 aIndent = 0) const; #endif // nsICSSRule methods @@ -252,7 +252,7 @@ NS_INTERFACE_MAP_END IMPL_STYLE_RULE_INHERIT(CSSCharsetRuleImpl, nsCSSRule) #ifdef DEBUG -NS_IMETHODIMP +/* virtual */ void CSSCharsetRuleImpl::List(FILE* out, PRInt32 aIndent) const { // Indent @@ -261,8 +261,6 @@ CSSCharsetRuleImpl::List(FILE* out, PRInt32 aIndent) const fputs("@charset \"", out); fputs(NS_LossyConvertUTF16toASCII(mEncoding).get(), out); fputs("\"\n", out); - - return NS_OK; } #endif @@ -376,7 +374,7 @@ public: // nsIStyleRule methods #ifdef DEBUG - NS_IMETHOD List(FILE* out = stdout, PRInt32 aIndent = 0) const; + virtual void List(FILE* out = stdout, PRInt32 aIndent = 0) const; #endif // nsICSSRule methods @@ -452,7 +450,7 @@ NS_INTERFACE_MAP_END IMPL_STYLE_RULE_INHERIT(CSSImportRuleImpl, nsCSSRule) #ifdef DEBUG -NS_IMETHODIMP +/* virtual */ void CSSImportRuleImpl::List(FILE* out, PRInt32 aIndent) const { // Indent @@ -466,8 +464,6 @@ CSSImportRuleImpl::List(FILE* out, PRInt32 aIndent) const mMedia->GetText(mediaText); fputs(NS_LossyConvertUTF16toASCII(mediaText).get(), out); fputs("\n", out); - - return NS_OK; } #endif @@ -700,7 +696,7 @@ nsCSSGroupRule::SetStyleSheet(nsCSSStyleSheet* aSheet) } #ifdef DEBUG -NS_IMETHODIMP +/* virtual */ void nsCSSGroupRule::List(FILE* out, PRInt32 aIndent) const { fputs(" {\n", out); @@ -709,7 +705,6 @@ nsCSSGroupRule::List(FILE* out, PRInt32 aIndent) const mRules.ObjectAt(index)->List(out, aIndent + 1); } fputs("}\n", out); - return NS_OK; } #endif @@ -934,7 +929,7 @@ nsCSSMediaRule::SetStyleSheet(nsCSSStyleSheet* aSheet) } #ifdef DEBUG -NS_IMETHODIMP +/* virtual */ void nsCSSMediaRule::List(FILE* out, PRInt32 aIndent) const { for (PRInt32 indent = aIndent; --indent >= 0; ) fputs(" ", out); @@ -949,7 +944,7 @@ nsCSSMediaRule::List(FILE* out, PRInt32 aIndent) const fputs(NS_LossyConvertUTF16toASCII(mediaText).get(), out); } - return nsCSSGroupRule::List(out, aIndent); + nsCSSGroupRule::List(out, aIndent); } #endif @@ -1094,7 +1089,7 @@ NS_INTERFACE_MAP_BEGIN(nsCSSDocumentRule) NS_INTERFACE_MAP_END #ifdef DEBUG -NS_IMETHODIMP +/* virtual */ void nsCSSDocumentRule::List(FILE* out, PRInt32 aIndent) const { for (PRInt32 indent = aIndent; --indent >= 0; ) fputs(" ", out); @@ -1121,7 +1116,7 @@ nsCSSDocumentRule::List(FILE* out, PRInt32 aIndent) const str.Cut(str.Length() - 2, 1); // remove last , fputs(str.get(), out); - return nsCSSGroupRule::List(out, aIndent); + nsCSSGroupRule::List(out, aIndent); } #endif @@ -1276,7 +1271,7 @@ public: // nsIStyleRule methods #ifdef DEBUG - NS_IMETHOD List(FILE* out = stdout, PRInt32 aIndent = 0) const; + virtual void List(FILE* out = stdout, PRInt32 aIndent = 0) const; #endif // nsICSSRule methods @@ -1336,7 +1331,7 @@ NS_INTERFACE_MAP_END IMPL_STYLE_RULE_INHERIT(CSSNameSpaceRuleImpl, nsCSSRule) #ifdef DEBUG -NS_IMETHODIMP +/* virtual */ void CSSNameSpaceRuleImpl::List(FILE* out, PRInt32 aIndent) const { for (PRInt32 indent = aIndent; --indent >= 0; ) fputs(" ", out); @@ -1354,7 +1349,6 @@ CSSNameSpaceRuleImpl::List(FILE* out, PRInt32 aIndent) const fputs("url(", out); fputs(NS_LossyConvertUTF16toASCII(mURLSpec).get(), out); fputs(")\n", out); - return NS_OK; } #endif @@ -1825,7 +1819,7 @@ NS_INTERFACE_MAP_END IMPL_STYLE_RULE_INHERIT(nsCSSFontFaceRule, nsCSSRule) #ifdef DEBUG -NS_IMETHODIMP +void nsCSSFontFaceRule::List(FILE* out, PRInt32 aIndent) const { nsCString baseInd, descInd; @@ -1852,7 +1846,6 @@ nsCSSFontFaceRule::List(FILE* out, PRInt32 aIndent) const NS_ConvertUTF16toUTF8(descStr).get()); } fprintf(out, "%s}\n", baseInd.get()); - return NS_OK; } #endif diff --git a/layout/style/nsCSSRules.h b/layout/style/nsCSSRules.h index e3eeb2ccf09..82f54fd3631 100644 --- a/layout/style/nsCSSRules.h +++ b/layout/style/nsCSSRules.h @@ -60,7 +60,7 @@ class nsMediaList; NS_IMETHOD GetStyleSheet(nsIStyleSheet*& aSheet) const; \ NS_IMETHOD SetStyleSheet(nsCSSStyleSheet* aSheet); \ NS_IMETHOD SetParentRule(nsICSSGroupRule* aRule); \ -NS_IMETHOD MapRuleInfoInto(nsRuleData* aRuleData); +virtual void MapRuleInfoInto(nsRuleData* aRuleData); #define DECL_STYLE_RULE_INHERIT \ DECL_STYLE_RULE_INHERIT_NO_DOMRULE \ @@ -80,7 +80,7 @@ protected: // to help implement nsIStyleRule #ifdef DEBUG - NS_IMETHOD List(FILE* out = stdout, PRInt32 aIndent = 0) const; + virtual void List(FILE* out = stdout, PRInt32 aIndent = 0) const; #endif public: @@ -124,7 +124,7 @@ public: // nsIStyleRule methods #ifdef DEBUG - NS_IMETHOD List(FILE* out = stdout, PRInt32 aIndent = 0) const; + virtual void List(FILE* out = stdout, PRInt32 aIndent = 0) const; #endif // nsICSSRule methods @@ -166,7 +166,7 @@ public: // nsIStyleRule methods #ifdef DEBUG - NS_IMETHOD List(FILE* out = stdout, PRInt32 aIndent = 0) const; + virtual void List(FILE* out = stdout, PRInt32 aIndent = 0) const; #endif // nsICSSRule methods @@ -255,7 +255,7 @@ public: // nsIStyleRule methods #ifdef DEBUG - NS_IMETHOD List(FILE* out = stdout, PRInt32 aIndent = 0) const; + virtual void List(FILE* out = stdout, PRInt32 aIndent = 0) const; #endif // nsICSSRule methods diff --git a/layout/style/nsCSSStyleRule.cpp b/layout/style/nsCSSStyleRule.cpp index c73e0245db7..6273184e8b3 100644 --- a/layout/style/nsCSSStyleRule.cpp +++ b/layout/style/nsCSSStyleRule.cpp @@ -903,9 +903,9 @@ public: NS_DECL_ISUPPORTS // nsIStyleRule interface - NS_IMETHOD MapRuleInfoInto(nsRuleData* aRuleData); + virtual void MapRuleInfoInto(nsRuleData* aRuleData); #ifdef DEBUG - NS_IMETHOD List(FILE* out = stdout, PRInt32 aIndent = 0) const; + virtual void List(FILE* out = stdout, PRInt32 aIndent = 0) const; #endif protected: @@ -927,14 +927,14 @@ CSSImportantRule::~CSSImportantRule(void) NS_IMPL_ISUPPORTS1(CSSImportantRule, nsIStyleRule) -NS_IMETHODIMP +/* virtual */ void CSSImportantRule::MapRuleInfoInto(nsRuleData* aRuleData) { - return mImportantBlock->MapRuleInfoInto(aRuleData); + mImportantBlock->MapRuleInfoInto(aRuleData); } #ifdef DEBUG -NS_IMETHODIMP +/* virtual */ void CSSImportantRule::List(FILE* out, PRInt32 aIndent) const { // Indent @@ -942,7 +942,6 @@ CSSImportantRule::List(FILE* out, PRInt32 aIndent) const fprintf(out, "! Important rule block=%p\n", static_cast(mImportantBlock.get())); - return NS_OK; } #endif @@ -1319,10 +1318,10 @@ public: DeclarationChanged(PRBool aHandleContainer); // The new mapping function. - NS_IMETHOD MapRuleInfoInto(nsRuleData* aRuleData); + virtual void MapRuleInfoInto(nsRuleData* aRuleData); #ifdef DEBUG - NS_IMETHOD List(FILE* out = stdout, PRInt32 aIndent = 0) const; + virtual void List(FILE* out = stdout, PRInt32 aIndent = 0) const; #endif private: @@ -1550,16 +1549,16 @@ CSSStyleRuleImpl::DeclarationChanged(PRBool aHandleContainer) return clone; } -NS_IMETHODIMP +/* virtual */ void CSSStyleRuleImpl::MapRuleInfoInto(nsRuleData* aRuleData) { NS_ABORT_IF_FALSE(mNormalBlock, "somebody forgot to call nsICSSStyleRule::RuleMatched"); - return mNormalBlock->MapRuleInfoInto(aRuleData); + mNormalBlock->MapRuleInfoInto(aRuleData); } #ifdef DEBUG -NS_IMETHODIMP +/* virtual */ void CSSStyleRuleImpl::List(FILE* out, PRInt32 aIndent) const { // Indent @@ -1578,8 +1577,6 @@ CSSStyleRuleImpl::List(FILE* out, PRInt32 aIndent) const fputs("{ null declaration }", out); } fputs("\n", out); - - return NS_OK; } #endif diff --git a/layout/style/nsHTMLStyleSheet.cpp b/layout/style/nsHTMLStyleSheet.cpp index e2464436b28..b55aa5d8ab3 100644 --- a/layout/style/nsHTMLStyleSheet.cpp +++ b/layout/style/nsHTMLStyleSheet.cpp @@ -76,7 +76,7 @@ using namespace mozilla::dom; NS_IMPL_ISUPPORTS1(nsHTMLStyleSheet::HTMLColorRule, nsIStyleRule) -NS_IMETHODIMP +/* virtual */ void nsHTMLStyleSheet::HTMLColorRule::MapRuleInfoInto(nsRuleData* aRuleData) { if (aRuleData->mSIDs & NS_STYLE_INHERIT_BIT(Color)) { @@ -84,36 +84,32 @@ nsHTMLStyleSheet::HTMLColorRule::MapRuleInfoInto(nsRuleData* aRuleData) aRuleData->mPresContext->UseDocumentColors()) aRuleData->mColorData->mColor.SetColorValue(mColor); } - return NS_OK; } #ifdef DEBUG -NS_IMETHODIMP +/* virtual */ void nsHTMLStyleSheet::HTMLColorRule::List(FILE* out, PRInt32 aIndent) const { - return NS_OK; } #endif NS_IMPL_ISUPPORTS1(nsHTMLStyleSheet::GenericTableRule, nsIStyleRule) -NS_IMETHODIMP +/* virtual */ void nsHTMLStyleSheet::GenericTableRule::MapRuleInfoInto(nsRuleData* aRuleData) { // Nothing to do. - return NS_OK; } #ifdef DEBUG -NS_IMETHODIMP +/* virtual */ void nsHTMLStyleSheet::GenericTableRule::List(FILE* out, PRInt32 aIndent) const { - return NS_OK; } #endif -NS_IMETHODIMP +/* virtual */ void nsHTMLStyleSheet::TableTHRule::MapRuleInfoInto(nsRuleData* aRuleData) { if (aRuleData->mSIDs & NS_STYLE_INHERIT_BIT(Text)) { @@ -123,7 +119,6 @@ nsHTMLStyleSheet::TableTHRule::MapRuleInfoInto(nsRuleData* aRuleData) eCSSUnit_Enumerated); } } - return NS_OK; } // ----------------------------------------------------------- diff --git a/layout/style/nsHTMLStyleSheet.h b/layout/style/nsHTMLStyleSheet.h index dba8a7ccd16..9a932f2f9f7 100644 --- a/layout/style/nsHTMLStyleSheet.h +++ b/layout/style/nsHTMLStyleSheet.h @@ -119,9 +119,9 @@ private: NS_DECL_ISUPPORTS // nsIStyleRule interface - NS_IMETHOD MapRuleInfoInto(nsRuleData* aRuleData); + virtual void MapRuleInfoInto(nsRuleData* aRuleData); #ifdef DEBUG - NS_IMETHOD List(FILE* out = stdout, PRInt32 aIndent = 0) const; + virtual void List(FILE* out = stdout, PRInt32 aIndent = 0) const; #endif nscolor mColor; @@ -137,9 +137,9 @@ private: NS_DECL_ISUPPORTS // nsIStyleRule interface - NS_IMETHOD MapRuleInfoInto(nsRuleData* aRuleData); + virtual void MapRuleInfoInto(nsRuleData* aRuleData); #ifdef DEBUG - NS_IMETHOD List(FILE* out = stdout, PRInt32 aIndent = 0) const; + virtual void List(FILE* out = stdout, PRInt32 aIndent = 0) const; #endif }; @@ -150,7 +150,7 @@ private: public: TableTHRule() {} - NS_IMETHOD MapRuleInfoInto(nsRuleData* aRuleData); + virtual void MapRuleInfoInto(nsRuleData* aRuleData); }; nsCOMPtr mURL; diff --git a/layout/style/nsICSSGroupRule.h b/layout/style/nsICSSGroupRule.h index 9cd7422ef66..602b6f8a65b 100644 --- a/layout/style/nsICSSGroupRule.h +++ b/layout/style/nsICSSGroupRule.h @@ -46,13 +46,13 @@ #include "nsICSSRule.h" #include "nsCOMArray.h" -class nsIAtom; class nsPresContext; class nsMediaQueryResultCacheKey; -// IID for the nsICSSGroupRule interface {d0f07b17-e9c7-4a54-aaa4-622425b38d27} +// IID for the nsICSSGroupRule interface {4d5e7eca-433e-491a-b226-39a200390ea1} #define NS_ICSS_GROUP_RULE_IID \ -{0xd0f07b17, 0xe9c7, 0x4a54, {0xaa, 0xa4, 0x62, 0x24, 0x25, 0xb3, 0x8d, 0x27}} +{0x4d5e7eca, 0x433e, 0x491a, {0xb2, 0x26, 0x39, 0xa2, 0x00, 0x39, 0x0e, 0xa1}} + class nsICSSGroupRule : public nsICSSRule { public: diff --git a/layout/style/nsICSSImportRule.h b/layout/style/nsICSSImportRule.h index a13070418d1..05c1471bddc 100644 --- a/layout/style/nsICSSImportRule.h +++ b/layout/style/nsICSSImportRule.h @@ -41,15 +41,14 @@ #define nsICSSImportRule_h___ #include "nsICSSRule.h" -#include "nsString.h" -class nsIAtom; -class nsIURI; class nsMediaList; +class nsString; -// IID for the nsICSSImportRule interface {b2e65d15-6673-4548-a65a-c45ce87304f2} +// IID for the nsICSSImportRule interface {1d7a658b-2f7b-423d-a3d9-dd5b553f69a9} #define NS_ICSS_IMPORT_RULE_IID \ -{0xb2e65d15, 0x6673, 0x4548, {0xa6, 0x5a, 0xc4, 0x5c, 0xe8, 0x73, 0x04, 0xf2}} +{0x1d7a658b, 0x2f7b, 0x423d, {0xa3, 0xd9, 0xdd, 0x5b, 0x55, 0x3f, 0x69, 0xa9}} + class nsICSSImportRule : public nsICSSRule { public: diff --git a/layout/style/nsICSSNameSpaceRule.h b/layout/style/nsICSSNameSpaceRule.h index 5c503cc25fa..98e77ffe2e1 100644 --- a/layout/style/nsICSSNameSpaceRule.h +++ b/layout/style/nsICSSNameSpaceRule.h @@ -41,13 +41,13 @@ #define nsICSSNameSpaceRule_h___ #include "nsICSSRule.h" -//#include "nsString.h" class nsIAtom; -// IID for the nsICSSNameSpaceRule interface {c2116a9f-370d-458a-80c1-c6445089a8b7} +// IID for the nsICSSNameSpaceRule interface {153392d4-90bb-424e-b737-1bf5bc775394} #define NS_ICSS_NAMESPACE_RULE_IID \ -{0xc2116a9f, 0x370d, 0x458a, {0x80, 0xc1, 0xc6, 0x44, 0x50, 0x89, 0xa8, 0xb7}} +{0x153392d4, 0x90bb, 0x424e, {0xb7, 0x37, 0x1b, 0xf5, 0xbc, 0x77, 0x53, 0x94}} + class nsICSSNameSpaceRule : public nsICSSRule { public: diff --git a/layout/style/nsICSSRule.h b/layout/style/nsICSSRule.h index 28ed016e71e..86b55cef433 100644 --- a/layout/style/nsICSSRule.h +++ b/layout/style/nsICSSRule.h @@ -47,10 +47,11 @@ class nsCSSStyleSheet; class nsICSSGroupRule; class nsAString; -// IID for the nsICSSRule interface {72250d73-dbb2-4409-90fe-e8e0283a2510} +// IID for the nsICSSRule interface {2a1fef35-eee9-4a5d-bc87-e2228acc926b} #define NS_ICSS_RULE_IID \ -{ 0x72250d73, 0xdbb2, 0x4409, \ - { 0x90, 0xfe, 0xe8, 0xe0, 0x28, 0x3a, 0x25, 0x10 } } +{ 0x2a1fef35, 0xeee9, 0x4a5d, \ + { 0xbc, 0x87, 0xe2, 0x22, 0x8a, 0xcc, 0x92, 0x6b } } + // inheriting from nsIStyleRule is only for style rules, not other rule types class nsICSSRule : public nsIStyleRule { diff --git a/layout/style/nsICSSStyleRule.h b/layout/style/nsICSSStyleRule.h index 0f3bd658ef7..c5836ea31cf 100644 --- a/layout/style/nsICSSStyleRule.h +++ b/layout/style/nsICSSStyleRule.h @@ -49,9 +49,7 @@ #include "nsICSSRule.h" #include "nsString.h" #include "nsCOMPtr.h" -#include "nsCSSProps.h" #include "nsCSSValue.h" -#include "nsIAtom.h" #include "nsCSSPseudoElements.h" #include "nsCSSPseudoClasses.h" @@ -289,10 +287,11 @@ private: nsCSSSelectorList& operator=(const nsCSSSelectorList& aCopy); }; -// 1aae9e9d-21c3-4993-90b1-66aa6809f597 +// c6065b5e-4870-4dc5-9be3-747b6e317b25 #define NS_ICSS_STYLE_RULE_IID \ -{ 0x1aae9e9d, 0x21c3, 0x4993, \ - { 0x90, 0xb1, 0x66, 0xaa, 0x68, 0x09, 0xf5, 0x97 } } +{ 0xc6065b5e, 0x4870, 0x4dc5, \ + { 0x9b, 0xe3, 0x74, 0x7b, 0x6e, 0x31, 0x7b, 0x25 } } + class nsICSSStyleRule : public nsICSSRule { public: diff --git a/layout/style/nsIStyleRule.h b/layout/style/nsIStyleRule.h index 66ef782c13b..819f169f563 100644 --- a/layout/style/nsIStyleRule.h +++ b/layout/style/nsIStyleRule.h @@ -103,12 +103,12 @@ public: * all needed data are found. Thus overwriting non-empty data will * break CSS cascading rules. */ - NS_IMETHOD MapRuleInfoInto(nsRuleData* aRuleData)=0; + virtual void MapRuleInfoInto(nsRuleData* aRuleData)=0; virtual nsIStyleRule* GetImportantRule(void) { return nsnull; } #ifdef DEBUG - NS_IMETHOD List(FILE* out = stdout, PRInt32 aIndent = 0) const = 0; + virtual void List(FILE* out = stdout, PRInt32 aIndent = 0) const = 0; #endif }; diff --git a/layout/style/nsStyleSet.cpp b/layout/style/nsStyleSet.cpp index 9d1e07ab775..6e99d3da997 100644 --- a/layout/style/nsStyleSet.cpp +++ b/layout/style/nsStyleSet.cpp @@ -66,17 +66,15 @@ using namespace mozilla::dom; NS_IMPL_ISUPPORTS1(nsEmptyStyleRule, nsIStyleRule) -NS_IMETHODIMP +/* virtual */ void nsEmptyStyleRule::MapRuleInfoInto(nsRuleData* aRuleData) { - return NS_OK; } #ifdef DEBUG -NS_IMETHODIMP +/* virtual */ void nsEmptyStyleRule::List(FILE* out, PRInt32 aIndent) const { - return NS_OK; } #endif diff --git a/layout/style/nsStyleSet.h b/layout/style/nsStyleSet.h index aa876905a84..4bfe9ff89d1 100644 --- a/layout/style/nsStyleSet.h +++ b/layout/style/nsStyleSet.h @@ -66,9 +66,9 @@ struct RuleProcessorData; class nsEmptyStyleRule : public nsIStyleRule { NS_DECL_ISUPPORTS - NS_IMETHOD MapRuleInfoInto(nsRuleData* aRuleData); + virtual void MapRuleInfoInto(nsRuleData* aRuleData); #ifdef DEBUG - NS_IMETHOD List(FILE* out = stdout, PRInt32 aIndent = 0) const; + virtual void List(FILE* out = stdout, PRInt32 aIndent = 0) const; #endif }; diff --git a/layout/style/nsTransitionManager.cpp b/layout/style/nsTransitionManager.cpp index 5af09d9ac6c..82c95fd3693 100644 --- a/layout/style/nsTransitionManager.cpp +++ b/layout/style/nsTransitionManager.cpp @@ -106,9 +106,9 @@ public: NS_DECL_ISUPPORTS // nsIStyleRule implementation - NS_IMETHOD MapRuleInfoInto(nsRuleData* aRuleData); + virtual void MapRuleInfoInto(nsRuleData* aRuleData); #ifdef DEBUG - NS_IMETHOD List(FILE* out = stdout, PRInt32 aIndent = 0) const; + virtual void List(FILE* out = stdout, PRInt32 aIndent = 0) const; #endif ElementTransitionsStyleRule(ElementTransitions *aOwner, @@ -142,9 +142,9 @@ public: NS_DECL_ISUPPORTS // nsIStyleRule implementation - NS_IMETHOD MapRuleInfoInto(nsRuleData* aRuleData); + virtual void MapRuleInfoInto(nsRuleData* aRuleData); #ifdef DEBUG - NS_IMETHOD List(FILE* out = stdout, PRInt32 aIndent = 0) const; + virtual void List(FILE* out = stdout, PRInt32 aIndent = 0) const; #endif void CoverValue(nsCSSProperty aProperty, nsStyleAnimation::Value &aStartValue) @@ -217,18 +217,22 @@ ElementTransitionsPropertyDtor(void *aObject, NS_IMPL_ISUPPORTS1(ElementTransitionsStyleRule, nsIStyleRule) -NS_IMETHODIMP +/* virtual */ void ElementTransitionsStyleRule::MapRuleInfoInto(nsRuleData* aRuleData) { nsStyleContext *contextParent = aRuleData->mStyleContext->GetParent(); if (contextParent && contextParent->HasPseudoElementData()) { // Don't apply transitions to things inside of pseudo-elements. // FIXME (Bug 522599): Add tests for this. - return NS_OK; + return; } ElementTransitions *et = ElementData(); - NS_ENSURE_TRUE(et, NS_OK); // FIXME (Bug 522597): Why can this be null? + if (NS_UNLIKELY(!et)) { // FIXME (Bug 522597): Why can this be null? + NS_WARNING("ElementData returned null"); + return; + } + for (PRUint32 i = 0, i_end = et->mPropertyTransitions.Length(); i < i_end; ++i) { @@ -267,16 +271,13 @@ ElementTransitionsStyleRule::MapRuleInfoInto(nsRuleData* aRuleData) NS_ABORT_IF_FALSE(ok, "could not store computed value"); } } - - return NS_OK; } #ifdef DEBUG -NS_IMETHODIMP +/* virtual */ void ElementTransitionsStyleRule::List(FILE* out, PRInt32 aIndent) const { // WRITE ME? - return NS_OK; } #endif @@ -310,7 +311,7 @@ ElementTransitions::EnsureStyleRuleFor(TimeStamp aRefreshTime) NS_IMPL_ISUPPORTS1(CoverTransitionStartStyleRule, nsIStyleRule) -NS_IMETHODIMP +/* virtual */ void CoverTransitionStartStyleRule::MapRuleInfoInto(nsRuleData* aRuleData) { for (PRUint32 i = 0, i_end = mCoveredValues.Length(); i < i_end; ++i) { @@ -328,16 +329,13 @@ CoverTransitionStartStyleRule::MapRuleInfoInto(nsRuleData* aRuleData) NS_ABORT_IF_FALSE(ok, "could not store computed value"); } } - - return NS_OK; } #ifdef DEBUG -NS_IMETHODIMP +/* virtual */ void CoverTransitionStartStyleRule::List(FILE* out, PRInt32 aIndent) const { // WRITE ME? - return NS_OK; } #endif From 55fc88f9062d63281ec6d07050794a863ff6ce2a Mon Sep 17 00:00:00 2001 From: Masatoshi Kimura Date: Mon, 24 May 2010 09:55:00 -0400 Subject: [PATCH 09/30] Bug 567497 - "Files executed via download manager cause Win7 compatibility mode to permanently apply to firefox.exe and not downloaded file" [r=ted] --- browser/app/firefox.exe.manifest | 8 ++++++-- config/nsinstall.exe.manifest | 7 ++++++- ipc/app/plugin-container.exe.manifest | 9 ++++++--- js/src/config/nsinstall.exe.manifest | 7 ++++++- .../crashreporter/client/crashreporter.exe.manifest | 12 ++++++++++++ toolkit/mozapps/update/updater/updater.exe.manifest | 8 ++++++-- xulrunner/app/xulrunner.exe.manifest | 8 ++++++-- xulrunner/stub/xulrunner-stub.exe.manifest | 12 ++++++++++++ 8 files changed, 60 insertions(+), 11 deletions(-) diff --git a/browser/app/firefox.exe.manifest b/browser/app/firefox.exe.manifest index 8014615fe9c..87d53058c9e 100644 --- a/browser/app/firefox.exe.manifest +++ b/browser/app/firefox.exe.manifest @@ -22,9 +22,13 @@ - - + + + + + + diff --git a/config/nsinstall.exe.manifest b/config/nsinstall.exe.manifest index 62290f93885..26768e938cd 100644 --- a/config/nsinstall.exe.manifest +++ b/config/nsinstall.exe.manifest @@ -10,8 +10,13 @@ - + + + + + + diff --git a/ipc/app/plugin-container.exe.manifest b/ipc/app/plugin-container.exe.manifest index 0bb15da0dbb..791d7b4dcf2 100644 --- a/ipc/app/plugin-container.exe.manifest +++ b/ipc/app/plugin-container.exe.manifest @@ -22,10 +22,13 @@ - - + + + + + + - diff --git a/js/src/config/nsinstall.exe.manifest b/js/src/config/nsinstall.exe.manifest index 62290f93885..26768e938cd 100644 --- a/js/src/config/nsinstall.exe.manifest +++ b/js/src/config/nsinstall.exe.manifest @@ -10,8 +10,13 @@ - + + + + + + diff --git a/toolkit/crashreporter/client/crashreporter.exe.manifest b/toolkit/crashreporter/client/crashreporter.exe.manifest index 85756303fc5..30536306ac7 100644 --- a/toolkit/crashreporter/client/crashreporter.exe.manifest +++ b/toolkit/crashreporter/client/crashreporter.exe.manifest @@ -19,4 +19,16 @@ /> + + + + + + + + + + + + diff --git a/toolkit/mozapps/update/updater/updater.exe.manifest b/toolkit/mozapps/update/updater/updater.exe.manifest index 8bea07a34b2..e242e49df46 100644 --- a/toolkit/mozapps/update/updater/updater.exe.manifest +++ b/toolkit/mozapps/update/updater/updater.exe.manifest @@ -22,9 +22,13 @@ - - + + + + + + diff --git a/xulrunner/app/xulrunner.exe.manifest b/xulrunner/app/xulrunner.exe.manifest index 660a7a67bc1..9d5f04c0736 100644 --- a/xulrunner/app/xulrunner.exe.manifest +++ b/xulrunner/app/xulrunner.exe.manifest @@ -22,9 +22,13 @@ - - + + + + + + diff --git a/xulrunner/stub/xulrunner-stub.exe.manifest b/xulrunner/stub/xulrunner-stub.exe.manifest index 2e19a993c8b..8ffb204dadb 100644 --- a/xulrunner/stub/xulrunner-stub.exe.manifest +++ b/xulrunner/stub/xulrunner-stub.exe.manifest @@ -19,4 +19,16 @@ /> + + + + + + + + + + + + From ddad34acad5b7194fcece680aa055996a8de06eb Mon Sep 17 00:00:00 2001 From: Robert Strong Date: Sat, 5 Jun 2010 00:39:30 -0700 Subject: [PATCH 10/30] Bug 569648 - First async XHR without other network activity has null securityInfo for the channel when using auto-detect proxy. r=dveditz --- toolkit/mozapps/shared/CertUtils.jsm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/toolkit/mozapps/shared/CertUtils.jsm b/toolkit/mozapps/shared/CertUtils.jsm index 9f789526d5b..1ec22adf347 100644 --- a/toolkit/mozapps/shared/CertUtils.jsm +++ b/toolkit/mozapps/shared/CertUtils.jsm @@ -86,7 +86,9 @@ BadCertHandler.prototype = { onChannelRedirect: function(oldChannel, newChannel, flags) { // make sure the certificate of the old channel checks out before we follow // a redirect from it. See bug 340198. - checkCert(oldChannel); + // Don't call checkCert for internal redirects. See bug 569648. + if (!(flags & Components.interfaces.nsIChannelEventSink.REDIRECT_INTERNAL)) + checkCert(oldChannel); }, // Suppress any certificate errors From a3caa4547f4bb78390c6abf90a47d3c5d7a75a8c Mon Sep 17 00:00:00 2001 From: Robert Strong Date: Sat, 5 Jun 2010 01:19:35 -0700 Subject: [PATCH 11/30] no bug - whitespace fix to force another build to kick off --- toolkit/mozapps/update/content/updates.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/toolkit/mozapps/update/content/updates.js b/toolkit/mozapps/update/content/updates.js index 5153ce83a3d..9d161e71d4c 100644 --- a/toolkit/mozapps/update/content/updates.js +++ b/toolkit/mozapps/update/content/updates.js @@ -1390,7 +1390,7 @@ var gDownloadingPage = { return; this.removeDownloadListener(); - }, + }, /** * When the user closes the Wizard UI by clicking the Hide button From c7cf2843835bce27e50e150a1263ff9a953e4d70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A3o=20Gottwald?= Date: Sat, 5 Jun 2010 18:47:19 +0200 Subject: [PATCH 12/30] Bug 461184 - Change urlbar placeholder text to 'Go to a Web Site'. r=mano --- browser/base/content/browser.xul | 5 +--- browser/base/content/urlbarBindings.xml | 26 ------------------- .../tests/browser_privacypane_1.js | 1 - .../preferences/tests/privacypane_tests.js | 14 ---------- .../locales/en-US/chrome/browser/browser.dtd | 5 +--- 5 files changed, 2 insertions(+), 49 deletions(-) diff --git a/browser/base/content/browser.xul b/browser/base/content/browser.xul index ee3cf1e67e5..f525ff1002c 100644 --- a/browser/base/content/browser.xul +++ b/browser/base/content/browser.xul @@ -467,10 +467,7 @@ @@ -466,27 +461,6 @@ - - - - - - - - + From a27454a03beb5073f26287299c61f3759ba3531d Mon Sep 17 00:00:00 2001 From: Brad Lassey Date: Sat, 5 Jun 2010 13:15:50 -0400 Subject: [PATCH 13/30] update nspr to NSPR_HEAD_20100604 r=ted --- nsprpub/config/autoconf.mk.in | 7 + nsprpub/config/config.mk | 11 + nsprpub/configure | 352 +++++++++++++++------- nsprpub/configure.in | 129 +++++++- nsprpub/lib/libc/include/plgetopt.h | 5 +- nsprpub/lib/libc/src/plgetopt.c | 46 ++- nsprpub/pr/include/md/_openbsd.h | 2 +- nsprpub/pr/include/md/_pth.h | 6 + nsprpub/pr/include/md/_winnt.h | 6 +- nsprpub/pr/include/pratom.h | 10 +- nsprpub/pr/src/md/unix/os_Darwin_ppc.s | 4 + nsprpub/pr/src/md/unix/os_Darwin_x86.s | 4 + nsprpub/pr/src/md/unix/os_Darwin_x86_64.s | 4 + nsprpub/pr/src/md/unix/os_HPUX.s | 7 +- nsprpub/pr/src/md/unix/os_Linux_x86_64.s | 8 + nsprpub/pr/src/md/unix/uxrng.c | 4 + nsprpub/pr/src/misc/prinit.c | 4 +- nsprpub/pr/src/misc/prsystem.c | 14 + nsprpub/pr/src/pthreads/ptsynch.c | 8 +- nsprpub/pr/src/pthreads/ptthread.c | 4 +- nsprpub/pr/src/threads/combined/pruthr.c | 4 +- nsprpub/pr/src/threads/prtpd.c | 2 +- nsprpub/pr/tests/nbconn.c | 4 +- 23 files changed, 493 insertions(+), 152 deletions(-) diff --git a/nsprpub/config/autoconf.mk.in b/nsprpub/config/autoconf.mk.in index 36b131403de..6fede1ae244 100644 --- a/nsprpub/config/autoconf.mk.in +++ b/nsprpub/config/autoconf.mk.in @@ -83,7 +83,14 @@ DLLFLAGS = @DLLFLAGS@ EXEFLAGS = @EXEFLAGS@ OPTIMIZER = @OPTIMIZER@ +PROFILE_GEN_CFLAGS = @PROFILE_GEN_CFLAGS@ +PROFILE_GEN_LDFLAGS = @PROFILE_GEN_LDFLAGS@ +PROFILE_USE_CFLAGS = @PROFILE_USE_CFLAGS@ +PROFILE_USE_LDFLAGS = @PROFILE_USE_LDFLAGS@ + MKSHLIB = @MKSHLIB@ +WRAP_MALLOC_LIB = @WRAP_MALLOC_LIB@ +WRAP_MALLOC_CFLAGS = @WRAP_MALLOC_CFLAGS@ DSO_CFLAGS = @DSO_CFLAGS@ DSO_LDOPTS = @DSO_LDOPTS@ diff --git a/nsprpub/config/config.mk b/nsprpub/config/config.mk index 10ebfdab139..b91fcc95007 100644 --- a/nsprpub/config/config.mk +++ b/nsprpub/config/config.mk @@ -74,6 +74,17 @@ NOMD_CCFLAGS = $(CCC_ONLY_FLAGS) $(OPTIMIZER) $(NOMD_OS_CFLAGS)\ LDFLAGS = $(OS_LDFLAGS) +# Enable profile-guided optimization +ifdef MOZ_PROFILE_GENERATE +CFLAGS += $(PROFILE_GEN_CFLAGS) +LDFLAGS += $(PROFILE_GEN_LDFLAGS) +endif # MOZ_PROFILE_GENERATE + +ifdef MOZ_PROFILE_USE +CFLAGS += $(PROFILE_USE_CFLAGS) +LDFLAGS += $(PROFILE_USE_LDFLAGS) +endif # MOZ_PROFILE_USE + define MAKE_OBJDIR if test ! -d $(@D); then rm -rf $(@D); $(NSINSTALL) -D $(@D); fi endef diff --git a/nsprpub/configure b/nsprpub/configure index 11713df8e04..06fb88b3c75 100755 --- a/nsprpub/configure +++ b/nsprpub/configure @@ -66,6 +66,8 @@ ac_help="$ac_help [10.2 for ppc, 10.4 for x86]" ac_help="$ac_help --disable-os2-high-mem Disable high-memory support on OS/2" +ac_help="$ac_help + --enable-thumb2 Enable Thumb2 instruction set" ac_help="$ac_help --with-symbian-sdk=SYMBIAN_SDK_DIR The path to the Symbian SDK" @@ -84,6 +86,10 @@ ac_help="$ac_help --enable-ipv6 Compile ipv6 support" ac_help="$ac_help --enable-boehm Enable the Boehm Garbage Collector" +ac_help="$ac_help + --enable-wrap-malloc Wrap malloc calls (gnu linker only)" +ac_help="$ac_help + --with-wrap-malloc=SHAREDLIB Location of malloc wrapper library" # Initialize some variables set by options. # The variables have the same names as the options, with @@ -642,7 +648,7 @@ else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; } fi echo $ac_n "checking host system type""... $ac_c" 1>&6 -echo "configure:646: checking host system type" >&5 +echo "configure:652: checking host system type" >&5 host_alias=$host case "$host_alias" in @@ -663,7 +669,7 @@ host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` echo "$ac_t""$host" 1>&6 echo $ac_n "checking target system type""... $ac_c" 1>&6 -echo "configure:667: checking target system type" >&5 +echo "configure:673: checking target system type" >&5 target_alias=$target case "$target_alias" in @@ -681,7 +687,7 @@ target_os=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` echo "$ac_t""$target" 1>&6 echo $ac_n "checking build system type""... $ac_c" 1>&6 -echo "configure:685: checking build system type" >&5 +echo "configure:691: checking build system type" >&5 build_alias=$build case "$build_alias" in @@ -734,6 +740,11 @@ MACOS_SDK_DIR= NEXT_ROOT= MT= MOZ_OS2_HIGH_MEMORY=1 +MOZ_THUMB2= +PROFILE_GEN_CFLAGS= +PROFILE_GEN_LDFLAGS= +PROFILE_USE_CFLAGS= +PROFILE_USE_LDFLAGS= RESOLVE_LINK_SYMBOLS= @@ -753,7 +764,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:757: checking for $ac_word" >&5 +echo "configure:768: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -853,8 +864,8 @@ if test "$target" = "arm-android-eabi" ; then STRIP="$android_toolchain"/bin/arm-eabi-strip CPPFLAGS="-I$android_platform/usr/include $CPPFLAGS" - CFLAGS="-mandroid -I$android_platform/usr/include -msoft-float -fno-short-enums -fno-exceptions -march=armv5te -mthumb-interwork $CFLAGS" - CXXFLAGS="-mandroid -I$android_platform/usr/include -msoft-float -fpic -fno-short-enums -fno-exceptions -march=armv5te -mthumb-interwork -mthumb $CXXFLAGS" + CFLAGS="-mandroid -I$android_platform/usr/include -msoft-float -fno-short-enums -fno-exceptions $CFLAGS" + CXXFLAGS="-mandroid -I$android_platform/usr/include -msoft-float -fpic -fno-short-enums -fno-exceptions $CXXFLAGS" LDFLAGS="-mandroid -L$android_platform/usr/lib -Wl,-rpath-link=$android_platform/usr/lib --sysroot=$android_platform $LDFLAGS" if test -z "$HOST_CPPFLAGS" ; then @@ -1166,7 +1177,7 @@ if test -z "$SKIP_PATH_CHECKS"; then # Extract the first word of "$WHOAMI whoami", so it can be a program name with args. set dummy $WHOAMI whoami; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1170: checking for $ac_word" >&5 +echo "configure:1181: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_WHOAMI'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1237,13 +1248,13 @@ if test "$target" != "$host"; then _SAVE_LDFLAGS="$LDFLAGS" echo $ac_n "checking for $host compiler""... $ac_c" 1>&6 -echo "configure:1241: checking for $host compiler" >&5 +echo "configure:1252: checking for $host compiler" >&5 for ac_prog in $HOST_CC gcc cc /usr/ucb/cc do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1247: checking for $ac_word" >&5 +echo "configure:1258: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_HOST_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1289,16 +1300,16 @@ test -n "$HOST_CC" || HOST_CC="""" LDFLAGS="$HOST_LDFLAGS" echo $ac_n "checking whether the $host compiler ($HOST_CC $HOST_CFLAGS $HOST_LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:1293: checking whether the $host compiler ($HOST_CC $HOST_CFLAGS $HOST_LDFLAGS) works" >&5 +echo "configure:1304: checking whether the $host compiler ($HOST_CC $HOST_CFLAGS $HOST_LDFLAGS) works" >&5 cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1313: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_prog_host_cc_works=1 echo "$ac_t""yes" 1>&6 else @@ -1327,7 +1338,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1331: checking for $ac_word" >&5 +echo "configure:1342: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1361,7 +1372,7 @@ test -n "$CC" || CC="echo" # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1365: checking for $ac_word" >&5 +echo "configure:1376: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1391,7 +1402,7 @@ if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1395: checking for $ac_word" >&5 +echo "configure:1406: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1442,7 +1453,7 @@ fi # Extract the first word of "cl", so it can be a program name with args. set dummy cl; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1446: checking for $ac_word" >&5 +echo "configure:1457: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1474,7 +1485,7 @@ fi fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:1478: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 +echo "configure:1489: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. @@ -1485,12 +1496,12 @@ cross_compiling=$ac_cv_prog_cc_cross cat > conftest.$ac_ext << EOF -#line 1489 "configure" +#line 1500 "configure" #include "confdefs.h" main(){return(0);} EOF -if { (eval echo configure:1494: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1505: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ac_cv_prog_cc_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then @@ -1516,12 +1527,12 @@ if test $ac_cv_prog_cc_works = no; then { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:1520: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:1531: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 cross_compiling=$ac_cv_prog_cc_cross echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:1525: checking whether we are using GNU C" >&5 +echo "configure:1536: checking whether we are using GNU C" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1530,7 +1541,7 @@ else yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1534: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1545: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gcc=yes else ac_cv_prog_gcc=no @@ -1549,7 +1560,7 @@ ac_test_CFLAGS="${CFLAGS+set}" ac_save_CFLAGS="$CFLAGS" CFLAGS= echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:1553: checking whether ${CC-cc} accepts -g" >&5 +echo "configure:1564: checking whether ${CC-cc} accepts -g" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1586,7 +1597,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1590: checking for $ac_word" >&5 +echo "configure:1601: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CXX'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1622,7 +1633,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1626: checking for $ac_word" >&5 +echo "configure:1637: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CXX'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1654,7 +1665,7 @@ test -n "$CXX" || CXX="gcc" echo $ac_n "checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:1658: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works" >&5 +echo "configure:1669: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works" >&5 ac_ext=C # CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. @@ -1665,12 +1676,12 @@ cross_compiling=$ac_cv_prog_cxx_cross cat > conftest.$ac_ext << EOF -#line 1669 "configure" +#line 1680 "configure" #include "confdefs.h" int main(){return(0);} EOF -if { (eval echo configure:1674: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1685: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ac_cv_prog_cxx_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then @@ -1696,12 +1707,12 @@ if test $ac_cv_prog_cxx_works = no; then { echo "configure: error: installation or configuration problem: C++ compiler cannot create executables." 1>&2; exit 1; } fi echo $ac_n "checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:1700: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:1711: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cxx_cross" 1>&6 cross_compiling=$ac_cv_prog_cxx_cross echo $ac_n "checking whether we are using GNU C++""... $ac_c" 1>&6 -echo "configure:1705: checking whether we are using GNU C++" >&5 +echo "configure:1716: checking whether we are using GNU C++" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gxx'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1710,7 +1721,7 @@ else yes; #endif EOF -if { ac_try='${CXX-g++} -E conftest.C'; { (eval echo configure:1714: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CXX-g++} -E conftest.C'; { (eval echo configure:1725: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gxx=yes else ac_cv_prog_gxx=no @@ -1729,7 +1740,7 @@ ac_test_CXXFLAGS="${CXXFLAGS+set}" ac_save_CXXFLAGS="$CXXFLAGS" CXXFLAGS= echo $ac_n "checking whether ${CXX-g++} accepts -g""... $ac_c" 1>&6 -echo "configure:1733: checking whether ${CXX-g++} accepts -g" >&5 +echo "configure:1744: checking whether ${CXX-g++} accepts -g" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cxx_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1774,7 +1785,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1778: checking for $ac_word" >&5 +echo "configure:1789: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1809,7 +1820,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1813: checking for $ac_word" >&5 +echo "configure:1824: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1844,7 +1855,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1848: checking for $ac_word" >&5 +echo "configure:1859: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_AS'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1879,7 +1890,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1883: checking for $ac_word" >&5 +echo "configure:1894: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_LD'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1914,7 +1925,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1918: checking for $ac_word" >&5 +echo "configure:1929: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_STRIP'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1949,7 +1960,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1953: checking for $ac_word" >&5 +echo "configure:1964: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_WINDRES'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1984,7 +1995,7 @@ else # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1988: checking for $ac_word" >&5 +echo "configure:1999: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2014,7 +2025,7 @@ if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2018: checking for $ac_word" >&5 +echo "configure:2029: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2065,7 +2076,7 @@ fi # Extract the first word of "cl", so it can be a program name with args. set dummy cl; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2069: checking for $ac_word" >&5 +echo "configure:2080: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2097,7 +2108,7 @@ fi fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:2101: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 +echo "configure:2112: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. @@ -2108,12 +2119,12 @@ cross_compiling=$ac_cv_prog_cc_cross cat > conftest.$ac_ext << EOF -#line 2112 "configure" +#line 2123 "configure" #include "confdefs.h" main(){return(0);} EOF -if { (eval echo configure:2117: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2128: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ac_cv_prog_cc_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then @@ -2139,12 +2150,12 @@ if test $ac_cv_prog_cc_works = no; then { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:2143: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:2154: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 cross_compiling=$ac_cv_prog_cc_cross echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:2148: checking whether we are using GNU C" >&5 +echo "configure:2159: checking whether we are using GNU C" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2153,7 +2164,7 @@ else yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:2157: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:2168: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gcc=yes else ac_cv_prog_gcc=no @@ -2172,7 +2183,7 @@ ac_test_CFLAGS="${CFLAGS+set}" ac_save_CFLAGS="$CFLAGS" CFLAGS= echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:2176: checking whether ${CC-cc} accepts -g" >&5 +echo "configure:2187: checking whether ${CC-cc} accepts -g" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2212,7 +2223,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2216: checking for $ac_word" >&5 +echo "configure:2227: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CXX'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2244,7 +2255,7 @@ test -n "$CXX" || CXX="gcc" echo $ac_n "checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:2248: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works" >&5 +echo "configure:2259: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works" >&5 ac_ext=C # CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. @@ -2255,12 +2266,12 @@ cross_compiling=$ac_cv_prog_cxx_cross cat > conftest.$ac_ext << EOF -#line 2259 "configure" +#line 2270 "configure" #include "confdefs.h" int main(){return(0);} EOF -if { (eval echo configure:2264: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2275: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ac_cv_prog_cxx_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then @@ -2286,12 +2297,12 @@ if test $ac_cv_prog_cxx_works = no; then { echo "configure: error: installation or configuration problem: C++ compiler cannot create executables." 1>&2; exit 1; } fi echo $ac_n "checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:2290: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:2301: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cxx_cross" 1>&6 cross_compiling=$ac_cv_prog_cxx_cross echo $ac_n "checking whether we are using GNU C++""... $ac_c" 1>&6 -echo "configure:2295: checking whether we are using GNU C++" >&5 +echo "configure:2306: checking whether we are using GNU C++" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gxx'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2300,7 +2311,7 @@ else yes; #endif EOF -if { ac_try='${CXX-g++} -E conftest.C'; { (eval echo configure:2304: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CXX-g++} -E conftest.C'; { (eval echo configure:2315: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gxx=yes else ac_cv_prog_gxx=no @@ -2319,7 +2330,7 @@ ac_test_CXXFLAGS="${CXXFLAGS+set}" ac_save_CXXFLAGS="$CXXFLAGS" CXXFLAGS= echo $ac_n "checking whether ${CXX-g++} accepts -g""... $ac_c" 1>&6 -echo "configure:2323: checking whether ${CXX-g++} accepts -g" >&5 +echo "configure:2334: checking whether ${CXX-g++} accepts -g" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cxx_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2353,7 +2364,7 @@ fi fi fi echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:2357: checking how to run the C preprocessor" >&5 +echo "configure:2368: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= @@ -2368,13 +2379,13 @@ else # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2378: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2389: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -2385,13 +2396,13 @@ else rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2395: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2406: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -2402,13 +2413,13 @@ else rm -rf conftest* CPP="${CC-cc} -nologo -E" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2412: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2423: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -2435,7 +2446,7 @@ echo "$ac_t""$CPP" 1>&6 # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2439: checking for $ac_word" >&5 +echo "configure:2450: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2467,7 +2478,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2471: checking for $ac_word" >&5 +echo "configure:2482: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_AS'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2508,7 +2519,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2512: checking for $ac_word" >&5 +echo "configure:2523: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_AR'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2549,7 +2560,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2553: checking for $ac_word" >&5 +echo "configure:2564: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_LD'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2590,7 +2601,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2594: checking for $ac_word" >&5 +echo "configure:2605: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_STRIP'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2631,7 +2642,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2635: checking for $ac_word" >&5 +echo "configure:2646: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_WINDRES'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2699,7 +2710,7 @@ else fi echo $ac_n "checking for gcc -pipe support""... $ac_c" 1>&6 -echo "configure:2703: checking for gcc -pipe support" >&5 +echo "configure:2714: checking for gcc -pipe support" >&5 if test -n "$GNU_CC" && test -n "$GNU_CXX" && test -n "$GNU_AS"; then echo '#include ' > dummy-hello.c echo 'int main() { printf("Hello World\n"); return 0; }' >> dummy-hello.c @@ -2714,14 +2725,14 @@ if test -n "$GNU_CC" && test -n "$GNU_CXX" && test -n "$GNU_AS"; then _SAVE_CFLAGS=$CFLAGS CFLAGS="$CFLAGS -pipe" cat > conftest.$ac_ext < int main() { printf("Hello World\n"); ; return 0; } EOF -if { (eval echo configure:2725: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2736: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* _res_gcc_pipe="yes" else @@ -2746,9 +2757,44 @@ else echo "$ac_t""no" 1>&6 fi + +_SAVE_CFLAGS="$CFLAGS" +CFLAGS="$CFLAGS -fprofile-generate -fprofile-correction" + +echo $ac_n "checking whether C compiler supports -fprofile-generate""... $ac_c" 1>&6 +echo "configure:2766: checking whether C compiler supports -fprofile-generate" >&5 +cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + PROFILE_GEN_CFLAGS="-fprofile-generate" + result="yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + result="no" +fi +rm -f conftest* +echo "$ac_t""$result" 1>&6 + +if test $result = "yes"; then + PROFILE_GEN_LDFLAGS="-fprofile-generate" + PROFILE_USE_CFLAGS="-fprofile-use -fprofile-correction -Wcoverage-mismatch -freoder-blocks-and-partition" + PROFILE_USE_LDFLAGS="-fprofile-use" +fi + +CFLAGS="$_SAVE_CFLAGS" + if test "$GNU_CC"; then echo $ac_n "checking for visibility(hidden) attribute""... $ac_c" 1>&6 -echo "configure:2752: checking for visibility(hidden) attribute" >&5 +echo "configure:2798: checking for visibility(hidden) attribute" >&5 if eval "test \"`echo '$''{'ac_cv_visibility_hidden'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2772,7 +2818,7 @@ echo "$ac_t""$ac_cv_visibility_hidden" 1>&6 EOF echo $ac_n "checking for visibility pragma support""... $ac_c" 1>&6 -echo "configure:2776: checking for visibility pragma support" >&5 +echo "configure:2822: checking for visibility pragma support" >&5 if eval "test \"`echo '$''{'ac_cv_visibility_pragma'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2825,7 +2871,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2829: checking for $ac_word" >&5 +echo "configure:2875: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_PERL'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3037,6 +3083,32 @@ if test "${enable_os2_high_mem+set}" = set; then fi +# Check whether --enable-thumb2 or --disable-thumb2 was given. +if test "${enable_thumb2+set}" = set; then + enableval="$enable_thumb2" + if test "$enableval" = "yes"; then + MOZ_THUMB2=1, + fi +fi + + +if test -n "$MOZ_THUMB2"; then + case "$target_cpu" in + arm*) + if test "$GNU_CC"; then + CFLAGS="$CFLAGS -march=armv7-a -mthumb -Wa, -march=armv7-a -Wa, -mthumb" + CXXFLAGS="$CXXFLAGS -march=armv7-a -mthumb -Wa, -march=armv7-a -Wa, -mthumb" + ASFLAGS="$ASFLAGS -march=armv7-a -mthumb" + else + { echo "configure: error: --enable-thumb2 is not supported for non-GNU toolchains" 1>&2; exit 1; } + fi + ;; + *) + { echo "configure: error: --enable-thumb2 is not supported for non-ARM CPU architectures" 1>&2; exit 1; } + ;; + esac +fi + case "$host" in *-mingw*) NSINSTALL=nsinstall @@ -3075,17 +3147,17 @@ EOF DSO_LDOPTS='-brtl -bnortllib -bM:SRE -bnoentry -bexpall -blibpath:/usr/lib:/lib' ac_safe=`echo "sys/atomic_op.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for sys/atomic_op.h""... $ac_c" 1>&6 -echo "configure:3079: checking for sys/atomic_op.h" >&5 +echo "configure:3151: checking for sys/atomic_op.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3089: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3161: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -3242,7 +3314,7 @@ EOF _DEBUG_FLAGS='-gdwarf-2 -O0' MKSHLIB='$(CCC) $(DSO_LDOPTS) -o $@' echo $ac_n "checking for gethostbyaddr in -lbind""... $ac_c" 1>&6 -echo "configure:3246: checking for gethostbyaddr in -lbind" >&5 +echo "configure:3318: checking for gethostbyaddr in -lbind" >&5 ac_lib_var=`echo bind'_'gethostbyaddr | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3250,7 +3322,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lbind $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3337: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3994,7 +4066,7 @@ EOF CXXFLAGS="$CXXFLAGS -Wall" MDCPUCFG_H=_linux.cfg PR_MD_CSRCS=linux.c - MKSHLIB='$(CC) $(DSO_LDOPTS) -o $@' + MKSHLIB='$(CC) $(DSO_LDOPTS) $(WRAP_MALLOC_LIB) -o $@' DSO_CFLAGS=-fPIC DSO_LDOPTS='-shared -Wl,-soname -Wl,$(notdir $@)' _OPTIMIZE_FLAGS=-O2 @@ -4037,7 +4109,7 @@ EOF CXXFLAGS="$CXXFLAGS -Wall" MDCPUCFG_H=_linux.cfg PR_MD_CSRCS=linux.c - MKSHLIB='$(CC) $(DSO_LDOPTS) -o $@' + MKSHLIB='$(CC) $(DSO_LDOPTS) $(WRAP_MALLOC_LIB) -o $@' DSO_CFLAGS=-fPIC DSO_LDOPTS='-shared -Wl,-soname -Wl,$(notdir $@)' _OPTIMIZE_FLAGS=-O2 @@ -4141,11 +4213,31 @@ EOF DLL_SUFFIX=dll # Determine compiler version - CC_VERSION=`"${CC}" -v 2>&1 | grep Version | sed -e 's|.* Version ||' -e 's| .*||'` - _CC_MAJOR_VERSION=`echo $CC_VERSION | awk -F\. '{ print $1 }'` - _CC_MINOR_VERSION=`echo $CC_VERSION | awk -F\. '{ print $2 }'` + + _MSVC_VER_FILTER='s|.* ([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?).*|\1|p' + + + CC_VERSION=`"${CC}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"` + _CC_MAJOR_VERSION=`echo ${CC_VERSION} | awk -F\. '{ print $1 }'` + _CC_MINOR_VERSION=`echo ${CC_VERSION} | awk -F\. '{ print $2 }'` + _CC_RELEASE=`echo ${CC_VERSION} | awk -F\. '{ print $3 }'` + _CC_BUILD=`echo ${CC_VERSION} | awk -F\. '{ print $4 }'` MSC_VER=${_CC_MAJOR_VERSION}${_CC_MINOR_VERSION} + if test "$_CC_MAJOR_VERSION" = "14"; then + if test $_CC_RELEASE -gt 50727; then + _USE_DYNAMICBASE=1 + elif test $_CC_BUILD -ge 762; then + _USE_DYNAMICBASE=1 + fi + elif test $_CC_MAJOR_VERSION -gt 15; then + _USE_DYNAMICBASE=1 + fi + + if test -n "$_USE_DYNAMICBASE"; then + DLLFLAGS="$DLLFLAGS -DYNAMICBASE" + fi + # Ensure that mt is Microsoft (R) Manifest Tool and not magnetic # tape manipulation utility (or something else) if test "$MSC_VER" -ge "1400"; then @@ -4170,6 +4262,12 @@ EOF DLLFLAGS="$DLLFLAGS -OUT:\"\$@\"" _DEBUG_FLAGS=-Zi _OPTIMIZE_FLAGS=-O2 + + PROFILE_GEN_CFLAGS="-GL" + PROFILE_GEN_LDFLAGS="-LTCG:PGINSTRUMENT" + PROFILE_USE_CFLAGS="-GL -wd4624 -wd4952" + PROFILE_USE_LDFLAGS="-LTCG:PGUPDATE" + if test -z "$MOZ_OPTIMIZE"; then CFLAGS="$CFLAGS -Od" fi @@ -4611,17 +4709,17 @@ EOF _OPTIMIZE_FLAGS="$_OPTIMIZE_FLAGS -Olimit 4000" ac_safe=`echo "machine/builtins.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for machine/builtins.h""... $ac_c" 1>&6 -echo "configure:4615: checking for machine/builtins.h" >&5 +echo "configure:4713: checking for machine/builtins.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4625: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4723: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -5270,7 +5368,7 @@ case $target in ;; *) echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6 -echo "configure:5274: checking for dlopen in -ldl" >&5 +echo "configure:5372: checking for dlopen in -ldl" >&5 ac_lib_var=`echo dl'_'dlopen | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -5278,7 +5376,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ldl $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5391: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5306,17 +5404,17 @@ if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 ac_safe=`echo "dlfcn.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for dlfcn.h""... $ac_c" 1>&6 -echo "configure:5310: checking for dlfcn.h" >&5 +echo "configure:5408: checking for dlfcn.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5320: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5418: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -5349,13 +5447,13 @@ esac if test $ac_cv_prog_gcc = yes; then echo $ac_n "checking whether ${CC-cc} needs -traditional""... $ac_c" 1>&6 -echo "configure:5353: checking whether ${CC-cc} needs -traditional" >&5 +echo "configure:5451: checking whether ${CC-cc} needs -traditional" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc_traditional'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_pattern="Autoconf.*'x'" cat > conftest.$ac_ext < Autoconf TIOCGETP @@ -5373,7 +5471,7 @@ rm -f conftest* if test $ac_cv_prog_gcc_traditional = no; then cat > conftest.$ac_ext < Autoconf TCGETA @@ -5397,12 +5495,12 @@ fi for ac_func in lchown strerror do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:5401: checking for $ac_func" >&5 +echo "configure:5499: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5527: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -5466,7 +5564,7 @@ hpux*) if test -z "$GNU_CC"; then echo $ac_n "checking for +Olit support""... $ac_c" 1>&6 -echo "configure:5470: checking for +Olit support" >&5 +echo "configure:5568: checking for +Olit support" >&5 if eval "test \"`echo '$''{'ac_cv_hpux_usable_olit_option'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5508,7 +5606,7 @@ wince*) *) echo $ac_n "checking for pthread_create in -lpthreads""... $ac_c" 1>&6 -echo "configure:5512: checking for pthread_create in -lpthreads" >&5 +echo "configure:5610: checking for pthread_create in -lpthreads" >&5 echo " #include void *foo(void *v) { return v; } @@ -5530,7 +5628,7 @@ echo " echo "$ac_t""no" 1>&6 echo $ac_n "checking for pthread_create in -lpthread""... $ac_c" 1>&6 -echo "configure:5534: checking for pthread_create in -lpthread" >&5 +echo "configure:5632: checking for pthread_create in -lpthread" >&5 echo " #include void *foo(void *v) { return v; } @@ -5552,7 +5650,7 @@ echo " echo "$ac_t""no" 1>&6 echo $ac_n "checking for pthread_create in -lc_r""... $ac_c" 1>&6 -echo "configure:5556: checking for pthread_create in -lc_r" >&5 +echo "configure:5654: checking for pthread_create in -lc_r" >&5 echo " #include void *foo(void *v) { return v; } @@ -5574,7 +5672,7 @@ echo " echo "$ac_t""no" 1>&6 echo $ac_n "checking for pthread_create in -lc""... $ac_c" 1>&6 -echo "configure:5578: checking for pthread_create in -lc" >&5 +echo "configure:5676: checking for pthread_create in -lc" >&5 echo " #include void *foo(void *v) { return v; } @@ -5706,7 +5804,7 @@ if test -n "$USE_PTHREADS"; then rm -f conftest* ac_cv_have_dash_pthread=no echo $ac_n "checking whether ${CC-cc} accepts -pthread""... $ac_c" 1>&6 -echo "configure:5710: checking whether ${CC-cc} accepts -pthread" >&5 +echo "configure:5808: checking whether ${CC-cc} accepts -pthread" >&5 echo 'int main() { return 0; }' | cat > conftest.c ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1 if test $? -eq 0; then @@ -5729,7 +5827,7 @@ echo "configure:5710: checking whether ${CC-cc} accepts -pthread" >&5 ac_cv_have_dash_pthreads=no if test "$ac_cv_have_dash_pthread" = "no"; then echo $ac_n "checking whether ${CC-cc} accepts -pthreads""... $ac_c" 1>&6 -echo "configure:5733: checking whether ${CC-cc} accepts -pthreads" >&5 +echo "configure:5831: checking whether ${CC-cc} accepts -pthreads" >&5 echo 'int main() { return 0; }' | cat > conftest.c ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1 if test $? -eq 0; then @@ -6042,6 +6140,38 @@ cygwin*|msvc*|mks*) ;; esac +# Check whether --enable-wrap-malloc or --disable-wrap-malloc was given. +if test "${enable_wrap_malloc+set}" = set; then + enableval="$enable_wrap_malloc" + if test "$enableval" = "yes"; then + _WRAP_MALLOC=1 + fi +fi + + +if test -n "$_WRAP_MALLOC"; then + if test "$GNU_CC"; then + WRAP_MALLOC_CFLAGS="${LDFLAGS} -Wl,--wrap -Wl,malloc -Wl,--wrap -Wl,calloc -Wl,--wrap -Wl,valloc -Wl,--wrap -Wl,free -Wl,--wrap -Wl,realloc -Wl,--wrap -Wl,memalign -Wl,--wrap -Wl,__builtin_new -Wl,--wrap -Wl,__builtin_vec_new -Wl,--wrap -Wl,__builtin_delete -Wl,--wrap -Wl,__builtin_vec_delete -Wl,--wrap -Wl,PR_Free -Wl,--wrap -Wl,PR_Malloc -Wl,--wrap -Wl,PR_Calloc -Wl,--wrap -Wl,PR_Realloc -Wl,--wrap -Wl,strdup -Wl,--wrap -Wl,strndup -Wl,--wrap -Wl,posix_memalign" + DSO_LDOPTS="$DSO_LDOPTS $WRAP_MALLOC_CFLAGS" + else + { echo "configure: error: --enable-wrap-malloc is not supported for non-GNU toolchains" 1>&2; exit 1; } + fi +fi + +# Check whether --with-wrap-malloc or --without-wrap-malloc was given. +if test "${with_wrap_malloc+set}" = set; then + withval="$with_wrap_malloc" + WRAP_MALLOC_LIB=$withval +fi + + + + + + + + + @@ -6404,6 +6534,8 @@ s%@OBJ_SUFFIX@%$OBJ_SUFFIX%g s%@LIB_SUFFIX@%$LIB_SUFFIX%g s%@DLL_SUFFIX@%$DLL_SUFFIX%g s%@ASM_SUFFIX@%$ASM_SUFFIX%g +s%@WRAP_MALLOC_CFLAGS@%$WRAP_MALLOC_CFLAGS%g +s%@WRAP_MALLOC_LIB@%$WRAP_MALLOC_LIB%g s%@MKSHLIB@%$MKSHLIB%g s%@DSO_CFLAGS@%$DSO_CFLAGS%g s%@DSO_LDOPTS@%$DSO_LDOPTS%g @@ -6417,6 +6549,10 @@ s%@AR_FLAGS@%$AR_FLAGS%g s%@ASFLAGS@%$ASFLAGS%g s%@FILTER@%$FILTER%g s%@IMPLIB@%$IMPLIB%g +s%@PROFILE_GEN_CFLAGS@%$PROFILE_GEN_CFLAGS%g +s%@PROFILE_GEN_LDFLAGS@%$PROFILE_GEN_LDFLAGS%g +s%@PROFILE_USE_CFLAGS@%$PROFILE_USE_CFLAGS%g +s%@PROFILE_USE_LDFLAGS@%$PROFILE_USE_LDFLAGS%g s%@OS_LIBS@%$OS_LIBS%g s%@RESOLVE_LINK_SYMBOLS@%$RESOLVE_LINK_SYMBOLS%g s%@AIX_LINK_OPTS@%$AIX_LINK_OPTS%g diff --git a/nsprpub/configure.in b/nsprpub/configure.in index e7603374e53..5adfcc5fa83 100644 --- a/nsprpub/configure.in +++ b/nsprpub/configure.in @@ -78,6 +78,11 @@ MACOS_SDK_DIR= NEXT_ROOT= MT= MOZ_OS2_HIGH_MEMORY=1 +MOZ_THUMB2= +PROFILE_GEN_CFLAGS= +PROFILE_GEN_LDFLAGS= +PROFILE_USE_CFLAGS= +PROFILE_USE_LDFLAGS= dnl Link in libraries necessary to resolve all symbols for shared libs RESOLVE_LINK_SYMBOLS= @@ -171,8 +176,8 @@ if test "$target" = "arm-android-eabi" ; then STRIP="$android_toolchain"/bin/arm-eabi-strip CPPFLAGS="-I$android_platform/usr/include $CPPFLAGS" - CFLAGS="-mandroid -I$android_platform/usr/include -msoft-float -fno-short-enums -fno-exceptions -march=armv5te -mthumb-interwork $CFLAGS" - CXXFLAGS="-mandroid -I$android_platform/usr/include -msoft-float -fpic -fno-short-enums -fno-exceptions -march=armv5te -mthumb-interwork -mthumb $CXXFLAGS" + CFLAGS="-mandroid -I$android_platform/usr/include -msoft-float -fno-short-enums -fno-exceptions $CFLAGS" + CXXFLAGS="-mandroid -I$android_platform/usr/include -msoft-float -fpic -fno-short-enums -fno-exceptions $CXXFLAGS" LDFLAGS="-mandroid -L$android_platform/usr/lib -Wl,-rpath-link=$android_platform/usr/lib --sysroot=$android_platform $LDFLAGS" dnl prevent cross compile section from using these flags as host flags @@ -637,6 +642,29 @@ else AC_MSG_RESULT([no]) fi +dnl ======================================================== +dnl Profile guided optimization +dnl ======================================================== +dnl Test for profiling options +dnl Under gcc 3.4+, use -fprofile-generate/-fprofile-use + +_SAVE_CFLAGS="$CFLAGS" +CFLAGS="$CFLAGS -fprofile-generate -fprofile-correction" + +AC_MSG_CHECKING([whether C compiler supports -fprofile-generate]) +AC_TRY_COMPILE([], [return 0;], + [ PROFILE_GEN_CFLAGS="-fprofile-generate" + result="yes" ], result="no") +AC_MSG_RESULT([$result]) + +if test $result = "yes"; then + PROFILE_GEN_LDFLAGS="-fprofile-generate" + PROFILE_USE_CFLAGS="-fprofile-use -fprofile-correction -Wcoverage-mismatch -freoder-blocks-and-partition" + PROFILE_USE_LDFLAGS="-fprofile-use" +fi + +CFLAGS="$_SAVE_CFLAGS" + dnl =============================================================== dnl Check for .hidden assembler directive and visibility attribute. dnl Borrowed from glibc configure.in @@ -880,6 +908,32 @@ AC_ARG_ENABLE(os2-high-mem, MOZ_OS2_HIGH_MEMORY=1 fi ]) +dnl ======================================================== +dnl = Enable building the Thumb2 instruction set +dnl ======================================================== +AC_ARG_ENABLE(thumb2, + [ --enable-thumb2 Enable Thumb2 instruction set], + [ if test "$enableval" = "yes"; then + MOZ_THUMB2=1, + fi ]) + +if test -n "$MOZ_THUMB2"; then + case "$target_cpu" in + arm*) + if test "$GNU_CC"; then + CFLAGS="$CFLAGS -march=armv7-a -mthumb -Wa, -march=armv7-a -Wa, -mthumb" + CXXFLAGS="$CXXFLAGS -march=armv7-a -mthumb -Wa, -march=armv7-a -Wa, -mthumb" + ASFLAGS="$ASFLAGS -march=armv7-a -mthumb" + else + AC_MSG_ERROR([--enable-thumb2 is not supported for non-GNU toolchains]) + fi + ;; + *) + AC_MSG_ERROR([--enable-thumb2 is not supported for non-ARM CPU architectures]) + ;; + esac +fi + dnl ======================================================== dnl Override of system specific host options dnl ======================================================== @@ -1506,7 +1560,7 @@ arm-android-eabi) CXXFLAGS="$CXXFLAGS -Wall" MDCPUCFG_H=_linux.cfg PR_MD_CSRCS=linux.c - MKSHLIB='$(CC) $(DSO_LDOPTS) -o $@' + MKSHLIB='$(CC) $(DSO_LDOPTS) $(WRAP_MALLOC_LIB) -o $@' DSO_CFLAGS=-fPIC DSO_LDOPTS='-shared -Wl,-soname -Wl,$(notdir $@)' _OPTIMIZE_FLAGS=-O2 @@ -1537,7 +1591,7 @@ arm-android-eabi) CXXFLAGS="$CXXFLAGS -Wall" MDCPUCFG_H=_linux.cfg PR_MD_CSRCS=linux.c - MKSHLIB='$(CC) $(DSO_LDOPTS) -o $@' + MKSHLIB='$(CC) $(DSO_LDOPTS) $(WRAP_MALLOC_LIB) -o $@' DSO_CFLAGS=-fPIC DSO_LDOPTS='-shared -Wl,-soname -Wl,$(notdir $@)' _OPTIMIZE_FLAGS=-O2 @@ -1623,11 +1677,34 @@ arm-android-eabi) DLL_SUFFIX=dll # Determine compiler version - CC_VERSION=`"${CC}" -v 2>&1 | grep Version | sed -e 's|.* Version ||' -e 's| .*||'` - _CC_MAJOR_VERSION=`echo $CC_VERSION | awk -F\. '{ print $1 }'` - _CC_MINOR_VERSION=`echo $CC_VERSION | awk -F\. '{ print $2 }'` + changequote(,) + _MSVC_VER_FILTER='s|.* ([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?).*|\1|p' + changequote([,]) + + CC_VERSION=`"${CC}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"` + _CC_MAJOR_VERSION=`echo ${CC_VERSION} | awk -F\. '{ print $1 }'` + _CC_MINOR_VERSION=`echo ${CC_VERSION} | awk -F\. '{ print $2 }'` + _CC_RELEASE=`echo ${CC_VERSION} | awk -F\. '{ print $3 }'` + _CC_BUILD=`echo ${CC_VERSION} | awk -F\. '{ print $4 }'` MSC_VER=${_CC_MAJOR_VERSION}${_CC_MINOR_VERSION} + if test "$_CC_MAJOR_VERSION" = "14"; then + dnl -DYNAMICBASE is only supported on VC8SP1 or newer, + dnl so be very specific here! + dnl VC8 is 14.00.50727.42, VC8SP1 is 14.00.50727.762 + if test $_CC_RELEASE -gt 50727; then + _USE_DYNAMICBASE=1 + elif test $_CC_BUILD -ge 762; then + _USE_DYNAMICBASE=1 + fi + elif test $_CC_MAJOR_VERSION -gt 15; then + _USE_DYNAMICBASE=1 + fi + + if test -n "$_USE_DYNAMICBASE"; then + DLLFLAGS="$DLLFLAGS -DYNAMICBASE" + fi + # Ensure that mt is Microsoft (R) Manifest Tool and not magnetic # tape manipulation utility (or something else) if test "$MSC_VER" -ge "1400"; then @@ -1652,6 +1729,12 @@ arm-android-eabi) DLLFLAGS="$DLLFLAGS -OUT:\"\$@\"" _DEBUG_FLAGS=-Zi _OPTIMIZE_FLAGS=-O2 + + PROFILE_GEN_CFLAGS="-GL" + PROFILE_GEN_LDFLAGS="-LTCG:PGINSTRUMENT" + PROFILE_USE_CFLAGS="-GL -wd4624 -wd4952" + PROFILE_USE_LDFLAGS="-LTCG:PGUPDATE" + if test -z "$MOZ_OPTIMIZE"; then CFLAGS="$CFLAGS -Od" fi @@ -2859,6 +2942,31 @@ cygwin*|msvc*|mks*) ;; esac +dnl ======================================================== +dnl = Use malloc wrapper lib +dnl ======================================================== +AC_ARG_ENABLE(wrap-malloc, +[ --enable-wrap-malloc Wrap malloc calls (gnu linker only)], +[ if test "$enableval" = "yes"; then + _WRAP_MALLOC=1 + fi ]) + +if test -n "$_WRAP_MALLOC"; then + if test "$GNU_CC"; then + WRAP_MALLOC_CFLAGS="${LDFLAGS} -Wl,--wrap -Wl,malloc -Wl,--wrap -Wl,calloc -Wl,--wrap -Wl,valloc -Wl,--wrap -Wl,free -Wl,--wrap -Wl,realloc -Wl,--wrap -Wl,memalign -Wl,--wrap -Wl,__builtin_new -Wl,--wrap -Wl,__builtin_vec_new -Wl,--wrap -Wl,__builtin_delete -Wl,--wrap -Wl,__builtin_vec_delete -Wl,--wrap -Wl,PR_Free -Wl,--wrap -Wl,PR_Malloc -Wl,--wrap -Wl,PR_Calloc -Wl,--wrap -Wl,PR_Realloc -Wl,--wrap -Wl,strdup -Wl,--wrap -Wl,strndup -Wl,--wrap -Wl,posix_memalign" + DSO_LDOPTS="$DSO_LDOPTS $WRAP_MALLOC_CFLAGS" + else + AC_MSG_ERROR([--enable-wrap-malloc is not supported for non-GNU toolchains]) + fi +fi + +dnl ======================================================== +dnl = Location of malloc wrapper lib +dnl ======================================================== +AC_ARG_WITH(wrap-malloc, +[ --with-wrap-malloc=SHAREDLIB Location of malloc wrapper library], + WRAP_MALLOC_LIB=$withval) + dnl ======================================================== dnl Substitution of found variables. dnl ======================================================== @@ -2913,6 +3021,8 @@ AC_SUBST(OBJ_SUFFIX) AC_SUBST(LIB_SUFFIX) AC_SUBST(DLL_SUFFIX) AC_SUBST(ASM_SUFFIX) +AC_SUBST(WRAP_MALLOC_CFLAGS) +AC_SUBST(WRAP_MALLOC_LIB) AC_SUBST(MKSHLIB) AC_SUBST(DSO_CFLAGS) AC_SUBST(DSO_LDOPTS) @@ -2936,6 +3046,11 @@ AC_SUBST(STRIP) AC_SUBST(FILTER) AC_SUBST(IMPLIB) +AC_SUBST(PROFILE_GEN_CFLAGS) +AC_SUBST(PROFILE_GEN_LDFLAGS) +AC_SUBST(PROFILE_USE_CFLAGS) +AC_SUBST(PROFILE_USE_LDFLAGS) + AC_SUBST(OS_LIBS) AC_SUBST(RESOLVE_LINK_SYMBOLS) AC_SUBST(AIX_LINK_OPTS) diff --git a/nsprpub/lib/libc/include/plgetopt.h b/nsprpub/lib/libc/include/plgetopt.h index fcdf23b6fc7..c59fabdf6f9 100644 --- a/nsprpub/lib/libc/include/plgetopt.h +++ b/nsprpub/lib/libc/include/plgetopt.h @@ -122,13 +122,14 @@ PR_EXTERN(void) PL_DestroyOptState(PLOptState *opt); * For a long option name, * - opt->longOptIndex will contain the non-negative index of the * PLLongOpt structure in the caller's array of PLLongOpt structures - 8 corresponding to the long option name, and + * corresponding to the long option name, and * For a single-character or long option, * - opt->longOption will contain the value of the single-character option * name, or the value of the longOption from the PLLongOpt structure * for that long option. See notes below. * - opt->value will point to the argument option string, or will - * be NULL if no argument option string was given. + * be NULL if option does not require argument. If option requires + * argument but it is not provided, PL_OPT_BAD is returned. * When opt->option is non-zero, * - opt->longOptIndex will be -1 * When this function returns PL_OPT_EOL, or PL_OPT_BAD, the contents of diff --git a/nsprpub/lib/libc/src/plgetopt.c b/nsprpub/lib/libc/src/plgetopt.c index 0fe4fafe5ba..2cd4896dad2 100644 --- a/nsprpub/lib/libc/src/plgetopt.c +++ b/nsprpub/lib/libc/src/plgetopt.c @@ -177,13 +177,13 @@ PR_IMPLEMENT(PLOptStatus) PL_GetNextOpt(PLOptState *opt) ** option. See if we can find a match in the list of possible ** options supplied. */ - if (internal->minus == 2) { char * foundEqual = strchr(internal->xargv,'='); PRIntn optNameLen = foundEqual ? (foundEqual - internal->xargv) : strlen(internal->xargv); const PLLongOpt *longOpt = internal->longOpts; + PLOptStatus result = PL_OPT_BAD; opt->option = 0; opt->value = NULL; @@ -197,19 +197,31 @@ PR_IMPLEMENT(PLOptStatus) PL_GetNextOpt(PLOptState *opt) /* option name match */ opt->longOptIndex = longOpt - internal->longOpts; opt->longOption = longOpt->longOption; + /* value is part of the current argv[] element if = was found */ + /* note: this sets value even for long options that do not + * require option if specified as --long=value */ if (foundEqual) { - opt->value = foundEqual[1] ? foundEqual + 1 : NULL; + opt->value = foundEqual + 1; } else if (longOpt->valueRequired) { - opt->value = internal->argv[++(internal->xargc)]; + /* value is the next argv[] element, if any */ + if (internal->xargc + 1 < internal->argc) + { + opt->value = internal->argv[++(internal->xargc)]; + } + /* missing value */ + else + { + break; /* return PL_OPT_BAD */ + } } - internal->xargv = &static_Nul; /* consume this */ - return PL_OPT_OK; + result = PL_OPT_OK; + break; } internal->xargv = &static_Nul; /* consume this */ - return PL_OPT_BAD; + return result; } if (internal->minus) { @@ -223,14 +235,27 @@ PR_IMPLEMENT(PLOptStatus) PL_GetNextOpt(PLOptState *opt) opt->longOption = opt->option & 0xff; /* ** if options indicates that there's an associated - ** value, this argv is finished and the next is the - ** option's value. + ** value, it must be provided, either as part of this + ** argv[] element or as the next one */ if (':' == internal->options[cop + 1]) { - if (0 != *internal->xargv) + /* value is part of the current argv[] element */ + if (0 != *internal->xargv) + { + opt->value = internal->xargv; + } + /* value is the next argv[] element, if any */ + else if (internal->xargc + 1 < internal->argc) + { + opt->value = internal->argv[++(internal->xargc)]; + } + /* missing value */ + else + { return PL_OPT_BAD; - opt->value = internal->argv[++(internal->xargc)]; + } + internal->xargv = &static_Nul; internal->minus = 0; } @@ -242,6 +267,7 @@ PR_IMPLEMENT(PLOptStatus) PL_GetNextOpt(PLOptState *opt) internal->xargv += 1; /* consume that option */ return PL_OPT_BAD; } + /* ** No '-', so it must be a standalone value. The option is nul. */ diff --git a/nsprpub/pr/include/md/_openbsd.h b/nsprpub/pr/include/md/_openbsd.h index 8719fe7802b..8dd44099f7d 100644 --- a/nsprpub/pr/include/md/_openbsd.h +++ b/nsprpub/pr/include/md/_openbsd.h @@ -69,7 +69,7 @@ #define HAVE_DLL #define USE_DLFCN #define _PR_HAVE_SOCKADDR_LEN -#define _PR_NO_LARGE_FILES +#define _PR_HAVE_LARGE_OFF_T #define _PR_STAT_HAS_ST_ATIMESPEC #define _PR_POLL_AVAILABLE #define _PR_USE_POLL diff --git a/nsprpub/pr/include/md/_pth.h b/nsprpub/pr/include/md/_pth.h index c4cb30abdf2..66a4c07e755 100644 --- a/nsprpub/pr/include/md/_pth.h +++ b/nsprpub/pr/include/md/_pth.h @@ -98,8 +98,14 @@ #else #define _PT_PTHREAD_MUTEX_IS_LOCKED(m) (EBUSY == pthread_mutex_trylock(&(m))) #endif +#if defined(ANDROID) +/* Conditional attribute init and destroy aren't implemented in bionic. */ +#define _PT_PTHREAD_CONDATTR_INIT(x) 0 +#define _PT_PTHREAD_CONDATTR_DESTROY(x) /* */ +#else #define _PT_PTHREAD_CONDATTR_INIT pthread_condattr_init #define _PT_PTHREAD_CONDATTR_DESTROY pthread_condattr_destroy +#endif #define _PT_PTHREAD_COND_INIT(m, a) pthread_cond_init(&(m), &(a)) #endif diff --git a/nsprpub/pr/include/md/_winnt.h b/nsprpub/pr/include/md/_winnt.h index c76b278e7ec..628fe959cb4 100644 --- a/nsprpub/pr/include/md/_winnt.h +++ b/nsprpub/pr/include/md/_winnt.h @@ -42,10 +42,10 @@ ** setting _WIN32_WINNT to NT 4.0 for winsock.h, winbase.h, winnt.h. */ #ifndef _WIN32_WINNT - #define _WIN32_WINNT 0x0403 -#elif (_WIN32_WINNT < 0x0403) + #define _WIN32_WINNT 0x0400 +#elif (_WIN32_WINNT < 0x0400) #undef _WIN32_WINNT - #define _WIN32_WINNT 0x0403 + #define _WIN32_WINNT 0x0400 #endif /* _WIN32_WINNT */ #include diff --git a/nsprpub/pr/include/pratom.h b/nsprpub/pr/include/pratom.h index 1c18a9f1e3f..9e90ad48fb7 100644 --- a/nsprpub/pr/include/pratom.h +++ b/nsprpub/pr/include/pratom.h @@ -125,10 +125,12 @@ long __cdecl _InterlockedExchange(long volatile *Target, long Value); long __cdecl _InterlockedExchangeAdd(long volatile *Addend, long Value); #pragma intrinsic(_InterlockedExchangeAdd) -#define PR_ATOMIC_INCREMENT(val) _InterlockedIncrement(val) -#define PR_ATOMIC_DECREMENT(val) _InterlockedDecrement(val) -#define PR_ATOMIC_SET(val, newval) _InterlockedExchange(val, newval) -#define PR_ATOMIC_ADD(ptr, val) (_InterlockedExchangeAdd(ptr, val) + (val)) +#define PR_ATOMIC_INCREMENT(val) _InterlockedIncrement((long volatile *)val) +#define PR_ATOMIC_DECREMENT(val) _InterlockedDecrement((long volatile *)val) +#define PR_ATOMIC_SET(val, newval) \ + _InterlockedExchange((long volatile *)val, (long)newval) +#define PR_ATOMIC_ADD(ptr, val) \ + (_InterlockedExchangeAdd((long volatile *)ptr, (long)val) + (val)) #elif ((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 1)) && \ ((defined(DARWIN) && \ diff --git a/nsprpub/pr/src/md/unix/os_Darwin_ppc.s b/nsprpub/pr/src/md/unix/os_Darwin_ppc.s index 4b61fb4f3bb..905ba9fbde5 100644 --- a/nsprpub/pr/src/md/unix/os_Darwin_ppc.s +++ b/nsprpub/pr/src/md/unix/os_Darwin_ppc.s @@ -49,6 +49,7 @@ # .align 2 .globl __PR_DarwinPPC_AtomicIncrement + .private_extern __PR_DarwinPPC_AtomicIncrement __PR_DarwinPPC_AtomicIncrement: lwarx r4,0,r3 addi r0,r4,1 @@ -62,6 +63,7 @@ __PR_DarwinPPC_AtomicIncrement: # .align 2 .globl __PR_DarwinPPC_AtomicDecrement + .private_extern __PR_DarwinPPC_AtomicDecrement __PR_DarwinPPC_AtomicDecrement: lwarx r4,0,r3 addi r0,r4,-1 @@ -75,6 +77,7 @@ __PR_DarwinPPC_AtomicDecrement: # .align 2 .globl __PR_DarwinPPC_AtomicSet + .private_extern __PR_DarwinPPC_AtomicSet __PR_DarwinPPC_AtomicSet: lwarx r5,0,r3 stwcx. r4,0,r3 @@ -87,6 +90,7 @@ __PR_DarwinPPC_AtomicSet: # .align 2 .globl __PR_DarwinPPC_AtomicAdd + .private_extern __PR_DarwinPPC_AtomicAdd __PR_DarwinPPC_AtomicAdd: lwarx r5,0,r3 add r0,r4,r5 diff --git a/nsprpub/pr/src/md/unix/os_Darwin_x86.s b/nsprpub/pr/src/md/unix/os_Darwin_x86.s index 276b16e032a..1c7ef8c1cc1 100644 --- a/nsprpub/pr/src/md/unix/os_Darwin_x86.s +++ b/nsprpub/pr/src/md/unix/os_Darwin_x86.s @@ -49,6 +49,7 @@ # .text .globl __PR_Darwin_x86_AtomicIncrement + .private_extern __PR_Darwin_x86_AtomicIncrement .align 4 __PR_Darwin_x86_AtomicIncrement: movl 4(%esp), %ecx @@ -66,6 +67,7 @@ __PR_Darwin_x86_AtomicIncrement: # .text .globl __PR_Darwin_x86_AtomicDecrement + .private_extern __PR_Darwin_x86_AtomicDecrement .align 4 __PR_Darwin_x86_AtomicDecrement: movl 4(%esp), %ecx @@ -83,6 +85,7 @@ __PR_Darwin_x86_AtomicDecrement: # .text .globl __PR_Darwin_x86_AtomicSet + .private_extern __PR_Darwin_x86_AtomicSet .align 4 __PR_Darwin_x86_AtomicSet: movl 4(%esp), %ecx @@ -98,6 +101,7 @@ __PR_Darwin_x86_AtomicSet: # .text .globl __PR_Darwin_x86_AtomicAdd + .private_extern __PR_Darwin_x86_AtomicAdd .align 4 __PR_Darwin_x86_AtomicAdd: movl 4(%esp), %ecx diff --git a/nsprpub/pr/src/md/unix/os_Darwin_x86_64.s b/nsprpub/pr/src/md/unix/os_Darwin_x86_64.s index 031186f5258..ce415435bd9 100644 --- a/nsprpub/pr/src/md/unix/os_Darwin_x86_64.s +++ b/nsprpub/pr/src/md/unix/os_Darwin_x86_64.s @@ -43,6 +43,7 @@ # .text .globl __PR_Darwin_x86_64_AtomicIncrement + .private_extern __PR_Darwin_x86_64_AtomicIncrement .align 4 __PR_Darwin_x86_64_AtomicIncrement: movl $1, %eax @@ -58,6 +59,7 @@ __PR_Darwin_x86_64_AtomicIncrement: # .text .globl __PR_Darwin_x86_64_AtomicDecrement + .private_extern __PR_Darwin_x86_64_AtomicDecrement .align 4 __PR_Darwin_x86_64_AtomicDecrement: movl $-1, %eax @@ -73,6 +75,7 @@ __PR_Darwin_x86_64_AtomicDecrement: # .text .globl __PR_Darwin_x86_64_AtomicSet + .private_extern __PR_Darwin_x86_64_AtomicSet .align 4 __PR_Darwin_x86_64_AtomicSet: movl %esi, %eax @@ -86,6 +89,7 @@ __PR_Darwin_x86_64_AtomicSet: # .text .globl __PR_Darwin_x86_64_AtomicAdd + .private_extern __PR_Darwin_x86_64_AtomicAdd .align 4 __PR_Darwin_x86_64_AtomicAdd: movl %esi, %eax diff --git a/nsprpub/pr/src/md/unix/os_HPUX.s b/nsprpub/pr/src/md/unix/os_HPUX.s index ef07db03252..a3bac2577c7 100644 --- a/nsprpub/pr/src/md/unix/os_HPUX.s +++ b/nsprpub/pr/src/md/unix/os_HPUX.s @@ -49,10 +49,9 @@ ret_cr16 .PROC .CALLINFO FRAME=0, NO_CALLS .EXPORT ret_cr16,ENTRY - .ENTER -; BV %r0(%rp) - BV 0(%rp) + .ENTRY + BV %r0(%rp) + .EXIT MFCTL %cr16,%ret0 - .LEAVE .PROCEND .END diff --git a/nsprpub/pr/src/md/unix/os_Linux_x86_64.s b/nsprpub/pr/src/md/unix/os_Linux_x86_64.s index 1a7b24a8005..8de045742a0 100644 --- a/nsprpub/pr/src/md/unix/os_Linux_x86_64.s +++ b/nsprpub/pr/src/md/unix/os_Linux_x86_64.s @@ -43,6 +43,7 @@ / .text .globl _PR_x86_64_AtomicIncrement + .type _PR_x86_64_AtomicIncrement, @function .align 4 _PR_x86_64_AtomicIncrement: movl $1, %eax @@ -50,6 +51,7 @@ _PR_x86_64_AtomicIncrement: xaddl %eax, (%rdi) incl %eax ret + .size _PR_x86_64_AtomicIncrement, .-_PR_x86_64_AtomicIncrement / PRInt32 _PR_x86_64_AtomicDecrement(PRInt32 *val) / @@ -58,6 +60,7 @@ _PR_x86_64_AtomicIncrement: / .text .globl _PR_x86_64_AtomicDecrement + .type _PR_x86_64_AtomicDecrement, @function .align 4 _PR_x86_64_AtomicDecrement: movl $-1, %eax @@ -65,6 +68,7 @@ _PR_x86_64_AtomicDecrement: xaddl %eax, (%rdi) decl %eax ret + .size _PR_x86_64_AtomicDecrement, .-_PR_x86_64_AtomicDecrement / PRInt32 _PR_x86_64_AtomicSet(PRInt32 *val, PRInt32 newval) / @@ -73,11 +77,13 @@ _PR_x86_64_AtomicDecrement: / .text .globl _PR_x86_64_AtomicSet + .type _PR_x86_64_AtomicSet, @function .align 4 _PR_x86_64_AtomicSet: movl %esi, %eax xchgl %eax, (%rdi) ret + .size _PR_x86_64_AtomicSet, .-_PR_x86_64_AtomicSet / PRInt32 _PR_x86_64_AtomicAdd(PRInt32 *ptr, PRInt32 val) / @@ -86,6 +92,7 @@ _PR_x86_64_AtomicSet: / .text .globl _PR_x86_64_AtomicAdd + .type _PR_x86_64_AtomicAdd, @function .align 4 _PR_x86_64_AtomicAdd: movl %esi, %eax @@ -93,6 +100,7 @@ _PR_x86_64_AtomicAdd: xaddl %eax, (%rdi) addl %esi, %eax ret + .size _PR_x86_64_AtomicAdd, .-_PR_x86_64_AtomicAdd / Magic indicating no need for an executable stack .section .note.GNU-stack, "", @progbits ; .previous diff --git a/nsprpub/pr/src/md/unix/uxrng.c b/nsprpub/pr/src/md/unix/uxrng.c index cafd928a3b5..d46f4475e22 100644 --- a/nsprpub/pr/src/md/unix/uxrng.c +++ b/nsprpub/pr/src/md/unix/uxrng.c @@ -75,7 +75,11 @@ GetHighResClock(void *buf, size_t maxbytes) { PRUint64 t; +#ifdef __GNUC__ + __asm__ __volatile__("mov %0 = ar.itc" : "=r" (t)); +#else t = _Asm_mov_from_ar(_AREG44); +#endif return _pr_CopyLowBits(buf, maxbytes, &t, sizeof(t)); } #else diff --git a/nsprpub/pr/src/misc/prinit.c b/nsprpub/pr/src/misc/prinit.c index 7071e0a04ad..e419e8916c0 100644 --- a/nsprpub/pr/src/misc/prinit.c +++ b/nsprpub/pr/src/misc/prinit.c @@ -803,7 +803,7 @@ PR_IMPLEMENT(PRStatus) PR_CallOnce( if (!_pr_initialized) _PR_ImplicitInitialization(); if (!once->initialized) { - if (PR_AtomicSet(&once->inProgress, 1) == 0) { + if (PR_ATOMIC_SET(&once->inProgress, 1) == 0) { once->status = (*func)(); PR_Lock(mod_init.ml); once->initialized = 1; @@ -832,7 +832,7 @@ PR_IMPLEMENT(PRStatus) PR_CallOnceWithArg( if (!_pr_initialized) _PR_ImplicitInitialization(); if (!once->initialized) { - if (PR_AtomicSet(&once->inProgress, 1) == 0) { + if (PR_ATOMIC_SET(&once->inProgress, 1) == 0) { once->status = (*func)(arg); PR_Lock(mod_init.ml); once->initialized = 1; diff --git a/nsprpub/pr/src/misc/prsystem.c b/nsprpub/pr/src/misc/prsystem.c index 1996468f877..098de02f45a 100644 --- a/nsprpub/pr/src/misc/prsystem.c +++ b/nsprpub/pr/src/misc/prsystem.c @@ -284,6 +284,20 @@ PR_IMPLEMENT(PRUint64) PR_GetPhysicalMemorySize(void) long pageCount = sysconf(_SC_PHYS_PAGES); bytes = (PRUint64) pageSize * pageCount; +#elif defined(NETBSD) + + int mib[2]; + int rc; + uint64_t memSize; + size_t len = sizeof(memSize); + + mib[0] = CTL_HW; + mib[1] = HW_PHYSMEM64; + rc = sysctl(mib, 2, &memSize, &len, NULL, 0); + if (-1 != rc) { + bytes = memSize; + } + #elif defined(HPUX) struct pst_static info; diff --git a/nsprpub/pr/src/pthreads/ptsynch.c b/nsprpub/pr/src/pthreads/ptsynch.c index 3f3b2720136..f90917e14b8 100644 --- a/nsprpub/pr/src/pthreads/ptsynch.c +++ b/nsprpub/pr/src/pthreads/ptsynch.c @@ -148,13 +148,13 @@ static void pt_PostNotifies(PRLock *lock, PRBool unlock) } #if defined(DEBUG) pt_debug.cvars_notified += 1; - if (0 > PR_AtomicDecrement(&cv->notify_pending)) + if (0 > PR_ATOMIC_DECREMENT(&cv->notify_pending)) { pt_debug.delayed_cv_deletes += 1; PR_DestroyCondVar(cv); } #else /* defined(DEBUG) */ - if (0 > PR_AtomicDecrement(&cv->notify_pending)) + if (0 > PR_ATOMIC_DECREMENT(&cv->notify_pending)) PR_DestroyCondVar(cv); #endif /* defined(DEBUG) */ } @@ -338,7 +338,7 @@ static void pt_PostNotifyToCvar(PRCondVar *cvar, PRBool broadcast) } /* A brand new entry in the array */ - (void)PR_AtomicIncrement(&cvar->notify_pending); + (void)PR_ATOMIC_INCREMENT(&cvar->notify_pending); notified->cv[index].times = (broadcast) ? -1 : 1; notified->cv[index].cv = cvar; notified->length += 1; @@ -367,7 +367,7 @@ PR_IMPLEMENT(PRCondVar*) PR_NewCondVar(PRLock *lock) PR_IMPLEMENT(void) PR_DestroyCondVar(PRCondVar *cvar) { - if (0 > PR_AtomicDecrement(&cvar->notify_pending)) + if (0 > PR_ATOMIC_DECREMENT(&cvar->notify_pending)) { PRIntn rv = pthread_cond_destroy(&cvar->cv); PR_ASSERT(0 == rv); #if defined(DEBUG) diff --git a/nsprpub/pr/src/pthreads/ptthread.c b/nsprpub/pr/src/pthreads/ptthread.c index 45afdac4f8b..b28dc07f378 100644 --- a/nsprpub/pr/src/pthreads/ptthread.c +++ b/nsprpub/pr/src/pthreads/ptthread.c @@ -752,10 +752,10 @@ PR_IMPLEMENT(PRStatus) PR_Interrupt(PRThread *thred) if ((NULL != cv) && !thred->interrupt_blocked) { PRIntn rv; - (void)PR_AtomicIncrement(&cv->notify_pending); + (void)PR_ATOMIC_INCREMENT(&cv->notify_pending); rv = pthread_cond_broadcast(&cv->cv); PR_ASSERT(0 == rv); - if (0 > PR_AtomicDecrement(&cv->notify_pending)) + if (0 > PR_ATOMIC_DECREMENT(&cv->notify_pending)) PR_DestroyCondVar(cv); } return PR_SUCCESS; diff --git a/nsprpub/pr/src/threads/combined/pruthr.c b/nsprpub/pr/src/threads/combined/pruthr.c index 9609d4d97dc..86c8276ea6f 100644 --- a/nsprpub/pr/src/threads/combined/pruthr.c +++ b/nsprpub/pr/src/threads/combined/pruthr.c @@ -1165,9 +1165,9 @@ PR_IMPLEMENT(PRThread*) _PR_CreateThread(PRThreadType type, if (type == PR_SYSTEM_THREAD) { thread->flags |= _PR_SYSTEM; - PR_AtomicIncrement(&_pr_systemActive); + PR_ATOMIC_INCREMENT(&_pr_systemActive); } - else PR_AtomicIncrement(&_pr_userActive); + else PR_ATOMIC_INCREMENT(&_pr_userActive); if (state == PR_JOINABLE_THREAD) { if (!thread->term) diff --git a/nsprpub/pr/src/threads/prtpd.c b/nsprpub/pr/src/threads/prtpd.c index 168c6601887..5c53313580e 100644 --- a/nsprpub/pr/src/threads/prtpd.c +++ b/nsprpub/pr/src/threads/prtpd.c @@ -137,7 +137,7 @@ PR_IMPLEMENT(PRStatus) PR_NewThreadPrivateIndex( PR_ASSERT(NULL != newIndex); PR_ASSERT(NULL != _pr_tpd_destructors); - index = PR_AtomicIncrement(&_pr_tpd_highwater) - 1; /* allocate index */ + index = PR_ATOMIC_INCREMENT(&_pr_tpd_highwater) - 1; /* allocate index */ if (_PR_TPD_LIMIT <= index) { PR_SetError(PR_TPD_RANGE_ERROR, 0); diff --git a/nsprpub/pr/tests/nbconn.c b/nsprpub/pr/tests/nbconn.c index 3598cba260b..27e0e698c55 100644 --- a/nsprpub/pr/tests/nbconn.c +++ b/nsprpub/pr/tests/nbconn.c @@ -125,7 +125,7 @@ int main(int argc, char **argv) * 1. successful connection: a server thread accepts a connection * from the main thread * 2. unsuccessful connection: the main thread tries to connect to a - * non-existent port and expects to get an error + * nonexistent port and expects to get an error */ rv = connection_success_test(); if (rv == 0) @@ -447,7 +447,7 @@ def_exit: } /* - * test for connection to a non-existent port using a non-blocking socket + * test for connection to a nonexistent port using a non-blocking socket */ static PRIntn connection_failure_test() From 18d49dc04164eb37ffe4b4f085e75a53b8c751b4 Mon Sep 17 00:00:00 2001 From: Brad Lassey Date: Sat, 5 Jun 2010 13:15:50 -0400 Subject: [PATCH 14/30] backout bug 415563 because a gcc4.3 bug causes it to break our 32bit linux builders r=ted --- nsprpub/pr/include/pratom.h | 10 ++++------ nsprpub/pr/src/misc/prinit.c | 4 ++-- nsprpub/pr/src/pthreads/ptsynch.c | 8 ++++---- nsprpub/pr/src/pthreads/ptthread.c | 4 ++-- nsprpub/pr/src/threads/combined/pruthr.c | 4 ++-- nsprpub/pr/src/threads/prtpd.c | 2 +- 6 files changed, 15 insertions(+), 17 deletions(-) diff --git a/nsprpub/pr/include/pratom.h b/nsprpub/pr/include/pratom.h index 9e90ad48fb7..1c18a9f1e3f 100644 --- a/nsprpub/pr/include/pratom.h +++ b/nsprpub/pr/include/pratom.h @@ -125,12 +125,10 @@ long __cdecl _InterlockedExchange(long volatile *Target, long Value); long __cdecl _InterlockedExchangeAdd(long volatile *Addend, long Value); #pragma intrinsic(_InterlockedExchangeAdd) -#define PR_ATOMIC_INCREMENT(val) _InterlockedIncrement((long volatile *)val) -#define PR_ATOMIC_DECREMENT(val) _InterlockedDecrement((long volatile *)val) -#define PR_ATOMIC_SET(val, newval) \ - _InterlockedExchange((long volatile *)val, (long)newval) -#define PR_ATOMIC_ADD(ptr, val) \ - (_InterlockedExchangeAdd((long volatile *)ptr, (long)val) + (val)) +#define PR_ATOMIC_INCREMENT(val) _InterlockedIncrement(val) +#define PR_ATOMIC_DECREMENT(val) _InterlockedDecrement(val) +#define PR_ATOMIC_SET(val, newval) _InterlockedExchange(val, newval) +#define PR_ATOMIC_ADD(ptr, val) (_InterlockedExchangeAdd(ptr, val) + (val)) #elif ((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 1)) && \ ((defined(DARWIN) && \ diff --git a/nsprpub/pr/src/misc/prinit.c b/nsprpub/pr/src/misc/prinit.c index e419e8916c0..7071e0a04ad 100644 --- a/nsprpub/pr/src/misc/prinit.c +++ b/nsprpub/pr/src/misc/prinit.c @@ -803,7 +803,7 @@ PR_IMPLEMENT(PRStatus) PR_CallOnce( if (!_pr_initialized) _PR_ImplicitInitialization(); if (!once->initialized) { - if (PR_ATOMIC_SET(&once->inProgress, 1) == 0) { + if (PR_AtomicSet(&once->inProgress, 1) == 0) { once->status = (*func)(); PR_Lock(mod_init.ml); once->initialized = 1; @@ -832,7 +832,7 @@ PR_IMPLEMENT(PRStatus) PR_CallOnceWithArg( if (!_pr_initialized) _PR_ImplicitInitialization(); if (!once->initialized) { - if (PR_ATOMIC_SET(&once->inProgress, 1) == 0) { + if (PR_AtomicSet(&once->inProgress, 1) == 0) { once->status = (*func)(arg); PR_Lock(mod_init.ml); once->initialized = 1; diff --git a/nsprpub/pr/src/pthreads/ptsynch.c b/nsprpub/pr/src/pthreads/ptsynch.c index f90917e14b8..3f3b2720136 100644 --- a/nsprpub/pr/src/pthreads/ptsynch.c +++ b/nsprpub/pr/src/pthreads/ptsynch.c @@ -148,13 +148,13 @@ static void pt_PostNotifies(PRLock *lock, PRBool unlock) } #if defined(DEBUG) pt_debug.cvars_notified += 1; - if (0 > PR_ATOMIC_DECREMENT(&cv->notify_pending)) + if (0 > PR_AtomicDecrement(&cv->notify_pending)) { pt_debug.delayed_cv_deletes += 1; PR_DestroyCondVar(cv); } #else /* defined(DEBUG) */ - if (0 > PR_ATOMIC_DECREMENT(&cv->notify_pending)) + if (0 > PR_AtomicDecrement(&cv->notify_pending)) PR_DestroyCondVar(cv); #endif /* defined(DEBUG) */ } @@ -338,7 +338,7 @@ static void pt_PostNotifyToCvar(PRCondVar *cvar, PRBool broadcast) } /* A brand new entry in the array */ - (void)PR_ATOMIC_INCREMENT(&cvar->notify_pending); + (void)PR_AtomicIncrement(&cvar->notify_pending); notified->cv[index].times = (broadcast) ? -1 : 1; notified->cv[index].cv = cvar; notified->length += 1; @@ -367,7 +367,7 @@ PR_IMPLEMENT(PRCondVar*) PR_NewCondVar(PRLock *lock) PR_IMPLEMENT(void) PR_DestroyCondVar(PRCondVar *cvar) { - if (0 > PR_ATOMIC_DECREMENT(&cvar->notify_pending)) + if (0 > PR_AtomicDecrement(&cvar->notify_pending)) { PRIntn rv = pthread_cond_destroy(&cvar->cv); PR_ASSERT(0 == rv); #if defined(DEBUG) diff --git a/nsprpub/pr/src/pthreads/ptthread.c b/nsprpub/pr/src/pthreads/ptthread.c index b28dc07f378..45afdac4f8b 100644 --- a/nsprpub/pr/src/pthreads/ptthread.c +++ b/nsprpub/pr/src/pthreads/ptthread.c @@ -752,10 +752,10 @@ PR_IMPLEMENT(PRStatus) PR_Interrupt(PRThread *thred) if ((NULL != cv) && !thred->interrupt_blocked) { PRIntn rv; - (void)PR_ATOMIC_INCREMENT(&cv->notify_pending); + (void)PR_AtomicIncrement(&cv->notify_pending); rv = pthread_cond_broadcast(&cv->cv); PR_ASSERT(0 == rv); - if (0 > PR_ATOMIC_DECREMENT(&cv->notify_pending)) + if (0 > PR_AtomicDecrement(&cv->notify_pending)) PR_DestroyCondVar(cv); } return PR_SUCCESS; diff --git a/nsprpub/pr/src/threads/combined/pruthr.c b/nsprpub/pr/src/threads/combined/pruthr.c index 86c8276ea6f..9609d4d97dc 100644 --- a/nsprpub/pr/src/threads/combined/pruthr.c +++ b/nsprpub/pr/src/threads/combined/pruthr.c @@ -1165,9 +1165,9 @@ PR_IMPLEMENT(PRThread*) _PR_CreateThread(PRThreadType type, if (type == PR_SYSTEM_THREAD) { thread->flags |= _PR_SYSTEM; - PR_ATOMIC_INCREMENT(&_pr_systemActive); + PR_AtomicIncrement(&_pr_systemActive); } - else PR_ATOMIC_INCREMENT(&_pr_userActive); + else PR_AtomicIncrement(&_pr_userActive); if (state == PR_JOINABLE_THREAD) { if (!thread->term) diff --git a/nsprpub/pr/src/threads/prtpd.c b/nsprpub/pr/src/threads/prtpd.c index 5c53313580e..168c6601887 100644 --- a/nsprpub/pr/src/threads/prtpd.c +++ b/nsprpub/pr/src/threads/prtpd.c @@ -137,7 +137,7 @@ PR_IMPLEMENT(PRStatus) PR_NewThreadPrivateIndex( PR_ASSERT(NULL != newIndex); PR_ASSERT(NULL != _pr_tpd_destructors); - index = PR_ATOMIC_INCREMENT(&_pr_tpd_highwater) - 1; /* allocate index */ + index = PR_AtomicIncrement(&_pr_tpd_highwater) - 1; /* allocate index */ if (_PR_TPD_LIMIT <= index) { PR_SetError(PR_TPD_RANGE_ERROR, 0); From 4859e2ab1dbf59c78454993b6eb1c144bc56966c Mon Sep 17 00:00:00 2001 From: Brad Lassey Date: Sat, 5 Jun 2010 13:15:50 -0400 Subject: [PATCH 15/30] bug 559263 - make jemalloc work with android, follow up patch r=ted --- configure.in | 14 ++- js/src/configure.in | 2 +- memory/jemalloc/jemalloc.c | 2 + memory/mozalloc/Makefile.in | 4 +- memory/mozalloc/ld_malloc_wrappers.c | 140 +++++++++++++++++++++++++++ memory/mozalloc/mozalloc.cpp | 3 +- memory/mozalloc/wraps.c | 102 ------------------- 7 files changed, 157 insertions(+), 110 deletions(-) create mode 100644 memory/mozalloc/ld_malloc_wrappers.c delete mode 100644 memory/mozalloc/wraps.c diff --git a/configure.in b/configure.in index 34f43904734..9e828cff9fe 100644 --- a/configure.in +++ b/configure.in @@ -7171,6 +7171,8 @@ if test "$MOZ_MEMORY"; then *-android*) AC_DEFINE(MOZ_MEMORY_LINUX) AC_DEFINE(MOZ_MEMORY_ANDROID) + _WRAP_MALLOC=1 + export WRAP_MALLOC_LIB="-L$_objdir/dist/lib -lmozalloc" ;; *) AC_MSG_ERROR([--enable-jemalloc not supported on ${target}]) @@ -7200,7 +7202,7 @@ MOZ_ARG_ENABLE_BOOL(wrap-malloc, if test -n "$_WRAP_MALLOC"; then if test "$GNU_CC"; then - WRAP_MALLOC_CFLAGS="${LDFLAGS} -Wl,--wrap -Wl,malloc -Wl,--wrap -Wl,calloc -Wl,--wrap -Wl,valloc -Wl,--wrap -Wl,free -Wl,--wrap -Wl,realloc -Wl,--wrap -Wl,memalign -Wl,--wrap -Wl,__builtin_new -Wl,--wrap -Wl,__builtin_vec_new -Wl,--wrap -Wl,__builtin_delete -Wl,--wrap -Wl,__builtin_vec_delete -Wl,--wrap -Wl,PR_Free -Wl,--wrap -Wl,PR_Malloc -Wl,--wrap -Wl,PR_Calloc -Wl,--wrap -Wl,PR_Realloc -Wl,--wrap -Wl,strdup -Wl,--wrap -Wl,strndup" + WRAP_MALLOC_CFLAGS="${LDFLAGS} -Wl,--wrap -Wl,malloc -Wl,--wrap -Wl,calloc -Wl,--wrap -Wl,valloc -Wl,--wrap -Wl,free -Wl,--wrap -Wl,realloc -Wl,--wrap -Wl,memalign -Wl,--wrap -Wl,__builtin_new -Wl,--wrap -Wl,__builtin_vec_new -Wl,--wrap -Wl,__builtin_delete -Wl,--wrap -Wl,__builtin_vec_delete -Wl,--wrap -Wl,PR_Free -Wl,--wrap -Wl,PR_Malloc -Wl,--wrap -Wl,PR_Calloc -Wl,--wrap -Wl,PR_Realloc -Wl,--wrap -Wl,strdup -Wl,--wrap -Wl,strndup -Wl,--wrap -Wl,posix_memalign" MKSHLIB='$(CXX) $(DSO_LDOPTS) $(WRAP_MALLOC_CFLAGS) $(WRAP_MALLOC_LIB) -o $@' fi fi @@ -9007,6 +9009,13 @@ unset CONFIG_FILES # No need to run subconfigures when building with LIBXUL_SDK_DIR if test "$COMPILE_ENVIRONMENT" -a -z "$LIBXUL_SDK_DIR"; then +if test -n "$MOZ_THUMB2"; then + _SUBDIR_CONFIG_ARGS="$_SUBDIR_CONFIG_ARGS --enable-thumb2" +fi +if test -n "$_WRAP_MALLOC"; then + _SUBDIR_CONFIG_ARGS="$_SUBDIR_CONFIG_ARGS --enable-wrap-malloc" +fi + if test -z "$MOZ_NATIVE_NSPR"; then ac_configure_args="$_SUBDIR_CONFIG_ARGS --with-dist-prefix=$MOZ_BUILD_ROOT/dist --with-mozilla" if test -z "$MOZ_DEBUG"; then @@ -9024,9 +9033,6 @@ if test -z "$MOZ_NATIVE_NSPR"; then if test -n "$USE_ARM_KUSER"; then ac_configure_args="$ac_configure_args --with-arm-kuser" fi - if test -n "$MOZ_THUMB2"; then - ac_configure_args="$ac_configure_args --enable-thumb2" - fi AC_OUTPUT_SUBDIRS(nsprpub) ac_configure_args="$_SUBDIR_CONFIG_ARGS" fi diff --git a/js/src/configure.in b/js/src/configure.in index 0d1bdeca9ae..7eed142e124 100644 --- a/js/src/configure.in +++ b/js/src/configure.in @@ -4368,7 +4368,7 @@ MOZ_ARG_ENABLE_BOOL(wrap-malloc, if test -n "$_WRAP_MALLOC"; then if test "$GNU_CC"; then - WRAP_MALLOC_CFLAGS="${LDFLAGS} -Wl,--wrap -Wl,malloc -Wl,--wrap -Wl,calloc -Wl,--wrap -Wl,valloc -Wl,--wrap -Wl,free -Wl,--wrap -Wl,realloc -Wl,--wrap -Wl,memalign -Wl,--wrap -Wl,__builtin_new -Wl,--wrap -Wl,__builtin_vec_new -Wl,--wrap -Wl,__builtin_delete -Wl,--wrap -Wl,__builtin_vec_delete -Wl,--wrap -Wl,PR_Free -Wl,--wrap -Wl,PR_Malloc -Wl,--wrap -Wl,PR_Calloc -Wl,--wrap -Wl,PR_Realloc -Wl,--wrap -Wl,strdup -Wl,--wrap -Wl,strndup" + WRAP_MALLOC_CFLAGS="${LDFLAGS} -Wl,--wrap -Wl,malloc -Wl,--wrap -Wl,calloc -Wl,--wrap -Wl,valloc -Wl,--wrap -Wl,free -Wl,--wrap -Wl,realloc -Wl,--wrap -Wl,memalign -Wl,--wrap -Wl,__builtin_new -Wl,--wrap -Wl,__builtin_vec_new -Wl,--wrap -Wl,__builtin_delete -Wl,--wrap -Wl,__builtin_vec_delete -Wl,--wrap -Wl,PR_Free -Wl,--wrap -Wl,PR_Malloc -Wl,--wrap -Wl,PR_Calloc -Wl,--wrap -Wl,PR_Realloc -Wl,--wrap -Wl,strdup -Wl,--wrap -Wl,strndup -Wl,--wrap -Wl,posix_memalign" MKSHLIB='$(CXX) $(DSO_LDOPTS) $(WRAP_MALLOC_CFLAGS) $(WRAP_MALLOC_LIB) -o $@' fi fi diff --git a/memory/jemalloc/jemalloc.c b/memory/jemalloc/jemalloc.c index b8cc352fd55..4b7c8e27fb7 100644 --- a/memory/jemalloc/jemalloc.c +++ b/memory/jemalloc/jemalloc.c @@ -5770,6 +5770,8 @@ inline void sys_free(void* ptr) {return free(ptr);} #define calloc(a, b) je_calloc(a, b) #define realloc(a, b) je_realloc(a, b) #define free(a) je_free(a) +#define posix_memalign(a, b, c) je_posix_memalign(a, b, c) + char *je_strndup(const char *src, size_t len) { char* dst = (char*)je_malloc(len + 1); if(dst) diff --git a/memory/mozalloc/Makefile.in b/memory/mozalloc/Makefile.in index 20348754e00..5d76d127d29 100644 --- a/memory/mozalloc/Makefile.in +++ b/memory/mozalloc/Makefile.in @@ -59,8 +59,8 @@ ifneq (,$(findstring mozalloc,$(WRAP_MALLOC_LIB))) EXTRA_DSO_LDOPTS += $(DIST)/lib/libjemalloc.a WRAP_MALLOC_LIB= WRAP_MALLOC_CFLAGS= -DEFINES += -DWRAP_MALLOC -CSRCS = wraps.c +DEFINES += -DWRAP_MALLOC_WITH_JEMALLOC +CSRCS = ld_malloc_wrappers.c ifeq (,$(filter-out Linux,$(OS_TARGET))) EXTRA_DSO_LDOPTS += -lpthread endif diff --git a/memory/mozalloc/ld_malloc_wrappers.c b/memory/mozalloc/ld_malloc_wrappers.c new file mode 100644 index 00000000000..7f9ced33d49 --- /dev/null +++ b/memory/mozalloc/ld_malloc_wrappers.c @@ -0,0 +1,140 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * Mozilla Foundation. + * Portions created by the Initial Developer are Copyright (C) 2010 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Brad Lassey + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +#include // for size_t +#include // for malloc, free +#include "mozalloc.h" +#include + +#ifdef __malloc_hook +static void* moz_malloc_hook(size_t size, const void *caller) +{ + return moz_malloc(size); +} + +static void* moz_realloc_hook(void *ptr, size_t size, const void *caller) +{ + return moz_realloc(ptr, size); +} + +static void moz_free_hook(void *ptr, const void *caller) +{ + moz_free(ptr); +} + +static void* moz_memalign_hook(size_t align, size_t size, const void *caller) +{ + return moz_memalign(align, size); +} + +static void +moz_malloc_init_hook (void) +{ + __malloc_hook = moz_malloc_hook; + __realloc_hook = moz_realloc_hook; + __free_hook = moz_free_hook; + __memalign_hook = moz_memalign_hook; +} + +/* Override initializing hook from the C library. */ +void (*__malloc_initialize_hook) (void) = moz_malloc_init_hook; +#endif + +inline void __wrap_free(void* ptr) +{ + moz_free(ptr); +} + +inline void* __wrap_malloc(size_t size) +{ + return moz_malloc(size); +} + +inline void* __wrap_realloc(void* ptr, size_t size) +{ + return moz_realloc(ptr, size); +} + +inline void* __wrap_calloc(size_t num, size_t size) +{ + return moz_calloc(num, size); +} + +inline void* __wrap_valloc(size_t size) +{ + return moz_valloc(size); +} + +inline void* __wrap_memalign(size_t align, size_t size) +{ + return moz_memalign(align, size); +} + +inline char* __wrap_strdup(char* str) +{ + return moz_strdup(str); +} + +inline char* __wrap_strndup(const char* str, size_t size) { + return moz_strndup(str, size); +} + + +inline void __wrap_PR_Free(void* ptr) +{ + moz_free(ptr); +} + +inline void* __wrap_PR_Malloc(size_t size) +{ + return moz_malloc(size); +} + +inline void* __wrap_PR_Realloc(void* ptr, size_t size) +{ + return moz_realloc(ptr, size); +} + +inline void* __wrap_PR_Calloc(size_t num, size_t size) +{ + return moz_calloc(num, size); +} + +inline int __wrap_posix_memalign(void **memptr, size_t alignment, size_t size) +{ + return moz_posix_memalign(memptr, alignment, size); +} diff --git a/memory/mozalloc/mozalloc.cpp b/memory/mozalloc/mozalloc.cpp index 15ab270b6c9..5cd2a00c1d2 100644 --- a/memory/mozalloc/mozalloc.cpp +++ b/memory/mozalloc/mozalloc.cpp @@ -74,7 +74,7 @@ #define UNLIKELY(x) (x) #endif -#if defined(MOZ_MEMORY_ANDROID) || defined(WRAP_MALLOC) +#if defined(MOZ_MEMORY_ANDROID) || defined(WRAP_MALLOC_WITH_JEMALLOC) #include "jemalloc.h" #define malloc(a) je_malloc(a) #define valloc(a) je_valloc(a) @@ -83,6 +83,7 @@ #define free(a) je_free(a) #define strdup(a) je_strdup(a) #define strndup(a, b) je_strndup(a, b) +#define posix_memalign(a, b, c) je_posix_memalign(a, b, c) #endif void diff --git a/memory/mozalloc/wraps.c b/memory/mozalloc/wraps.c deleted file mode 100644 index ba780a76897..00000000000 --- a/memory/mozalloc/wraps.c +++ /dev/null @@ -1,102 +0,0 @@ -#include // for size_t -#include // for malloc, free -#include "mozalloc.h" -#ifdef MOZ_MEMORY_ANDROID -#include -#define LOG(args...) __android_log_print(ANDROID_LOG_INFO, "wrap", args) -#endif -#include - -#ifdef __malloc_hook -static void* moz_malloc_hook(size_t size, const void *caller) -{ - return moz_malloc(size); -} - -static void* moz_realloc_hook(void *ptr, size_t size, const void *caller) -{ - return moz_realloc(ptr, size); -} - -static void moz_free_hook(void *ptr, const void *caller) -{ - moz_free(ptr); -} - -static void* moz_memalign_hook(size_t align, size_t size, const void *caller) -{ - return moz_memalign(align, size); -} - -static void -moz_malloc_init_hook (void) -{ - __malloc_hook = moz_malloc_hook; - __realloc_hook = moz_realloc_hook; - __free_hook = moz_free_hook; - __memalign_hook = moz_memalign_hook; -} - -/* Override initializing hook from the C library. */ -void (*__malloc_initialize_hook) (void) = moz_malloc_init_hook; -#endif - -inline void __wrap_free(void* ptr) -{ - moz_free(ptr); -} - -inline void* __wrap_malloc(size_t size) -{ - return moz_malloc(size); -} - -inline void* __wrap_realloc(void* ptr, size_t size) -{ - return moz_realloc(ptr, size); -} - -inline void* __wrap_calloc(size_t num, size_t size) -{ - return moz_calloc(num, size); -} - -inline void* __wrap_valloc(size_t size) -{ - return moz_valloc(size); -} - -inline void* __wrap_memalign(size_t align, size_t size) -{ - return moz_memalign(align, size); -} - -inline char* __wrap_strdup(char* str) -{ - return moz_strdup(str); -} - -inline char* __wrap_strndup(const char* str, size_t size) { - return moz_strndup(str, size); -} - - -inline void __wrap_PR_Free(void* ptr) -{ - moz_free(ptr); -} - -inline void* __wrap_PR_Malloc(size_t size) -{ - return moz_malloc(size); -} - -inline void* __wrap_PR_Realloc(void* ptr, size_t size) -{ - return moz_realloc(ptr, size); -} - -inline void* __wrap_PR_Calloc(size_t num, size_t size) -{ - return moz_calloc(num, size); -} From b9dde1111f4e3f1118e5621172c3b5031495d7d4 Mon Sep 17 00:00:00 2001 From: Brad Lassey Date: Sat, 5 Jun 2010 13:15:50 -0400 Subject: [PATCH 16/30] bug 557824 - move default configs for android into configure.in r=ted --- configure.in | 75 ++++++++++++++++++++++++++++------------------------ 1 file changed, 40 insertions(+), 35 deletions(-) diff --git a/configure.in b/configure.in index 9e828cff9fe..ee054463443 100644 --- a/configure.in +++ b/configure.in @@ -2821,8 +2821,6 @@ alpha*-*-osf*) MOZ_GFX_OPTIMIZE_MOBILE=1 MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks -fno-reorder-functions -fomit-frame-pointer" - - dnl MOZ_MEMORY=1 ;; esac @@ -4880,18 +4878,6 @@ MOZ_ARG_WITH_STRING(java-bin-path, Location of Java binaries (java, javac, jar)], JAVA_BIN_PATH=$withval) -dnl ======================================================== -dnl Use ARM userspace kernel helpers; tell NSPR to enable -dnl their usage and use them in spidermonkey. -dnl ======================================================== -MOZ_ARG_WITH_BOOL(arm-kuser, -[ --with-arm-kuser Use kuser helpers (Linux/ARM only -- requires kernel 2.6.13 or later)], - USE_ARM_KUSER=1, - USE_ARM_KUSER=) -if test -n "$USE_ARM_KUSER"; then - AC_DEFINE(USE_ARM_KUSER) -fi - dnl ======================================================== dnl = dnl = Application @@ -4908,6 +4894,7 @@ MOZ_OFFICIAL_BRANDING= MOZ_FEEDS=1 MOZ_IMG_DECODERS_DEFAULT="png gif jpeg bmp icon" MOZ_IMG_ENCODERS_DEFAULT="png jpeg" +MOZ_INSTALLER=1 MOZ_IPC=1 MOZ_JAVAXPCOM= MOZ_JSDEBUGGER=1 @@ -4953,10 +4940,12 @@ MOZ_XTF=1 MOZ_XUL=1 MOZ_ZIPWRITER=1 NS_PRINTING=1 +NSS_DISABLE_DBM= NECKO_WIFI=1 NECKO_COOKIES=1 NECKO_DISK_CACHE=1 NECKO_PROTOCOLS_DEFAULT="about data file ftp gopher http res viewsource" +USE_ARM_KUSER= BUILD_CTYPES=1 XPC_IDISPATCH_SUPPORT= @@ -4986,6 +4975,22 @@ case "$target_os" in ;; esac +case "${target}" in + arm-android-eabi) + NSS_DISABLE_DBM=1 + USE_ARM_KUSER=1 + MOZ_INSTALLER= + MOZ_CRASHREPORTER= + NS_PRINTING= + NECKO_WIFI= + MOZ_PLUGINS= + MOZ_THUMB2=1 + MOZ_THEME_FASTSTRIPE=1 + MOZ_TREE_FREETYPE=1 + MOZ_MEMORY=1 + ;; +esac + MOZ_ARG_ENABLE_STRING(application, [ --enable-application=APP Options include: @@ -5243,6 +5248,17 @@ fi # COMPILE_ENVIRONMENT AC_SUBST(MOZ_FS_LAYOUT) +dnl ======================================================== +dnl Use ARM userspace kernel helpers; tell NSPR to enable +dnl their usage and use them in spidermonkey. +dnl ======================================================== +MOZ_ARG_WITH_BOOL(arm-kuser, +[ --with-arm-kuser Use kuser helpers (Linux/ARM only -- requires kernel 2.6.13 or later)], + USE_ARM_KUSER=1,) +if test -n "$USE_ARM_KUSER"; then + AC_DEFINE(USE_ARM_KUSER) +fi + dnl ======================================================== dnl = startup-notification support module dnl ======================================================== @@ -5723,16 +5739,14 @@ dnl = Disable plugin support dnl ======================================================== MOZ_ARG_DISABLE_BOOL(plugins, [ --disable-plugins Disable plugins support], - MOZ_PLUGINS=, - MOZ_PLUGINS=1) + MOZ_PLUGINS=,) dnl ======================================================== dnl = Disable building dbm dnl ======================================================== MOZ_ARG_DISABLE_BOOL(dbm, -[ --disable-dbm Disable building dbm], - NSS_DISABLE_DBM=1, - NSS_DISABLE_DBM=) +[ --disable-dbm Disable building dbm], + NSS_DISABLE_DBM=1,) dnl bi-directional support always on IBMBIDI=1 @@ -5782,8 +5796,7 @@ dnl Disable printing dnl ======================================================== MOZ_ARG_DISABLE_BOOL(printing, [ --disable-printing Disable printing support], - NS_PRINTING=, - NS_PRINTING=1 ) + NS_PRINTING=,) if test "$MOZ_WIDGET_TOOLKIT" = "qt"; then AC_MSG_WARN([Printing does not work with Qt at this time. Omitting printing support.]) @@ -5794,7 +5807,6 @@ if test "$NS_PRINTING"; then AC_DEFINE(NS_PRINTING) AC_DEFINE(NS_PRINT_PREVIEW) fi - dnl ======================================================== dnl use native unicode converters dnl ======================================================== @@ -5843,8 +5855,7 @@ dnl = Disable Ogg Codecs dnl ======================================================== MOZ_ARG_DISABLE_BOOL(ogg, [ --disable-ogg Disable Ogg Codec support], - MOZ_OGG=, - MOZ_OGG=1) + MOZ_OGG=,) AC_SUBST(MOZ_OGG) @@ -5880,8 +5891,7 @@ dnl = Disable Wave decoder support dnl ======================================================== MOZ_ARG_DISABLE_BOOL(wave, [ --disable-wave Disable Wave decoder support], - MOZ_WAVE=, - MOZ_WAVE=1) + MOZ_WAVE=,) AC_SUBST(MOZ_WAVE) @@ -5994,8 +6004,7 @@ esac MOZ_ARG_ENABLE_BOOL(javaxpcom, [ --enable-javaxpcom Enable Java-XPCOM bridge], - MOZ_JAVAXPCOM=1, - MOZ_JAVAXPCOM= ) + MOZ_JAVAXPCOM=1,) case "$host_os" in cygwin*|msvc*|mks*) @@ -6072,8 +6081,7 @@ esac MOZ_ARG_DISABLE_BOOL(crashreporter, [ --disable-crashreporter Disable breakpad crash reporting], - MOZ_CRASHREPORTER=, - MOZ_CRASHREPORTER=1) + MOZ_CRASHREPORTER=,) if test -n "$MOZ_CRASHREPORTER"; then AC_DEFINE(MOZ_CRASHREPORTER) @@ -6350,8 +6358,7 @@ esac MOZ_ARG_DISABLE_BOOL(installer, [ --disable-installer Disable building of installer], - MOZ_INSTALLER=, - MOZ_INSTALLER=1 ) + MOZ_INSTALLER=,) if test -n "$MOZ_INSTALLER" -a "$OS_ARCH" = "WINNT"; then # Disable installer for Windows builds that use the new toolkit if NSIS # isn't in the path. @@ -8399,9 +8406,7 @@ dnl option to disable necko's wifi scanner dnl MOZ_ARG_DISABLE_BOOL(necko-wifi, [ --disable-necko-wifi Disable necko wifi scanner], - NECKO_WIFI=, - NECKO_WIFI=1 -) + NECKO_WIFI=,) if test "$OS_ARCH" = "OS2"; then dnl OS/2 implementation of Necko-WiFi support will be added in bug 506566 From 844e62b830f064a13920f8dd02be1c571c4e765a Mon Sep 17 00:00:00 2001 From: Ehsan Akhgari Date: Wed, 21 Apr 2010 16:17:41 -0400 Subject: [PATCH 17/30] Bug 534785 - Move the ownership of editor and selection controller from the text frame to the content node; r=roc,jst sr=roc --HG-- rename : layout/reftests/forms/placeholder/placeholder-14.html => layout/reftests/forms/placeholder/placeholder-18.html --- content/base/public/nsContentUtils.h | 8 + content/base/src/nsContentUtils.cpp | 13 + .../content/public/nsITextControlElement.h | 162 +- content/html/content/src/Makefile.in | 2 + .../html/content/src/nsGenericHTMLElement.cpp | 27 +- .../html/content/src/nsGenericHTMLElement.h | 2 + .../html/content/src/nsHTMLInputElement.cpp | 379 +++- .../content/src/nsHTMLTextAreaElement.cpp | 275 ++- .../html/content/src/nsTextEditorState.cpp | 1890 ++++++++++++++++ content/html/content/src/nsTextEditorState.h | 239 ++ editor/libeditor/base/nsEditor.cpp | 11 +- editor/libeditor/base/nsEditor.h | 2 +- .../libeditor/base/nsEditorEventListener.cpp | 1 - layout/build/nsLayoutStatics.cpp | 1 - layout/forms/nsFileControlFrame.cpp | 27 +- layout/forms/nsFileControlFrame.h | 6 - layout/forms/nsITextControlFrame.h | 20 +- layout/forms/nsIsIndexFrame.cpp | 14 +- layout/forms/nsTextControlFrame.cpp | 1964 ++--------------- layout/forms/nsTextControlFrame.h | 189 +- layout/forms/test/Makefile.in | 1 + layout/forms/test/test_bug534785.html | 89 + layout/generic/nsFrame.cpp | 3 +- layout/generic/test/test_bug527306.html | 25 +- layout/reftests/editor/dynamic-type-1.html | 11 + layout/reftests/editor/dynamic-type-2.html | 11 + layout/reftests/editor/dynamic-type-3.html | 11 + layout/reftests/editor/dynamic-type-4.html | 11 + layout/reftests/editor/reftest.list | 4 + .../forms/placeholder/placeholder-18.html | 22 + .../reftests/forms/placeholder/reftest.list | 1 + layout/reftests/forms/reftest.list | 1 + ...xtarea-setvalue-framereconstruction-1.html | 48 + ...area-setvalue-framereconstruction-ref.html | 17 + 34 files changed, 3335 insertions(+), 2152 deletions(-) create mode 100644 content/html/content/src/nsTextEditorState.cpp create mode 100644 content/html/content/src/nsTextEditorState.h create mode 100644 layout/forms/test/test_bug534785.html create mode 100644 layout/reftests/editor/dynamic-type-1.html create mode 100644 layout/reftests/editor/dynamic-type-2.html create mode 100644 layout/reftests/editor/dynamic-type-3.html create mode 100644 layout/reftests/editor/dynamic-type-4.html create mode 100644 layout/reftests/forms/placeholder/placeholder-18.html create mode 100644 layout/reftests/forms/textarea-setvalue-framereconstruction-1.html create mode 100644 layout/reftests/forms/textarea-setvalue-framereconstruction-ref.html diff --git a/content/base/public/nsContentUtils.h b/content/base/public/nsContentUtils.h index 8f34f42e4f9..67fbfafbc28 100644 --- a/content/base/public/nsContentUtils.h +++ b/content/base/public/nsContentUtils.h @@ -1615,6 +1615,14 @@ public: static already_AddRefed LayerManagerForDocument(nsIDocument *aDoc); + /** + * Determine whether a content node is focused or not, + * + * @param aContent the content node to check + * @return true if the content node is focused, false otherwise. + */ + static PRBool IsFocusedContent(nsIContent *aContent); + private: static PRBool InitializeEventTable(); diff --git a/content/base/src/nsContentUtils.cpp b/content/base/src/nsContentUtils.cpp index 966ae184a4f..0b529518c9e 100644 --- a/content/base/src/nsContentUtils.cpp +++ b/content/base/src/nsContentUtils.cpp @@ -178,6 +178,8 @@ static NS_DEFINE_CID(kXTFServiceCID, NS_XTFSERVICE_CID); #include "nsLayoutUtils.h" #include "nsFrameManager.h" #include "BasicLayers.h" +#include "nsFocusManager.h" +#include "nsTextEditorState.h" #ifdef IBMBIDI #include "nsIBidiKeyboard.h" @@ -1047,6 +1049,8 @@ nsContentUtils::Shutdown() NS_IF_RELEASE(sSameOriginChecker); nsAutoGCRoot::Shutdown(); + + nsTextEditorState::ShutDown(); } // static @@ -5953,6 +5957,15 @@ mozAutoRemovableBlockerRemover::~mozAutoRemovableBlockerRemover() } } +// static +PRBool +nsContentUtils::IsFocusedContent(nsIContent* aContent) +{ + nsFocusManager* fm = nsFocusManager::GetFocusManager(); + + return fm && fm->GetFocusedContent() == aContent; +} + void nsContentUtils::RemoveNewlines(nsString &aString) { // strip CR/LF and null diff --git a/content/html/content/public/nsITextControlElement.h b/content/html/content/public/nsITextControlElement.h index 6d2af224d6b..de30a84d47c 100644 --- a/content/html/content/public/nsITextControlElement.h +++ b/content/html/content/public/nsITextControlElement.h @@ -40,32 +40,174 @@ #define nsITextControlElement_h___ #include "nsISupports.h" +class nsIContent; class nsAString; -class nsITextControlFrame; +class nsIEditor; +class nsISelectionController; +class nsFrameSelection; +class nsTextControlFrame; // IID for the nsITextControl interface #define NS_ITEXTCONTROLELEMENT_IID \ -{ 0x8c22af1e, 0x1dd2, 0x11b2, \ - { 0x9d, 0x72, 0xb4, 0xc1, 0x53, 0x68, 0xdc, 0xa1 } } +{ 0x66545dde, 0x3f4a, 0x49fd, \ + { 0x82, 0x73, 0x69, 0x7e, 0xab, 0x54, 0x06, 0x0a } } /** - * This interface is used for the text control frame to store its value away - * into the content. + * This interface is used for the text control frame to get the editor and + * selection controller objects, and some helper properties. */ class nsITextControlElement : public nsISupports { public: NS_DECLARE_STATIC_IID_ACCESSOR(NS_ITEXTCONTROLELEMENT_IID) - /** - * Set the control's value without security checks - */ - NS_IMETHOD TakeTextFrameValue(const nsAString& aValue) = 0; - /** * Tell the control that value has been deliberately changed (or not). */ NS_IMETHOD SetValueChanged(PRBool changed) = 0; + + /** + * Find out whether this is a single line text control. (text or password) + * @return whether this is a single line text control + */ + NS_IMETHOD_(PRBool) IsSingleLineTextControl() const = 0; + + /** + * Find out whether this control is a textarea. + * @return whether this is a textarea text control + */ + NS_IMETHOD_(PRBool) IsTextArea() const = 0; + + /** + * Find out whether this control edits plain text. (Currently always true.) + * @return whether this is a plain text control + */ + NS_IMETHOD_(PRBool) IsPlainTextControl() const = 0; + + /** + * Find out whether this is a password control (input type=password) + * @return whether this is a password ontrol + */ + NS_IMETHOD_(PRBool) IsPasswordTextControl() const = 0; + + /** + * Get the cols attribute (if textarea) or a default + * @return the number of columns to use + */ + NS_IMETHOD_(PRInt32) GetCols() = 0; + + /** + * Get the column index to wrap at, or -1 if we shouldn't wrap + */ + NS_IMETHOD_(PRInt32) GetWrapCols() = 0; + + /** + * Get the rows attribute (if textarea) or a default + * @return the number of rows to use + */ + NS_IMETHOD_(PRInt32) GetRows() = 0; + + /** + * Get the default value of the text control + */ + NS_IMETHOD_(void) GetDefaultValueFromContent(nsAString& aValue) = 0; + + /** + * Return true if the value of the control has been changed. + */ + NS_IMETHOD_(PRBool) ValueChanged() const = 0; + + /** + * Get the current value of the text editor. + * + * @param aValue the buffer to retrieve the value in + * @param aIgnoreWrap whether to ignore the text wrapping behavior specified + * for the element. + */ + NS_IMETHOD_(void) GetTextEditorValue(nsAString& aValue, PRBool aIgnoreWrap) const = 0; + + /** + * Set the current value of the text editor. + * + * @param aValue the new value for the text control. + * @param aUserInput whether this value is coming from user input. + */ + NS_IMETHOD_(void) SetTextEditorValue(const nsAString& aValue, PRBool aUserInput) = 0; + + /** + * Get the editor object associated with the text editor. + * The return value is null if the control does not support an editor + * (for example, if it is a checkbox.) + */ + NS_IMETHOD_(nsIEditor*) GetTextEditor() = 0; + + /** + * Get the selection controller object associated with the text editor. + * The return value is null if the control does not support an editor + * (for example, if it is a checkbox.) + */ + NS_IMETHOD_(nsISelectionController*) GetSelectionController() = 0; + + NS_IMETHOD_(nsFrameSelection*) GetConstFrameSelection() = 0; + + /** + * Binds a frame to the text control. This is performed when a frame + * is created for the content node. + */ + NS_IMETHOD BindToFrame(nsTextControlFrame* aFrame) = 0; + + /** + * Unbinds a frame from the text control. This is performed when a frame + * belonging to a content node is destroyed. + */ + NS_IMETHOD_(void) UnbindFromFrame(nsTextControlFrame* aFrame) = 0; + + /** + * Creates an editor for the text control. This should happen when + * a frame has been created for the text control element, but the created + * editor may outlive the frame itself. + */ + NS_IMETHOD CreateEditor() = 0; + + /** + * Get the anonymous root node for the text control. + */ + NS_IMETHOD_(nsIContent*) GetRootEditorNode() = 0; + + /** + * Get the placeholder anonymous node for the text control. + */ + NS_IMETHOD_(nsIContent*) GetPlaceholderNode() = 0; + + /** + * Initialize the keyboard event listeners. + */ + NS_IMETHOD_(void) InitializeKeyboardEventListeners() = 0; + + /** + * Notify the text control that the placeholder text needs to be updated. + */ + NS_IMETHOD_(void) UpdatePlaceholderText(PRBool aNotify) = 0; + + /** + * Show/hide the placeholder for the control. + */ + NS_IMETHOD_(void) SetPlaceholderClass(PRBool aVisible, PRBool aNotify) = 0; + + static const PRInt32 DEFAULT_COLS = 20; + static const PRInt32 DEFAULT_ROWS = 1; + static const PRInt32 DEFAULT_ROWS_TEXTAREA = 2; + static const PRInt32 DEFAULT_UNDO_CAP = 1000; + + // wrap can be one of these three values. + typedef enum { + eHTMLTextWrap_Off = 1, // "off" + eHTMLTextWrap_Hard = 2, // "hard" + eHTMLTextWrap_Soft = 3 // the default + } nsHTMLTextWrap; + + static PRBool + GetWrapPropertyEnum(nsIContent* aContent, nsHTMLTextWrap& aWrapProp); }; NS_DEFINE_STATIC_IID_ACCESSOR(nsITextControlElement, diff --git a/content/html/content/src/Makefile.in b/content/html/content/src/Makefile.in index 6ea5a54503b..0464a2d9ee4 100644 --- a/content/html/content/src/Makefile.in +++ b/content/html/content/src/Makefile.in @@ -58,6 +58,7 @@ CPPSRCS = \ nsGenericHTMLElement.cpp \ nsFormSubmission.cpp \ nsImageMapUtils.cpp \ + nsTextEditorState.cpp \ nsHTMLAnchorElement.cpp \ nsHTMLAreaElement.cpp \ nsHTMLBRElement.cpp \ @@ -124,6 +125,7 @@ INCLUDES += \ -I$(srcdir)/../../../base/src \ -I$(srcdir)/../../../events/src \ -I$(srcdir)/../../../xbl/src \ + -I$(srcdir)/../../../../layout/forms \ -I$(srcdir)/../../../../layout/style \ -I$(srcdir)/../../../../layout/tables \ -I$(srcdir)/../../../../layout/xul/base/src \ diff --git a/content/html/content/src/nsGenericHTMLElement.cpp b/content/html/content/src/nsGenericHTMLElement.cpp index 89586d92c6b..6facd8863bc 100644 --- a/content/html/content/src/nsGenericHTMLElement.cpp +++ b/content/html/content/src/nsGenericHTMLElement.cpp @@ -110,6 +110,7 @@ #include "nsContentCreatorFunctions.h" #include "mozAutoDocUpdate.h" #include "nsHtml5Module.h" +#include "nsITextControlElement.h" #include "nsThreadUtils.h" @@ -2707,14 +2708,20 @@ nsGenericHTMLFormElement::IsTextControl(PRBool aExcludePassword) const type == NS_FORM_TEXTAREA; } +PRBool +nsGenericHTMLFormElement::IsSingleLineTextControlInternal(PRBool aExcludePassword, + PRInt32 aType) const +{ + return aType == NS_FORM_INPUT_TEXT || + aType == NS_FORM_INPUT_SEARCH || + aType == NS_FORM_INPUT_TEL || + (!aExcludePassword && aType == NS_FORM_INPUT_PASSWORD); +} + PRBool nsGenericHTMLFormElement::IsSingleLineTextControl(PRBool aExcludePassword) const { - PRInt32 type = GetType(); - return type == NS_FORM_INPUT_TEXT || - type == NS_FORM_INPUT_SEARCH || - type == NS_FORM_INPUT_TEL || - (!aExcludePassword && type == NS_FORM_INPUT_PASSWORD); + return IsSingleLineTextControlInternal(aExcludePassword, GetType()); } PRBool @@ -3166,12 +3173,10 @@ nsGenericHTMLElement::GetEditorInternal(nsIEditor** aEditor) { *aEditor = nsnull; - nsIFormControlFrame *fcFrame = GetFormControlFrame(PR_FALSE); - if (fcFrame) { - nsITextControlFrame *textFrame = do_QueryFrame(fcFrame); - if (textFrame) { - return textFrame->GetEditor(aEditor); - } + nsCOMPtr textCtrl = do_QueryInterface(this); + if (textCtrl) { + *aEditor = textCtrl->GetTextEditor(); + NS_IF_ADDREF(*aEditor); } return NS_OK; diff --git a/content/html/content/src/nsGenericHTMLElement.h b/content/html/content/src/nsGenericHTMLElement.h index cca6ea35271..211515f478d 100644 --- a/content/html/content/src/nsGenericHTMLElement.h +++ b/content/html/content/src/nsGenericHTMLElement.h @@ -863,6 +863,8 @@ protected: void UpdateEditableFormControlState(); + PRBool IsSingleLineTextControlInternal(PRBool aExcludePassword, PRInt32 mType) const; + // The focusability state of this form control. eUnfocusable means that it // shouldn't be focused at all, eInactiveWindow means it's in an inactive // window, eActiveWindow means it's in an active window. diff --git a/content/html/content/src/nsHTMLInputElement.cpp b/content/html/content/src/nsHTMLInputElement.cpp index b4f89c107ee..8adc6172999 100644 --- a/content/html/content/src/nsHTMLInputElement.cpp +++ b/content/html/content/src/nsHTMLInputElement.cpp @@ -112,6 +112,8 @@ #include "nsTextEditRules.h" +#include "nsTextEditorState.h" + // XXX align=left, hspace, vspace, border? other nav4 attrs static NS_DEFINE_CID(kXULControllersCID, NS_XULCONTROLLERS_CID); @@ -308,9 +310,30 @@ public: virtual PRInt32 IntrinsicState() const; // nsITextControlElement - NS_IMETHOD TakeTextFrameValue(const nsAString& aValue); NS_IMETHOD SetValueChanged(PRBool aValueChanged); - + NS_IMETHOD_(PRBool) IsSingleLineTextControl() const; + NS_IMETHOD_(PRBool) IsTextArea() const; + NS_IMETHOD_(PRBool) IsPlainTextControl() const; + NS_IMETHOD_(PRBool) IsPasswordTextControl() const; + NS_IMETHOD_(PRInt32) GetCols(); + NS_IMETHOD_(PRInt32) GetWrapCols(); + NS_IMETHOD_(PRInt32) GetRows(); + NS_IMETHOD_(void) GetDefaultValueFromContent(nsAString& aValue); + NS_IMETHOD_(PRBool) ValueChanged() const; + NS_IMETHOD_(void) GetTextEditorValue(nsAString& aValue, PRBool aIgnoreWrap) const; + NS_IMETHOD_(void) SetTextEditorValue(const nsAString& aValue, PRBool aUserInput); + NS_IMETHOD_(nsIEditor*) GetTextEditor(); + NS_IMETHOD_(nsISelectionController*) GetSelectionController(); + NS_IMETHOD_(nsFrameSelection*) GetConstFrameSelection(); + NS_IMETHOD BindToFrame(nsTextControlFrame* aFrame); + NS_IMETHOD_(void) UnbindFromFrame(nsTextControlFrame* aFrame); + NS_IMETHOD CreateEditor(); + NS_IMETHOD_(nsIContent*) GetRootEditorNode(); + NS_IMETHOD_(nsIContent*) GetPlaceholderNode(); + NS_IMETHOD_(void) UpdatePlaceholderText(PRBool aNotify); + NS_IMETHOD_(void) SetPlaceholderClass(PRBool aVisible, PRBool aNotify); + NS_IMETHOD_(void) InitializeKeyboardEventListeners(); + // nsIFileControlElement virtual void GetDisplayFileName(nsAString& aFileName); virtual void GetFileArray(nsCOMArray &aFile); @@ -341,9 +364,12 @@ public: void MaybeLoadImage(); protected: + // Pull IsSingleLineTextControl into our scope, otherwise it'd be hidden + // by the nsITextControlElement version. + using nsGenericHTMLFormElement::IsSingleLineTextControl; + // Helper method nsresult SetValueInternal(const nsAString& aValue, - nsITextControlFrame* aFrame, PRBool aUserInput); void ClearFileNames() { @@ -455,6 +481,9 @@ protected: */ PRBool NeedToInitializeEditorForEvent(nsEventChainPreVisitor& aVisitor) const; + void FreeData(); + nsTextEditorState *GetEditorState() const; + nsCOMPtr mControllers; /** @@ -467,10 +496,24 @@ protected: * @see GET_BOOLBIT / SET_BOOLBIT macros and BF_* field identifiers */ PRInt16 mBitField; - /** - * The current value of the input if it has been changed from the default + /* + * In mInputData, the mState field is used if IsSingleLineTextControl returns + * true and mValue is used otherwise. We have to be careful when handling it + * on a type change. + * + * Accessing the mState member should be done using the GetEditorState function, + * which returns null if the state is not present. */ - char* mValue; + union InputData { + /** + * The current value of the input if it has been changed from the default + */ + char* mValue; + /** + * The state of the text editor associated with the text/password input + */ + nsTextEditorState* mState; + } mInputData; /** * The value of the input if it is a file input. This is the list of filenames * used when uploading a file. It is vital that this is kept separate from @@ -503,20 +546,43 @@ nsHTMLInputElement::nsHTMLInputElement(nsINodeInfo *aNodeInfo, PRBool aFromParser) : nsGenericHTMLFormElement(aNodeInfo), mType(kInputDefaultType->value), - mBitField(0), - mValue(nsnull) + mBitField(0) { SET_BOOLBIT(mBitField, BF_PARSER_CREATING, aFromParser); + mInputData.mState = new nsTextEditorState(this); + NS_ADDREF(mInputData.mState); } nsHTMLInputElement::~nsHTMLInputElement() { DestroyImageLoadingContent(); - if (mValue) { - nsMemory::Free(mValue); + FreeData(); +} + +void +nsHTMLInputElement::FreeData() +{ + if (!IsSingleLineTextControl(PR_FALSE)) { + nsMemory::Free(mInputData.mValue); + mInputData.mValue = nsnull; + } else { + NS_IF_RELEASE(mInputData.mState); } } +nsTextEditorState* +nsHTMLInputElement::GetEditorState() const +{ + if (!IsSingleLineTextControl(PR_FALSE)) { + return nsnull; + } + + NS_ASSERTION(mInputData.mState, + "Single line text controls need to have a state associated with them"); + + return mInputData.mState; +} + // nsISupports @@ -524,6 +590,9 @@ NS_IMPL_CYCLE_COLLECTION_CLASS(nsHTMLInputElement) NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(nsHTMLInputElement, nsGenericHTMLFormElement) NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mControllers) + if (tmp->IsSingleLineTextControl(PR_FALSE)) { + NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NATIVE_MEMBER(mInputData.mState, nsTextEditorState) + } NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END NS_IMPL_ADDREF_INHERITED(nsHTMLInputElement, nsGenericElement) @@ -578,7 +647,7 @@ nsHTMLInputElement::Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const nsAutoString value; const_cast(this)->GetValue(value); // SetValueInternal handles setting the VALUE_CHANGED bit for us - it->SetValueInternal(value, nsnull, PR_FALSE); + it->SetValueInternal(value, PR_FALSE); } break; case NS_FORM_INPUT_FILE: @@ -707,20 +776,17 @@ nsHTMLInputElement::AfterSetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, mType = kInputDefaultType->value; } - // If we are changing type from File/Text/Tel/Passwd - // to other input types we need save the mValue into value attribute - if (mValue && + // If we are changing type from File/Text/Tel/Passwd to other input types + // we need save the mValue into value attribute + if (mInputData.mValue && mType != NS_FORM_INPUT_TEXT && mType != NS_FORM_INPUT_SEARCH && mType != NS_FORM_INPUT_PASSWORD && mType != NS_FORM_INPUT_TEL && mType != NS_FORM_INPUT_FILE) { SetAttr(kNameSpaceID_None, nsGkAtoms::value, - NS_ConvertUTF8toUTF16(mValue), PR_FALSE); - if (mValue) { - nsMemory::Free(mValue); - mValue = nsnull; - } + NS_ConvertUTF8toUTF16(mInputData.mValue), PR_FALSE); + FreeData(); } if (mType != NS_FORM_INPUT_IMAGE) { @@ -889,40 +955,9 @@ nsHTMLInputElement::SetSize(PRUint32 aValue) NS_IMETHODIMP nsHTMLInputElement::GetValue(nsAString& aValue) { - if (IsSingleLineTextControl(PR_FALSE)) { - // No need to flush here, if there's no frame created for this - // input yet, there won't be a value in it (that we don't already - // have) even if we force it to be created - nsIFormControlFrame* formControlFrame = GetFormControlFrame(PR_FALSE); - - PRBool frameOwnsValue = PR_FALSE; - if (formControlFrame) { - nsITextControlFrame* textControlFrame = do_QueryFrame(formControlFrame); - if (textControlFrame) { - textControlFrame->OwnsValue(&frameOwnsValue); - } else { - // We assume if it's not a text control frame that it owns the value - frameOwnsValue = PR_TRUE; - } - } - - if (frameOwnsValue) { - formControlFrame->GetFormProperty(nsGkAtoms::value, aValue); - } else { - if (!GET_BOOLBIT(mBitField, BF_VALUE_CHANGED) || !mValue) { - GetDefaultValue(aValue); - } else { - CopyUTF8toUTF16(mValue, aValue); - } - - // If the value is not owned by the frame, then we should handle any - // exiting newline characters inside it, instead of relying on the - // editor to do it for us. - nsString value(aValue); - nsTextEditRules::HandleNewLines(value, -1); - aValue.Assign(value); - } - + nsTextEditorState* state = GetEditorState(); + if (state) { + state->GetValue(aValue, PR_TRUE); return NS_OK; } @@ -979,7 +1014,7 @@ nsHTMLInputElement::SetValue(const nsAString& aValue) } } else { - SetValueInternal(aValue, nsnull, PR_FALSE); + SetValueInternal(aValue, PR_FALSE); } return NS_OK; @@ -1045,21 +1080,99 @@ nsHTMLInputElement::SetUserInput(const nsAString& aValue) { SetSingleFileName(aValue); } else { - SetValueInternal(aValue, nsnull, PR_TRUE); + SetValueInternal(aValue, PR_TRUE); } return NS_OK; } -NS_IMETHODIMP -nsHTMLInputElement::TakeTextFrameValue(const nsAString& aValue) +NS_IMETHODIMP_(nsIEditor*) +nsHTMLInputElement::GetTextEditor() { - if (mValue) { - nsMemory::Free(mValue); + nsTextEditorState *state = GetEditorState(); + if (state) { + return state->GetEditor(); + return nsnull; +} + +NS_IMETHODIMP_(nsISelectionController*) +nsHTMLInputElement::GetSelectionController() +{ + nsTextEditorState *state = GetEditorState(); + if (state) { + return state->GetSelectionController(); + return nsnull; +} + +nsFrameSelection* +nsHTMLInputElement::GetConstFrameSelection() +{ + nsTextEditorState *state = GetEditorState(); + if (state) { + return state->GetConstFrameSelection(); + return nsnull; +} + +NS_IMETHODIMP +nsHTMLInputElement::BindToFrame(nsTextControlFrame* aFrame) +{ + nsTextEditorState *state = GetEditorState(); + if (state) { + return state->BindToFrame(aFrame); + return NS_ERROR_FAILURE; +} + +NS_IMETHODIMP_(void) +nsHTMLInputElement::UnbindFromFrame(nsTextControlFrame* aFrame) +{ + nsTextEditorState *state = GetEditorState(); + if (state) { + state->UnbindFromFrame(aFrame); + } +} + +NS_IMETHODIMP +nsHTMLInputElement::CreateEditor() +{ + nsTextEditorState *state = GetEditorState(); + if (state) { + return state->PrepareEditor(); + return NS_ERROR_FAILURE; +} + +NS_IMETHODIMP_(nsIContent*) +nsHTMLInputElement::GetRootEditorNode() +{ + nsTextEditorState *state = GetEditorState(); + if (state) { + return state->GetRootNode(); + return nsnull; +} + +NS_IMETHODIMP_(nsIContent*) +nsHTMLInputElement::GetPlaceholderNode() +{ + nsTextEditorState *state = GetEditorState(); + if (state) { + return state->GetPlaceholderNode(); + return nsnull; +} + +NS_IMETHODIMP_(void) +nsHTMLInputElement::UpdatePlaceholderText(PRBool aNotify) +{ + nsTextEditorState *state = GetEditorState(); + if (state) { + state->UpdatePlaceholderText(aNotify); + } +} + +NS_IMETHODIMP_(void) +nsHTMLInputElement::SetPlaceholderClass(PRBool aVisible, PRBool aNotify) +{ + nsTextEditorState *state = GetEditorState(); + if (state) { + state->SetPlaceholderClass(aVisible, aNotify); } - nsString value(aValue); - nsContentUtils::PlatformToDOMLineBreaks(value); - mValue = ToNewUTF8String(value); - return NS_OK; } void @@ -1158,32 +1271,19 @@ nsHTMLInputElement::UpdateFileList() nsresult nsHTMLInputElement::SetValueInternal(const nsAString& aValue, - nsITextControlFrame* aFrame, PRBool aUserInput) { NS_PRECONDITION(mType != NS_FORM_INPUT_FILE, "Don't call SetValueInternal for file inputs"); if (IsSingleLineTextControl(PR_FALSE)) { - nsIFormControlFrame* formControlFrame = aFrame; - if (!formControlFrame) { - // No need to flush here, if there's no frame at this point we - // don't need to force creation of one just to tell it about this - // new value. - formControlFrame = GetFormControlFrame(PR_FALSE); - } - - if (formControlFrame) { - // Always set the value in the frame. If the frame does not own the - // value yet (per OwnsValue()), it will turn around and call - // TakeTextFrameValue() on us, but will update its display with the new - // value if needed. - return formControlFrame->SetFormProperty( - aUserInput ? nsGkAtoms::userInput : nsGkAtoms::value, aValue); - } - + // Need to set the value changed flag here, so that + // nsTextControlFrame::UpdateValueDisplay retrieves the correct value + // if needed. SetValueChanged(PR_TRUE); - return TakeTextFrameValue(aValue); + mInputData.mState->SetValue(aValue, aUserInput); + + return NS_OK; } if (mType == NS_FORM_INPUT_FILE) { @@ -1210,9 +1310,8 @@ nsHTMLInputElement::SetValueChanged(PRBool aValueChanged) { SET_BOOLBIT(mBitField, BF_VALUE_CHANGED, aValueChanged); if (!aValueChanged) { - if (mValue) { - nsMemory::Free(mValue); - mValue = nsnull; + if (!IsSingleLineTextControl(PR_FALSE)) { + FreeData(); } } return NS_OK; @@ -2281,6 +2380,19 @@ nsHTMLInputElement::ParseAttribute(PRInt32 aNamespaceID, ClearFileNames(); } + // Only single line text inputs have a text editor state. + PRBool isNewTypeSingleLine = + IsSingleLineTextControlInternal(PR_FALSE, newType); + PRBool isCurrentTypeSingleLine = + IsSingleLineTextControl(PR_FALSE); + if (isNewTypeSingleLine && !isCurrentTypeSingleLine) { + FreeData(); + mInputData.mState = new nsTextEditorState(this); + NS_ADDREF(mInputData.mState); + } else if (isCurrentTypeSingleLine && !isNewTypeSingleLine) { + FreeData(); + } + mType = newType; } @@ -2909,7 +3021,7 @@ nsHTMLInputElement::RestoreState(nsPresState* aState) case NS_FORM_INPUT_TEL: case NS_FORM_INPUT_HIDDEN: { - SetValueInternal(inputState->GetValue(), nsnull, PR_FALSE); + SetValueInternal(inputState->GetValue(), PR_FALSE); break; } case NS_FORM_INPUT_FILE: @@ -3286,3 +3398,98 @@ NS_GetRadioGetCheckedChangedVisitor(PRBool* aCheckedChanged, return NS_OK; } +NS_IMETHODIMP_(PRBool) +nsHTMLInputElement::IsSingleLineTextControl() const +{ + return IsSingleLineTextControl(PR_FALSE); +} + +NS_IMETHODIMP_(PRBool) +nsHTMLInputElement::IsTextArea() const +{ + return PR_FALSE; +} + +NS_IMETHODIMP_(PRBool) +nsHTMLInputElement::IsPlainTextControl() const +{ + // need to check our HTML attribute and/or CSS. + return PR_TRUE; +} + +NS_IMETHODIMP_(PRBool) +nsHTMLInputElement::IsPasswordTextControl() const +{ + return mType == NS_FORM_INPUT_PASSWORD; +} + +NS_IMETHODIMP_(PRInt32) +nsHTMLInputElement::GetCols() +{ + // Else we know (assume) it is an input with size attr + const nsAttrValue* attr = GetParsedAttr(nsGkAtoms::size); + if (attr && attr->Type() == nsAttrValue::eInteger) { + PRInt32 cols = attr->GetIntegerValue(); + if (cols > 0) { + return cols; + } + } + + return DEFAULT_COLS; +} + +NS_IMETHODIMP_(PRInt32) +nsHTMLInputElement::GetWrapCols() +{ + return -1; // only textarea's can have wrap cols +} + +NS_IMETHODIMP_(PRInt32) +nsHTMLInputElement::GetRows() +{ + return DEFAULT_ROWS; +} + +NS_IMETHODIMP_(void) +nsHTMLInputElement::GetDefaultValueFromContent(nsAString& aValue) +{ + nsTextEditorState *state = GetEditorState(); + if (state) { + GetDefaultValue(aValue); + } +} + +NS_IMETHODIMP_(PRBool) +nsHTMLInputElement::ValueChanged() const +{ + return GET_BOOLBIT(mBitField, BF_VALUE_CHANGED); +} + +NS_IMETHODIMP_(void) +nsHTMLInputElement::GetTextEditorValue(nsAString& aValue, + PRBool aIgnoreWrap) const +{ + nsTextEditorState *state = GetEditorState(); + if (state) { + state->GetValue(aValue, aIgnoreWrap); + } +} + +NS_IMETHODIMP_(void) +nsHTMLInputElement::SetTextEditorValue(const nsAString& aValue, + PRBool aUserInput) +{ + nsTextEditorState *state = GetEditorState(); + if (state) { + state->SetValue(aValue, aUserInput); + } +} + +NS_IMETHODIMP_(void) +nsHTMLInputElement::InitializeKeyboardEventListeners() +{ + nsTextEditorState *state = GetEditorState(); + if (state) { + state->InitializeKeyboardEventListeners(); + } +} diff --git a/content/html/content/src/nsHTMLTextAreaElement.cpp b/content/html/content/src/nsHTMLTextAreaElement.cpp index 056d5913fe6..0d3f2d5eed7 100644 --- a/content/html/content/src/nsHTMLTextAreaElement.cpp +++ b/content/html/content/src/nsHTMLTextAreaElement.cpp @@ -77,6 +77,8 @@ #include "mozAutoDocUpdate.h" #include "nsISupportsPrimitives.h" +#include "nsTextEditorState.h" + static NS_DEFINE_CID(kXULControllersCID, NS_XULCONTROLLERS_CID); #define NS_NO_CONTENT_DISPATCH (1 << 0) @@ -90,7 +92,6 @@ class nsHTMLTextAreaElement : public nsGenericHTMLFormElement, { public: nsHTMLTextAreaElement(nsINodeInfo *aNodeInfo, PRBool aFromParser = PR_FALSE); - virtual ~nsHTMLTextAreaElement(); // nsISupports NS_DECL_ISUPPORTS_INHERITED @@ -126,8 +127,29 @@ public: virtual PRBool RestoreState(nsPresState* aState); // nsITextControlElemet - NS_IMETHOD TakeTextFrameValue(const nsAString& aValue); NS_IMETHOD SetValueChanged(PRBool aValueChanged); + NS_IMETHOD_(PRBool) IsSingleLineTextControl() const; + NS_IMETHOD_(PRBool) IsTextArea() const; + NS_IMETHOD_(PRBool) IsPlainTextControl() const; + NS_IMETHOD_(PRBool) IsPasswordTextControl() const; + NS_IMETHOD_(PRInt32) GetCols(); + NS_IMETHOD_(PRInt32) GetWrapCols(); + NS_IMETHOD_(PRInt32) GetRows(); + NS_IMETHOD_(void) GetDefaultValueFromContent(nsAString& aValue); + NS_IMETHOD_(PRBool) ValueChanged() const; + NS_IMETHOD_(void) GetTextEditorValue(nsAString& aValue, PRBool aIgnoreWrap) const; + NS_IMETHOD_(void) SetTextEditorValue(const nsAString& aValue, PRBool aUserInput); + NS_IMETHOD_(nsIEditor*) GetTextEditor(); + NS_IMETHOD_(nsISelectionController*) GetSelectionController(); + NS_IMETHOD_(nsFrameSelection*) GetConstFrameSelection(); + NS_IMETHOD BindToFrame(nsTextControlFrame* aFrame); + NS_IMETHOD_(void) UnbindFromFrame(nsTextControlFrame* aFrame); + NS_IMETHOD CreateEditor(); + NS_IMETHOD_(nsIContent*) GetRootEditorNode(); + NS_IMETHOD_(nsIContent*) GetPlaceholderNode(); + NS_IMETHOD_(void) UpdatePlaceholderText(PRBool aNotify); + NS_IMETHOD_(void) SetPlaceholderClass(PRBool aVisible, PRBool aNotify); + NS_IMETHOD_(void) InitializeKeyboardEventListeners(); // nsIContent virtual PRBool ParseAttribute(PRInt32 aNamespaceID, @@ -172,9 +194,9 @@ public: nsGenericHTMLFormElement) protected: + using nsGenericHTMLFormElement::IsSingleLineTextControl; // get rid of the compiler warning + nsCOMPtr mControllers; - /** The current value. This is null if the frame owns the value. */ - char* mValue; /** Whether or not the value has changed since its default value was given. */ PRPackedBool mValueChanged; /** Whether or not we are already handling select event. */ @@ -184,6 +206,8 @@ protected: PRPackedBool mDoneAddingChildren; /** Whether our disabled state has changed from the default **/ PRPackedBool mDisabledChanged; + /** The state of the text editor (selection controller and the editor) **/ + nsRefPtr mState; NS_IMETHOD SelectAll(nsPresContext* aPresContext); /** @@ -196,7 +220,6 @@ protected: void GetValueInternal(nsAString& aValue, PRBool aIgnoreWrap); nsresult SetValueInternal(const nsAString& aValue, - nsITextControlFrame* aFrame, PRBool aUserInput); nsresult GetSelectionRange(PRInt32* aSelectionStart, PRInt32* aSelectionEnd); @@ -223,22 +246,15 @@ NS_IMPL_NS_NEW_HTML_ELEMENT_CHECK_PARSER(TextArea) nsHTMLTextAreaElement::nsHTMLTextAreaElement(nsINodeInfo *aNodeInfo, PRBool aFromParser) : nsGenericHTMLFormElement(aNodeInfo), - mValue(nsnull), mValueChanged(PR_FALSE), mHandlingSelect(PR_FALSE), mDoneAddingChildren(!aFromParser), - mDisabledChanged(PR_FALSE) + mDisabledChanged(PR_FALSE), + mState(new nsTextEditorState(this)) { AddMutationObserver(this); } -nsHTMLTextAreaElement::~nsHTMLTextAreaElement() -{ - if (mValue) { - nsMemory::Free(mValue); - } -} - NS_IMPL_CYCLE_COLLECTION_CLASS(nsHTMLTextAreaElement) NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(nsHTMLTextAreaElement, @@ -248,6 +264,7 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_END NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(nsHTMLTextAreaElement, nsGenericHTMLFormElement) NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mControllers) + NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NATIVE_MEMBER(mState, nsTextEditorState) NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END NS_IMPL_ADDREF_INHERITED(nsHTMLTextAreaElement, nsGenericElement) @@ -397,79 +414,78 @@ nsHTMLTextAreaElement::GetValue(nsAString& aValue) void nsHTMLTextAreaElement::GetValueInternal(nsAString& aValue, PRBool aIgnoreWrap) { - // Get the frame. - // No need to flush here, if there is no frame yet for this textarea - // there won't be a value in it we don't already have even if we - // force the frame to be created. - nsIFrame* primaryFrame = GetPrimaryFrame(); - nsITextControlFrame* textControlFrame = nsnull; - if (primaryFrame) { - textControlFrame = do_QueryFrame(primaryFrame); - } + mState->GetValue(aValue, aIgnoreWrap); +} - // If the frame exists and owns the value, get it from the frame. Otherwise - // get it from content. - PRBool frameOwnsValue = PR_FALSE; - if (textControlFrame) { - textControlFrame->OwnsValue(&frameOwnsValue); - } - if (frameOwnsValue) { - textControlFrame->GetValue(aValue, aIgnoreWrap); - } else { - if (!mValueChanged || !mValue) { - GetDefaultValue(aValue); - } else { - CopyUTF8toUTF16(mValue, aValue); - } - } +NS_IMETHODIMP_(nsIEditor*) +nsHTMLTextAreaElement::GetTextEditor() +{ + return mState->GetEditor(); +} + +NS_IMETHODIMP_(nsISelectionController*) +nsHTMLTextAreaElement::GetSelectionController() +{ + return mState->GetSelectionController(); +} + +NS_IMETHODIMP_(nsFrameSelection*) +nsHTMLTextAreaElement::GetConstFrameSelection() +{ + return mState->GetConstFrameSelection(); } NS_IMETHODIMP -nsHTMLTextAreaElement::TakeTextFrameValue(const nsAString& aValue) +nsHTMLTextAreaElement::BindToFrame(nsTextControlFrame* aFrame) { - if (mValue) { - nsMemory::Free(mValue); - } - nsString value(aValue); - nsContentUtils::PlatformToDOMLineBreaks(value); - mValue = ToNewUTF8String(value); - return NS_OK; + return mState->BindToFrame(aFrame); +} + +NS_IMETHODIMP_(void) +nsHTMLTextAreaElement::UnbindFromFrame(nsTextControlFrame* aFrame) +{ + mState->UnbindFromFrame(aFrame); +} + +NS_IMETHODIMP +nsHTMLTextAreaElement::CreateEditor() +{ + return mState->PrepareEditor(); +} + +NS_IMETHODIMP_(nsIContent*) +nsHTMLTextAreaElement::GetRootEditorNode() +{ + return mState->GetRootNode(); +} + +NS_IMETHODIMP_(nsIContent*) +nsHTMLTextAreaElement::GetPlaceholderNode() +{ + return mState->GetPlaceholderNode(); +} + +NS_IMETHODIMP_(void) +nsHTMLTextAreaElement::UpdatePlaceholderText(PRBool aNotify) +{ + mState->UpdatePlaceholderText(aNotify); +} + +NS_IMETHODIMP_(void) +nsHTMLTextAreaElement::SetPlaceholderClass(PRBool aVisible, PRBool aNotify) +{ + mState->SetPlaceholderClass(aVisible, aNotify); } nsresult nsHTMLTextAreaElement::SetValueInternal(const nsAString& aValue, - nsITextControlFrame* aFrame, PRBool aUserInput) { - nsITextControlFrame* textControlFrame = aFrame; - nsIFormControlFrame* formControlFrame = textControlFrame; - if (!textControlFrame) { - // No need to flush here, if there is no frame for this yet forcing - // creation of one will not do us any good - formControlFrame = GetFormControlFrame(PR_FALSE); - - if (formControlFrame) { - textControlFrame = do_QueryFrame(formControlFrame); - } - } - - PRBool frameOwnsValue = PR_FALSE; - if (textControlFrame) { - textControlFrame->OwnsValue(&frameOwnsValue); - } - if (frameOwnsValue) { - formControlFrame->SetFormProperty( - aUserInput ? nsGkAtoms::userInput : nsGkAtoms::value, aValue); - } - else { - if (mValue) { - nsMemory::Free(mValue); - } - mValue = ToNewUTF8String(aValue); - NS_ENSURE_TRUE(mValue, NS_ERROR_OUT_OF_MEMORY); - - SetValueChanged(PR_TRUE); - } + // Need to set the value changed flag here, so that + // nsTextControlFrame::UpdateValueDisplay retrieves the correct value + // if needed. + SetValueChanged(PR_TRUE); + mState->SetValue(aValue, aUserInput); return NS_OK; } @@ -477,7 +493,7 @@ nsHTMLTextAreaElement::SetValueInternal(const nsAString& aValue, NS_IMETHODIMP nsHTMLTextAreaElement::SetValue(const nsAString& aValue) { - return SetValueInternal(aValue, nsnull, PR_FALSE); + return SetValueInternal(aValue, PR_FALSE); } NS_IMETHODIMP @@ -486,7 +502,7 @@ nsHTMLTextAreaElement::SetUserInput(const nsAString& aValue) if (!nsContentUtils::IsCallerTrustedForWrite()) { return NS_ERROR_DOM_SECURITY_ERR; } - SetValueInternal(aValue, nsnull, PR_TRUE); + SetValueInternal(aValue, PR_TRUE); return NS_OK; } @@ -494,9 +510,8 @@ NS_IMETHODIMP nsHTMLTextAreaElement::SetValueChanged(PRBool aValueChanged) { mValueChanged = aValueChanged; - if (!aValueChanged && mValue) { - nsMemory::Free(mValue); - mValue = nsnull; + if (!aValueChanged && !mState->IsEmpty()) { + mState->EmptyValue(); } return NS_OK; } @@ -1003,3 +1018,101 @@ nsHTMLTextAreaElement::CopyInnerTo(nsGenericElement* aDest) const return NS_OK; } +NS_IMETHODIMP_(PRBool) +nsHTMLTextAreaElement::IsSingleLineTextControl() const +{ + return PR_FALSE; +} + +NS_IMETHODIMP_(PRBool) +nsHTMLTextAreaElement::IsTextArea() const +{ + return PR_TRUE; +} + +NS_IMETHODIMP_(PRBool) +nsHTMLTextAreaElement::IsPlainTextControl() const +{ + // need to check our HTML attribute and/or CSS. + return PR_TRUE; +} + +NS_IMETHODIMP_(PRBool) +nsHTMLTextAreaElement::IsPasswordTextControl() const +{ + return PR_FALSE; +} + +NS_IMETHODIMP_(PRInt32) +nsHTMLTextAreaElement::GetCols() +{ + const nsAttrValue* attr = GetParsedAttr(nsGkAtoms::cols); + if (attr) { + PRInt32 cols = attr->Type() == nsAttrValue::eInteger ? + attr->GetIntegerValue() : 0; + // XXX why a default of 1 char, why hide it + return (cols <= 0) ? 1 : cols; + } + + return DEFAULT_COLS; +} + +NS_IMETHODIMP_(PRInt32) +nsHTMLTextAreaElement::GetWrapCols() +{ + // wrap=off means -1 for wrap width no matter what cols is + nsHTMLTextWrap wrapProp; + nsITextControlElement::GetWrapPropertyEnum(this, wrapProp); + if (wrapProp == nsITextControlElement::eHTMLTextWrap_Off) { + // do not wrap when wrap=off + return -1; + } + + // Otherwise we just wrap at the given number of columns + return GetCols(); +} + + +NS_IMETHODIMP_(PRInt32) +nsHTMLTextAreaElement::GetRows() +{ + const nsAttrValue* attr = GetParsedAttr(nsGkAtoms::rows); + if (attr && attr->Type() == nsAttrValue::eInteger) { + PRInt32 rows = attr->GetIntegerValue(); + return (rows <= 0) ? DEFAULT_ROWS_TEXTAREA : rows; + } + + return DEFAULT_ROWS_TEXTAREA; +} + +NS_IMETHODIMP_(void) +nsHTMLTextAreaElement::GetDefaultValueFromContent(nsAString& aValue) +{ + GetDefaultValue(aValue); +} + +NS_IMETHODIMP_(PRBool) +nsHTMLTextAreaElement::ValueChanged() const +{ + return mValueChanged; +} + +NS_IMETHODIMP_(void) +nsHTMLTextAreaElement::GetTextEditorValue(nsAString& aValue, + PRBool aIgnoreWrap) const +{ + mState->GetValue(aValue, aIgnoreWrap); +} + +NS_IMETHODIMP_(void) +nsHTMLTextAreaElement::SetTextEditorValue(const nsAString& aValue, + PRBool aUserInput) +{ + mState->SetValue(aValue, aUserInput); +} + +NS_IMETHODIMP_(void) +nsHTMLTextAreaElement::InitializeKeyboardEventListeners() +{ + mState->InitializeKeyboardEventListeners(); +} diff --git a/content/html/content/src/nsTextEditorState.cpp b/content/html/content/src/nsTextEditorState.cpp new file mode 100644 index 00000000000..295e67190f0 --- /dev/null +++ b/content/html/content/src/nsTextEditorState.cpp @@ -0,0 +1,1890 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim: set sw=2 ts=2 et tw=80: */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is Mozilla.org client code. + * + * The Initial Developer of the Original Code is Mozilla Foundation. + * Portions created by the Initial Developer are Copyright (C) 2009 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Ehsan Akhgari (Original Author) + * + * Alternatively, the contents of this file may be used under the terms of + * either of the GNU General Public License Version 2 or later (the "GPL"), + * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +#include "nsCOMPtr.h" +#include "nsIPresShell.h" +#include "nsIView.h" +#include "nsCaret.h" +#include "nsEditorCID.h" +#include "nsLayoutCID.h" +#include "nsITextControlFrame.h" +#include "nsIPlaintextEditor.h" +#include "nsIDOMDocument.h" +#include "nsContentCreatorFunctions.h" +#include "nsTextControlFrame.h" +#include "nsIControllers.h" +#include "nsIDOMNSHTMLInputElement.h" +#include "nsIDOMNSHTMLTextAreaElement.h" +#include "nsITransactionManager.h" +#include "nsIControllerContext.h" +#include "nsAttrValue.h" +#include "nsGenericHTMLElement.h" +#include "nsIDOMKeyListener.h" +#include "nsIEditorObserver.h" +#include "nsINativeKeyBindings.h" +#include "nsIDocumentEncoder.h" +#include "nsISelectionPrivate.h" +#include "nsPIDOMWindow.h" +#include "nsServiceManagerUtils.h" +#include "nsIDOMEventGroup.h" +#include "nsIEditor.h" +#include "nsTextEditRules.h" + +#include "nsTextEditorState.h" + +static NS_DEFINE_CID(kTextEditorCID, NS_TEXTEDITOR_CID); +static NS_DEFINE_CID(kFrameSelectionCID, NS_FRAMESELECTION_CID); + +static nsINativeKeyBindings *sNativeInputBindings = nsnull; +static nsINativeKeyBindings *sNativeTextAreaBindings = nsnull; + +/*static*/ +PRBool +nsITextControlElement::GetWrapPropertyEnum(nsIContent* aContent, + nsITextControlElement::nsHTMLTextWrap& aWrapProp) +{ + // soft is the default; "physical" defaults to soft as well because all other + // browsers treat it that way and there is no real reason to maintain physical + // and virtual as separate entities if no one else does. Only hard and off + // do anything different. + aWrapProp = eHTMLTextWrap_Soft; // the default + + nsAutoString wrap; + if (aContent->IsHTML()) { + static nsIContent::AttrValuesArray strings[] = + {&nsGkAtoms::HARD, &nsGkAtoms::OFF, nsnull}; + + switch (aContent->FindAttrValueIn(kNameSpaceID_None, nsGkAtoms::wrap, + strings, eIgnoreCase)) { + case 0: aWrapProp = eHTMLTextWrap_Hard; break; + case 1: aWrapProp = eHTMLTextWrap_Off; break; + } + + return PR_TRUE; + } + + return PR_FALSE; +} + +static PRBool +SuppressEventHandlers(nsPresContext* aPresContext) +{ + PRBool suppressHandlers = PR_FALSE; + + if (aPresContext) + { + // Right now we only suppress event handlers and controller manipulation + // when in a print preview or print context! + + // In the current implementation, we only paginate when + // printing or in print preview. + + suppressHandlers = aPresContext->IsPaginated(); + } + + return suppressHandlers; +} + +class nsAnonDivObserver : public nsStubMutationObserver +{ +public: + nsAnonDivObserver(nsTextEditorState* aTextEditorState) + : mTextEditorState(aTextEditorState) {} + NS_DECL_ISUPPORTS + NS_DECL_NSIMUTATIONOBSERVER_CHARACTERDATACHANGED + NS_DECL_NSIMUTATIONOBSERVER_CONTENTAPPENDED + NS_DECL_NSIMUTATIONOBSERVER_CONTENTINSERTED + NS_DECL_NSIMUTATIONOBSERVER_CONTENTREMOVED + +private: + nsTextEditorState* mTextEditorState; +}; + +class nsTextInputSelectionImpl : public nsSupportsWeakReference + , public nsISelectionController +{ +public: + NS_DECL_CYCLE_COLLECTING_ISUPPORTS + NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsTextInputSelectionImpl, nsISelectionController) + + nsTextInputSelectionImpl(nsFrameSelection *aSel, nsIPresShell *aShell, nsIContent *aLimiter); + ~nsTextInputSelectionImpl(){} + + void SetScrollableFrame(nsIScrollableFrame *aScrollableFrame); + nsFrameSelection* GetConstFrameSelection() + { return mFrameSelection; } + + //NSISELECTIONCONTROLLER INTERFACES + NS_IMETHOD SetDisplaySelection(PRInt16 toggle); + NS_IMETHOD GetDisplaySelection(PRInt16 *_retval); + NS_IMETHOD SetSelectionFlags(PRInt16 aInEnable); + NS_IMETHOD GetSelectionFlags(PRInt16 *aOutEnable); + NS_IMETHOD GetSelection(PRInt16 type, nsISelection **_retval); + NS_IMETHOD ScrollSelectionIntoView(PRInt16 aType, PRInt16 aRegion, PRBool aIsSynchronous); + NS_IMETHOD RepaintSelection(PRInt16 type); + NS_IMETHOD RepaintSelection(nsPresContext* aPresContext, SelectionType aSelectionType); + NS_IMETHOD SetCaretEnabled(PRBool enabled); + NS_IMETHOD SetCaretReadOnly(PRBool aReadOnly); + NS_IMETHOD GetCaretEnabled(PRBool *_retval); + NS_IMETHOD GetCaretVisible(PRBool *_retval); + NS_IMETHOD SetCaretVisibilityDuringSelection(PRBool aVisibility); + NS_IMETHOD CharacterMove(PRBool aForward, PRBool aExtend); + NS_IMETHOD CharacterExtendForDelete(); + NS_IMETHOD WordMove(PRBool aForward, PRBool aExtend); + NS_IMETHOD WordExtendForDelete(PRBool aForward); + NS_IMETHOD LineMove(PRBool aForward, PRBool aExtend); + NS_IMETHOD IntraLineMove(PRBool aForward, PRBool aExtend); + NS_IMETHOD PageMove(PRBool aForward, PRBool aExtend); + NS_IMETHOD CompleteScroll(PRBool aForward); + NS_IMETHOD CompleteMove(PRBool aForward, PRBool aExtend); + NS_IMETHOD ScrollPage(PRBool aForward); + NS_IMETHOD ScrollLine(PRBool aForward); + NS_IMETHOD ScrollHorizontal(PRBool aLeft); + NS_IMETHOD SelectAll(void); + NS_IMETHOD CheckVisibility(nsIDOMNode *node, PRInt16 startOffset, PRInt16 EndOffset, PRBool *_retval); + +private: + nsCOMPtr mFrameSelection; + nsCOMPtr mLimiter; + nsIScrollableFrame *mScrollFrame; + nsWeakPtr mPresShellWeak; +}; + +NS_IMPL_CYCLE_COLLECTING_ADDREF_AMBIGUOUS(nsTextInputSelectionImpl, nsISelectionController) +NS_IMPL_CYCLE_COLLECTING_RELEASE_AMBIGUOUS(nsTextInputSelectionImpl, nsISelectionController) +NS_INTERFACE_TABLE_HEAD(nsTextInputSelectionImpl) + NS_INTERFACE_TABLE3(nsTextInputSelectionImpl, + nsISelectionController, + nsISelectionDisplay, + nsISupportsWeakReference) + NS_INTERFACE_TABLE_TO_MAP_SEGUE_CYCLE_COLLECTION(nsTextInputSelectionImpl) +NS_INTERFACE_MAP_END + +NS_IMPL_CYCLE_COLLECTION_2(nsTextInputSelectionImpl, mFrameSelection, mLimiter) + + +// BEGIN nsTextInputSelectionImpl + +nsTextInputSelectionImpl::nsTextInputSelectionImpl(nsFrameSelection *aSel, + nsIPresShell *aShell, + nsIContent *aLimiter) + : mScrollFrame(nsnull) +{ + if (aSel && aShell) + { + mFrameSelection = aSel;//we are the owner now! + mLimiter = aLimiter; + mFrameSelection->Init(aShell, mLimiter); + mPresShellWeak = do_GetWeakReference(aShell); + } +} + +void +nsTextInputSelectionImpl::SetScrollableFrame(nsIScrollableFrame *aScrollableFrame) +{ + mScrollFrame = aScrollableFrame; + if (!mScrollFrame && mFrameSelection) { + mFrameSelection->DisconnectFromPresShell(); + mFrameSelection = nsnull; + } +} + +NS_IMETHODIMP +nsTextInputSelectionImpl::SetDisplaySelection(PRInt16 aToggle) +{ + if (!mFrameSelection) + return NS_ERROR_NULL_POINTER; + + mFrameSelection->SetDisplaySelection(aToggle); + return NS_OK; +} + +NS_IMETHODIMP +nsTextInputSelectionImpl::GetDisplaySelection(PRInt16 *aToggle) +{ + if (!mFrameSelection) + return NS_ERROR_NULL_POINTER; + + *aToggle = mFrameSelection->GetDisplaySelection(); + return NS_OK; +} + +NS_IMETHODIMP +nsTextInputSelectionImpl::SetSelectionFlags(PRInt16 aToggle) +{ + return NS_OK;//stub this out. not used in input +} + +NS_IMETHODIMP +nsTextInputSelectionImpl::GetSelectionFlags(PRInt16 *aOutEnable) +{ + *aOutEnable = nsISelectionDisplay::DISPLAY_TEXT; + return NS_OK; +} + +NS_IMETHODIMP +nsTextInputSelectionImpl::GetSelection(PRInt16 type, nsISelection **_retval) +{ + if (!mFrameSelection) + return NS_ERROR_NULL_POINTER; + + *_retval = mFrameSelection->GetSelection(type); + + if (!(*_retval)) + return NS_ERROR_FAILURE; + + NS_ADDREF(*_retval); + return NS_OK; +} + +NS_IMETHODIMP +nsTextInputSelectionImpl::ScrollSelectionIntoView(PRInt16 aType, PRInt16 aRegion, PRBool aIsSynchronous) +{ + if (!mFrameSelection) + return NS_ERROR_FAILURE; + + return mFrameSelection->ScrollSelectionIntoView(aType, aRegion, aIsSynchronous); +} + +NS_IMETHODIMP +nsTextInputSelectionImpl::RepaintSelection(PRInt16 type) +{ + if (!mFrameSelection) + return NS_ERROR_FAILURE; + + return mFrameSelection->RepaintSelection(type); +} + +NS_IMETHODIMP +nsTextInputSelectionImpl::RepaintSelection(nsPresContext* aPresContext, SelectionType aSelectionType) +{ + if (!mFrameSelection) + return NS_ERROR_FAILURE; + + return mFrameSelection->RepaintSelection(aSelectionType); +} + +NS_IMETHODIMP +nsTextInputSelectionImpl::SetCaretEnabled(PRBool enabled) +{ + if (!mPresShellWeak) return NS_ERROR_NOT_INITIALIZED; + + nsCOMPtr shell = do_QueryReferent(mPresShellWeak); + if (!shell) return NS_ERROR_FAILURE; + + // tell the pres shell to enable the caret, rather than settings its visibility directly. + // this way the presShell's idea of caret visibility is maintained. + nsCOMPtr selCon = do_QueryInterface(shell); + if (!selCon) return NS_ERROR_NO_INTERFACE; + selCon->SetCaretEnabled(enabled); + + return NS_OK; +} + +NS_IMETHODIMP +nsTextInputSelectionImpl::SetCaretReadOnly(PRBool aReadOnly) +{ + if (!mPresShellWeak) return NS_ERROR_NOT_INITIALIZED; + nsresult result; + nsCOMPtr shell = do_QueryReferent(mPresShellWeak, &result); + if (shell) + { + nsRefPtr caret = shell->GetCaret(); + if (caret) { + nsISelection* domSel = mFrameSelection-> + GetSelection(nsISelectionController::SELECTION_NORMAL); + if (domSel) + caret->SetCaretReadOnly(aReadOnly); + return NS_OK; + } + } + return NS_ERROR_FAILURE; +} + +NS_IMETHODIMP +nsTextInputSelectionImpl::GetCaretEnabled(PRBool *_retval) +{ + return GetCaretVisible(_retval); +} + +NS_IMETHODIMP +nsTextInputSelectionImpl::GetCaretVisible(PRBool *_retval) +{ + if (!mPresShellWeak) return NS_ERROR_NOT_INITIALIZED; + nsresult result; + nsCOMPtr shell = do_QueryReferent(mPresShellWeak, &result); + if (shell) + { + nsRefPtr caret = shell->GetCaret(); + if (caret) { + nsISelection* domSel = mFrameSelection-> + GetSelection(nsISelectionController::SELECTION_NORMAL); + if (domSel) + return caret->GetCaretVisible(_retval); + } + } + return NS_ERROR_FAILURE; +} + +NS_IMETHODIMP +nsTextInputSelectionImpl::SetCaretVisibilityDuringSelection(PRBool aVisibility) +{ + if (!mPresShellWeak) return NS_ERROR_NOT_INITIALIZED; + nsresult result; + nsCOMPtr shell = do_QueryReferent(mPresShellWeak, &result); + if (shell) + { + nsRefPtr caret = shell->GetCaret(); + if (caret) { + nsISelection* domSel = mFrameSelection-> + GetSelection(nsISelectionController::SELECTION_NORMAL); + if (domSel) + caret->SetVisibilityDuringSelection(aVisibility); + return NS_OK; + } + } + return NS_ERROR_FAILURE; +} + +NS_IMETHODIMP +nsTextInputSelectionImpl::CharacterMove(PRBool aForward, PRBool aExtend) +{ + if (mFrameSelection) + return mFrameSelection->CharacterMove(aForward, aExtend); + return NS_ERROR_NULL_POINTER; +} + +NS_IMETHODIMP +nsTextInputSelectionImpl::CharacterExtendForDelete() +{ + if (mFrameSelection) + return mFrameSelection->CharacterExtendForDelete(); + return NS_ERROR_NULL_POINTER; +} + +NS_IMETHODIMP +nsTextInputSelectionImpl::WordMove(PRBool aForward, PRBool aExtend) +{ + if (mFrameSelection) + return mFrameSelection->WordMove(aForward, aExtend); + return NS_ERROR_NULL_POINTER; +} + +NS_IMETHODIMP +nsTextInputSelectionImpl::WordExtendForDelete(PRBool aForward) +{ + if (mFrameSelection) + return mFrameSelection->WordExtendForDelete(aForward); + return NS_ERROR_NULL_POINTER; +} + +NS_IMETHODIMP +nsTextInputSelectionImpl::LineMove(PRBool aForward, PRBool aExtend) +{ + if (mFrameSelection) + { + nsresult result = mFrameSelection->LineMove(aForward, aExtend); + if (NS_FAILED(result)) + result = CompleteMove(aForward,aExtend); + return result; + } + return NS_ERROR_NULL_POINTER; +} + + +NS_IMETHODIMP +nsTextInputSelectionImpl::IntraLineMove(PRBool aForward, PRBool aExtend) +{ + if (mFrameSelection) + return mFrameSelection->IntraLineMove(aForward, aExtend); + return NS_ERROR_NULL_POINTER; +} + + +NS_IMETHODIMP +nsTextInputSelectionImpl::PageMove(PRBool aForward, PRBool aExtend) +{ + // expected behavior for PageMove is to scroll AND move the caret + // and to remain relative position of the caret in view. see Bug 4302. + if (mScrollFrame) + { + mFrameSelection->CommonPageMove(aForward, aExtend, mScrollFrame); + } + // After ScrollSelectionIntoView(), the pending notifications might be + // flushed and PresShell/PresContext/Frames may be dead. See bug 418470. + return ScrollSelectionIntoView(nsISelectionController::SELECTION_NORMAL, nsISelectionController::SELECTION_FOCUS_REGION, PR_TRUE); +} + +NS_IMETHODIMP +nsTextInputSelectionImpl::CompleteScroll(PRBool aForward) +{ + if (!mScrollFrame) + return NS_ERROR_NOT_INITIALIZED; + + mScrollFrame->ScrollBy(nsIntPoint(0, aForward ? 1 : -1), + nsIScrollableFrame::WHOLE, + nsIScrollableFrame::INSTANT); + return NS_OK; +} + +NS_IMETHODIMP +nsTextInputSelectionImpl::CompleteMove(PRBool aForward, PRBool aExtend) +{ + // grab the parent / root DIV for this text widget + nsIContent* parentDIV = mFrameSelection->GetLimiter(); + if (!parentDIV) + return NS_ERROR_UNEXPECTED; + + // make the caret be either at the very beginning (0) or the very end + PRInt32 offset = 0; + nsFrameSelection::HINT hint = nsFrameSelection::HINTLEFT; + if (aForward) + { + offset = parentDIV->GetChildCount(); + + // Prevent the caret from being placed after the last + // BR node in the content tree! + + if (offset > 0) + { + nsIContent *child = parentDIV->GetChildAt(offset - 1); + + if (child->Tag() == nsGkAtoms::br) + { + --offset; + hint = nsFrameSelection::HINTRIGHT; // for Bug 106855 + } + } + } + + mFrameSelection->HandleClick(parentDIV, offset, offset, aExtend, + PR_FALSE, hint); + + // if we got this far, attempt to scroll no matter what the above result is + return CompleteScroll(aForward); +} + +NS_IMETHODIMP +nsTextInputSelectionImpl::ScrollPage(PRBool aForward) +{ + if (!mScrollFrame) + return NS_ERROR_NOT_INITIALIZED; + + mScrollFrame->ScrollBy(nsIntPoint(0, aForward ? 1 : -1), + nsIScrollableFrame::PAGES, + nsIScrollableFrame::SMOOTH); + return NS_OK; +} + +NS_IMETHODIMP +nsTextInputSelectionImpl::ScrollLine(PRBool aForward) +{ + if (!mScrollFrame) + return NS_ERROR_NOT_INITIALIZED; + + mScrollFrame->ScrollBy(nsIntPoint(0, aForward ? 1 : -1), + nsIScrollableFrame::LINES, + nsIScrollableFrame::SMOOTH); + return NS_OK; +} + +NS_IMETHODIMP +nsTextInputSelectionImpl::ScrollHorizontal(PRBool aLeft) +{ + if (!mScrollFrame) + return NS_ERROR_NOT_INITIALIZED; + + mScrollFrame->ScrollBy(nsIntPoint(aLeft ? -1 : 1, 0), + nsIScrollableFrame::LINES, + nsIScrollableFrame::SMOOTH); + return NS_OK; +} + +NS_IMETHODIMP +nsTextInputSelectionImpl::SelectAll() +{ + if (mFrameSelection) + return mFrameSelection->SelectAll(); + return NS_ERROR_NULL_POINTER; +} + +NS_IMETHODIMP +nsTextInputSelectionImpl::CheckVisibility(nsIDOMNode *node, PRInt16 startOffset, PRInt16 EndOffset, PRBool *_retval) +{ + if (!mPresShellWeak) return NS_ERROR_NOT_INITIALIZED; + nsresult result; + nsCOMPtr shell = do_QueryReferent(mPresShellWeak, &result); + if (shell) + { + return shell->CheckVisibility(node,startOffset,EndOffset, _retval); + } + return NS_ERROR_FAILURE; + +} + +class nsTextInputListener : public nsISelectionListener, + public nsIDOMKeyListener, + public nsIEditorObserver, + public nsSupportsWeakReference +{ +public: + /** the default constructor + */ + explicit nsTextInputListener(nsITextControlElement* aTxtCtrlElement); + /** the default destructor. virtual due to the possibility of derivation. + */ + virtual ~nsTextInputListener(); + + /** SetEditor gives an address to the editor that will be accessed + * @param aEditor the editor this listener calls for editing operations + */ + void SetFrame(nsTextControlFrame *aFrame){mFrame = aFrame;} + + NS_DECL_ISUPPORTS + + NS_DECL_NSISELECTIONLISTENER + + NS_IMETHOD HandleEvent(nsIDOMEvent* aEvent); + + // nsIDOMKeyListener + NS_IMETHOD KeyDown(nsIDOMEvent *aKeyEvent); + NS_IMETHOD KeyPress(nsIDOMEvent *aKeyEvent); + NS_IMETHOD KeyUp(nsIDOMEvent *aKeyEvent); + + NS_DECL_NSIEDITOROBSERVER + +protected: + + nsresult UpdateTextInputCommands(const nsAString& commandsToUpdate); + + NS_HIDDEN_(nsINativeKeyBindings*) GetKeyBindings(); + +protected: + + nsTextControlFrame* mFrame; // weak reference + + nsITextControlElement* const mTxtCtrlElement; + + PRPackedBool mSelectionWasCollapsed; + /** + * Whether we had undo items or not the last time we got EditAction() + * notification (when this state changes we update undo and redo menus) + */ + PRPackedBool mHadUndoItems; + /** + * Whether we had redo items or not the last time we got EditAction() + * notification (when this state changes we update undo and redo menus) + */ + PRPackedBool mHadRedoItems; +}; + + +/* + * nsTextInputListener implementation + */ + +nsTextInputListener::nsTextInputListener(nsITextControlElement* aTxtCtrlElement) +: mFrame(nsnull) +, mTxtCtrlElement(aTxtCtrlElement) +, mSelectionWasCollapsed(PR_TRUE) +, mHadUndoItems(PR_FALSE) +, mHadRedoItems(PR_FALSE) +{ +} + +nsTextInputListener::~nsTextInputListener() +{ +} + +NS_IMPL_ADDREF(nsTextInputListener) +NS_IMPL_RELEASE(nsTextInputListener) + +NS_INTERFACE_MAP_BEGIN(nsTextInputListener) + NS_INTERFACE_MAP_ENTRY(nsISelectionListener) + NS_INTERFACE_MAP_ENTRY(nsIEditorObserver) + NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference) + NS_INTERFACE_MAP_ENTRY(nsIDOMKeyListener) + NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsIDOMEventListener, nsIDOMKeyListener) + NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMKeyListener) +NS_INTERFACE_MAP_END + +// BEGIN nsIDOMSelectionListener + +NS_IMETHODIMP +nsTextInputListener::NotifySelectionChanged(nsIDOMDocument* aDoc, nsISelection* aSel, PRInt16 aReason) +{ + PRBool collapsed; + if (!mFrame || !aDoc || !aSel || NS_FAILED(aSel->GetIsCollapsed(&collapsed))) + return NS_OK; + + // Fire the select event + // The specs don't exactly say when we should fire the select event. + // IE: Whenever you add/remove a character to/from the selection. Also + // each time for select all. Also if you get to the end of the text + // field you will get new event for each keypress or a continuous + // stream of events if you use the mouse. IE will fire select event + // when the selection collapses to nothing if you are holding down + // the shift or mouse button. + // Mozilla: If we have non-empty selection we will fire a new event for each + // keypress (or mouseup) if the selection changed. Mozilla will also + // create the event each time select all is called, even if everything + // was previously selected, becase technically select all will first collapse + // and then extend. Mozilla will never create an event if the selection + // collapses to nothing. + if (!collapsed && (aReason & (nsISelectionListener::MOUSEUP_REASON | + nsISelectionListener::KEYPRESS_REASON | + nsISelectionListener::SELECTALL_REASON))) + { + nsIContent* content = mFrame->GetContent(); + if (content) + { + nsCOMPtr doc = content->GetDocument(); + if (doc) + { + nsCOMPtr presShell = doc->GetPrimaryShell(); + if (presShell) + { + nsEventStatus status = nsEventStatus_eIgnore; + nsEvent event(PR_TRUE, NS_FORM_SELECTED); + + presShell->HandleEventWithTarget(&event, mFrame, content, &status); + } + } + } + } + + // if the collapsed state did not change, don't fire notifications + if (collapsed == mSelectionWasCollapsed) + return NS_OK; + + mSelectionWasCollapsed = collapsed; + + if (!mFrame || !nsContentUtils::IsFocusedContent(mFrame->GetContent())) + return NS_OK; + + return UpdateTextInputCommands(NS_LITERAL_STRING("select")); +} + +// END nsIDOMSelectionListener + +// BEGIN nsIDOMKeyListener + +NS_IMETHODIMP +nsTextInputListener::HandleEvent(nsIDOMEvent* aEvent) +{ + return NS_OK; +} + +static void +DoCommandCallback(const char *aCommand, void *aData) +{ + nsTextControlFrame *frame = static_cast(aData); + nsIContent *content = frame->GetContent(); + + nsCOMPtr controllers; + nsCOMPtr input = do_QueryInterface(content); + if (input) { + input->GetControllers(getter_AddRefs(controllers)); + } else { + nsCOMPtr textArea = + do_QueryInterface(content); + + if (textArea) { + textArea->GetControllers(getter_AddRefs(controllers)); + } + } + + if (!controllers) { + NS_WARNING("Could not get controllers"); + return; + } + + nsCOMPtr controller; + controllers->GetControllerForCommand(aCommand, getter_AddRefs(controller)); + if (controller) { + controller->DoCommand(aCommand); + } +} + + +NS_IMETHODIMP +nsTextInputListener::KeyDown(nsIDOMEvent *aDOMEvent) +{ + nsCOMPtr keyEvent(do_QueryInterface(aDOMEvent)); + NS_ENSURE_TRUE(keyEvent, NS_ERROR_INVALID_ARG); + + nsNativeKeyEvent nativeEvent; + nsINativeKeyBindings *bindings = GetKeyBindings(); + if (bindings && + nsContentUtils::DOMEventToNativeKeyEvent(keyEvent, &nativeEvent, PR_FALSE)) { + if (bindings->KeyDown(nativeEvent, DoCommandCallback, mFrame)) { + aDOMEvent->PreventDefault(); + } + } + + return NS_OK; +} + +NS_IMETHODIMP +nsTextInputListener::KeyPress(nsIDOMEvent *aDOMEvent) +{ + nsCOMPtr keyEvent(do_QueryInterface(aDOMEvent)); + NS_ENSURE_TRUE(keyEvent, NS_ERROR_INVALID_ARG); + + nsNativeKeyEvent nativeEvent; + nsINativeKeyBindings *bindings = GetKeyBindings(); + if (bindings && + nsContentUtils::DOMEventToNativeKeyEvent(keyEvent, &nativeEvent, PR_TRUE)) { + if (bindings->KeyPress(nativeEvent, DoCommandCallback, mFrame)) { + aDOMEvent->PreventDefault(); + } + } + + return NS_OK; +} + +NS_IMETHODIMP +nsTextInputListener::KeyUp(nsIDOMEvent *aDOMEvent) +{ + nsCOMPtr keyEvent(do_QueryInterface(aDOMEvent)); + NS_ENSURE_TRUE(keyEvent, NS_ERROR_INVALID_ARG); + + nsNativeKeyEvent nativeEvent; + nsINativeKeyBindings *bindings = GetKeyBindings(); + if (bindings && + nsContentUtils::DOMEventToNativeKeyEvent(keyEvent, &nativeEvent, PR_FALSE)) { + if (bindings->KeyUp(nativeEvent, DoCommandCallback, mFrame)) { + aDOMEvent->PreventDefault(); + } + } + + return NS_OK; +} +// END nsIDOMKeyListener + +// BEGIN nsIEditorObserver + +NS_IMETHODIMP +nsTextInputListener::EditAction() +{ + // + // Update the undo / redo menus + // + nsCOMPtr editor; + mFrame->GetEditor(getter_AddRefs(editor)); + + nsCOMPtr manager; + editor->GetTransactionManager(getter_AddRefs(manager)); + NS_ENSURE_TRUE(manager, NS_ERROR_FAILURE); + + // Get the number of undo / redo items + PRInt32 numUndoItems = 0; + PRInt32 numRedoItems = 0; + manager->GetNumberOfUndoItems(&numUndoItems); + manager->GetNumberOfRedoItems(&numRedoItems); + if ((numUndoItems && !mHadUndoItems) || (!numUndoItems && mHadUndoItems) || + (numRedoItems && !mHadRedoItems) || (!numRedoItems && mHadRedoItems)) { + // Modify the menu if undo or redo items are different + UpdateTextInputCommands(NS_LITERAL_STRING("undo")); + + mHadUndoItems = numUndoItems != 0; + mHadRedoItems = numRedoItems != 0; + } + + // Make sure we know we were changed (do NOT set this to false if there are + // no undo items; JS could change the value and we'd still need to save it) + mFrame->SetValueChanged(PR_TRUE); + + // Fire input event + mFrame->FireOnInput(); + + return NS_OK; +} + +// END nsIEditorObserver + + +nsresult +nsTextInputListener::UpdateTextInputCommands(const nsAString& commandsToUpdate) +{ + NS_ENSURE_STATE(mFrame); + + nsIContent* content = mFrame->GetContent(); + NS_ENSURE_TRUE(content, NS_ERROR_FAILURE); + + nsCOMPtr doc = content->GetDocument(); + NS_ENSURE_TRUE(doc, NS_ERROR_FAILURE); + + nsPIDOMWindow *domWindow = doc->GetWindow(); + NS_ENSURE_TRUE(domWindow, NS_ERROR_FAILURE); + + return domWindow->UpdateCommands(commandsToUpdate); +} + +nsINativeKeyBindings* +nsTextInputListener::GetKeyBindings() +{ + if (mTxtCtrlElement->IsTextArea()) { + static PRBool sNoTextAreaBindings = PR_FALSE; + + if (!sNativeTextAreaBindings && !sNoTextAreaBindings) { + CallGetService(NS_NATIVEKEYBINDINGS_CONTRACTID_PREFIX "textarea", + &sNativeTextAreaBindings); + + if (!sNativeTextAreaBindings) { + sNoTextAreaBindings = PR_TRUE; + } + } + + return sNativeTextAreaBindings; + } + + static PRBool sNoInputBindings = PR_FALSE; + if (!sNativeInputBindings && !sNoInputBindings) { + CallGetService(NS_NATIVEKEYBINDINGS_CONTRACTID_PREFIX "input", + &sNativeInputBindings); + + if (!sNativeInputBindings) { + sNoInputBindings = PR_TRUE; + } + } + + return sNativeInputBindings; +} + +// END nsTextInputListener + +// nsTextEditorState + +nsTextEditorState::nsTextEditorState(nsITextControlElement* aOwningElement) + : mTextCtrlElement(aOwningElement), + mBoundFrame(nsnull), + mTextListener(nsnull), + mEditorInitialized(PR_FALSE) +{ + MOZ_COUNT_CTOR(nsTextEditorState); +} + +nsTextEditorState::~nsTextEditorState() +{ + MOZ_COUNT_DTOR(nsTextEditorState); + Clear(); +} + +void +nsTextEditorState::Clear() +{ + if (mBoundFrame) { + // Oops, we still have a frame! + // This should happen when the type of a text input control is being changed + // to something which is not a text control. In this case, we should pretend + // that a frame is being destroyed, and clean up after ourselves properly. + UnbindFromFrame(mBoundFrame); + mEditor = nsnull; + } else { + // If we have a bound frame around, UnbindFromFrame will call DestroyEditor + // for us. + DestroyEditor(); + } + NS_IF_RELEASE(mTextListener); +} + +NS_IMPL_CYCLE_COLLECTION_CLASS(nsTextEditorState) +NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(nsTextEditorState, AddRef) +NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(nsTextEditorState, Release) +NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_NATIVE(nsTextEditorState) + tmp->Clear(); +NS_IMPL_CYCLE_COLLECTION_UNLINK_END +NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NATIVE_BEGIN(nsTextEditorState) + NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR_AMBIGUOUS(mSelCon, nsISelectionController) + NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mEditor) + NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mRootNode) + NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mPlaceholderDiv) +NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END + +nsFrameSelection* +nsTextEditorState::GetConstFrameSelection() { + if (mSelCon) + return mSelCon->GetConstFrameSelection(); + return nsnull; +} + +nsIEditor* +nsTextEditorState::GetEditor() +{ + if (!mEditor) { + nsresult rv = PrepareEditor(); + NS_ENSURE_SUCCESS(rv, nsnull); + } + return mEditor; +} + +nsISelectionController* +nsTextEditorState::GetSelectionController() const +{ + return mSelCon; +} + +nsresult +nsTextEditorState::BindToFrame(nsTextControlFrame* aFrame) +{ + NS_ASSERTION(aFrame, "The frame to bind to should be valid"); + NS_ENSURE_ARG_POINTER(aFrame); + + NS_ASSERTION(!mBoundFrame, "Cannot bind twice, need to unbind first"); + NS_ENSURE_TRUE(!mBoundFrame, NS_ERROR_FAILURE); + + // If we'll need to transfer our current value to the editor, save it before + // binding to the frame. + nsAutoString currentValue; + if (mEditor) { + GetValue(currentValue, PR_TRUE); + } + + mBoundFrame = aFrame; + + nsIContent *rootNode = GetRootNode(); + + nsIPresShell *shell = mBoundFrame->PresContext()->GetPresShell(); + NS_ENSURE_TRUE(shell, NS_ERROR_FAILURE); + + // Create selection + nsresult rv; + nsCOMPtr frameSel; + frameSel = do_CreateInstance(kFrameSelectionCID, &rv); + NS_ENSURE_SUCCESS(rv, rv); + + // Create a SelectionController + mSelCon = new nsTextInputSelectionImpl(frameSel, shell, rootNode); + NS_ENSURE_TRUE(mSelCon, NS_ERROR_OUT_OF_MEMORY); + mTextListener = new nsTextInputListener(mTextCtrlElement); + NS_ENSURE_TRUE(mTextListener, NS_ERROR_OUT_OF_MEMORY); + NS_ADDREF(mTextListener); + + mTextListener->SetFrame(mBoundFrame); + mSelCon->SetDisplaySelection(nsISelectionController::SELECTION_ON); + + // Get the caret and make it a selection listener. + nsRefPtr domSelection; + if (NS_SUCCEEDED(mSelCon->GetSelection(nsISelectionController::SELECTION_NORMAL, + getter_AddRefs(domSelection))) && + domSelection) { + nsCOMPtr selPriv(do_QueryInterface(domSelection)); + nsRefPtr caret = shell->GetCaret(); + nsCOMPtr listener; + if (caret) { + listener = do_QueryInterface(caret); + if (listener) { + selPriv->AddSelectionListener(listener); + } + } + + selPriv->AddSelectionListener(static_cast + (mTextListener)); + } + + // If an editor exists from before, prepare it for usage + if (mEditor) { + class PrepareEditorEvent : public nsRunnable { + public: + PrepareEditorEvent(nsTextEditorState &aState, + nsIContent *aOwnerContent, + const nsAString &aCurrentValue) + : mState(aState) + , mOwnerContent(aOwnerContent) + , mCurrentValue(aCurrentValue) + { + } + + NS_IMETHOD Run() { + // Transfer the saved value to the editor if we have one + const nsAString *value = nsnull; + if (!mCurrentValue.IsEmpty()) { + value = &mCurrentValue; + } + + mState.PrepareEditor(value); + + return NS_OK; + } + + private: + nsTextEditorState &mState; + nsCOMPtr mOwnerContent; // strong reference + nsAutoString mCurrentValue; + }; + + nsCOMPtr content = do_QueryInterface(mTextCtrlElement); + NS_ENSURE_TRUE(content, NS_ERROR_FAILURE); + + if (!nsContentUtils::AddScriptRunner( + new PrepareEditorEvent(*this, content, currentValue))) + return NS_ERROR_OUT_OF_MEMORY; + } + + return NS_OK; +} + +nsresult +nsTextEditorState::PrepareEditor(const nsAString *aValue) +{ + if (!mBoundFrame) { + // Cannot create an editor without a bound frame. + // Don't return a failure code, because js callers can't handle that. + return NS_OK; + } + + if (mEditorInitialized) { + // Do not initialize the editor multiple times. + return NS_OK; + } + + // Note that we don't check mEditor here, because we might already have one + // around, in which case we don't create a new one, and we'll just tie the + // required machinery to it. + + nsPresContext *presContext = mBoundFrame->PresContext(); + nsIPresShell *shell = presContext->GetPresShell(); + + // Setup the editor flags + PRUint32 editorFlags = 0; + if (IsPlainTextControl()) + editorFlags |= nsIPlaintextEditor::eEditorPlaintextMask; + if (IsSingleLineTextControl()) + editorFlags |= nsIPlaintextEditor::eEditorSingleLineMask; + if (IsPasswordTextControl()) + editorFlags |= nsIPlaintextEditor::eEditorPasswordMask; + + // All nsTextControlFrames are widgets + editorFlags |= nsIPlaintextEditor::eEditorWidgetMask; + + // Use async reflow and painting for text widgets to improve + // performance. + + // XXX: Using editor async updates exposes bugs 158782, 151882, + // and 165130, so we're disabling it for now, until they + // can be addressed. + // editorFlags |= nsIPlaintextEditor::eEditorUseAsyncUpdatesMask; + + PRBool shouldInitializeEditor = PR_FALSE; + nsCOMPtr newEditor; // the editor that we might create + nsresult rv; + if (!mEditor) { + shouldInitializeEditor = PR_TRUE; + + // Create an editor + newEditor = do_CreateInstance(kTextEditorCID, &rv); + NS_ENSURE_SUCCESS(rv, rv); + + // Make sure we clear out the non-breaking space before we initialize the editor + rv = mBoundFrame->UpdateValueDisplay(PR_FALSE, PR_TRUE); + NS_ENSURE_SUCCESS(rv, rv); + } else { + if (aValue) { + // Set the correct value in the root node + rv = mBoundFrame->UpdateValueDisplay(PR_FALSE, PR_FALSE, aValue); + NS_ENSURE_SUCCESS(rv, rv); + } + + newEditor = mEditor; // just pretend that we have a new editor! + } + + if (!mEditorInitialized) { + // Now initialize the editor. + // + // NOTE: Conversion of '\n' to
happens inside the + // editor's Init() call. + + // Get the DOM document + nsCOMPtr domdoc = do_QueryInterface(shell->GetDocument()); + if (!domdoc) + return NS_ERROR_FAILURE; + + // What follows is a bit of a hack. The editor uses the public DOM APIs + // for its content manipulations, and it causes it to fail some security + // checks deep inside when initializing. So we push a null JSContext + // on the JS stack here to make it clear that we're native code. + // Note that any script that's directly trying to access our value + // has to be going through some scriptable object to do that and that + // already does the relevant security checks. + nsCxPusher pusher; + pusher.PushNull(); + + rv = newEditor->Init(domdoc, shell, GetRootNode(), mSelCon, editorFlags); + NS_ENSURE_SUCCESS(rv, rv); + } + + // Initialize the controller for the editor + + if (!SuppressEventHandlers(presContext)) { + nsCOMPtr controllers; + nsCOMPtr inputElement = + do_QueryInterface(mTextCtrlElement); + if (inputElement) { + rv = inputElement->GetControllers(getter_AddRefs(controllers)); + } else { + nsCOMPtr textAreaElement = + do_QueryInterface(mTextCtrlElement); + + if (!textAreaElement) + return NS_ERROR_FAILURE; + + rv = textAreaElement->GetControllers(getter_AddRefs(controllers)); + } + + NS_ENSURE_SUCCESS(rv, rv); + + if (controllers) { + PRUint32 numControllers; + PRBool found = PR_FALSE; + rv = controllers->GetControllerCount(&numControllers); + for (PRUint32 i = 0; i < numControllers; i ++) { + nsCOMPtr controller; + rv = controllers->GetControllerAt(i, getter_AddRefs(controller)); + if (NS_SUCCEEDED(rv) && controller) { + nsCOMPtr editController = + do_QueryInterface(controller); + if (editController) { + editController->SetCommandContext(newEditor); + found = PR_TRUE; + } + } + } + if (!found) + rv = NS_ERROR_FAILURE; + } + } + + if (shouldInitializeEditor) { + // Initialize the plaintext editor + nsCOMPtr textEditor(do_QueryInterface(newEditor)); + if (textEditor) { + // Set up wrapping + textEditor->SetWrapColumn(GetWrapCols()); + + // Set max text field length + PRInt32 maxLength; + if (GetMaxLength(&maxLength)) { + textEditor->SetMaxTextLength(maxLength); + } + } + } + + nsCOMPtr content = do_QueryInterface(mTextCtrlElement); + if (content) { + rv = newEditor->GetFlags(&editorFlags); + NS_ENSURE_SUCCESS(rv, rv); + + // Check if the readonly attribute is set. + if (content->HasAttr(kNameSpaceID_None, nsGkAtoms::readonly)) + editorFlags |= nsIPlaintextEditor::eEditorReadonlyMask; + + // Check if the disabled attribute is set. + if (content->HasAttr(kNameSpaceID_None, nsGkAtoms::disabled)) + editorFlags |= nsIPlaintextEditor::eEditorDisabledMask; + + // Disable the selection if necessary. + if (editorFlags & nsIPlaintextEditor::eEditorDisabledMask) + mSelCon->SetDisplaySelection(nsISelectionController::SELECTION_OFF); + + newEditor->SetFlags(editorFlags); + } + + // Get the current value of the textfield from the content. + // Note that if we've created a new editor, mEditor is null at this stage, + // so we will get the real value from the content. + nsAutoString defaultValue; + if (aValue) { + defaultValue = *aValue; + } else { + GetValue(defaultValue, PR_TRUE); + } + + if (shouldInitializeEditor) { + // Hold on to the newly created editor + mEditor = newEditor; + } + + // If we have a default value, insert it under the div we created + // above, but be sure to use the editor so that '*' characters get + // displayed for password fields, etc. SetValue() will call the + // editor for us. + + if (!defaultValue.IsEmpty()) { + // Avoid causing reentrant painting and reflowing by telling the editor + // that we don't want it to force immediate view refreshes or force + // immediate reflows during any editor calls. + + rv = newEditor->SetFlags(editorFlags | + nsIPlaintextEditor::eEditorUseAsyncUpdatesMask); + NS_ENSURE_SUCCESS(rv, rv); + + // Now call SetValue() which will make the necessary editor calls to set + // the default value. Make sure to turn off undo before setting the default + // value, and turn it back on afterwards. This will make sure we can't undo + // past the default value. + + rv = newEditor->EnableUndo(PR_FALSE); + NS_ENSURE_SUCCESS(rv, rv); + + SetValue(defaultValue, PR_FALSE); + + rv = newEditor->EnableUndo(PR_TRUE); + NS_ASSERTION(NS_SUCCEEDED(rv),"Transaction Manager must have failed"); + + // Now restore the original editor flags. + rv = newEditor->SetFlags(editorFlags); + NS_ENSURE_SUCCESS(rv, rv); + } + + nsCOMPtr transMgr; + newEditor->GetTransactionManager(getter_AddRefs(transMgr)); + NS_ENSURE_TRUE(transMgr, NS_ERROR_FAILURE); + + transMgr->SetMaxTransactionCount(nsITextControlElement::DEFAULT_UNDO_CAP); + + if (IsPasswordTextControl()) { + // Disable undo for password textfields. Note that we want to do this at + // the very end of InitEditor, so the calls to EnableUndo when setting the + // default value don't screw us up. + // Since changing the control type does a reframe, we don't have to worry + // about dynamic type changes here. + newEditor->EnableUndo(PR_FALSE); + } + + if (!mEditorInitialized) { + newEditor->PostCreate(); + mEditorInitialized = PR_TRUE; + } + + if (mTextListener) + newEditor->AddEditorObserver(mTextListener); + + return rv; +} + +void +nsTextEditorState::DestroyEditor() +{ + // notify the editor that we are going away + if (mEditorInitialized) { + if (mTextListener) + mEditor->RemoveEditorObserver(mTextListener); + + mEditor->PreDestroy(PR_TRUE); + mEditorInitialized = PR_FALSE; + } +} + +void +nsTextEditorState::UnbindFromFrame(nsTextControlFrame* aFrame) +{ + NS_ASSERTION(mBoundFrame, "Can't be unbound without being bound originally"); + NS_ENSURE_TRUE(mBoundFrame, ); + + // If it was, however, it should be unbounded from the same frame. + NS_ASSERTION(aFrame == mBoundFrame, "Unbinding from the wrong frame"); + NS_ENSURE_TRUE(aFrame == mBoundFrame, ); + + // We need to start storing the value outside of the editor if we're not + // going to use it anymore, so retrieve it for now. + nsAutoString value; + GetValue(value, PR_TRUE); + + // Destroy our editor + DestroyEditor(); + + // Clean up the controller + if (!SuppressEventHandlers(mBoundFrame->PresContext())) + { + nsCOMPtr controllers; + nsCOMPtr inputElement = + do_QueryInterface(mTextCtrlElement); + if (inputElement) + inputElement->GetControllers(getter_AddRefs(controllers)); + else + { + nsCOMPtr textAreaElement = + do_QueryInterface(mTextCtrlElement); + if (textAreaElement) { + textAreaElement->GetControllers(getter_AddRefs(controllers)); + } + } + + if (controllers) + { + PRUint32 numControllers; + nsresult rv = controllers->GetControllerCount(&numControllers); + NS_ASSERTION((NS_SUCCEEDED(rv)), "bad result in gfx text control destructor"); + for (PRUint32 i = 0; i < numControllers; i ++) + { + nsCOMPtr controller; + rv = controllers->GetControllerAt(i, getter_AddRefs(controller)); + if (NS_SUCCEEDED(rv) && controller) + { + nsCOMPtr editController = do_QueryInterface(controller); + if (editController) + { + editController->SetCommandContext(nsnull); + } + } + } + } + } + + if (mSelCon) { + if (mTextListener) { + nsRefPtr domSelection; + if (NS_SUCCEEDED(mSelCon->GetSelection(nsISelectionController::SELECTION_NORMAL, + getter_AddRefs(domSelection))) && + domSelection) { + nsCOMPtr selPriv(do_QueryInterface(domSelection)); + + selPriv->RemoveSelectionListener(static_cast + (mTextListener)); + } + } + + mSelCon->SetScrollableFrame(nsnull); + mSelCon = nsnull; + } + + if (mTextListener) + { + mTextListener->SetFrame(nsnull); + + nsCOMPtr systemGroup; + nsCOMPtr content = do_QueryInterface(mTextCtrlElement); + content->GetSystemEventGroup(getter_AddRefs(systemGroup)); + nsCOMPtr dom3Targ = do_QueryInterface(mTextCtrlElement); + if (dom3Targ) { + // cast because of ambiguous base + nsIDOMEventListener *listener = static_cast + (mTextListener); + + dom3Targ->RemoveGroupedEventListener(NS_LITERAL_STRING("keydown"), + listener, PR_FALSE, systemGroup); + dom3Targ->RemoveGroupedEventListener(NS_LITERAL_STRING("keypress"), + listener, PR_FALSE, systemGroup); + dom3Targ->RemoveGroupedEventListener(NS_LITERAL_STRING("keyup"), + listener, PR_FALSE, systemGroup); + } + + NS_RELEASE(mTextListener); + mTextListener = nsnull; + } + + mBoundFrame = nsnull; + + // Now that we don't have a frame any more, store the value in the text buffer. + SetValue(value, PR_FALSE); + + if (mRootNode && mMutationObserver) { + mRootNode->RemoveMutationObserver(mMutationObserver); + mMutationObserver = nsnull; + } + + // Unbind the anonymous content from the tree. + // We actually hold a reference to the content nodes so that + // they're not actually destroyed. + nsContentUtils::DestroyAnonymousContent(&mRootNode); + nsContentUtils::DestroyAnonymousContent(&mPlaceholderDiv); +} + +nsresult +nsTextEditorState::CreateRootNode() +{ + NS_ENSURE_TRUE(!mRootNode, NS_ERROR_UNEXPECTED); + NS_ENSURE_ARG_POINTER(mBoundFrame); + + nsIPresShell *shell = mBoundFrame->PresContext()->GetPresShell(); + NS_ENSURE_TRUE(shell, NS_ERROR_FAILURE); + + nsIDocument *doc = shell->GetDocument(); + NS_ENSURE_TRUE(doc, NS_ERROR_FAILURE); + + // Now create a DIV and add it to the anonymous content child list. + nsCOMPtr nodeInfo; + nodeInfo = doc->NodeInfoManager()->GetNodeInfo(nsGkAtoms::div, nsnull, + kNameSpaceID_XHTML); + NS_ENSURE_TRUE(nodeInfo, NS_ERROR_OUT_OF_MEMORY); + + nsresult rv = NS_NewHTMLElement(getter_AddRefs(mRootNode), nodeInfo, PR_FALSE); + NS_ENSURE_SUCCESS(rv, rv); + + // Set the necessary classes on the text control. We use class values + // instead of a 'style' attribute so that the style comes from a user-agent + // style sheet and is still applied even if author styles are disabled. + nsAutoString classValue; + classValue.AppendLiteral("anonymous-div"); + PRInt32 wrapCols = GetWrapCols(); + if (wrapCols >= 0) { + classValue.AppendLiteral(" wrap"); + } + if (!IsSingleLineTextControl()) { + // We can't just inherit the overflow because setting visible overflow will + // crash when the number of lines exceeds the height of the textarea and + // setting -moz-hidden-unscrollable overflow (NS_STYLE_OVERFLOW_CLIP) + // doesn't paint the caret for some reason. + const nsStyleDisplay* disp = mBoundFrame->GetStyleDisplay(); + if (disp->mOverflowX != NS_STYLE_OVERFLOW_VISIBLE && + disp->mOverflowX != NS_STYLE_OVERFLOW_CLIP) { + classValue.AppendLiteral(" inherit-overflow"); + } + + mMutationObserver = new nsAnonDivObserver(this); + NS_ENSURE_TRUE(mMutationObserver, NS_ERROR_OUT_OF_MEMORY); + mRootNode->AddMutationObserver(mMutationObserver); + } + rv = mRootNode->SetAttr(kNameSpaceID_None, nsGkAtoms::_class, + classValue, PR_FALSE); + NS_ENSURE_SUCCESS(rv, rv); + + rv = mBoundFrame->UpdateValueDisplay(PR_FALSE); + NS_ENSURE_SUCCESS(rv, rv); + + return rv; +} + +nsresult +nsTextEditorState::CreatePlaceholderNode() +{ + NS_ENSURE_TRUE(!mPlaceholderDiv, NS_ERROR_UNEXPECTED); + NS_ENSURE_ARG_POINTER(mBoundFrame); + + nsIPresShell *shell = mBoundFrame->PresContext()->GetPresShell(); + NS_ENSURE_TRUE(shell, NS_ERROR_FAILURE); + + nsIDocument *doc = shell->GetDocument(); + NS_ENSURE_TRUE(doc, NS_ERROR_FAILURE); + + nsNodeInfoManager* pNodeInfoManager = doc->NodeInfoManager(); + NS_ENSURE_TRUE(pNodeInfoManager, NS_ERROR_OUT_OF_MEMORY); + + nsresult rv; + nsCOMPtr placeholderText; + + // Create a DIV for the placeholder + // and add it to the anonymous content child list + nsCOMPtr nodeInfo; + nodeInfo = pNodeInfoManager->GetNodeInfo(nsGkAtoms::div, nsnull, + kNameSpaceID_XHTML); + NS_ENSURE_TRUE(nodeInfo, NS_ERROR_OUT_OF_MEMORY); + + rv = NS_NewHTMLElement(getter_AddRefs(mPlaceholderDiv), nodeInfo, PR_FALSE); + NS_ENSURE_SUCCESS(rv, rv); + + // Create the text node for the placeholder text before doing anything else + rv = NS_NewTextNode(getter_AddRefs(placeholderText), pNodeInfoManager); + NS_ENSURE_SUCCESS(rv, rv); + + rv = mPlaceholderDiv->AppendChildTo(placeholderText, PR_FALSE); + NS_ENSURE_SUCCESS(rv, rv); + + // initialize the text + UpdatePlaceholderText(PR_FALSE); + + return NS_OK; +} + +PRBool +nsTextEditorState::GetMaxLength(PRInt32* aMaxLength) +{ + nsCOMPtr content = do_QueryInterface(mTextCtrlElement); + NS_ENSURE_TRUE(content, PR_FALSE); + nsGenericHTMLElement* element = nsGenericHTMLElement::FromContent(content); + NS_ENSURE_TRUE(element, PR_FALSE); + + const nsAttrValue* attr = element->GetParsedAttr(nsGkAtoms::maxlength); + if (attr && attr->Type() == nsAttrValue::eInteger) { + *aMaxLength = attr->GetIntegerValue(); + + return PR_TRUE; + } + + return PR_FALSE; +} + +void +nsTextEditorState::GetValue(nsAString& aValue, PRBool aIgnoreWrap) const +{ + if (mEditor && mBoundFrame) { + PRBool canCache = aIgnoreWrap && !IsSingleLineTextControl(); + if (canCache && !mCachedValue.IsEmpty()) { + aValue = mCachedValue; + return; + } + + aValue.Truncate(); // initialize out param + + PRUint32 flags = (nsIDocumentEncoder::OutputLFLineBreak | + nsIDocumentEncoder::OutputPreformatted | + nsIDocumentEncoder::OutputPersistNBSP); + + if (IsPlainTextControl()) + { + flags |= nsIDocumentEncoder::OutputBodyOnly; + } + + if (!aIgnoreWrap) { + nsITextControlElement::nsHTMLTextWrap wrapProp; + nsCOMPtr content = do_QueryInterface(mTextCtrlElement); + if (content && + nsITextControlElement::GetWrapPropertyEnum(content, wrapProp) && + wrapProp == nsITextControlElement::eHTMLTextWrap_Hard) { + flags |= nsIDocumentEncoder::OutputWrap; + } + } + + // What follows is a bit of a hack. The problem is that we could be in + // this method because we're being destroyed for whatever reason while + // script is executing. If that happens, editor will run with the + // privileges of the executing script, which means it may not be able to + // access its own DOM nodes! Let's try to deal with that by pushing a null + // JSContext on the JSContext stack to make it clear that we're native + // code. Note that any script that's directly trying to access our value + // has to be going through some scriptable object to do that and that + // already does the relevant security checks. + // XXXbz if we could just get the textContent of our anonymous content (eg + // if plaintext editor didn't create
nodes all over), we wouldn't need + // this. + { /* Scope for context pusher */ + nsCxPusher pusher; + pusher.PushNull(); + + mEditor->OutputToString(NS_LITERAL_STRING("text/plain"), flags, + aValue); + } + if (canCache) { + mCachedValue = aValue; + } else { + mCachedValue.Truncate(); + } + } else { + if (!mTextCtrlElement->ValueChanged() || !mValue) { + mTextCtrlElement->GetDefaultValueFromContent(aValue); + } else { + aValue = NS_ConvertUTF8toUTF16(*mValue); + } + + if (IsSingleLineTextControl()) { + // If the value is not owned by the frame, then we should handle any + // existing newline characters inside it, instead of relying on the + // editor to do it for us. + nsString value(aValue); + nsTextEditRules::HandleNewLines(value, -1); + aValue.Assign(value); + } + } +} + +void +nsTextEditorState::SetValue(const nsAString& aValue, PRBool aUserInput) +{ + if (mEditor && mBoundFrame) { + // The InsertText call below might flush pending notifications, which + // could lead into a scheduled PrepareEditor to be called. That will + // lead to crashes (or worse) because we'd be initializing the editor + // before InsertText returns. This script blocker makes sure that + // PrepareEditor cannot be called prematurely. + nsAutoScriptBlocker scriptBlocker; + + PRBool fireChangeEvent = mBoundFrame->GetFireChangeEventState(); + if (aUserInput) { + mBoundFrame->SetFireChangeEventState(PR_TRUE); + } + + nsAutoString currentValue; + mBoundFrame->GetText(currentValue); + + nsWeakFrame weakFrame(mBoundFrame); + + // this is necessary to avoid infinite recursion + if (!currentValue.Equals(aValue)) + { + nsTextControlFrame::ValueSetter valueSetter(mBoundFrame, + mBoundFrame->mFocusedValue.Equals(currentValue)); + + // \r is an illegal character in the dom, but people use them, + // so convert windows and mac platform linebreaks to \n: + // Unfortunately aValue is declared const, so we have to copy + // in order to do this substitution. + nsString newValue(aValue); + if (aValue.FindChar(PRUnichar('\r')) != -1) { + nsContentUtils::PlatformToDOMLineBreaks(newValue); + } + + nsCOMPtr domDoc; + mEditor->GetDocument(getter_AddRefs(domDoc)); + if (!domDoc) { + NS_WARNING("Why don't we have a document?"); + return; + } + + // Time to mess with our security context... See comments in GetValue() + // for why this is needed. Note that we have to do this up here, because + // otherwise SelectAll() will fail. + { /* Scope for context pusher */ + nsCxPusher pusher; + pusher.PushNull(); + + nsCOMPtr domSel; + nsCOMPtr selPriv; + mSelCon->GetSelection(nsISelectionController::SELECTION_NORMAL, + getter_AddRefs(domSel)); + if (domSel) + { + selPriv = do_QueryInterface(domSel); + if (selPriv) + selPriv->StartBatchChanges(); + } + + nsCOMPtr kungFuDeathGrip = mSelCon.get(); + PRUint32 currentLength = currentValue.Length(); + PRUint32 newlength = newValue.Length(); + if (!currentLength || + !StringBeginsWith(newValue, currentValue)) { + // Replace the whole text. + currentLength = 0; + mSelCon->SelectAll(); + } else { + // Collapse selection to the end so that we can append data. + mBoundFrame->SelectAllOrCollapseToEndOfText(PR_FALSE); + } + const nsAString& insertValue = + StringTail(newValue, newlength - currentLength); + nsCOMPtr plaintextEditor = do_QueryInterface(mEditor); + if (!plaintextEditor || !weakFrame.IsAlive()) { + NS_WARNING("Somehow not a plaintext editor?"); + return; + } + + valueSetter.Init(); + + // get the flags, remove readonly and disabled, set the value, + // restore flags + PRUint32 flags, savedFlags; + mEditor->GetFlags(&savedFlags); + flags = savedFlags; + flags &= ~(nsIPlaintextEditor::eEditorDisabledMask); + flags &= ~(nsIPlaintextEditor::eEditorReadonlyMask); + flags |= nsIPlaintextEditor::eEditorUseAsyncUpdatesMask; + flags |= nsIPlaintextEditor::eEditorDontEchoPassword; + mEditor->SetFlags(flags); + + // Also don't enforce max-length here + PRInt32 savedMaxLength; + plaintextEditor->GetMaxTextLength(&savedMaxLength); + plaintextEditor->SetMaxTextLength(-1); + + if (insertValue.IsEmpty()) { + mEditor->DeleteSelection(nsIEditor::eNone); + } else { + plaintextEditor->InsertText(insertValue); + } + if (!weakFrame.IsAlive()) { + NS_ASSERTION(!mBoundFrame, "The frame should have been unbounded"); + SetValue(newValue, PR_FALSE); + valueSetter.Cancel(); + return; + } + + if (!IsSingleLineTextControl()) { + mCachedValue = newValue; + } + + plaintextEditor->SetMaxTextLength(savedMaxLength); + mEditor->SetFlags(savedFlags); + if (selPriv) + selPriv->EndBatchChanges(); + } + } + + // This second check _shouldn't_ be necessary, but let's be safe. + if (!weakFrame.IsAlive()) { + return; + } + nsIScrollableFrame* scrollableFrame = do_QueryFrame(mBoundFrame->GetFirstChild(nsnull)); + if (scrollableFrame) + { + // Scroll the upper left corner of the text control's + // content area back into view. + scrollableFrame->ScrollTo(nsPoint(0, 0), nsIScrollableFrame::INSTANT); + } + + if (aUserInput) { + mBoundFrame->SetFireChangeEventState(fireChangeEvent); + } + } else { + if (!mValue) { + mValue = new nsCString; + } + nsString value(aValue); + nsContentUtils::PlatformToDOMLineBreaks(value); + *mValue = ToNewUTF8String(value); + + // Update the frame display if needed + if (mBoundFrame) { + mBoundFrame->UpdateValueDisplay(PR_TRUE); + } + } + + // If we've reached the point where the root node has been created, we + // can assume that it's safe to notify. + ValueWasChanged(!!mRootNode); +} + +void +nsTextEditorState::InitializeKeyboardEventListeners() +{ + nsCOMPtr content = do_QueryInterface(mTextCtrlElement); + + //register key listeners + nsCOMPtr systemGroup; + content->GetSystemEventGroup(getter_AddRefs(systemGroup)); + nsCOMPtr dom3Targ = do_QueryInterface(content); + if (dom3Targ) { + // cast because of ambiguous base + nsIDOMEventListener *listener = static_cast + (mTextListener); + + dom3Targ->AddGroupedEventListener(NS_LITERAL_STRING("keydown"), + listener, PR_FALSE, systemGroup); + dom3Targ->AddGroupedEventListener(NS_LITERAL_STRING("keypress"), + listener, PR_FALSE, systemGroup); + dom3Targ->AddGroupedEventListener(NS_LITERAL_STRING("keyup"), + listener, PR_FALSE, systemGroup); + } + + mSelCon->SetScrollableFrame(do_QueryFrame(mBoundFrame->GetFirstChild(nsnull))); +} + +/* static */ void +nsTextEditorState::ShutDown() +{ + NS_IF_RELEASE(sNativeTextAreaBindings); + NS_IF_RELEASE(sNativeInputBindings); +} + +void +nsTextEditorState::ValueWasChanged(PRBool aNotify) +{ + // placeholder management + PRBool showPlaceholder = PR_FALSE; + nsCOMPtr content = do_QueryInterface(mTextCtrlElement); + if (!nsContentUtils::IsFocusedContent(content)) { + // If the content is focused, we don't care about the changes because + // the placeholder is going to be hidden/shown on blur. + nsAutoString valueString; + GetValue(valueString, PR_TRUE); + showPlaceholder = valueString.IsEmpty(); + } + SetPlaceholderClass(showPlaceholder, aNotify); +} + +void +nsTextEditorState::UpdatePlaceholderText(PRBool aNotify) +{ + nsAutoString placeholderValue; + + nsCOMPtr content = do_QueryInterface(mTextCtrlElement); + content->GetAttr(kNameSpaceID_None, nsGkAtoms::placeholder, placeholderValue); + nsContentUtils::RemoveNewlines(placeholderValue); + NS_ASSERTION(mPlaceholderDiv->GetChildAt(0), "placeholder div has no child"); + mPlaceholderDiv->GetChildAt(0)->SetText(placeholderValue, aNotify); + ValueWasChanged(aNotify); +} + +void +nsTextEditorState::SetPlaceholderClass(PRBool aVisible, + PRBool aNotify) +{ + // No need to do anything if we don't have a frame yet + if (!mBoundFrame) + return; + + nsAutoString classValue; + + classValue.Assign(NS_LITERAL_STRING("anonymous-div placeholder")); + + if (!aVisible) + classValue.AppendLiteral(" hidden"); + + nsIContent* placeholderDiv = GetPlaceholderNode(); + NS_ENSURE_TRUE(placeholderDiv, ); + + placeholderDiv->SetAttr(kNameSpaceID_None, nsGkAtoms::_class, + classValue, aNotify); +} + +NS_IMPL_ISUPPORTS1(nsAnonDivObserver, nsIMutationObserver) + +void +nsAnonDivObserver::CharacterDataChanged(nsIDocument* aDocument, + nsIContent* aContent, + CharacterDataChangeInfo* aInfo) +{ + mTextEditorState->ClearValueCache(); +} + +void +nsAnonDivObserver::ContentAppended(nsIDocument* aDocument, + nsIContent* aContainer, + nsIContent* aFirstNewContent, + PRInt32 /* unused */) +{ + mTextEditorState->ClearValueCache(); +} + +void +nsAnonDivObserver::ContentInserted(nsIDocument* aDocument, + nsIContent* aContainer, + nsIContent* aChild, + PRInt32 /* unused */) +{ + mTextEditorState->ClearValueCache(); +} + +void +nsAnonDivObserver::ContentRemoved(nsIDocument* aDocument, + nsIContent* aContainer, + nsIContent* aChild, + PRInt32 aIndexInContainer) +{ + mTextEditorState->ClearValueCache(); +} diff --git a/content/html/content/src/nsTextEditorState.h b/content/html/content/src/nsTextEditorState.h new file mode 100644 index 00000000000..bd8567296a7 --- /dev/null +++ b/content/html/content/src/nsTextEditorState.h @@ -0,0 +1,239 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim: set sw=2 ts=2 et tw=80: */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is Mozilla.org client code. + * + * The Initial Developer of the Original Code is Mozilla Foundation. + * Portions created by the Initial Developer are Copyright (C) 2009 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Ehsan Akhgari (Original Author) + * + * Alternatively, the contents of this file may be used under the terms of + * either of the GNU General Public License Version 2 or later (the "GPL"), + * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +#ifndef nsTextEditorState_h__ +#define nsTextEditorState_h__ + +#include "nsAutoPtr.h" +#include "nsITextControlElement.h" +#include "nsCycleCollectionParticipant.h" + +class nsTextInputListener; +class nsTextControlFrame; +class nsTextInputSelectionImpl; +class nsAnonDivObserver; +class nsISelectionController; +class nsFrameSelection; +class nsIEditor; +class nsITextControlElement; + +/** + * nsTextEditorState is a class which is responsible for managing the state of + * plaintext controls. This currently includes the following HTML elements: + * + * + * + + + + +
+
+
+ + diff --git a/layout/generic/nsFrame.cpp b/layout/generic/nsFrame.cpp index 5dab39e425c..5642168fad0 100644 --- a/layout/generic/nsFrame.cpp +++ b/layout/generic/nsFrame.cpp @@ -4315,8 +4315,7 @@ nsFrame::GetSelectionController(nsPresContext *aPresContext, nsISelectionControl while (frame && (frame->GetStateBits() & NS_FRAME_INDEPENDENT_SELECTION)) { nsITextControlFrame *tcf = do_QueryFrame(frame); if (tcf) { - NS_IF_ADDREF(*aSelCon = tcf->GetOwnedSelectionController()); - return NS_OK; + return tcf->GetOwnedSelectionController(aSelCon); } frame = frame->GetParent(); } diff --git a/layout/generic/test/test_bug527306.html b/layout/generic/test/test_bug527306.html index d2658adbc6c..ba25f7fee62 100644 --- a/layout/generic/test/test_bug527306.html +++ b/layout/generic/test/test_bug527306.html @@ -10,18 +10,35 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=527306 - +

Mozilla Bug 527306 -

+

+

+

+

 
+
+
diff --git a/layout/reftests/editor/dynamic-type-2.html b/layout/reftests/editor/dynamic-type-2.html
new file mode 100644
index 00000000000..4d99ac06e24
--- /dev/null
+++ b/layout/reftests/editor/dynamic-type-2.html
@@ -0,0 +1,11 @@
+
+
+
+    
+    
+
+
diff --git a/layout/reftests/editor/dynamic-type-3.html b/layout/reftests/editor/dynamic-type-3.html
new file mode 100644
index 00000000000..7cf5be6abb5
--- /dev/null
+++ b/layout/reftests/editor/dynamic-type-3.html
@@ -0,0 +1,11 @@
+
+
+
+    
+    
+
+
diff --git a/layout/reftests/editor/dynamic-type-4.html b/layout/reftests/editor/dynamic-type-4.html
new file mode 100644
index 00000000000..7cf5be6abb5
--- /dev/null
+++ b/layout/reftests/editor/dynamic-type-4.html
@@ -0,0 +1,11 @@
+
+
+
+    
+    
+
+
diff --git a/layout/reftests/editor/reftest.list b/layout/reftests/editor/reftest.list
index d7968af7c5a..16b741b7f9f 100644
--- a/layout/reftests/editor/reftest.list
+++ b/layout/reftests/editor/reftest.list
@@ -5,6 +5,10 @@ include xul/reftest.list
 == newline-2.html newline-ref.html
 == newline-3.html newline-ref.html
 == dynamic-1.html dynamic-ref.html
+== dynamic-type-1.html dynamic-ref.html
+== dynamic-type-2.html dynamic-ref.html
+== dynamic-type-3.html dynamic-ref.html
+== dynamic-type-4.html dynamic-ref.html
 == passwd-1.html passwd-ref.html
 != passwd-2.html passwd-ref.html
 == passwd-3.html passwd-ref.html
diff --git a/layout/reftests/forms/placeholder/placeholder-18.html b/layout/reftests/forms/placeholder/placeholder-18.html
new file mode 100644
index 00000000000..159d5d7e27b
--- /dev/null
+++ b/layout/reftests/forms/placeholder/placeholder-18.html
@@ -0,0 +1,22 @@
+
+
+  
+  
+  
+    
+  
+
diff --git a/layout/reftests/forms/placeholder/reftest.list b/layout/reftests/forms/placeholder/reftest.list
index 5d45a28b540..f090c21657d 100644
--- a/layout/reftests/forms/placeholder/reftest.list
+++ b/layout/reftests/forms/placeholder/reftest.list
@@ -18,3 +18,4 @@
 == placeholder-15.html placeholder-focus-ref.html
 == placeholder-16.html placeholder-focus-ref.html
 == placeholder-17.html placeholder-focus-ref.html
+== placeholder-18.html placeholder-overridden-ref.html
diff --git a/layout/reftests/forms/reftest.list b/layout/reftests/forms/reftest.list
index 3c397733201..2d358705542 100644
--- a/layout/reftests/forms/reftest.list
+++ b/layout/reftests/forms/reftest.list
@@ -18,6 +18,7 @@ HTTP(..) == text-control-baseline-1.html text-control-baseline-1-ref.html
 != textarea-in-ltr-doc-scrollbar.html textarea-in-rtl-doc-scrollbar.html
 != textarea-ltr.html textarea-no-resize.html
 random-if(MOZ_WIDGET_TOOLKIT=="gtk2") != textarea-rtl.html textarea-no-resize.html # bug 558201
+== textarea-setvalue-framereconstruction-1.html textarea-setvalue-framereconstruction-ref.html
 
 == radio-label-dynamic.html radio-label-dynamic-ref.html
 == out-of-bounds-selectedindex.html out-of-bounds-selectedindex-ref.html # test for bug 471741
diff --git a/layout/reftests/forms/textarea-setvalue-framereconstruction-1.html b/layout/reftests/forms/textarea-setvalue-framereconstruction-1.html
new file mode 100644
index 00000000000..0be72b771dd
--- /dev/null
+++ b/layout/reftests/forms/textarea-setvalue-framereconstruction-1.html
@@ -0,0 +1,48 @@
+
+
+
+
+
+  
+    
+      
+    
+  
+
+
+
+
+
+
+
+
+
+ +
+ + + + + + diff --git a/layout/reftests/forms/textarea-setvalue-framereconstruction-ref.html b/layout/reftests/forms/textarea-setvalue-framereconstruction-ref.html new file mode 100644 index 00000000000..95fcd5c2321 --- /dev/null +++ b/layout/reftests/forms/textarea-setvalue-framereconstruction-ref.html @@ -0,0 +1,17 @@ + + + + + + +
+ +
+ + + + + + From b2fc2491e5bd458402a1a591a33be94e06ac1032 Mon Sep 17 00:00:00 2001 From: Ehsan Akhgari Date: Fri, 4 Jun 2010 13:28:19 -0400 Subject: [PATCH 18/30] Bug 567020 - Intermittent timeout in 343889-1.html, leading to the crashtest suite being aborted; r=jst --- content/base/crashtests/343889-1.html | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/content/base/crashtests/343889-1.html b/content/base/crashtests/343889-1.html index 3dfcc92da2d..8ea8bc28d38 100644 --- a/content/base/crashtests/343889-1.html +++ b/content/base/crashtests/343889-1.html @@ -1,15 +1,18 @@ - + - + From d2be7ae95156ea6b28349e549e60e017344aee97 Mon Sep 17 00:00:00 2001 From: Ehsan Akhgari Date: Fri, 4 Jun 2010 13:28:19 -0400 Subject: [PATCH 19/30] Bug 563864 - Add some debugging output to figure out what's going on with test_mozPaintCount.html intermittent oranges (temporary test-only change) --- layout/base/tests/test_mozPaintCount.html | 2 ++ 1 file changed, 2 insertions(+) diff --git a/layout/base/tests/test_mozPaintCount.html b/layout/base/tests/test_mozPaintCount.html index a063841bf23..ca102824308 100644 --- a/layout/base/tests/test_mozPaintCount.html +++ b/layout/base/tests/test_mozPaintCount.html @@ -17,9 +17,11 @@ SimpleTest.waitForExplicitFinish(); var startPaintCount = window.mozPaintCount; +ok(true, "Got to initial paint count: " + startPaintCount); var color = 0; function doFlicker() { + ok(true, "Iteration " + color + ", paint count: " + window.mozPaintCount); if (window.mozPaintCount - startPaintCount > 20) { ok(true, "Got enough paints"); SimpleTest.finish(); From 34c835038ef633d6c95470e0001460401b585d87 Mon Sep 17 00:00:00 2001 From: Ehsan Akhgari Date: Fri, 4 Jun 2010 13:28:19 -0400 Subject: [PATCH 20/30] Bug 569238 - Add some debugging information to determine what causes test_flush_on_paint.html to time out (temporary test-only change) --- layout/base/tests/test_flush_on_paint.html | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/layout/base/tests/test_flush_on_paint.html b/layout/base/tests/test_flush_on_paint.html index 651dc884a06..84da4c4cac2 100644 --- a/layout/base/tests/test_flush_on_paint.html +++ b/layout/base/tests/test_flush_on_paint.html @@ -31,14 +31,15 @@ invalidationLoop(); function doIteration() { lastPaintCount = plugin.getPaintCount(); + ok(true, "Beginning iteration " + iterations + ", last paint count: " + lastPaintCount); - var v = 255 - iterations; expectedWidth = 201 + iterations; plugin.style.width = expectedWidth + "px"; checkDone(); } function checkDone() { + ok(true, "Check to see if we're done: " + plugin.getPaintCount()); if (plugin.getPaintCount() == lastPaintCount) { setTimeout(checkDone, 30); return; From 8a94479eabf40554e9c3a5d86db74e2e477badeb Mon Sep 17 00:00:00 2001 From: Ehsan Akhgari Date: Sun, 23 May 2010 22:13:00 -0400 Subject: [PATCH 21/30] Bug 567701 - Don't store a view manager pointer in nsEditor; retrieve it lazily; r=roc --- editor/libeditor/base/nsEditor.cpp | 23 ++++++++++++----------- editor/libeditor/base/nsEditor.h | 1 - 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/editor/libeditor/base/nsEditor.cpp b/editor/libeditor/base/nsEditor.cpp index 2f416501cd7..e2a1e6b08e3 100644 --- a/editor/libeditor/base/nsEditor.cpp +++ b/editor/libeditor/base/nsEditor.cpp @@ -65,7 +65,6 @@ #include "nsITransactionManager.h" #include "nsIAbsorbingTransaction.h" #include "nsIPresShell.h" -#include "nsIViewManager.h" #include "nsISelection.h" #include "nsISelectionPrivate.h" #include "nsISelectionController.h" @@ -242,14 +241,6 @@ nsEditor::Init(nsIDOMDocument *aDoc, nsIPresShell* aPresShell, nsIContent *aRoot nsCOMPtr document = do_QueryInterface(aDoc); document->AddMutationObserver(this); - // Set up the DTD - // XXX - in the long run we want to get this from the document, but there - // is no way to do that right now. So we leave it null here and set - // up a nav html dtd in nsHTMLEditor::Init - - mViewManager = ps->GetViewManager(); - if (!mViewManager) {return NS_ERROR_NULL_POINTER;} - mUpdateCount=0; /* initialize IME stuff */ @@ -4178,7 +4169,14 @@ nsresult nsEditor::BeginUpdateViewBatch() } // Turn off view updating. - mBatch.BeginUpdateViewBatch(mViewManager); + nsCOMPtr ps; + GetPresShell(getter_AddRefs(ps)); + if (ps) { + nsCOMPtr viewManager = ps->GetViewManager(); + if (viewManager) { + mBatch.BeginUpdateViewBatch(viewManager); + } + } } mUpdateCount++; @@ -4220,7 +4218,10 @@ nsresult nsEditor::EndUpdateViewBatch() GetFlags(&flags); // Turn view updating back on. - if (mViewManager) + nsCOMPtr viewManager; + if (presShell) + viewManager = presShell->GetViewManager(); + if (viewManager) { PRUint32 updateFlag = NS_VMREFRESH_IMMEDIATE; diff --git a/editor/libeditor/base/nsEditor.h b/editor/libeditor/base/nsEditor.h index a0cc0208f24..fed5adff3ac 100644 --- a/editor/libeditor/base/nsEditor.h +++ b/editor/libeditor/base/nsEditor.h @@ -657,7 +657,6 @@ protected: nsWeakPtr mPresShellWeak; // weak reference to the nsIPresShell nsWeakPtr mSelConWeak; // weak reference to the nsISelectionController - nsCOMPtr mViewManager; PRInt32 mUpdateCount; nsIViewManager::UpdateViewBatch mBatch; From 8a99cfd855fe4ec4742786dc853a748f3508afb4 Mon Sep 17 00:00:00 2001 From: Ehsan Akhgari Date: Sat, 5 Jun 2010 16:17:42 -0400 Subject: [PATCH 22/30] Bug 534785 - fix build bustage --- content/html/content/src/nsHTMLInputElement.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/content/html/content/src/nsHTMLInputElement.cpp b/content/html/content/src/nsHTMLInputElement.cpp index 8adc6172999..e03a04be881 100644 --- a/content/html/content/src/nsHTMLInputElement.cpp +++ b/content/html/content/src/nsHTMLInputElement.cpp @@ -1091,6 +1091,7 @@ nsHTMLInputElement::GetTextEditor() nsTextEditorState *state = GetEditorState(); if (state) { return state->GetEditor(); + } return nsnull; } @@ -1100,6 +1101,7 @@ nsHTMLInputElement::GetSelectionController() nsTextEditorState *state = GetEditorState(); if (state) { return state->GetSelectionController(); + } return nsnull; } @@ -1109,6 +1111,7 @@ nsHTMLInputElement::GetConstFrameSelection() nsTextEditorState *state = GetEditorState(); if (state) { return state->GetConstFrameSelection(); + } return nsnull; } @@ -1118,6 +1121,7 @@ nsHTMLInputElement::BindToFrame(nsTextControlFrame* aFrame) nsTextEditorState *state = GetEditorState(); if (state) { return state->BindToFrame(aFrame); + } return NS_ERROR_FAILURE; } @@ -1136,6 +1140,7 @@ nsHTMLInputElement::CreateEditor() nsTextEditorState *state = GetEditorState(); if (state) { return state->PrepareEditor(); + } return NS_ERROR_FAILURE; } @@ -1145,6 +1150,7 @@ nsHTMLInputElement::GetRootEditorNode() nsTextEditorState *state = GetEditorState(); if (state) { return state->GetRootNode(); + } return nsnull; } @@ -1154,6 +1160,7 @@ nsHTMLInputElement::GetPlaceholderNode() nsTextEditorState *state = GetEditorState(); if (state) { return state->GetPlaceholderNode(); + } return nsnull; } From ce66a52a3820ce9819096d9d2caaffcf87f06c65 Mon Sep 17 00:00:00 2001 From: Timothy Nikkel Date: Sat, 5 Jun 2010 15:29:49 -0500 Subject: [PATCH 23/30] Bug 8253. Part 1. Disable first-letter and first-line styles in select elements. r=bzbarsky --- layout/base/nsCSSFrameConstructor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/layout/base/nsCSSFrameConstructor.cpp b/layout/base/nsCSSFrameConstructor.cpp index 38591ac3000..cec6f54d433 100644 --- a/layout/base/nsCSSFrameConstructor.cpp +++ b/layout/base/nsCSSFrameConstructor.cpp @@ -3267,7 +3267,7 @@ nsCSSFrameConstructor::InitializeSelectFrame(nsFrameConstructorState& aState, } ProcessChildren(aState, aContent, aStyleContext, scrolledFrame, PR_FALSE, - childItems, PR_TRUE, aPendingBinding); + childItems, PR_FALSE, aPendingBinding); // Set the scrolled frame's initial child lists scrolledFrame->SetInitialChildList(nsnull, childItems); From 4ae8e7b053dd22ec1e01046095b0af91b1b0fb42 Mon Sep 17 00:00:00 2001 From: Timothy Nikkel Date: Sat, 5 Jun 2010 15:29:49 -0500 Subject: [PATCH 24/30] Bug 563878. Part 1a. Make nsThebesRegion hold a nsIntRegion like it should. r=mats --- gfx/public/nsIRegion.h | 6 ++++++ gfx/src/thebes/nsThebesRegion.cpp | 23 ++++++++++++++--------- gfx/src/thebes/nsThebesRegion.h | 3 ++- 3 files changed, 22 insertions(+), 10 deletions(-) diff --git a/gfx/public/nsIRegion.h b/gfx/public/nsIRegion.h index 74cdbc48960..377ba8ae236 100644 --- a/gfx/public/nsIRegion.h +++ b/gfx/public/nsIRegion.h @@ -41,6 +41,7 @@ #include "nscore.h" #include "nsISupports.h" #include "nsRect.h" +#include "nsRegion.h" enum nsRegionComplexity { @@ -249,6 +250,11 @@ public: **/ NS_IMETHOD FreeRects(nsRegionRectSet *aRects) = 0; + /** + * Get the underlying nsIntRegion that this nsIRegion represents. + **/ + virtual nsIntRegion GetUnderlyingRegion() const = 0; + /** * Get the native region that this nsIRegion represents. * @param aRegion out parameter for native region handle diff --git a/gfx/src/thebes/nsThebesRegion.cpp b/gfx/src/thebes/nsThebesRegion.cpp index d8bbb6081bd..1e272df8d98 100644 --- a/gfx/src/thebes/nsThebesRegion.cpp +++ b/gfx/src/thebes/nsThebesRegion.cpp @@ -60,7 +60,7 @@ void nsThebesRegion::SetTo (const nsIRegion &aRegion) void nsThebesRegion::SetTo (PRInt32 aX, PRInt32 aY, PRInt32 aWidth, PRInt32 aHeight) { - mRegion = nsRect (aX, aY, aWidth, aHeight); + mRegion = nsIntRect (aX, aY, aWidth, aHeight); } void nsThebesRegion::Intersect (const nsIRegion &aRegion) @@ -71,7 +71,7 @@ void nsThebesRegion::Intersect (const nsIRegion &aRegion) void nsThebesRegion::Intersect (PRInt32 aX, PRInt32 aY, PRInt32 aWidth, PRInt32 aHeight) { - mRegion.And (mRegion, nsRect (aX, aY, aWidth, aHeight)); + mRegion.And (mRegion, nsIntRect (aX, aY, aWidth, aHeight)); } void nsThebesRegion::Union (const nsIRegion &aRegion) @@ -82,7 +82,7 @@ void nsThebesRegion::Union (const nsIRegion &aRegion) void nsThebesRegion::Union (PRInt32 aX, PRInt32 aY, PRInt32 aWidth, PRInt32 aHeight) { - mRegion.Or (mRegion, nsRect (aX, aY, aWidth, aHeight)); + mRegion.Or (mRegion, nsIntRect (aX, aY, aWidth, aHeight)); } void nsThebesRegion::Subtract (const nsIRegion &aRegion) @@ -93,7 +93,7 @@ void nsThebesRegion::Subtract (const nsIRegion &aRegion) void nsThebesRegion::Subtract (PRInt32 aX, PRInt32 aY, PRInt32 aWidth, PRInt32 aHeight) { - mRegion.Sub (mRegion, nsRect (aX, aY, aWidth, aHeight)); + mRegion.Sub (mRegion, nsIntRect (aX, aY, aWidth, aHeight)); } PRBool nsThebesRegion::IsEmpty (void) @@ -109,7 +109,7 @@ PRBool nsThebesRegion::IsEqual (const nsIRegion &aRegion) void nsThebesRegion::GetBoundingBox (PRInt32 *aX, PRInt32 *aY, PRInt32 *aWidth, PRInt32 *aHeight) { - nsRect BoundRect; + nsIntRect BoundRect; BoundRect = mRegion.GetBounds(); *aX = BoundRect.x; *aY = BoundRect.y; @@ -124,8 +124,8 @@ void nsThebesRegion::Offset (PRInt32 aXOffset, PRInt32 aYOffset) PRBool nsThebesRegion::ContainsRect (PRInt32 aX, PRInt32 aY, PRInt32 aWidth, PRInt32 aHeight) { - nsRegion TmpRegion; - TmpRegion.And (mRegion, nsRect (aX, aY, aWidth, aHeight)); + nsIntRegion TmpRegion; + TmpRegion.And (mRegion, nsIntRect (aX, aY, aWidth, aHeight)); return (!TmpRegion.IsEmpty ()); } @@ -157,9 +157,9 @@ nsThebesRegion::GetRects (nsRegionRectSet **aRects) *aRects = pRegionSet; - nsRegionRectIterator ri (mRegion); + nsIntRegionRectIterator ri (mRegion); nsRegionRect* pDest = &pRegionSet->mRects [0]; - const nsRect* pSrc; + const nsIntRect* pSrc; while ((pSrc = ri.Next ())) { @@ -184,6 +184,11 @@ nsThebesRegion::FreeRects (nsRegionRectSet *aRects) return NS_OK; } +nsIntRegion nsThebesRegion::GetUnderlyingRegion () const +{ + return mRegion; +} + NS_IMETHODIMP nsThebesRegion::GetNativeRegion (void *&aRegion) const { diff --git a/gfx/src/thebes/nsThebesRegion.h b/gfx/src/thebes/nsThebesRegion.h index e2f33128eb1..2112b15d247 100644 --- a/gfx/src/thebes/nsThebesRegion.h +++ b/gfx/src/thebes/nsThebesRegion.h @@ -67,12 +67,13 @@ public: PRBool ContainsRect (PRInt32 aX, PRInt32 aY, PRInt32 aWidth, PRInt32 aHeight); NS_IMETHOD GetRects (nsRegionRectSet **aRects); NS_IMETHOD FreeRects (nsRegionRectSet *aRects); + nsIntRegion GetUnderlyingRegion() const; NS_IMETHOD GetNativeRegion (void *&aRegion) const; NS_IMETHOD GetRegionComplexity (nsRegionComplexity &aComplexity) const; NS_IMETHOD GetNumRects (PRUint32 *aRects) const; protected: - nsRegion mRegion; + nsIntRegion mRegion; }; #endif From 1b5c6590a7bfc8757806c558f86fb516eee71bf9 Mon Sep 17 00:00:00 2001 From: Timothy Nikkel Date: Sat, 5 Jun 2010 15:29:49 -0500 Subject: [PATCH 25/30] Bug 563878. Part 1b. Make nsIPresShell::RenderNode and nsIRenderingContext::SetClipRegion take an nsIntRegion. r=mats --- gfx/public/nsIRenderingContext.h | 9 ++--- gfx/public/nsRegion.h | 1 + gfx/src/nsRegion.cpp | 17 +++++++- gfx/src/thebes/nsThebesRenderingContext.cpp | 45 +++++---------------- gfx/src/thebes/nsThebesRenderingContext.h | 2 +- layout/base/nsIPresShell.h | 10 ++--- layout/base/nsPresShell.cpp | 23 ++++++----- widget/src/xpwidgets/nsBaseDragService.cpp | 13 ++++-- 8 files changed, 57 insertions(+), 63 deletions(-) diff --git a/gfx/public/nsIRenderingContext.h b/gfx/public/nsIRenderingContext.h index 796706522e6..da063af6f84 100644 --- a/gfx/public/nsIRenderingContext.h +++ b/gfx/public/nsIRenderingContext.h @@ -55,7 +55,7 @@ class nsIFontMetrics; class nsTransform2D; class nsString; class nsIDeviceContext; -class nsIRegion; +class nsIntRegion; class nsIAtom; struct nsFont; @@ -98,10 +98,9 @@ typedef enum // IID for the nsIRenderingContext interface -// 37762dd8-8df0-48cd-a5d6-24573ffdb5b6 #define NS_IRENDERING_CONTEXT_IID \ -{ 0xA553DAB8, 0xD8B3, 0x469F, \ - { 0x85, 0xC5, 0xD9, 0x4E, 0xBD, 0x65, 0x37, 0x5D } } +{ 0xefbfeb6c, 0x937e, 0x4889, \ + { 0x92, 0x46, 0x16, 0xc0, 0xe8, 0x4b, 0xfa, 0xae } } //---------------------------------------------------------------------- @@ -185,7 +184,7 @@ public: * @param aCombine how to combine this region with the current clip region. * see the bottom of nsIRenderingContext.h */ - NS_IMETHOD SetClipRegion(const nsIRegion& aRegion, nsClipCombine aCombine) = 0; + NS_IMETHOD SetClipRegion(const nsIntRegion& aRegion, nsClipCombine aCombine) = 0; /** * Sets the forground color for the RenderingContext diff --git a/gfx/public/nsRegion.h b/gfx/public/nsRegion.h index 59a97f5c633..6d600ca4757 100644 --- a/gfx/public/nsRegion.h +++ b/gfx/public/nsRegion.h @@ -410,6 +410,7 @@ public: } PRUint32 GetNumRects () const { return mImpl.GetNumRects (); } nsIntRect GetBounds () const { return FromRect (mImpl.GetBounds ()); } + nsRegion ToAppUnits (nscoord aAppUnitsPerPixel) const; nsIntRect GetLargestRectangle () const { return FromRect (mImpl.GetLargestRectangle()); } /** diff --git a/gfx/src/nsRegion.cpp b/gfx/src/nsRegion.cpp index 1ed8dbbb180..37df396bbc9 100644 --- a/gfx/src/nsRegion.cpp +++ b/gfx/src/nsRegion.cpp @@ -1289,10 +1289,11 @@ void nsRegion::MoveBy (nsPoint aPt) } } -nsIntRegion nsRegion::ToOutsidePixels(nscoord aAppUnitsPerPixel) const { +nsIntRegion nsRegion::ToOutsidePixels (nscoord aAppUnitsPerPixel) const +{ nsIntRegion result; nsRegionRectIterator rgnIter(*this); - const nsRect *currentRect; + const nsRect* currentRect; while ((currentRect = rgnIter.Next())) { nsIntRect deviceRect = currentRect->ToOutsidePixels(aAppUnitsPerPixel); result.Or(result, deviceRect); @@ -1605,3 +1606,15 @@ void nsRegion::SimpleSubtract (const nsRegion& aRegion) Optimize(); } + +nsRegion nsIntRegion::ToAppUnits (nscoord aAppUnitsPerPixel) const +{ + nsRegion result; + nsIntRegionRectIterator rgnIter(*this); + const nsIntRect* currentRect; + while ((currentRect = rgnIter.Next())) { + nsRect appRect = currentRect->ToAppUnits(aAppUnitsPerPixel); + result.Or(result, appRect); + } + return result; +} diff --git a/gfx/src/thebes/nsThebesRenderingContext.cpp b/gfx/src/thebes/nsThebesRenderingContext.cpp index 997f3e7cb48..d0add095181 100644 --- a/gfx/src/thebes/nsThebesRenderingContext.cpp +++ b/gfx/src/thebes/nsThebesRenderingContext.cpp @@ -277,10 +277,9 @@ nsThebesRenderingContext::SetClipRect(const nsRect& aRect, } NS_IMETHODIMP -nsThebesRenderingContext::SetClipRegion(const nsIRegion& pxRegion, +nsThebesRenderingContext::SetClipRegion(const nsIntRegion& aRegion, nsClipCombine aCombine) { - //return NS_OK; // Region is in device coords, no transformation. // This should only be called when there is no transform in place, when we // we just start painting a widget. The region is set by the platform paint @@ -288,45 +287,19 @@ nsThebesRenderingContext::SetClipRegion(const nsIRegion& pxRegion, NS_ASSERTION(aCombine == nsClipCombine_kReplace, "Unexpected usage of SetClipRegion"); - nsRegionComplexity cplx; - pxRegion.GetRegionComplexity(cplx); - gfxMatrix mat = mThebes->CurrentMatrix(); mThebes->IdentityMatrix(); mThebes->ResetClip(); - // GetBoundingBox, GetRects, FreeRects are non-const - nsIRegion *evilPxRegion = const_cast(&pxRegion); - if (cplx == eRegionComplexity_rect) { - PRInt32 x, y, w, h; - evilPxRegion->GetBoundingBox(&x, &y, &w, &h); - - PR_LOG(gThebesGFXLog, PR_LOG_DEBUG, ("## %p nsTRC::SetClipRegion %d [%d,%d,%d,%d]", this, cplx, x, y, w, h)); - - mThebes->NewPath(); - mThebes->Rectangle(gfxRect(x, y, w, h), PR_TRUE); - mThebes->Clip(); - } else if (cplx == eRegionComplexity_complex) { - nsRegionRectSet *rects = nsnull; - nsresult rv = evilPxRegion->GetRects (&rects); - PR_LOG(gThebesGFXLog, PR_LOG_DEBUG, ("## %p nsTRC::SetClipRegion %d %d rects", this, cplx, rects->mNumRects)); - if (NS_FAILED(rv) || !rects) { - mThebes->SetMatrix(mat); - return rv; - } - - mThebes->NewPath(); - for (PRUint32 i = 0; i < rects->mNumRects; i++) { - mThebes->Rectangle(gfxRect(rects->mRects[i].x, - rects->mRects[i].y, - rects->mRects[i].width, - rects->mRects[i].height), - PR_TRUE); - } - mThebes->Clip(); - - evilPxRegion->FreeRects (rects); + + mThebes->NewPath(); + nsIntRegionRectIterator iter(aRegion); + const nsIntRect* rect; + while ((rect = iter.Next())) { + mThebes->Rectangle(gfxRect(rect->x, rect->y, rect->width, rect->height), + PR_TRUE); } + mThebes->Clip(); mThebes->SetMatrix(mat); diff --git a/gfx/src/thebes/nsThebesRenderingContext.h b/gfx/src/thebes/nsThebesRenderingContext.h index 5b1d54bb395..c9450106deb 100644 --- a/gfx/src/thebes/nsThebesRenderingContext.h +++ b/gfx/src/thebes/nsThebesRenderingContext.h @@ -140,7 +140,7 @@ public: NS_IMETHOD PopState(void); NS_IMETHOD SetClipRect(const nsRect& aRect, nsClipCombine aCombine); NS_IMETHOD SetLineStyle(nsLineStyle aLineStyle); - NS_IMETHOD SetClipRegion(const nsIRegion& aRegion, nsClipCombine aCombine); + NS_IMETHOD SetClipRegion(const nsIntRegion& aRegion, nsClipCombine aCombine); NS_IMETHOD SetColor(nscolor aColor); NS_IMETHOD GetColor(nscolor &aColor) const; NS_IMETHOD SetFont(const nsFont& aFont, nsIAtom* aLanguage, diff --git a/layout/base/nsIPresShell.h b/layout/base/nsIPresShell.h index 17913e44d1c..25faacff167 100644 --- a/layout/base/nsIPresShell.h +++ b/layout/base/nsIPresShell.h @@ -83,7 +83,7 @@ class nsFrameManager; class nsILayoutHistoryState; class nsIReflowCallback; class nsIDOMNode; -class nsIRegion; +class nsIntRegion; class nsIStyleSheet; class nsCSSFrameConstructor; class nsISelection; @@ -127,8 +127,8 @@ typedef struct CapturingContentInfo { } CapturingContentInfo; #define NS_IPRESSHELL_IID \ - { 0x47c5b7c4, 0x8d35, 0x4d36, \ - { 0xa1, 0xf9, 0x19, 0x44, 0xf8, 0xb9, 0x46, 0xb5 } } + { 0x7ae0e29f, 0x4d2e, 0x4acd, \ + { 0xb5, 0x74, 0xb6, 0x40, 0x8a, 0xca, 0xb8, 0x4d } } // Constants for ScrollContentIntoView() function #define NS_PRESSHELL_SCROLL_TOP 0 @@ -839,12 +839,12 @@ public: /** * Renders a node aNode to a surface and returns it. The aRegion may be used - * to clip the rendering. This region is measured in device pixels from the + * to clip the rendering. This region is measured in CSS pixels from the * edge of the presshell area. The aPoint, aScreenRect and aSurface * arguments function in a similar manner as RenderSelection. */ virtual already_AddRefed RenderNode(nsIDOMNode* aNode, - nsIRegion* aRegion, + nsIntRegion* aRegion, nsIntPoint& aPoint, nsIntRect* aScreenRect) = 0; diff --git a/layout/base/nsPresShell.cpp b/layout/base/nsPresShell.cpp index 009e50767d9..9996081ebf4 100644 --- a/layout/base/nsPresShell.cpp +++ b/layout/base/nsPresShell.cpp @@ -795,7 +795,7 @@ public: gfxContext* aThebesContext); virtual already_AddRefed RenderNode(nsIDOMNode* aNode, - nsIRegion* aRegion, + nsIntRegion* aRegion, nsIntPoint& aPoint, nsIntRect* aScreenRect); @@ -1030,7 +1030,7 @@ protected: already_AddRefed PaintRangePaintInfo(nsTArray >* aItems, nsISelection* aSelection, - nsIRegion* aRegion, + nsIntRegion* aRegion, nsRect aArea, nsIntPoint& aPoint, nsIntRect* aScreenRect); @@ -5497,7 +5497,7 @@ PresShell::CreateRangePaintInfo(nsIDOMRange* aRange, already_AddRefed PresShell::PaintRangePaintInfo(nsTArray >* aItems, nsISelection* aSelection, - nsIRegion* aRegion, + nsIntRegion* aRegion, nsRect aArea, nsIntPoint& aPoint, nsIntRect* aScreenRect) @@ -5568,8 +5568,13 @@ PresShell::PaintRangePaintInfo(nsTArray >* aItems, deviceContext->CreateRenderingContextInstance(*getter_AddRefs(rc)); rc->Init(deviceContext, surface); - if (aRegion) - rc->SetClipRegion(*aRegion, nsClipCombine_kReplace); + if (aRegion) { + // Convert aRegion from CSS pixels to dev pixels + nsIntRegion region = + aRegion->ToAppUnits(nsPresContext::AppUnitsPerCSSPixel()) + .ToOutsidePixels(pc->AppUnitsPerDevPixel()); + rc->SetClipRegion(region, nsClipCombine_kReplace); + } if (resize) rc->Scale(scale, scale); @@ -5616,7 +5621,7 @@ PresShell::PaintRangePaintInfo(nsTArray >* aItems, already_AddRefed PresShell::RenderNode(nsIDOMNode* aNode, - nsIRegion* aRegion, + nsIntRegion* aRegion, nsIntPoint& aPoint, nsIntRect* aScreenRect) { @@ -5643,9 +5648,7 @@ PresShell::RenderNode(nsIDOMNode* aNode, if (aRegion) { // combine the area with the supplied region - nsIntRect rrectPixels; - aRegion->GetBoundingBox(&rrectPixels.x, &rrectPixels.y, - &rrectPixels.width, &rrectPixels.height); + nsIntRect rrectPixels = aRegion->GetBounds(); nsRect rrect = rrectPixels.ToAppUnits(nsPresContext::AppUnitsPerCSSPixel()); area.IntersectRect(area, rrect); @@ -5655,7 +5658,7 @@ PresShell::RenderNode(nsIDOMNode* aNode, return nsnull; // move the region so that it is offset from the topleft corner of the surface - aRegion->Offset(-rrectPixels.x + (rrectPixels.x - pc->AppUnitsToDevPixels(area.x)), + aRegion->MoveBy(-rrectPixels.x + (rrectPixels.x - pc->AppUnitsToDevPixels(area.x)), -rrectPixels.y + (rrectPixels.y - pc->AppUnitsToDevPixels(area.y))); } diff --git a/widget/src/xpwidgets/nsBaseDragService.cpp b/widget/src/xpwidgets/nsBaseDragService.cpp index 613b039dd68..eb681d78373 100644 --- a/widget/src/xpwidgets/nsBaseDragService.cpp +++ b/widget/src/xpwidgets/nsBaseDragService.cpp @@ -520,12 +520,17 @@ nsBaseDragService::DrawDrag(nsIDOMNode* aDOMNode, } // otherwise, just draw the node - nsCOMPtr clipRegion; - if (aRegion) - aRegion->GetRegion(getter_AddRefs(clipRegion)); + nsIntRegion clipRegion; + if (aRegion) { + nsCOMPtr clipIRegion; + aRegion->GetRegion(getter_AddRefs(clipIRegion)); + if (clipIRegion) { + clipRegion = clipIRegion->GetUnderlyingRegion(); + } + } nsIntPoint pnt(aScreenDragRect->x, aScreenDragRect->y); - nsRefPtr surface = presShell->RenderNode(dragNode, clipRegion, + nsRefPtr surface = presShell->RenderNode(dragNode, &clipRegion, pnt, aScreenDragRect); // if an image was specified, reposition the drag rectangle to From 8e1c8a02456545d7e2461ee3ad8e66efd6b0ab99 Mon Sep 17 00:00:00 2001 From: Timothy Nikkel Date: Sat, 5 Jun 2010 15:29:49 -0500 Subject: [PATCH 26/30] Bug 563878. Part 1c. Misc layout cleanup. r=mats --- layout/base/nsCSSRendering.h | 9 --------- layout/base/nsDisplayList.cpp | 2 +- layout/base/nsDisplayList.h | 7 ++++--- layout/base/nsLayoutUtils.h | 4 +--- layout/base/nsPresShell.cpp | 38 ++++++++++++++++++++++++++++------- 5 files changed, 37 insertions(+), 23 deletions(-) diff --git a/layout/base/nsCSSRendering.h b/layout/base/nsCSSRendering.h index daa3ddabf9c..ce8f3c6a9ec 100644 --- a/layout/base/nsCSSRendering.h +++ b/layout/base/nsCSSRendering.h @@ -86,9 +86,6 @@ struct nsCSSRendering { * Render the border for an element using css rendering rules * for borders. aSkipSides is a bitmask of the sides to skip * when rendering. If 0 then no sides are skipped. - * - * Both aDirtyRect and aBorderArea are in the local coordinate space - * of aForFrame */ static void PaintBorder(nsPresContext* aPresContext, nsIRenderingContext& aRenderingContext, @@ -116,9 +113,6 @@ struct nsCSSRendering { * Render the outline for an element using css rendering rules * for borders. aSkipSides is a bitmask of the sides to skip * when rendering. If 0 then no sides are skipped. - * - * Both aDirtyRect and aBorderArea are in the local coordinate space - * of aForFrame */ static void PaintOutline(nsPresContext* aPresContext, nsIRenderingContext& aRenderingContext, @@ -227,9 +221,6 @@ struct nsCSSRendering { /** * Render the background for an element using css rendering rules * for backgrounds. - * - * Both aDirtyRect and aBorderArea are in the local coordinate space - * of aForFrame */ enum { /** diff --git a/layout/base/nsDisplayList.cpp b/layout/base/nsDisplayList.cpp index da61ea3b52e..0e6afcaecec 100644 --- a/layout/base/nsDisplayList.cpp +++ b/layout/base/nsDisplayList.cpp @@ -1348,7 +1348,7 @@ nsDisplayTransform::GetFrameBoundsForTransform(const nsIFrame* aFrame) #endif -/* Returns the delta specified by the -moz-tranform-origin property. +/* Returns the delta specified by the -moz-transform-origin property. * This is a positive delta, meaning that it indicates the direction to move * to get from (0, 0) of the frame to the transform origin. */ diff --git a/layout/base/nsDisplayList.h b/layout/base/nsDisplayList.h index 2ff8fd051c5..65a06e2689d 100644 --- a/layout/base/nsDisplayList.h +++ b/layout/base/nsDisplayList.h @@ -521,12 +521,13 @@ public: virtual Type GetType() { return TYPE_GENERIC; } /** * This is called after we've constructed a display list for event handling. - * When this is called, we've already ensured that aPt is in the item's bounds. + * When this is called, we've already ensured that aRect intersects the + * item's bounds. * * @param aState must point to a HitTestState. If you don't have one, * just create one with the default constructor and pass it in. - * @return the frame that the point is considered over, or nsnull if - * this is not over any frame + * @param aOutFrames each item appends the frame(s) in this display item that + * the rect is considered over (if any) to aOutFrames. */ virtual void HitTest(nsDisplayListBuilder* aBuilder, const nsRect& aRect, HitTestState* aState, nsTArray *aOutFrames) {} diff --git a/layout/base/nsLayoutUtils.h b/layout/base/nsLayoutUtils.h index ec3a2c2da9a..bc08936a440 100644 --- a/layout/base/nsLayoutUtils.h +++ b/layout/base/nsLayoutUtils.h @@ -916,9 +916,7 @@ public: * Gets the closest frame (the frame passed in or one of its parents) that * qualifies as a "layer"; used in DOM0 methods that depends upon that * definition. This is the nearest frame that is either positioned or scrolled - * (the child of a scroll frame). In Gecko terms, it's approximately - * equivalent to having a view, at least for simple HTML. However, views are - * going away, so this is a cleaner definition. + * (the child of a scroll frame). */ static nsIFrame* GetClosestLayer(nsIFrame* aFrame); diff --git a/layout/base/nsPresShell.cpp b/layout/base/nsPresShell.cpp index 9996081ebf4..80ae9219e46 100644 --- a/layout/base/nsPresShell.cpp +++ b/layout/base/nsPresShell.cpp @@ -3649,8 +3649,7 @@ PresShell::CreateRenderingContext(nsIFrame *aFrame, nsPoint offset(0,0); if (mPresContext->IsScreen()) { // Get the widget to create the rendering context for and calculate - // the offset from the frame to it. (Calculating the offset is important - // if the frame isn't the root frame.) + // the offset from the frame to it. nsPoint viewOffset; nsIView* view = aFrame->GetClosestView(&viewOffset); nsPoint widgetOffset; @@ -5391,11 +5390,16 @@ PresShell::ClipListToRange(nsDisplayListBuilder *aBuilder, itemToInsert = new (aBuilder)nsDisplayClip(frame, frame, i, textRect); } } - else { + // Don't try to descend into subdocuments. + // If this ever changes we'd need to add handling for subdocuments with + // different zoom levels. + else if (content->GetCurrentDoc() == + aRange->GetStartParent()->GetCurrentDoc()) { // if the node is within the range, append it to the temporary list PRBool before, after; - nsRange::CompareNodeToRange(content, aRange, &before, &after); - if (!before && !after) { + nsresult rv = + nsRange::CompareNodeToRange(content, aRange, &before, &after); + if (NS_SUCCEEDED(rv) && !before && !after) { itemToInsert = i; surfaceRect.UnionRect(surfaceRect, i->GetBounds(aBuilder)); } @@ -5425,6 +5429,12 @@ PresShell::ClipListToRange(nsDisplayListBuilder *aBuilder, return surfaceRect; } +#ifdef DEBUG +#include + +static PRBool gDumpRangePaintList = PR_FALSE; +#endif + RangePaintInfo* PresShell::CreateRangePaintInfo(nsIDOMRange* aRange, nsRect& aSurfaceRect) @@ -5482,8 +5492,22 @@ PresShell::CreateRangePaintInfo(nsIDOMRange* aRange, ancestorRect, &info->mList); info->mBuilder.LeavePresShell(ancestorFrame, ancestorRect); +#ifdef DEBUG + if (gDumpRangePaintList) { + fprintf(stderr, "CreateRangePaintInfo --- before ClipListToRange:\n"); + nsFrame::PrintDisplayList(&(info->mBuilder), info->mList); + } +#endif + nsRect rangeRect = ClipListToRange(&info->mBuilder, &info->mList, range); +#ifdef DEBUG + if (gDumpRangePaintList) { + fprintf(stderr, "CreateRangePaintInfo --- after ClipListToRange:\n"); + nsFrame::PrintDisplayList(&(info->mBuilder), info->mList); + } +#endif + // determine the offset of the reference frame for the display list // to the root frame. This will allow the coordinates used when painting // to all be offset from the same point @@ -5658,8 +5682,8 @@ PresShell::RenderNode(nsIDOMNode* aNode, return nsnull; // move the region so that it is offset from the topleft corner of the surface - aRegion->MoveBy(-rrectPixels.x + (rrectPixels.x - pc->AppUnitsToDevPixels(area.x)), - -rrectPixels.y + (rrectPixels.y - pc->AppUnitsToDevPixels(area.y))); + aRegion->MoveBy(-pc->AppUnitsToDevPixels(area.x), + -pc->AppUnitsToDevPixels(area.y)); } return PaintRangePaintInfo(&rangeItems, nsnull, aRegion, area, aPoint, From 6200807dba590c98000141b83ee57b730bbf22bc Mon Sep 17 00:00:00 2001 From: Timothy Nikkel Date: Sat, 5 Jun 2010 15:29:49 -0500 Subject: [PATCH 27/30] Bug 563878. Part 2. Some view/ cleanup. r=mats --- gfx/public/nsGfxCIID.h | 4 --- view/src/nsViewManager.cpp | 64 ++------------------------------------ view/src/nsViewManager.h | 10 +----- 3 files changed, 4 insertions(+), 74 deletions(-) diff --git a/gfx/public/nsGfxCIID.h b/gfx/public/nsGfxCIID.h index 30787a76cd9..76a8229f416 100644 --- a/gfx/public/nsGfxCIID.h +++ b/gfx/public/nsGfxCIID.h @@ -70,10 +70,6 @@ { 0xda5b130a, 0x1dd1, 0x11b2, \ { 0xad, 0x47, 0xf4, 0x55, 0xb1, 0x81, 0x4a, 0x78 } } -#define NS_BLENDER_CID \ -{ 0x6049b264, 0xc1e6, 0x11d1, \ -{ 0xa8, 0x27, 0x00, 0x40, 0x95, 0x9a, 0x28, 0xc9 } } - #define NS_DRAWING_SURFACE_CID \ { 0x199c7040, 0xcab0, 0x11d2, \ { 0xa8, 0x49, 0x00, 0x40, 0x95, 0x9a, 0x28, 0xc9 } } diff --git a/view/src/nsViewManager.cpp b/view/src/nsViewManager.cpp index ae7b561d0b5..65ec44edb38 100644 --- a/view/src/nsViewManager.cpp +++ b/view/src/nsViewManager.cpp @@ -44,7 +44,6 @@ #include "nsAutoPtr.h" #include "nsViewManager.h" -#include "nsIRenderingContext.h" #include "nsIDeviceContext.h" #include "nsGfxCIID.h" #include "nsView.h" @@ -60,12 +59,9 @@ #include "nsCOMArray.h" #include "nsThreadUtils.h" #include "nsContentUtils.h" -#include "gfxContext.h" #include "nsIPluginWidget.h" -static NS_DEFINE_IID(kBlenderCID, NS_BLENDER_CID); static NS_DEFINE_IID(kRegionCID, NS_REGION_CID); -static NS_DEFINE_IID(kRenderingContextCID, NS_RENDERING_CONTEXT_CID); /** XXX TODO XXX @@ -87,10 +83,6 @@ static NS_DEFINE_IID(kRenderingContextCID, NS_RENDERING_CONTEXT_CID); #define NSCOORD_NONE PR_INT32_MIN -#ifdef NS_VM_PERF_METRICS -#include "nsITimeRecorder.h" -#endif - //-------------- Begin Invalidate Event Definition ------------------------ class nsInvalidateEvent : public nsViewManagerEvent { @@ -136,7 +128,6 @@ nsViewManager::PostInvalidateEvent() #undef DEBUG_MOUSE_LOCATION PRInt32 nsViewManager::mVMCount = 0; -nsIRenderingContext* nsViewManager::gCleanupContext = nsnull; // Weakly held references to all of the view managers nsVoidArray* nsViewManager::gViewManagers = nsnull; @@ -153,13 +144,6 @@ nsViewManager::nsViewManager() gViewManagers = new nsVoidArray; } - if (gCleanupContext == nsnull) { - /* XXX: This should use a device to create a matching |nsIRenderingContext| object */ - CallCreateInstance(kRenderingContextCID, &gCleanupContext); - NS_ASSERTION(gCleanupContext, - "Wasn't able to create a graphics context for cleanup"); - } - gViewManagers->AppendElement(this); ++mVMCount; @@ -205,14 +189,6 @@ nsViewManager::~nsViewManager() NS_ASSERTION(gViewManagers != nsnull, "About to delete null gViewManagers"); delete gViewManagers; gViewManagers = nsnull; - - // Cleanup all of the offscreen drawing surfaces if the last view manager - // has been destroyed and there is something to cleanup - - // Note: A global rendering context is needed because it is not possible - // to create a nsIRenderingContext during the shutdown of XPCOM. The last - // viewmanager is typically destroyed during XPCOM shutdown. - NS_IF_RELEASE(gCleanupContext); } mObserver = nsnull; @@ -1024,32 +1000,7 @@ NS_IMETHODIMP nsViewManager::DispatchEvent(nsGUIEvent *aEvent, #endif } - //Calculate the proper offset for the view we're going to - nsPoint offset(0, 0); - - if (view != baseView) { - //Get offset from root of baseView - nsView *parent; - for (parent = baseView; parent; parent = parent->GetParent()) - parent->ConvertToParentCoords(&offset.x, &offset.y); - - //Subtract back offset from root of view - for (parent = view; parent; parent = parent->GetParent()) - parent->ConvertFromParentCoords(&offset.x, &offset.y); - } - - // Dispatch the event - nsRect baseViewDimensions; - baseView->GetDimensions(baseViewDimensions); - - nsPoint pt; - pt.x = baseViewDimensions.x + - NSFloatPixelsToAppUnits(float(aEvent->refPoint.x) + 0.5f, p2a); - pt.y = baseViewDimensions.y + - NSFloatPixelsToAppUnits(float(aEvent->refPoint.y) + 0.5f, p2a); - pt += offset; - - *aStatus = HandleEvent(view, pt, aEvent); + *aStatus = HandleEvent(view, aEvent); } break; @@ -1059,8 +1010,8 @@ NS_IMETHODIMP nsViewManager::DispatchEvent(nsGUIEvent *aEvent, return NS_OK; } -nsEventStatus nsViewManager::HandleEvent(nsView* aView, nsPoint aPoint, - nsGUIEvent* aEvent) { +nsEventStatus nsViewManager::HandleEvent(nsView* aView, nsGUIEvent* aEvent) +{ //printf(" %d %d %d %d (%d,%d) \n", this, event->widget, event->widgetSupports, // event->message, event->point.x, event->point.y); @@ -1244,15 +1195,6 @@ NS_IMETHODIMP nsViewManager::RemoveChild(nsIView *aChild) return NS_OK; } -NS_IMETHODIMP nsViewManager::MoveViewBy(nsIView *aView, nscoord aX, nscoord aY) -{ - nsView* view = static_cast(aView); - - nsPoint pt = view->GetPosition(); - MoveViewTo(view, aX + pt.x, aY + pt.y); - return NS_OK; -} - NS_IMETHODIMP nsViewManager::MoveViewTo(nsIView *aView, nscoord aX, nscoord aY) { nsView* view = static_cast(aView); diff --git a/view/src/nsViewManager.h b/view/src/nsViewManager.h index 05c2767cbee..58ca0fa482b 100644 --- a/view/src/nsViewManager.h +++ b/view/src/nsViewManager.h @@ -49,9 +49,6 @@ #include "nsView.h" #include "nsIViewObserver.h" -//Uncomment the following line to enable generation of viewmanager performance data. -//#define NS_VM_PERF_METRICS 1 - /** Invalidation model: @@ -132,8 +129,6 @@ public: NS_IMETHOD RemoveChild(nsIView *parent); - NS_IMETHOD MoveViewBy(nsIView *aView, nscoord aX, nscoord aY); - NS_IMETHOD MoveViewTo(nsIView *aView, nscoord aX, nscoord aY); NS_IMETHOD ResizeView(nsIView *aView, const nsRect &aRect, PRBool aRepaintExposedAreaOnly = PR_FALSE); @@ -265,7 +260,7 @@ public: // NOT in nsIViewManager, so private to the view module nsViewManager* RootViewManager() const { return mRootViewManager; } PRBool IsRootVM() const { return this == RootViewManager(); } - nsEventStatus HandleEvent(nsView* aView, nsPoint aPoint, nsGUIEvent* aEvent); + nsEventStatus HandleEvent(nsView* aView, nsGUIEvent* aEvent); virtual nsresult WillBitBlit(nsIView* aView, const nsRect& aRect, nsPoint aScrollAmount); @@ -318,9 +313,6 @@ private: //from here to public should be static and locked... MMP static PRInt32 mVMCount; //number of viewmanagers - //Rendering context used to cleanup the blending buffers - static nsIRenderingContext* gCleanupContext; - //list of view managers static nsVoidArray *gViewManagers; From 1609d33fad53fb87c8481edbcc4b9f747a25e9fb Mon Sep 17 00:00:00 2001 From: Timothy Nikkel Date: Sat, 5 Jun 2010 15:29:49 -0500 Subject: [PATCH 28/30] Bug 563878. Part 3. Fix FindViewContaining. r=mats --- view/src/nsViewManager.cpp | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/view/src/nsViewManager.cpp b/view/src/nsViewManager.cpp index 65ec44edb38..9aeeb5e6807 100644 --- a/view/src/nsViewManager.cpp +++ b/view/src/nsViewManager.cpp @@ -1715,17 +1715,18 @@ static nsView* FindFloatingViewContaining(nsView* aView, nsPoint aPt) */ static nsView* FindViewContaining(nsView* aView, nsPoint aPt) { - for (nsView* v = aView->GetFirstChild(); v; v = v->GetNextSibling()) { - if (aView->GetDimensions().Contains(aPt) && - aView->GetVisibility() != nsViewVisibility_kHide) { - nsView* r = FindViewContaining(v, aPt - v->GetOffsetTo(aView)); - if (r) - return r; - return v; - } + if (!aView->GetDimensions().Contains(aPt) || + aView->GetVisibility() == nsViewVisibility_kHide) { + return nsnull; } - return nsnull; + for (nsView* v = aView->GetFirstChild(); v; v = v->GetNextSibling()) { + nsView* r = FindViewContaining(v, aPt - v->GetOffsetTo(aView)); + if (r) + return r; + } + + return aView; } void From 22d582c49775f7d9b73241fabdb35c752a54e08d Mon Sep 17 00:00:00 2001 From: Timothy Nikkel Date: Sat, 5 Jun 2010 15:29:49 -0500 Subject: [PATCH 29/30] Bug 563878. Part 4. Add AppUnitsPerDevPixel convenience function to viewmanager. r=mats --- view/src/nsViewManager.cpp | 11 +++++------ view/src/nsViewManager.h | 7 +++++++ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/view/src/nsViewManager.cpp b/view/src/nsViewManager.cpp index 9aeeb5e6807..76e359eb4e1 100644 --- a/view/src/nsViewManager.cpp +++ b/view/src/nsViewManager.cpp @@ -44,7 +44,6 @@ #include "nsAutoPtr.h" #include "nsViewManager.h" -#include "nsIDeviceContext.h" #include "nsGfxCIID.h" #include "nsView.h" #include "nsISupportsArray.h" @@ -652,7 +651,7 @@ nsViewManager::UpdateWidgetArea(nsView *aWidgetView, nsIWidget* aWidget, childWidget->GetWindowClipRegion(&clipRects); for (PRUint32 i = 0; i < clipRects.Length(); ++i) { nsRect rr = (clipRects[i] + bounds.TopLeft()). - ToAppUnits(mContext->AppUnitsPerDevPixel()); + ToAppUnits(AppUnitsPerDevPixel()); children.Or(children, rr - aWidgetView->ViewToWidgetOffset()); children.SimplifyInward(20); } @@ -752,7 +751,7 @@ NS_IMETHODIMP nsViewManager::DispatchEvent(nsGUIEvent *aEvent, if (aView == mRootView) { - PRInt32 p2a = mContext->AppUnitsPerDevPixel(); + PRInt32 p2a = AppUnitsPerDevPixel(); SetWindowDimensions(NSIntPixelsToAppUnits(width, p2a), NSIntPixelsToAppUnits(height, p2a)); *aStatus = nsEventStatus_eConsumeNoDefault; @@ -959,7 +958,7 @@ NS_IMETHODIMP nsViewManager::DispatchEvent(nsGUIEvent *aEvent, } if (nsnull != view) { - PRInt32 p2a = mContext->AppUnitsPerDevPixel(); + PRInt32 p2a = AppUnitsPerDevPixel(); if ((aEvent->message == NS_MOUSE_MOVE && static_cast(aEvent)->reason == @@ -1540,7 +1539,7 @@ nsIntRect nsViewManager::ViewToWidget(nsView *aView, nsView* aWidgetView, const rect += aView->ViewToWidgetOffset(); // finally, convert to device coordinates. - return rect.ToOutsidePixels(mContext->AppUnitsPerDevPixel()); + return rect.ToOutsidePixels(AppUnitsPerDevPixel()); } NS_IMETHODIMP @@ -1754,7 +1753,7 @@ nsViewManager::ProcessSynthMouseMoveEvent(PRBool aFromScroll) #endif nsPoint pt; - PRInt32 p2a = mContext->AppUnitsPerDevPixel(); + PRInt32 p2a = AppUnitsPerDevPixel(); pt.x = NSIntPixelsToAppUnits(mMouseLocation.x, p2a); pt.y = NSIntPixelsToAppUnits(mMouseLocation.y, p2a); // This could be a bit slow (traverses entire view hierarchy) diff --git a/view/src/nsViewManager.h b/view/src/nsViewManager.h index 58ca0fa482b..c44b0caa07b 100644 --- a/view/src/nsViewManager.h +++ b/view/src/nsViewManager.h @@ -48,6 +48,7 @@ #include "nsIRegion.h" #include "nsView.h" #include "nsIViewObserver.h" +#include "nsIDeviceContext.h" /** @@ -276,6 +277,12 @@ public: // NOT in nsIViewManager, so private to the view module // Call this when you need to let the viewmanager know that it now has // pending updates. void PostPendingUpdate() { RootViewManager()->mHasPendingUpdates = PR_TRUE; } + + PRInt32 AppUnitsPerDevPixel() const + { + return mContext->AppUnitsPerDevPixel(); + } + private: nsCOMPtr mContext; nsIViewObserver *mObserver; From 5e4d9a7b315e3c212a83e5b99bf8e0bae84b2f8f Mon Sep 17 00:00:00 2001 From: Ehsan Akhgari Date: Sat, 5 Jun 2010 17:42:42 -0400 Subject: [PATCH 30/30] Marking the tip of mozilla-central as dormant-branch-bug-542222 --HG-- branch : dormant-bug-542222