Remove the obsolete concept of "DTD verification". bug 323958, r+sr=jst

This commit is contained in:
mrbkap%gmail.com 2006-01-30 23:45:19 +00:00
Родитель e1a7d2ce41
Коммит c4f20f9306
18 изменённых файлов: 23 добавлений и 56 удалений

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

@ -498,7 +498,7 @@ nsFeedLoadListener::ParseHTMLFragment(nsAString &aFragString,
// parse the fragment
parser->SetContentSink(sink);
parser->Parse(aFragString, (void*)0, NS_LITERAL_CSTRING("text/html"), PR_FALSE, PR_TRUE, eDTDMode_fragment);
parser->Parse(aFragString, (void*)0, NS_LITERAL_CSTRING("text/html"), PR_TRUE, eDTDMode_fragment);
// get the fragment node
nsCOMPtr<nsIDOMDocumentFragment> contextfrag;
rv = fragSink->GetFragment(getter_AddRefs(contextfrag));

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

@ -906,7 +906,7 @@ nsNavBookmarks::ImportBookmarksHTMLInternal(nsIURI* aURL,
NS_ENSURE_SUCCESS(rv, rv);
// init parser
rv = parser->Parse(aURL, nsnull, PR_FALSE);
rv = parser->Parse(aURL, nsnull);
NS_ENSURE_SUCCESS(rv, rv);
// feed the parser the data

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

@ -948,7 +948,7 @@ nsHTMLDocument::StartDocumentLoad(const char* aCommand,
mParser->SetContentSink(sink);
// parser the content of the URI
mParser->Parse(uri, nsnull, PR_FALSE, (void *)this);
mParser->Parse(uri, nsnull, (void *)this);
}
return rv;
@ -2148,11 +2148,10 @@ nsHTMLDocument::Close()
if (mContentType.EqualsLiteral("text/html")) {
rv = mParser->Parse(NS_LITERAL_STRING("</HTML>"),
mParser->GetRootContextKey(),
mContentType, PR_FALSE,
PR_TRUE);
mContentType, PR_TRUE);
} else {
rv = mParser->Parse(EmptyString(), mParser->GetRootContextKey(),
mContentType, PR_FALSE, PR_TRUE);
mContentType, PR_TRUE);
}
--mWriteLevel;
@ -2252,11 +2251,11 @@ nsHTMLDocument::WriteCommon(const nsAString& aText,
// why pay that price when we don't need to?
if (aNewlineTerminate) {
rv = mParser->Parse(aText + new_line,
key, mContentType, PR_FALSE,
key, mContentType,
(mWriteState == eNotWriting || (mWriteLevel > 1)));
} else {
rv = mParser->Parse(aText,
key, mContentType, PR_FALSE,
key, mContentType,
(mWriteState == eNotWriting || (mWriteLevel > 1)));
}

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

@ -620,7 +620,7 @@ nsXMLDocument::StartDocumentLoad(const char* aCommand,
mParser->SetDocumentCharset(charset, charsetSource);
mParser->SetCommand(aCommand);
mParser->SetContentSink(sink);
mParser->Parse(aUrl, nsnull, PR_FALSE, (void *)this);
mParser->Parse(aUrl, nsnull, (void *)this);
return NS_OK;
}

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

@ -2553,7 +2553,7 @@ nsresult nsHTMLEditor::ParseFragment(const nsAString & aFragStr,
// parse the fragment
parser->SetContentSink(sink);
if (bContext)
parser->Parse(aFragStr, (void*)0, NS_LITERAL_CSTRING("text/html"), PR_FALSE, PR_TRUE, eDTDMode_fragment);
parser->Parse(aFragStr, (void*)0, NS_LITERAL_CSTRING("text/html"), PR_TRUE, eDTDMode_fragment);
else
parser->ParseFragment(aFragStr, 0, aTagStack, PR_FALSE, NS_LITERAL_CSTRING("text/html"), eDTDMode_quirks);
// get the fragment node

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

@ -192,7 +192,7 @@ ConvertBufToPlainText(nsString &aConBuf)
parser->SetContentSink(sink);
parser->Parse(aConBuf, 0, NS_LITERAL_CSTRING("text/html"), PR_FALSE, PR_TRUE);
parser->Parse(aConBuf, 0, NS_LITERAL_CSTRING("text/html"), PR_TRUE);
//
// Now if we get here, we need to get from ASCII text to

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

@ -5213,7 +5213,7 @@ nsresult nsMsgDBFolder::GetMsgPreviewTextFromStream(nsIMsgDBHdr *msgHdr, nsIInpu
nsAutoString msgBodyStr;
// need to do an appropriate conversion here.
msgBodyStr.AssignWithConversion(msgBody);
rv = parser->Parse(msgBodyStr, 0, NS_LITERAL_CSTRING("text/html"), PR_FALSE, PR_TRUE);
rv = parser->Parse(msgBodyStr, 0, NS_LITERAL_CSTRING("text/html"), PR_TRUE);
CopyUTF16toUTF8(bodyText, msgBody);
}
msgHdr->SetStringProperty("preview", msgBody.get());

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

@ -2072,7 +2072,7 @@ ConvertBufToPlainText(nsString &aConBuf, PRBool formatflowed /* = PR_FALSE */)
parser->SetContentSink(sink);
parser->Parse(aConBuf, 0, NS_LITERAL_CSTRING("text/html"), PR_FALSE, PR_TRUE);
parser->Parse(aConBuf, 0, NS_LITERAL_CSTRING("text/html"), PR_TRUE);
//
// Now if we get here, we need to get from ASCII text to
// UTF-8 format or there is a problem downstream...

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

@ -578,7 +578,7 @@ NS_IMETHODIMP nsMsgComposeService::GetParamsForMailto(nsIURI * aURI, nsIMsgCompo
sanSink->Initialize(&sanitizedBody, 0, NS_ConvertASCIItoUTF16(allowedTags));
parser->SetContentSink(sink);
rv = parser->Parse(rawBody, 0, NS_LITERAL_CSTRING("text/html"), PR_FALSE, PR_TRUE);
rv = parser->Parse(rawBody, 0, NS_LITERAL_CSTRING("text/html"), PR_TRUE);
if (NS_FAILED(rv))
{
// Something went horribly wrong with parsing for html format

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

@ -559,7 +559,7 @@ nsresult Tokenizer::stripHTML(const nsAString& inString, nsAString& outString)
parser->SetContentSink(sink);
return parser->Parse(inString, 0, NS_LITERAL_CSTRING("text/html"), PR_FALSE, PR_TRUE);
return parser->Parse(inString, 0, NS_LITERAL_CSTRING("text/html"), PR_TRUE);
}
void Tokenizer::tokenize(char* aText)

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

@ -2188,8 +2188,7 @@ HTML2Plaintext(const nsString& inString, nsString& outString,
parser->SetContentSink(sink);
rv = parser->Parse(inString, 0, NS_LITERAL_CSTRING("text/html"),
PR_FALSE, PR_TRUE);
rv = parser->Parse(inString, 0, NS_LITERAL_CSTRING("text/html"), PR_TRUE);
// Aah! How can NS_ERROR and NS_ABORT_IF_FALSE be no-ops in release builds???
if (NS_FAILED(rv))
@ -2248,8 +2247,7 @@ HTMLSanitize(const nsString& inString, nsString& outString,
parser->SetContentSink(sink);
rv = parser->Parse(inString, 0, NS_LITERAL_CSTRING("text/html"),
PR_FALSE, PR_TRUE);
rv = parser->Parse(inString, 0, NS_LITERAL_CSTRING("text/html"), PR_TRUE);
if (NS_FAILED(rv))
{
NS_ERROR("Parse() failed!");

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

@ -226,18 +226,15 @@ class nsIParser : public nsISupports {
NS_IMETHOD Parse(nsIURI* aURL,
nsIRequestObserver* aListener = nsnull,
PRBool aEnableVerify = PR_FALSE,
void* aKey = 0,
nsDTDMode aMode = eDTDMode_autodetect) = 0;
NS_IMETHOD Parse(nsIInputStream* aStream,
const nsACString& aMimeType,
PRBool aEnableVerify = PR_FALSE,
void* aKey = 0,
nsDTDMode aMode = eDTDMode_autodetect) = 0;
NS_IMETHOD Parse(const nsAString& aSourceBuffer,
void* aKey,
const nsACString& aMimeType,
PRBool aEnableVerify,
PRBool aLastCall,
nsDTDMode aMode = eDTDMode_autodetect) = 0;

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

@ -306,7 +306,7 @@ extern "C" NS_EXPORT int DebugRobot(
parser->SetContentSink(sink);
g_bReadyForNextUrl = PR_FALSE;
parser->Parse(url, nsnull,PR_TRUE);/* XXX hook up stream listener here! */
parser->Parse(url, nsnull);/* XXX hook up stream listener here! */
while (!g_bReadyForNextUrl) {
if (yieldProc != NULL) {
nsCAutoString spec;

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

@ -67,7 +67,6 @@
#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
#define NS_PARSER_FLAG_PENDING_CONTINUE_EVENT 0x00000008
@ -1249,7 +1248,6 @@ nsParser::SetCanInterrupt(PRBool aCanInterrupt)
NS_IMETHODIMP
nsParser::Parse(nsIURI* aURL,
nsIRequestObserver* aListener,
PRBool aVerifyEnabled,
void* aKey,
nsDTDMode aMode)
{
@ -1259,12 +1257,6 @@ nsParser::Parse(nsIURI* aURL,
nsresult result=kBadURL;
mObserver = aListener;
if (aVerifyEnabled) {
mFlags |= NS_PARSER_FLAG_DTD_VERIFICATION;
} else {
mFlags &= ~NS_PARSER_FLAG_DTD_VERIFICATION;
}
if (aURL) {
nsCAutoString spec;
nsresult rv = aURL->GetSpec(spec);
@ -1304,16 +1296,9 @@ nsParser::Parse(nsIURI* aURL,
NS_IMETHODIMP
nsParser::Parse(nsIInputStream* aStream,
const nsACString& aMimeType,
PRBool aVerifyEnabled,
void* aKey,
nsDTDMode aMode)
{
if (aVerifyEnabled) {
mFlags |= NS_PARSER_FLAG_DTD_VERIFICATION;
} else {
mFlags &= ~NS_PARSER_FLAG_DTD_VERIFICATION;
}
nsresult result = NS_ERROR_OUT_OF_MEMORY;
// Ok, time to create our tokenizer and begin the process
@ -1353,7 +1338,6 @@ NS_IMETHODIMP
nsParser::Parse(const nsAString& aSourceBuffer,
void* aKey,
const nsACString& aMimeType,
PRBool aVerifyEnabled,
PRBool aLastCall,
nsDTDMode aMode)
{
@ -1378,12 +1362,6 @@ nsParser::Parse(const nsAString& aSourceBuffer,
nsCOMPtr<nsIParser> kungFuDeathGrip(this);
if (aLastCall || !aSourceBuffer.IsEmpty() || !mUnusedInput.IsEmpty()) {
if (aVerifyEnabled) {
mFlags |= NS_PARSER_FLAG_DTD_VERIFICATION;
} else {
mFlags &= ~NS_PARSER_FLAG_DTD_VERIFICATION;
}
// Note: The following code will always find the parser context associated
// with the given key, even if that context has been suspended (e.g., for
// another document.write call). This doesn't appear to be exactly what IE
@ -1502,8 +1480,7 @@ nsParser::ParseFragment(const nsAString& aSourceBuffer,
// First, parse the context to build up the DTD's tag stack. Note that we
// pass PR_FALSE for the aLastCall parameter.
result = Parse(theContext, (void*)&theContext, aMimeType,
PR_FALSE, PR_FALSE, aMode);
result = Parse(theContext, (void*)&theContext, aMimeType, PR_FALSE, aMode);
if (NS_FAILED(result)) {
mFlags |= NS_PARSER_FLAG_OBSERVERS_ENABLED;
return result;
@ -1552,7 +1529,7 @@ nsParser::ParseFragment(const nsAString& aSourceBuffer,
// Now, parse the actual content. Note that this is the last call for HTML
// content, but for XML, we will want to build and parse the end tags.
result = Parse(aSourceBuffer, (void*)&theContext, aMimeType,
PR_FALSE, !aXMLMode, aMode);
!aXMLMode, aMode);
fragSink->DidBuildContent();
if (aXMLMode && NS_SUCCEEDED(result)) {
@ -1569,8 +1546,7 @@ nsParser::ParseFragment(const nsAString& aSourceBuffer,
endContext.AppendLiteral(">");
}
result = Parse(endContext, (void*)&theContext, aMimeType,
PR_FALSE, PR_TRUE, aMode);
result = Parse(endContext, (void*)&theContext, aMimeType, PR_TRUE, aMode);
}
mFlags |= NS_PARSER_FLAG_OBSERVERS_ENABLED;

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

@ -196,7 +196,6 @@ class nsParser : public nsIParser,
*/
NS_IMETHOD Parse(nsIURI* aURL,
nsIRequestObserver* aListener = nsnull,
PRBool aEnableVerify = PR_FALSE,
void* aKey = 0,
nsDTDMode aMode = eDTDMode_autodetect);
@ -208,7 +207,6 @@ class nsParser : public nsIParser,
*/
NS_IMETHOD Parse(nsIInputStream* aStream,
const nsACString& aMimeType,
PRBool aEnableVerify = PR_FALSE,
void* aKey = 0,
nsDTDMode aMode = eDTDMode_autodetect);
@ -221,7 +219,6 @@ class nsParser : public nsIParser,
NS_IMETHOD Parse(const nsAString& aSourceBuffer,
void* aKey,
const nsACString& aContentType,
PRBool aEnableVerify,
PRBool aLastCall,
nsDTDMode aMode = eDTDMode_autodetect);

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

@ -98,7 +98,7 @@ nsresult ParseData(char* anInputStream,char* anOutputStream) {
sink->SetOutputStream(out);
parser->SetContentSink(sink);
result = parser->Parse(stream, 0, NS_LITERAL_CSTRING("text/html"), PR_FALSE, PR_TRUE);
result = parser->Parse(stream, 0, NS_LITERAL_CSTRING("text/html"), PR_TRUE);
PR_Close(in);
PR_Close(out);

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

@ -101,7 +101,7 @@ nsresult GenerateBaselineFile(const char* aSourceFilename,const char* aBaselineF
// Parse the document, having the sink write the data to fp
parser->SetContentSink(sink);
rv = parser->Parse(inputURI, 0, PR_FALSE, 0, eDTDMode_unknown);
rv = parser->Parse(inputURI, 0, PR_FALSE, eDTDMode_unknown);
return rv;
}

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

@ -175,7 +175,7 @@ HTML2text(nsString& inString, nsString& inType, nsString& outType,
return NS_ERROR_NOT_IMPLEMENTED;
}
rv = parser->Parse(inString, 0, NS_LossyConvertUCS2toASCII(inType), PR_FALSE, PR_TRUE);
rv = parser->Parse(inString, 0, NS_LossyConvertUCS2toASCII(inType), PR_TRUE);
if (NS_FAILED(rv))
{
printf("Parse() failed! 0x%x\n", rv);