From af437476c2f9c729107eac11748da516dd74705e Mon Sep 17 00:00:00 2001 From: "rickg%netscape.com" Date: Tue, 23 Nov 1999 03:09:12 +0000 Subject: [PATCH] fixed bug18312; this isn't PDT+, but is something that Phil has been *really* anxious to have fixed. r=nisheeth --- htmlparser/src/nsParser.h | 3 ++- htmlparser/src/nsViewSourceHTML.cpp | 12 +++++++----- parser/htmlparser/src/nsParser.h | 3 ++- parser/htmlparser/src/nsViewSourceHTML.cpp | 12 +++++++----- 4 files changed, 18 insertions(+), 12 deletions(-) diff --git a/htmlparser/src/nsParser.h b/htmlparser/src/nsParser.h index 3cabb15f2118..c3a7aafea997 100644 --- a/htmlparser/src/nsParser.h +++ b/htmlparser/src/nsParser.h @@ -291,7 +291,7 @@ CLASS_EXPORT_HTMLPARS nsParser : public nsIParser, public nsIStreamListener { * @param * @return */ - CObserverService& GetObserverService(void) { return mObserverService; } + CObserverService* GetObserverService(void); protected: @@ -382,6 +382,7 @@ protected: nsCharsetSource mCharsetSource; nsresult mInternalState; CObserverService mObserverService; + PRBool mObserversEnabled; public: MOZ_TIMER_DECLARE(mParseTime) diff --git a/htmlparser/src/nsViewSourceHTML.cpp b/htmlparser/src/nsViewSourceHTML.cpp index a0f6e69feb56..16a9f3c20637 100644 --- a/htmlparser/src/nsViewSourceHTML.cpp +++ b/htmlparser/src/nsViewSourceHTML.cpp @@ -861,12 +861,14 @@ NS_IMETHODIMP CViewSourceHTML::HandleToken(CToken* aToken,nsIParser* aParser) { result=WriteTag(mStartTag,aToken,aToken->GetAttributeCount(),PR_TRUE); if((!mIsText) && mParser && (NS_OK==result)) { - CObserverService& theService=mParser->GetObserverService(); - CParserContext* pc=mParser->PeekContext(); - void* theDocID=(pc)? pc->mKey:0; - eHTMLTags theTag=(eHTMLTags)theToken->GetTypeID(); + CObserverService* theService=mParser->GetObserverService(); + if(theService) { + CParserContext* pc=mParser->PeekContext(); + void* theDocID=(pc)? pc->mKey:0; + eHTMLTags theTag=(eHTMLTags)theToken->GetTypeID(); - result=theService.Notify(theTag,theContext.mTokenNode,(PRUint32)theDocID,kViewSourceCommand,mParser); + result=theService->Notify(theTag,theContext.mTokenNode,(PRUint32)theDocID,kViewSourceCommand,mParser); + } } theContext.mTokenNode.Init(0,0,gTokenRecycler); //now recycle. break; diff --git a/parser/htmlparser/src/nsParser.h b/parser/htmlparser/src/nsParser.h index 3cabb15f2118..c3a7aafea997 100644 --- a/parser/htmlparser/src/nsParser.h +++ b/parser/htmlparser/src/nsParser.h @@ -291,7 +291,7 @@ CLASS_EXPORT_HTMLPARS nsParser : public nsIParser, public nsIStreamListener { * @param * @return */ - CObserverService& GetObserverService(void) { return mObserverService; } + CObserverService* GetObserverService(void); protected: @@ -382,6 +382,7 @@ protected: nsCharsetSource mCharsetSource; nsresult mInternalState; CObserverService mObserverService; + PRBool mObserversEnabled; public: MOZ_TIMER_DECLARE(mParseTime) diff --git a/parser/htmlparser/src/nsViewSourceHTML.cpp b/parser/htmlparser/src/nsViewSourceHTML.cpp index a0f6e69feb56..16a9f3c20637 100644 --- a/parser/htmlparser/src/nsViewSourceHTML.cpp +++ b/parser/htmlparser/src/nsViewSourceHTML.cpp @@ -861,12 +861,14 @@ NS_IMETHODIMP CViewSourceHTML::HandleToken(CToken* aToken,nsIParser* aParser) { result=WriteTag(mStartTag,aToken,aToken->GetAttributeCount(),PR_TRUE); if((!mIsText) && mParser && (NS_OK==result)) { - CObserverService& theService=mParser->GetObserverService(); - CParserContext* pc=mParser->PeekContext(); - void* theDocID=(pc)? pc->mKey:0; - eHTMLTags theTag=(eHTMLTags)theToken->GetTypeID(); + CObserverService* theService=mParser->GetObserverService(); + if(theService) { + CParserContext* pc=mParser->PeekContext(); + void* theDocID=(pc)? pc->mKey:0; + eHTMLTags theTag=(eHTMLTags)theToken->GetTypeID(); - result=theService.Notify(theTag,theContext.mTokenNode,(PRUint32)theDocID,kViewSourceCommand,mParser); + result=theService->Notify(theTag,theContext.mTokenNode,(PRUint32)theDocID,kViewSourceCommand,mParser); + } } theContext.mTokenNode.Init(0,0,gTokenRecycler); //now recycle. break;