mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 21:31:04 +00:00
Bug 1749935 - Remove unused NS_PARSER_FLAG_OBSERVERS_ENABLED and NS_PARSER_FLAG_FLUSH_TOKENS. r=hsivonen
Differential Revision: https://phabricator.services.mozilla.com/D135842
This commit is contained in:
parent
dbcebc9c00
commit
2021662efc
@ -1228,7 +1228,7 @@ void nsExpatDriver::ParseBuffer(const char16_t* aBuffer, uint32_t aLength,
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsExpatDriver::ConsumeToken(nsScanner& aScanner, bool& aFlushTokens) {
|
||||
nsExpatDriver::ConsumeToken(nsScanner& aScanner) {
|
||||
// We keep the scanner pointing to the position where Expat will start
|
||||
// parsing.
|
||||
nsScannerIterator currentExpatPosition;
|
||||
|
@ -46,7 +46,6 @@ nsresult nsHTMLTokenizer::WillTokenize(bool aIsFinalChunk) { return NS_OK; }
|
||||
* reach a <script>).
|
||||
* @return Success or error
|
||||
*/
|
||||
nsresult nsHTMLTokenizer::ConsumeToken(nsScanner& aScanner,
|
||||
bool& aFlushTokens) {
|
||||
nsresult nsHTMLTokenizer::ConsumeToken(nsScanner& aScanner) {
|
||||
return NS_ERROR_HTMLPARSER_EOF;
|
||||
}
|
||||
|
@ -32,13 +32,13 @@ class nsITokenizer : public nsISupports {
|
||||
NS_DECLARE_STATIC_IID_ACCESSOR(NS_ITOKENIZER_IID)
|
||||
|
||||
NS_IMETHOD WillTokenize(bool aIsFinalChunk) = 0;
|
||||
NS_IMETHOD ConsumeToken(nsScanner& aScanner, bool& aFlushTokens) = 0;
|
||||
NS_IMETHOD ConsumeToken(nsScanner& aScanner) = 0;
|
||||
};
|
||||
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(nsITokenizer, NS_ITOKENIZER_IID)
|
||||
|
||||
#define NS_DECL_NSITOKENIZER \
|
||||
NS_IMETHOD WillTokenize(bool aIsFinalChunk) override; \
|
||||
NS_IMETHOD ConsumeToken(nsScanner& aScanner, bool& aFlushTokens) override;
|
||||
NS_IMETHOD ConsumeToken(nsScanner& aScanner) override;
|
||||
|
||||
#endif
|
||||
|
@ -37,10 +37,8 @@
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
#define NS_PARSER_FLAG_OBSERVERS_ENABLED 0x00000004
|
||||
#define NS_PARSER_FLAG_PENDING_CONTINUE_EVENT 0x00000008
|
||||
#define NS_PARSER_FLAG_FLUSH_TOKENS 0x00000020
|
||||
#define NS_PARSER_FLAG_CAN_TOKENIZE 0x00000040
|
||||
#define NS_PARSER_FLAG_PENDING_CONTINUE_EVENT 0x00000001
|
||||
#define NS_PARSER_FLAG_CAN_TOKENIZE 0x00000002
|
||||
|
||||
//-------------- Begin ParseContinue Event Definition ------------------------
|
||||
/*
|
||||
@ -137,7 +135,7 @@ void nsParser::Initialize(bool aConstructor) {
|
||||
mStreamStatus = NS_OK;
|
||||
mCommand = eViewNormal;
|
||||
mBlocked = 0;
|
||||
mFlags = NS_PARSER_FLAG_OBSERVERS_ENABLED | NS_PARSER_FLAG_CAN_TOKENIZE;
|
||||
mFlags = NS_PARSER_FLAG_CAN_TOKENIZE;
|
||||
|
||||
mProcessingNetworkData = false;
|
||||
mIsAboutBlank = false;
|
||||
@ -786,9 +784,6 @@ nsParser::ParseFragment(const nsAString& aSourceBuffer,
|
||||
uint32_t theCount = aTagStack.Length();
|
||||
uint32_t theIndex = 0;
|
||||
|
||||
// Disable observers for fragments
|
||||
mFlags &= ~NS_PARSER_FLAG_OBSERVERS_ENABLED;
|
||||
|
||||
for (theIndex = 0; theIndex < theCount; theIndex++) {
|
||||
theContext.Append('<');
|
||||
theContext.Append(aTagStack[theCount - theIndex - 1]);
|
||||
@ -805,7 +800,6 @@ nsParser::ParseFragment(const nsAString& aSourceBuffer,
|
||||
// pass false for the aLastCall parameter.
|
||||
result = Parse(theContext, (void*)&theContext, false);
|
||||
if (NS_FAILED(result)) {
|
||||
mFlags |= NS_PARSER_FLAG_OBSERVERS_ENABLED;
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -855,8 +849,6 @@ nsParser::ParseFragment(const nsAString& aSourceBuffer,
|
||||
}
|
||||
}
|
||||
|
||||
mFlags |= NS_PARSER_FLAG_OBSERVERS_ENABLED;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -1368,15 +1360,12 @@ nsresult nsParser::Tokenize(bool aIsFinalChunk) {
|
||||
}
|
||||
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
bool flushTokens = false;
|
||||
|
||||
bool killSink = false;
|
||||
|
||||
WillTokenize(aIsFinalChunk);
|
||||
while (NS_SUCCEEDED(result)) {
|
||||
mParserContext->mScanner->Mark();
|
||||
result =
|
||||
theTokenizer->ConsumeToken(*mParserContext->mScanner, flushTokens);
|
||||
result = theTokenizer->ConsumeToken(*mParserContext->mScanner);
|
||||
if (NS_FAILED(result)) {
|
||||
mParserContext->mScanner->RewindToMark();
|
||||
if (NS_ERROR_HTMLPARSER_EOF == result) {
|
||||
@ -1387,13 +1376,6 @@ nsresult nsParser::Tokenize(bool aIsFinalChunk) {
|
||||
result = Terminate();
|
||||
break;
|
||||
}
|
||||
} else if (flushTokens && (mFlags & NS_PARSER_FLAG_OBSERVERS_ENABLED)) {
|
||||
// I added the extra test of NS_PARSER_FLAG_OBSERVERS_ENABLED to fix
|
||||
// Bug# 23931. Flush tokens on seeing </SCRIPT> -- Ref: Bug# 22485 --
|
||||
// Also remember to update the marked position.
|
||||
mFlags |= NS_PARSER_FLAG_FLUSH_TOKENS;
|
||||
mParserContext->mScanner->Mark();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user