diff --git a/layout/build/Makefile.in b/layout/build/Makefile.in index c43928a2da2..7a245c43545 100644 --- a/layout/build/Makefile.in +++ b/layout/build/Makefile.in @@ -26,6 +26,7 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk +BUILD_DATE = gbdate.h MODULE = layout LIBRARY_NAME = raptorhtml @@ -43,7 +44,7 @@ ifndef MKSHLIB_FORCE_ALL CPPSRCS += dlldeps.cpp endif -EXPORTS = nsLayoutCID.h +EXPORTS = nsLayoutCID.h $(BUILD_DATE) SHARED_LIBRARY_LIBS = \ $(DIST)/lib/libraptorevents_s.a \ @@ -107,3 +108,7 @@ endif $(LIBRARY) $(SHARED_LIBRARY): $(SHARED_LIBRARY_LIBS) Makefile +$(BUILD_DATE): FORCE + $(RM) $@ + $(PERL) gbdate.pl > $@ + diff --git a/layout/build/makefile.win b/layout/build/makefile.win index c80fe3c2282..a7dc85ae395 100644 --- a/layout/build/makefile.win +++ b/layout/build/makefile.win @@ -28,6 +28,8 @@ MODULE=raptor REQUIRES=xpcom raptor dom js IS_COMPONENT = 1 +BUILD_DATE=gbdate.h + CPPSRCS=dlldeps.cpp nsLayoutDLF.cpp nsLayoutFactory.cpp CPP_OBJS= \ @@ -37,7 +39,7 @@ CPP_OBJS= \ .\$(OBJDIR)\nsLayoutModule.obj \ $(NULL) -EXPORTS=nsLayoutCID.h +EXPORTS=nsLayoutCID.h $(BUILD_DATE) MAKE_OBJ_TYPE = DLL @@ -108,3 +110,7 @@ install:: $(DLL) clobber:: rm -f $(DIST)\bin\$(DLLNAME).dll rm -f $(DIST)\lib\$(DLLNAME).lib + +$(BUILD_DATE):: + rm -f $@ + $(PERL) gbdate.pl > $@ diff --git a/layout/build/nsLayoutModule.cpp b/layout/build/nsLayoutModule.cpp index 7410362b670..176f8b137d5 100644 --- a/layout/build/nsLayoutModule.cpp +++ b/layout/build/nsLayoutModule.cpp @@ -63,7 +63,11 @@ #include "nsIServiceManager.h" #include "nsTextTransformer.h" +#include "nsIHTTPProtocolHandler.h" +#include "gbdate.h" +#define PRODUCT_NAME "Gecko" +static NS_DEFINE_CID(kHTTPHandlerCID, NS_IHTTPHANDLER_CID); static nsLayoutModule *gModule = NULL; extern "C" NS_EXPORT nsresult NSGetModule(nsIComponentManager *servMgr, @@ -223,6 +227,8 @@ nsLayoutModule::Initialize() } } + SetUserAgent(); + rv = nsTextTransformer::Initialize(); if (NS_FAILED(rv)) { return rv; @@ -413,3 +419,20 @@ nsLayoutModule::CanUnload(nsIComponentManager *aCompMgr, PRBool *okToUnload) *okToUnload = PR_FALSE; return NS_ERROR_FAILURE; } + +void +nsLayoutModule::SetUserAgent( void ) +{ + nsString productName(PRODUCT_NAME), productVersion(PRODUCT_VERSION); + nsresult rv = nsnull; + + nsCOMPtr theService(do_GetService(kHTTPHandlerCID, + &rv)); + + if( NS_SUCCEEDED(rv) && (nsnull != theService) ) + { + rv = theService->SetProduct(productName.GetUnicode()); + + rv = theService->SetProductSub(productVersion.GetUnicode()); + } +} diff --git a/layout/build/nsLayoutModule.h b/layout/build/nsLayoutModule.h index 66107133174..d73d38e7071 100644 --- a/layout/build/nsLayoutModule.h +++ b/layout/build/nsLayoutModule.h @@ -50,6 +50,8 @@ protected: void UnregisterDocumentFactories(nsIComponentManager* aCompMgr, nsIFile* aPath); + void SetUserAgent(); + PRBool mInitialized; // static nsIFactory* gFactory; static nsIScriptNameSetRegistry* gRegistry;