Bug 849597 - Add more kung fu to nsParser. r=smaug.
authorHenri Sivonen <hsivonen@iki.fi>
Fri, 05 Apr 2013 15:36:16 +0300
changeset 127795 905671d954c58534ec4b2c3a28db568c563b79e2
parent 127794 624ff603f70cb17d0664eb7b23deabdf12949a2c
child 127796 1740631994daf663573763f3843b2e33c9850945
push id24512
push userryanvm@gmail.com
push dateFri, 05 Apr 2013 20:13:49 +0000
treeherdermozilla-central@139b6ba547fa [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs849597
milestone23.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 849597 - Add more kung fu to nsParser. r=smaug.
parser/htmlparser/src/nsParser.cpp
--- a/parser/htmlparser/src/nsParser.cpp
+++ b/parser/htmlparser/src/nsParser.cpp
@@ -1094,16 +1094,17 @@ nsParser::ContinueInterruptedParsing()
   }
 
   // If the stream has already finished, there's a good chance
   // that we might start closing things down when the parser
   // is reenabled. To make sure that we're not deleted across
   // the reenabling process, hold a reference to ourselves.
   nsresult result=NS_OK;
   nsCOMPtr<nsIParser> kungFuDeathGrip(this);
+  nsCOMPtr<nsIContentSink> sinkDeathGrip(mSink);
 
 #ifdef DEBUG
   if (!(mFlags & NS_PARSER_FLAG_PARSER_ENABLED)) {
     NS_WARNING("Don't call ContinueInterruptedParsing on a blocked parser.");
   }
 #endif
 
   bool isFinalChunk = mParserContext &&
@@ -1904,16 +1905,18 @@ nsParser::OnDataAvailable(nsIRequest *re
     if (NS_FAILED(rv)) {
       return rv;
     }
 
     // Don't bother to start parsing until we've seen some
     // non-whitespace data
     if (IsOkToProcessNetworkData() &&
         theContext->mScanner->FirstNonWhitespacePosition() >= 0) {
+      nsCOMPtr<nsIParser> kungFuDeathGrip(this);
+      nsCOMPtr<nsIContentSink> sinkDeathGrip(mSink);
       mProcessingNetworkData = true;
       if (mSink) {
         mSink->WillParse();
       }
       rv = ResumeParse();
       mProcessingNetworkData = false;
     }
   } else {