Adding the ablity to disable view source. r=bz,sr=darin,b=199335

This commit is contained in:
dougt%meer.net 2003-07-30 02:39:05 +00:00
Родитель eb7af66602
Коммит e8c9880a8b
13 изменённых файлов: 65 добавлений и 20 удалений

Просмотреть файл

@ -87,6 +87,7 @@ ENABLE_TESTS = @ENABLE_TESTS@
IBMBIDI = @IBMBIDI@
SUNCTL = @SUNCTL@
ACCESSIBILITY = @ACCESSIBILITY@
MOZ_VIEW_SOURCE = @MOZ_VIEW_SOURCE@
MOZ_XPINSTALL = @MOZ_XPINSTALL@
MOZ_JSLOADER = @MOZ_JSLOADER@
MOZ_USE_NATIVE_UCONV = @MOZ_USE_NATIVE_UCONV@

Просмотреть файл

@ -3436,6 +3436,19 @@ MOZ_ARG_ENABLE_BOOL(ctl,
SUNCTL=1,
SUNCTL= )
dnl ========================================================
dnl view source support on by default
dnl ========================================================
MOZ_VIEW_SOURCE=1
MOZ_ARG_DISABLE_BOOL(view-source,
[ --disable-view-source Disable view source support],
MOZ_VIEW_SOURCE=,
MOZ_VIEW_SOURCE=1 )
if test "$MOZ_VIEW_SOURCE"; then
AC_DEFINE(MOZ_VIEW_SOURCE)
fi
dnl ========================================================
dnl accessibility support on by default
dnl ========================================================
@ -5065,6 +5078,7 @@ AC_SUBST(IBMBIDI)
AC_SUBST(SUNCTL)
AC_SUBST(ACCESSIBILITY)
AC_SUBST(MOZ_XPINSTALL)
AC_SUBST(MOZ_VIEW_SOURCE)
AC_SUBST(MOZ_SINGLE_PROFILE)
AC_SUBST(MOZ_XPFE_COMPONENTS)
AC_SUBST(MOZ_USER_DIR)

Просмотреть файл

@ -58,7 +58,6 @@
#include "nsDTDUtils.h"
#include "nsHTMLTokenizer.h"
#include "nsTime.h"
#include "nsViewSourceHTML.h"
#include "nsParserNode.h"
#include "nsHTMLEntities.h"
#include "nsLinebreakConverter.h"

Просмотреть файл

@ -55,7 +55,6 @@
#include "nsDTDUtils.h"
#include "nsHTMLTokenizer.h"
#include "nsTime.h"
#include "nsViewSourceHTML.h"
#include "nsParserNode.h"
#include "nsHTMLEntities.h"
#include "nsLinebreakConverter.h"
@ -63,7 +62,6 @@
#include "prmem.h"
static NS_DEFINE_IID(kIHTMLContentSinkIID, NS_IHTML_CONTENT_SINK_IID);
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
static NS_DEFINE_IID(kIDTDIID, NS_IDTD_IID);
@ -299,7 +297,7 @@ COtherDTD::CanParse(CParserContext& aParserContext, const nsString& aBuffer,
}
}
}
}
}
return result;
}

Просмотреть файл

@ -1,4 +1,3 @@
#
# The contents of this file are subject to the Netscape Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
@ -74,10 +73,15 @@ CPPSRCS = \
nsParserNode.cpp \
nsScanner.cpp \
nsToken.cpp \
nsViewSourceHTML.cpp\
nsParserMsgUtils.cpp\
$(NULL)
ifdef MOZ_VIEW_SOURCE
CPPSRCS += \
nsViewSourceHTML.cpp \
$(NULL)
endif
ifdef MOZ_DEBUG
CPPSRCS += \
nsLoggingSink.cpp \

Просмотреть файл

