зеркало из https://github.com/mozilla/pjs.git
#=27745
r=pollmann d=Adding Gecko user agent string.
This commit is contained in:
Родитель
8439797630
Коммит
26b333776d
|
@ -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 > $@
|
||||
|
||||
|
|
|
@ -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 > $@
|
||||
|
|
|
@ -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<nsIHTTPProtocolHandler> theService(do_GetService(kHTTPHandlerCID,
|
||||
&rv));
|
||||
|
||||
if( NS_SUCCEEDED(rv) && (nsnull != theService) )
|
||||
{
|
||||
rv = theService->SetProduct(productName.GetUnicode());
|
||||
|
||||
rv = theService->SetProductSub(productVersion.GetUnicode());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -50,6 +50,8 @@ protected:
|
|||
void UnregisterDocumentFactories(nsIComponentManager* aCompMgr,
|
||||
nsIFile* aPath);
|
||||
|
||||
void SetUserAgent();
|
||||
|
||||
PRBool mInitialized;
|
||||
// static nsIFactory* gFactory;
|
||||
static nsIScriptNameSetRegistry* gRegistry;
|
||||
|
|
Загрузка…
Ссылка в новой задаче