Bug 1440567 - Add non-null checks around assignment of warning report to preflight HTTP channel in nsCORSListenerProxy::StartCORSPreflight. r=dveditz
authorHonza Bambas <honzab.moz@firemni.cz>
Wed, 07 Mar 2018 08:03:00 -0500
changeset 406968 857cd5aebd4bb3b166bf37b56fb00d8f98dc6b64
parent 406967 77acafe9c8136da959a24c54b68d3975a2f36c7a
child 406969 2339a45e7261396ad5614a592c45dd65e6a3b127
push id100558
push userryanvm@gmail.com
push dateWed, 07 Mar 2018 20:25:13 +0000
treeherdermozilla-inbound@857cd5aebd4b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdveditz
bugs1440567
milestone60.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 1440567 - Add non-null checks around assignment of warning report to preflight HTTP channel in nsCORSListenerProxy::StartCORSPreflight. r=dveditz
netwerk/protocol/http/nsCORSListenerProxy.cpp
--- a/netwerk/protocol/http/nsCORSListenerProxy.cpp
+++ b/netwerk/protocol/http/nsCORSListenerProxy.cpp
@@ -1517,17 +1517,19 @@ nsCORSListenerProxy::StartCORSPreflight(
                      method, false);
   NS_ENSURE_SUCCESS(rv, rv);
 
   // Set the CORS preflight channel's warning reporter to be the same as the
   // requesting channel so that all log messages are able to be reported through
   // the warning reporter.
   RefPtr<nsHttpChannel> reqCh = do_QueryObject(aRequestChannel);
   RefPtr<nsHttpChannel> preCh = do_QueryObject(preHttp);
-  preCh->SetWarningReporter(reqCh->GetWarningReporter());
+  if (preCh && reqCh) { // there are other implementers of nsIHttpChannel
+    preCh->SetWarningReporter(reqCh->GetWarningReporter());
+  }
 
   nsTArray<nsCString> preflightHeaders;
   if (!aUnsafeHeaders.IsEmpty()) {
     for (uint32_t i = 0; i < aUnsafeHeaders.Length(); ++i) {
       preflightHeaders.AppendElement();
       ToLowerCase(aUnsafeHeaders[i], preflightHeaders[i]);
     }
     preflightHeaders.Sort();