@ -48,7 +48,6 @@
#include "nsCRT.h"
#include "nsScanner.h"
#include "plstr.h"
#include "nsViewSourceHTML.h"
#include "nsIStringStream.h"
#include "nsIChannel.h"
#include "nsICachingChannel.h"
@ -67,6 +66,10 @@
#include "nsIServiceManager.h"
//#define rickgdebug
#ifdef MOZ_VIEW_SOURCE
#include "nsViewSourceHTML.h"
#endif
#define NS_PARSER_FLAG_DTD_VERIFICATION 0x00000001
#define NS_PARSER_FLAG_PARSER_ENABLED 0x00000002
#define NS_PARSER_FLAG_OBSERVERS_ENABLED 0x00000004
@ -1154,6 +1157,7 @@ FindSuitableDTD(CParserContext& aParserContext,
sharedObjects->mDTDDeque.Push(theDTD);
sharedObjects->mHasXMLDTD = PR_TRUE;
}
#ifdef MOZ_VIEW_SOURCE
else if (!sharedObjects->mHasViewSourceDTD) {
rv = NS_NewViewSourceHTML(&theDTD); //do this so all non-html files can be viewed...
NS_ENSURE_SUCCESS(rv, rv);
@ -1161,6 +1165,7 @@ FindSuitableDTD(CParserContext& aParserContext,
sharedObjects->mDTDDeque.Push(theDTD);
sharedObjects->mHasViewSourceDTD = PR_TRUE;
}
#endif
}
}

Просмотреть файл

@ -47,13 +47,16 @@
#include "nsParser.h"
#include "CNavDTD.h"
#include "COtherDTD.h"
#include "nsViewSourceHTML.h"
#include "nsHTMLEntities.h"
#include "nsHTMLTokenizer.h"
//#include "nsTextTokenizer.h"
#include "nsElementTable.h"
#include "nsParserService.h"
#ifdef MOZ_VIEW_SOURCE
#include "nsViewSourceHTML.h"
#endif
#ifdef NS_DEBUG
#include "nsLoggingSink.h"
#include "nsExpatDriver.h"
@ -69,9 +72,12 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(nsExpatDriver)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsParser)
NS_GENERIC_FACTORY_CONSTRUCTOR(CNavDTD)
NS_GENERIC_FACTORY_CONSTRUCTOR(CTransitionalDTD)
NS_GENERIC_FACTORY_CONSTRUCTOR(CViewSourceHTML)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsParserService)
#ifdef MOZ_VIEW_SOURCE
NS_GENERIC_FACTORY_CONSTRUCTOR(CViewSourceHTML)
#endif
static const nsModuleComponentInfo gComponents[] = {
#ifdef NS_DEBUG
@ -83,7 +89,9 @@ static const nsModuleComponentInfo gComponents[] = {
{ "Navigator HTML DTD", NS_CNAVDTD_CID, NULL, CNavDTDConstructor },
{ "Transitional DTD", NS_CTRANSITIONAL_DTD_CID, NULL,
CTransitionalDTDConstructor },
#ifdef MOZ_VIEW_SOURCE
{ "ViewSource DTD", NS_VIEWSOURCE_DTD_CID, NULL, CViewSourceHTMLConstructor },
#endif
{ "ParserService",
NS_PARSERSERVICE_CID,
NS_PARSER_CONTRACTID_PREFIX "/parser-service;1",

Просмотреть файл

@ -95,7 +95,9 @@ static const char* const gHTMLTypes[] = {
"text/css",
"text/javascript",
"application/x-javascript",
#ifdef MOZ_VIEW_SOURCE
"application/x-view-source", //XXX I wish I could just use nsMimeTypes.h here
#endif
"application/xhtml+xml",
0
};
@ -162,7 +164,7 @@ nsContentDLF::CreateInstance(const char* aCommand,
EnsureUAStyleSheet();
// Are we viewing source?
#ifdef MOZ_VIEW_SOURCE
nsCOMPtr<nsIViewSourceChannel> viewSourceChannel = do_QueryInterface(aChannel);
if (viewSourceChannel)
{
@ -212,7 +214,7 @@ nsContentDLF::CreateInstance(const char* aCommand,
aChannel->SetContentType(NS_LITERAL_CSTRING("text/plain"));
aContentType = "text/plain";
}
#endif
// Try html
int typeIndex=0;
while(gHTMLTypes[typeIndex]) {

Просмотреть файл

@ -58,7 +58,6 @@
#include "nsDTDUtils.h"
#include "nsHTMLTokenizer.h"
#include "nsTime.h"
#include "nsViewSourceHTML.h"
#include "nsParserNode.h"
#include "nsHTMLEntities.h"
#include "nsLinebreakConverter.h"

Просмотреть файл

@ -55,7 +55,6 @@
#include "nsDTDUtils.h"
#include "nsHTMLTokenizer.h"
#include "nsTime.h"
#include "nsViewSourceHTML.h"
#include "nsParserNode.h"
#include "nsHTMLEntities.h"
#include "nsLinebreakConverter.h"
@ -63,7 +62,6 @@
#include "prmem.h"
static NS_DEFINE_IID(kIHTMLContentSinkIID, NS_IHTML_CONTENT_SINK_IID);
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
static NS_DEFINE_IID(kIDTDIID, NS_IDTD_IID);
@ -299,7 +297,7 @@ COtherDTD::CanParse(CParserContext& aParserContext, const nsString& aBuffer,
}
}
}
}
}
return result;
}

Просмотреть файл

@ -1,4 +1,3 @@
#
# The contents of this file are subject to the Netscape Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
@ -74,10 +73,15 @@ CPPSRCS = \
nsParserNode.cpp \
nsScanner.cpp \
nsToken.cpp \
nsViewSourceHTML.cpp\
nsParserMsgUtils.cpp\
$(NULL)
ifdef MOZ_VIEW_SOURCE
CPPSRCS += \
nsViewSourceHTML.cpp \
$(NULL)
endif
ifdef MOZ_DEBUG
CPPSRCS += \
nsLoggingSink.cpp \

Просмотреть файл

@ -48,7 +48,6 @@
#include "nsCRT.h"
#include "nsScanner.h"
#include "plstr.h"
#include "nsViewSourceHTML.h"
#include "nsIStringStream.h"
#include "nsIChannel.h"
#include "nsICachingChannel.h"
@ -67,6 +66,10 @@
#include "nsIServiceManager.h"
//#define rickgdebug
#ifdef MOZ_VIEW_SOURCE
#include "nsViewSourceHTML.h"
#endif
#define NS_PARSER_FLAG_DTD_VERIFICATION 0x00000001
#define NS_PARSER_FLAG_PARSER_ENABLED 0x00000002
#define NS_PARSER_FLAG_OBSERVERS_ENABLED 0x00000004
@ -1154,6 +1157,7 @@ FindSuitableDTD(CParserContext& aParserContext,
sharedObjects->mDTDDeque.Push(theDTD);
sharedObjects->mHasXMLDTD = PR_TRUE;
}
#ifdef MOZ_VIEW_SOURCE
else if (!sharedObjects->mHasViewSourceDTD) {
rv = NS_NewViewSourceHTML(&theDTD); //do this so all non-html files can be viewed...
NS_ENSURE_SUCCESS(rv, rv);
@ -1161,6 +1165,7 @@ FindSuitableDTD(CParserContext& aParserContext,
sharedObjects->mDTDDeque.Push(theDTD);
sharedObjects->mHasViewSourceDTD = PR_TRUE;
}
#endif
}
}

