Bug 1371893 - Backed out changeset 4ff3727aec0f as experiment to see whether it's related to crash in bug 1408175. a=jorgk
authorJorg K <jorgk@jorgk.com>
Sat, 14 Oct 2017 11:50:53 +0200
changeset 29179 e570d6d99079220e5b11035dd26910d3c9448886
parent 29178 1e0d2de710f53e8d4b8dd4c34ba7ff7629f1a7e7
child 29180 ea5c170b3d95e3a1664858a94fc3423ce5999c5c
push id2068
push userclokep@gmail.com
push dateMon, 13 Nov 2017 19:02:14 +0000
treeherdercomm-beta@9c7e7ce8672b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjorgk
bugs1371893, 1408175
Bug 1371893 - Backed out changeset 4ff3727aec0f as experiment to see whether it's related to crash in bug 1408175. a=jorgk
calendar/base/backend/libical/calICSService.cpp
mailnews/addrbook/src/nsAddbookProtocolHandler.cpp
mailnews/base/util/nsMsgUtils.cpp
mailnews/imap/src/nsImapMailFolder.cpp
--- a/calendar/base/backend/libical/calICSService.cpp
+++ b/calendar/base/backend/libical/calICSService.cpp
@@ -996,25 +996,26 @@ NS_IMETHODIMP
 calIcalComponent::SerializeToICSStream(nsIInputStream **aStreamResult)
 {
     NS_ENSURE_ARG_POINTER(aStreamResult);
 
     char *icalstr;
     nsresult rv = Serialize(&icalstr);
     NS_ENSURE_SUCCESS(rv, rv);
 
-    nsCOMPtr<nsIStringInputStream> aStringStream(
+    nsCOMPtr<nsIStringInputStream> const aStringStream(
         do_CreateInstance(NS_STRINGINPUTSTREAM_CONTRACTID, &rv));
     NS_ENSURE_SUCCESS(rv, rv);
     // copies the string into the input stream that's handed back.
     // This copy is necessary because we don't really own icalstr;
     // it's one of libical's ring buffers
     rv = aStringStream->SetData(icalstr, -1);
     NS_ENSURE_SUCCESS(rv, rv);
-    return CallQueryInterface(aStringStream, aStreamResult);
+    NS_ADDREF(*aStreamResult = aStringStream);
+    return rv;
 }
 
 nsresult
 calIcalComponent::Serialize(char **icalstr)
 {
     NS_ENSURE_ARG_POINTER(icalstr);
 
     // add the timezone bits
--- a/mailnews/addrbook/src/nsAddbookProtocolHandler.cpp
+++ b/mailnews/addrbook/src/nsAddbookProtocolHandler.cpp
@@ -22,17 +22,16 @@
 #include "nsITreeView.h"
 #include "nsIStringBundle.h"
 #include "nsIServiceManager.h"
 #include "mozilla/Services.h"
 #include "nsIAsyncInputStream.h"
 #include "nsIAsyncOutputStream.h"
 #include "nsIPipe.h"
 #include "nsIPrincipal.h"
-#include "nsIInputStream.h"
 
 nsAddbookProtocolHandler::nsAddbookProtocolHandler()
 {
   mAddbookOperation = nsIAddbookUrlOperation::InvalidUrl;
 }
 
 nsAddbookProtocolHandler::~nsAddbookProtocolHandler()
 {
@@ -95,35 +94,34 @@ nsAddbookProtocolHandler::GenerateXMLOut
   nsCOMPtr<nsIStringInputStream> inStr(do_CreateInstance("@mozilla.org/io/string-input-stream;1", &rv));
   NS_ENSURE_SUCCESS(rv, rv);
 
   NS_ConvertUTF16toUTF8 utf8String(aOutput.get());
 
   rv = inStr->SetData(utf8String.get(), utf8String.Length());
   NS_ENSURE_SUCCESS(rv, rv);
 
-  nsCOMPtr<nsIInputStream> stream(do_QueryInterface(inStr));
   if (aLoadInfo) {
     return NS_NewInputStreamChannelInternal(_retval,
                                             aURI,
-                                            stream,
+                                            inStr,
                                             NS_LITERAL_CSTRING("text/xml"),
                                             EmptyCString(),
                                             aLoadInfo);
   }
 
   nsCOMPtr<nsIPrincipal> nullPrincipal =
     do_CreateInstance("@mozilla.org/nullprincipal;1", &rv);
   NS_ASSERTION(NS_SUCCEEDED(rv), "CreateInstance of nullprincipalfailed.");
   if (NS_FAILED(rv))
       return rv;
 
   return NS_NewInputStreamChannel(_retval,
                                   aURI,
-                                  stream,
+                                  inStr,
                                   nullPrincipal,
                                   nsILoadInfo::SEC_ALLOW_CROSS_ORIGIN_DATA_IS_NULL,
                                   nsIContentPolicy::TYPE_OTHER,
                                   NS_LITERAL_CSTRING("text/xml"));
 }
 
 NS_IMETHODIMP
 nsAddbookProtocolHandler::NewChannel(nsIURI *aURI, nsIChannel **_retval)
--- a/mailnews/base/util/nsMsgUtils.cpp
+++ b/mailnews/base/util/nsMsgUtils.cpp
@@ -72,17 +72,16 @@
 #include "nsIParserUtils.h"
 #include "nsICharsetConverterManager.h"
 #include "nsIDocumentEncoder.h"
 #include "mozilla/ArrayUtils.h"
 #include "mozilla/Services.h"
 #include "locale.h"
 #include "nsStringStream.h"
 #include "nsIInputStreamPump.h"
-#include "nsIInputStream.h"
 #include "nsIChannel.h"
 
 /* for logging to Error Console */
 #include "nsIScriptError.h"
 #include "nsIConsoleService.h"
 
 // Log an error string to the error console
 // (adapted from nsContentUtils::LogSimpleConsoleError).
@@ -1919,20 +1918,18 @@ MsgStreamMsgHeaders(nsIInputStream *aInp
     msgHeaders.Append(curLine);
     msgHeaders.AppendLiteral("\r\n");
   }
   lineBuffer = nullptr;
   nsCOMPtr<nsIStringInputStream> hdrsStream =
         do_CreateInstance("@mozilla.org/io/string-input-stream;1", &rv);
   NS_ENSURE_SUCCESS(rv, rv);
   hdrsStream->SetData(msgHeaders.get(), msgHeaders.Length());
-  nsCOMPtr<nsIInputStream> stream(do_QueryInterface(hdrsStream));
-
   nsCOMPtr<nsIInputStreamPump> pump;
-  rv = NS_NewInputStreamPump(getter_AddRefs(pump), stream);
+  rv = NS_NewInputStreamPump(getter_AddRefs(pump), hdrsStream);
   NS_ENSURE_SUCCESS(rv, rv);
 
   return pump->AsyncRead(aConsumer, nullptr);
 }
 
 class CharsetDetectionObserver : public nsICharsetDetectionObserver
 {
 public:
--- a/mailnews/imap/src/nsImapMailFolder.cpp
+++ b/mailnews/imap/src/nsImapMailFolder.cpp
@@ -2938,20 +2938,18 @@ NS_IMETHODIMP nsImapMailFolder::ParseMsg
       nsCOMPtr <nsIMsgDBHdr> msgHdr;
       headerInfo->GetMsgHdrs(&msgHdrs);
       // create an input stream based on the hdr string.
       nsCOMPtr<nsIStringInputStream> inputStream =
             do_CreateInstance("@mozilla.org/io/string-input-stream;1", &rv);
       NS_ENSURE_SUCCESS(rv, rv);
       inputStream->ShareData(msgHdrs, strlen(msgHdrs));
       GetMessageHeader(msgKey, getter_AddRefs(msgHdr));
-      if (msgHdr) {
-        nsCOMPtr<nsIInputStream> stream(do_QueryInterface(inputStream));
-        GetMsgPreviewTextFromStream(msgHdr, stream);
-      }
+      if (msgHdr)
+        GetMsgPreviewTextFromStream(msgHdr, inputStream);
       continue;
     }
     if (mDatabase && NS_SUCCEEDED(mDatabase->ContainsKey(msgKey, &containsKey)) && containsKey)
     {
       NS_ERROR("downloading hdrs for hdr we already have");
       continue;
     }
     nsresult rv = SetupHeaderParseStream(msgSize, EmptyCString(), nullptr);