Bug 1310156 - Add a null check to nsExpatDriver::HandleError to prevent crashes while determining whether to suppress console error messages. r=smaug
authorThomas Wisniewski <wisniewskit@gmail.com>
Fri, 14 Oct 2016 18:41:08 -0400
changeset 318145 daf6fc1090f7845e08c8a1b39c218fc4c8f7f5c5
parent 318144 a26cfff8041b76769b39fa78d4502b6d469f4cb2
child 318146 3c83a34f913ad840252fba1eda31d656388179c4
push id33211
push usercbook@mozilla.com
push dateMon, 17 Oct 2016 09:38:38 +0000
treeherderautoland@e4ef6fa03aa8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs1310156
milestone52.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 1310156 - Add a null check to nsExpatDriver::HandleError to prevent crashes while determining whether to suppress console error messages. r=smaug
parser/htmlparser/nsExpatDriver.cpp
--- a/parser/htmlparser/nsExpatDriver.cpp
+++ b/parser/htmlparser/nsExpatDriver.cpp
@@ -964,19 +964,21 @@ nsExpatDriver::HandleError()
                             sourceText.get(), 
                             serr, 
                             &shouldReportError);
     if (NS_FAILED(rv)) {
       shouldReportError = true;
     }
   }
 
-  nsCOMPtr<nsIDocument> doc = do_QueryInterface(mOriginalSink->GetTarget());
-  if (doc && doc->SuppressParserErrorConsoleMessages()) {
-    shouldReportError = false;
+  if (mOriginalSink) {
+    nsCOMPtr<nsIDocument> doc = do_QueryInterface(mOriginalSink->GetTarget());
+    if (doc && doc->SuppressParserErrorConsoleMessages()) {
+      shouldReportError = false;
+    }
   }
 
   if (shouldReportError) {
     nsCOMPtr<nsIConsoleService> cs
       (do_GetService(NS_CONSOLESERVICE_CONTRACTID));  
     if (cs) {
       cs->LogMessage(serr);
     }