Просмотреть файл

@ -47,13 +47,16 @@
#include "nsParser.h"
#include "CNavDTD.h"
#include "COtherDTD.h"
#include "nsViewSourceHTML.h"
#include "nsHTMLEntities.h"
#include "nsHTMLTokenizer.h"
//#include "nsTextTokenizer.h"
#include "nsElementTable.h"
#include "nsParserService.h"
#ifdef MOZ_VIEW_SOURCE
#include "nsViewSourceHTML.h"
#endif
#ifdef NS_DEBUG
#include "nsLoggingSink.h"
#include "nsExpatDriver.h"
@ -69,9 +72,12 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(nsExpatDriver)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsParser)
NS_GENERIC_FACTORY_CONSTRUCTOR(CNavDTD)
NS_GENERIC_FACTORY_CONSTRUCTOR(CTransitionalDTD)
NS_GENERIC_FACTORY_CONSTRUCTOR(CViewSourceHTML)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsParserService)
#ifdef MOZ_VIEW_SOURCE
NS_GENERIC_FACTORY_CONSTRUCTOR(CViewSourceHTML)
#endif
static const nsModuleComponentInfo gComponents[] = {
#ifdef NS_DEBUG
@ -83,7 +89,9 @@ static const nsModuleComponentInfo gComponents[] = {
{ "Navigator HTML DTD", NS_CNAVDTD_CID, NULL, CNavDTDConstructor },
{ "Transitional DTD", NS_CTRANSITIONAL_DTD_CID, NULL,
CTransitionalDTDConstructor },
#ifdef MOZ_VIEW_SOURCE
{ "ViewSource DTD", NS_VIEWSOURCE_DTD_CID, NULL, CViewSourceHTMLConstructor },
#endif
{ "ParserService",
NS_PARSERSERVICE_CID,
NS_PARSER_CONTRACTID_PREFIX "/parser-service;1",