Bug 1294645 - Don't use NS_CALLBACK for callbacks in nsI{Input,Output,UnicharInput},Stream.idl. r=froydnj.
authorNicholas Nethercote <nnethercote@mozilla.com>
Fri, 12 Aug 2016 17:36:22 +1000
changeset 352885 360df5276cf6e2d7294ce0e122952cf56bc5372e
parent 352884 b274d6e85690c468b5f97dce27c92835f2b8168d
child 352886 57c5749e5b19612638a3ab08027431e6346c538e
push id1324
push usermtabara@mozilla.com
push dateMon, 16 Jan 2017 13:07:44 +0000
treeherdermozilla-release@a01c49833940 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfroydnj
bugs1294645
milestone51.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 1294645 - Don't use NS_CALLBACK for callbacks in nsI{Input,Output,UnicharInput},Stream.idl. r=froydnj. Slightly less than half (93 / 210) of the NS_METHOD instances in the codebase are because of the use of NS_CALLBACK in nsI{Input,Output,UnicharInput},Stream.idl. The use of __stdcall on Win32 isn't important for these callbacks because they are only used as arguments to [noscript] methods. This patch converts them to vanilla |nsresult| functions. It increases the size of xul.dll by about ~600 bytes, which is about 0.001%.
browser/components/feeds/nsFeedSniffer.cpp
browser/components/feeds/nsFeedSniffer.h
docshell/base/nsDocShell.cpp
dom/base/EventSource.cpp
dom/base/EventSource.h
dom/base/FileReader.cpp
dom/flyweb/HttpServer.cpp
dom/flyweb/HttpServer.h
dom/media/MediaResource.cpp
dom/media/MediaResource.h
dom/media/WebVTTListener.cpp
dom/media/WebVTTListener.h
dom/security/ContentVerifier.cpp
dom/security/nsCSPContext.cpp
dom/xhr/XMLHttpRequestMainThread.cpp
dom/xhr/XMLHttpRequestMainThread.h
image/SourceBuffer.cpp
image/imgRequest.cpp
netwerk/base/MemoryDownloader.cpp
netwerk/base/MemoryDownloader.h
netwerk/base/nsBufferedStreams.cpp
netwerk/base/nsDownloader.cpp
netwerk/base/nsDownloader.h
netwerk/base/nsIncrementalStreamLoader.cpp
netwerk/base/nsIncrementalStreamLoader.h
netwerk/base/nsInputStreamPump.cpp
netwerk/base/nsMIMEInputStream.cpp
netwerk/base/nsSocketTransport2.cpp
netwerk/base/nsSocketTransport2.h
netwerk/base/nsStreamLoader.cpp
netwerk/base/nsStreamLoader.h
netwerk/base/nsUnicharStreamLoader.cpp
netwerk/base/nsUnicharStreamLoader.h
netwerk/protocol/about/nsAboutCacheEntry.cpp
netwerk/protocol/about/nsAboutCacheEntry.h
netwerk/protocol/http/PackagedAppService.cpp
netwerk/protocol/http/PackagedAppService.h
netwerk/protocol/http/PackagedAppVerifier.cpp
netwerk/protocol/http/PackagedAppVerifier.h
netwerk/protocol/http/nsHttpConnection.cpp
netwerk/protocol/http/nsHttpConnection.h
netwerk/protocol/http/nsHttpPipeline.cpp
netwerk/protocol/http/nsHttpPipeline.h
netwerk/protocol/http/nsHttpTransaction.cpp
netwerk/protocol/http/nsHttpTransaction.h
netwerk/streamconv/converters/nsHTTPCompressConv.cpp
netwerk/streamconv/converters/nsHTTPCompressConv.h
netwerk/streamconv/converters/nsUnknownDecoder.cpp
netwerk/streamconv/converters/nsUnknownDecoder.h
netwerk/test/TestStreamTransport.cpp
parser/html/nsHtml5StreamParser.cpp
parser/html/nsHtml5StreamParser.h
parser/htmlparser/nsExpatDriver.cpp
parser/htmlparser/nsParser.cpp
toolkit/components/downloads/ApplicationReputation.cpp
uriloader/prefetch/nsOfflineCacheUpdate.cpp
uriloader/prefetch/nsOfflineCacheUpdate.h
xpcom/ds/nsPersistentProperties.cpp
xpcom/io/Base64.cpp
xpcom/io/nsBinaryStream.cpp
xpcom/io/nsIInputStream.idl
xpcom/io/nsIOutputStream.idl
xpcom/io/nsIUnicharInputStream.idl
xpcom/io/nsInputStreamTee.cpp
xpcom/io/nsMultiplexInputStream.cpp
xpcom/io/nsPipe3.cpp
xpcom/io/nsStreamUtils.cpp
xpcom/io/nsStreamUtils.h
xpcom/tests/gtest/TestPipes.cpp
--- a/browser/components/feeds/nsFeedSniffer.cpp
+++ b/browser/components/feeds/nsFeedSniffer.cpp
@@ -326,17 +326,17 @@ nsFeedSniffer::GetMIMETypeFromContent(ns
 }
 
 NS_IMETHODIMP
 nsFeedSniffer::OnStartRequest(nsIRequest* request, nsISupports* context)
 {
   return NS_OK;
 }
 
-NS_METHOD
+nsresult
 nsFeedSniffer::AppendSegmentToString(nsIInputStream* inputStream,
                                      void* closure,
                                      const char* rawSegment,
                                      uint32_t toOffset,
                                      uint32_t count,
                                      uint32_t* writeCount)
 {
   nsCString* decodedData = static_cast<nsCString*>(closure);
--- a/browser/components/feeds/nsFeedSniffer.h
+++ b/browser/components/feeds/nsFeedSniffer.h
@@ -13,22 +13,22 @@ class nsFeedSniffer final : public nsICo
                                    nsIStreamListener
 {
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSICONTENTSNIFFER
   NS_DECL_NSIREQUESTOBSERVER
   NS_DECL_NSISTREAMLISTENER
 
-  static NS_METHOD AppendSegmentToString(nsIInputStream* inputStream,
-                                         void* closure,
-                                         const char* rawSegment,
-                                         uint32_t toOffset,
-                                         uint32_t count,
-                                         uint32_t* writeCount);
+  static nsresult AppendSegmentToString(nsIInputStream* inputStream,
+                                        void* closure,
+                                        const char* rawSegment,
+                                        uint32_t toOffset,
+                                        uint32_t count,
+                                        uint32_t* writeCount);
 
 protected:
   ~nsFeedSniffer() {}
 
   nsresult ConvertEncodedData(nsIRequest* request, const uint8_t* data,
                               uint32_t length);
 
 private:
--- a/docshell/base/nsDocShell.cpp
+++ b/docshell/base/nsDocShell.cpp
@@ -11106,17 +11106,17 @@ nsDocShell::DoURILoad(nsIURI* aURI,
       *aDocShell = this;
       NS_ADDREF(*aDocShell);
     }
   }
 
   return rv;
 }
 
-static NS_METHOD
+static nsresult
 AppendSegmentToString(nsIInputStream* aIn,
                       void* aClosure,
                       const char* aFromRawSegment,
                       uint32_t aToOffset,
                       uint32_t aCount,
                       uint32_t* aWriteCount)
 {
   // aFromSegment now contains aCount bytes of data.
--- a/dom/base/EventSource.cpp
+++ b/dom/base/EventSource.cpp
@@ -370,17 +370,17 @@ EventSource::OnStartRequest(nsIRequest *
 
   mStatus = PARSE_STATE_BEGIN_OF_STREAM;
 
   return NS_OK;
 }
 
 // this method parses the characters as they become available instead of
 // buffering them.
-NS_METHOD
+nsresult
 EventSource::StreamReaderFunc(nsIInputStream *aInputStream,
                               void *aClosure,
                               const char *aFromRawSegment,
                               uint32_t aToOffset,
                               uint32_t aCount,
                               uint32_t *aWriteCount)
 {
   EventSource* thisObject = static_cast<EventSource*>(aClosure);
--- a/dom/base/EventSource.h
+++ b/dom/base/EventSource.h
@@ -122,22 +122,22 @@ protected:
   static void TimerCallback(nsITimer *aTimer, void *aClosure);
 
   nsresult PrintErrorOnConsole(const char       *aBundleURI,
                                const char16_t  *aError,
                                const char16_t **aFormatStrings,
                                uint32_t          aFormatStringsLen);
   nsresult ConsoleError();
 
-  static NS_METHOD StreamReaderFunc(nsIInputStream *aInputStream,
-                                    void           *aClosure,
-                                    const char     *aFromRawSegment,
-                                    uint32_t        aToOffset,
-                                    uint32_t        aCount,
-                                    uint32_t       *aWriteCount);
+  static nsresult StreamReaderFunc(nsIInputStream *aInputStream,
+                                   void           *aClosure,
+                                   const char     *aFromRawSegment,
+                                   uint32_t        aToOffset,
+                                   uint32_t        aCount,
+                                   uint32_t       *aWriteCount);
   nsresult SetFieldAndClear();
   nsresult ClearFields();
   nsresult ResetEvent();
   nsresult DispatchCurrentMessageEvent();
   nsresult ParseCharacter(char16_t aChr);
   nsresult CheckHealthOfRequestCallback(nsIRequest *aRequestCallback);
   nsresult OnRedirectVerifyCallback(nsresult result);
 
--- a/dom/base/FileReader.cpp
+++ b/dom/base/FileReader.cpp
@@ -176,17 +176,17 @@ FileReader::GetResult(JSContext* aCx,
 
   nsString tmpResult = mResult;
   if (!xpc::StringToJsval(aCx, tmpResult, aResult)) {
     aRv.Throw(NS_ERROR_FAILURE);
     return;
   }
 }
 
-static NS_METHOD
+static nsresult
 ReadFuncBinaryString(nsIInputStream* in,
                      void* closure,
                      const char* fromRawSegment,
                      uint32_t toOffset,
                      uint32_t count,
                      uint32_t *writeCount)
 {
   char16_t* dest = static_cast<char16_t*>(closure) + toOffset;
--- a/dom/flyweb/HttpServer.cpp
+++ b/dom/flyweb/HttpServer.cpp
@@ -385,17 +385,17 @@ HttpServer::Connection::OnInputStreamRea
   NS_ENSURE_SUCCESS(rv, rv);
 
   rv = mInput->AsyncWait(this, 0, 0, NS_GetCurrentThread());
   NS_ENSURE_SUCCESS(rv, rv);
 
   return NS_OK;
 }
 
-NS_METHOD
+nsresult
 HttpServer::Connection::ReadSegmentsFunc(nsIInputStream* aIn,
                                          void* aClosure,
                                          const char* aBuffer,
                                          uint32_t aToOffset,
                                          uint32_t aCount,
                                          uint32_t* aWriteCount)
 {
   const char* buffer = aBuffer;
@@ -977,22 +977,22 @@ private:
     , mChunkRemaining(0)
     , mChunked(aChunked)
     , mAddedFinalSeparator(false)
     , mFirstChunk(aChunked)
     {
     }
   ~StreamCopier() {}
 
-  static NS_METHOD FillOutputBufferHelper(nsIOutputStream* aOutStr,
-                                          void* aClosure,
-                                          char* aBuffer,
-                                          uint32_t aOffset,
-                                          uint32_t aCount,
-                                          uint32_t* aCountRead);
+  static nsresult FillOutputBufferHelper(nsIOutputStream* aOutStr,
+                                         void* aClosure,
+                                         char* aBuffer,
+                                         uint32_t aOffset,
+                                         uint32_t aCount,
+                                         uint32_t* aCountRead);
   nsresult FillOutputBuffer(char* aBuffer,
                             uint32_t aCount,
                             uint32_t* aCountRead);
 
   nsCOMPtr<nsIInputStream> mSource;
   nsCOMPtr<nsIAsyncInputStream> mAsyncSource;
   nsCOMPtr<nsIAsyncOutputStream> mSink;
   MozPromiseHolder<StreamCopyPromise> mPromise;
@@ -1012,30 +1012,30 @@ NS_IMPL_ISUPPORTS(StreamCopier,
 struct WriteState
 {
   StreamCopier* copier;
   nsresult sourceRv;
 };
 
 // This function only exists to enable FillOutputBuffer to be a non-static
 // function where we can use member variables more easily.
-NS_METHOD
+nsresult
 StreamCopier::FillOutputBufferHelper(nsIOutputStream* aOutStr,
                                      void* aClosure,
                                      char* aBuffer,
                                      uint32_t aOffset,
                                      uint32_t aCount,
                                      uint32_t* aCountRead)
 {
   WriteState* ws = static_cast<WriteState*>(aClosure);
   ws->sourceRv = ws->copier->FillOutputBuffer(aBuffer, aCount, aCountRead);
   return ws->sourceRv;
 }
 
-NS_METHOD
+nsresult
 CheckForEOF(nsIInputStream* aIn,
             void* aClosure,
             const char* aBuffer,
             uint32_t aToOffset,
             uint32_t aCount,
             uint32_t* aWriteCount)
 {
   *static_cast<bool*>(aClosure) = true;
--- a/dom/flyweb/HttpServer.h
+++ b/dom/flyweb/HttpServer.h
@@ -124,22 +124,22 @@ private:
 
     void Close();
 
     private:
     ~Connection();
 
     void SetSecurityObserver(bool aListen);
 
-    static NS_METHOD ReadSegmentsFunc(nsIInputStream* aIn,
-                                      void* aClosure,
-                                      const char* aBuffer,
-                                      uint32_t aToOffset,
-                                      uint32_t aCount,
-                                      uint32_t* aWriteCount);
+    static nsresult ReadSegmentsFunc(nsIInputStream* aIn,
+                                     void* aClosure,
+                                     const char* aBuffer,
+                                     uint32_t aToOffset,
+                                     uint32_t aCount,
+                                     uint32_t* aWriteCount);
     nsresult ConsumeInput(const char*& aBuffer,
                           const char* aEnd);
     nsresult ConsumeLine(const char* aBuffer,
                          size_t aLength);
     void MaybeAddPendingHeader();
 
     void QueueResponse(InternalResponse* aResponse);
 
--- a/dom/media/MediaResource.cpp
+++ b/dom/media/MediaResource.cpp
@@ -420,17 +420,17 @@ ChannelMediaResource::OnChannelRedirect(
   return SetupChannelHeaders();
 }
 
 struct CopySegmentClosure {
   nsCOMPtr<nsIPrincipal> mPrincipal;
   ChannelMediaResource*  mResource;
 };
 
-NS_METHOD
+nsresult
 ChannelMediaResource::CopySegmentToCache(nsIInputStream *aInStream,
                                          void *aClosure,
                                          const char *aFromSegment,
                                          uint32_t aToOffset,
                                          uint32_t aCount,
                                          uint32_t *aWriteCount)
 {
   CopySegmentClosure* closure = static_cast<CopySegmentClosure*>(aClosure);
--- a/dom/media/MediaResource.h
+++ b/dom/media/MediaResource.h
@@ -663,22 +663,22 @@ protected:
   // values are out of range.
   nsresult ParseContentRangeHeader(nsIHttpChannel * aHttpChan,
                                    int64_t& aRangeStart,
                                    int64_t& aRangeEnd,
                                    int64_t& aRangeTotal);
 
   void DoNotifyDataReceived();
 
-  static NS_METHOD CopySegmentToCache(nsIInputStream *aInStream,
-                                      void *aClosure,
-                                      const char *aFromSegment,
-                                      uint32_t aToOffset,
-                                      uint32_t aCount,
-                                      uint32_t *aWriteCount);
+  static nsresult CopySegmentToCache(nsIInputStream *aInStream,
+                                     void *aClosure,
+                                     const char *aFromSegment,
+                                     uint32_t aToOffset,
+                                     uint32_t aCount,
+                                     uint32_t *aWriteCount);
 
   // Main thread access only
   int64_t            mOffset;
   RefPtr<Listener> mListener;
   // A data received event for the decoder that has been dispatched but has
   // not yet been processed.
   nsRevocableEventPtr<nsRunnableMethod<ChannelMediaResource, void, false> > mDataReceivedEvent;
   // When this flag is set, if we get a network error we should silently
--- a/dom/media/WebVTTListener.cpp
+++ b/dom/media/WebVTTListener.cpp
@@ -108,17 +108,17 @@ WebVTTListener::OnStopRequest(nsIRequest
     mElement->SetReadyState(TextTrackReadyState::Loaded);
   }
 
   mElement->DropChannel();
 
   return aStatus;
 }
 
-NS_METHOD
+nsresult
 WebVTTListener::ParseChunk(nsIInputStream* aInStream, void* aClosure,
                            const char* aFromSegment, uint32_t aToOffset,
                            uint32_t aCount, uint32_t* aWriteCount)
 {
   nsCString buffer(aFromSegment, aCount);
   WebVTTListener* listener = static_cast<WebVTTListener*>(aClosure);
 
   if (NS_FAILED(listener->mParserWrapper->Parse(buffer))) {
--- a/dom/media/WebVTTListener.h
+++ b/dom/media/WebVTTListener.h
@@ -45,19 +45,19 @@ public:
 
 private:
   ~WebVTTListener();
 
   // List of error codes returned from the WebVTT parser that we care about.
   enum ErrorCodes {
     BadSignature = 0
   };
-  static NS_METHOD ParseChunk(nsIInputStream* aInStream, void* aClosure,
-                              const char* aFromSegment, uint32_t aToOffset,
-                              uint32_t aCount, uint32_t* aWriteCount);
+  static nsresult ParseChunk(nsIInputStream* aInStream, void* aClosure,
+                             const char* aFromSegment, uint32_t aToOffset,
+                             uint32_t aCount, uint32_t* aWriteCount);
 
   RefPtr<HTMLTrackElement> mElement;
   nsCOMPtr<nsIWebVTTParserWrapper> mParserWrapper;
 };
 
 } // namespace dom
 } // namespace mozilla
 
--- a/dom/security/ContentVerifier.cpp
+++ b/dom/security/ContentVerifier.cpp
@@ -53,17 +53,17 @@ ContentVerifier::Init(const nsACString& 
   }
   return rv;
 }
 
 /**
  * Implement nsIStreamListener
  * We buffer the entire content here and kick off verification
  */
-NS_METHOD
+nsresult
 AppendNextSegment(nsIInputStream* aInputStream, void* aClosure,
                   const char* aRawSegment, uint32_t aToOffset, uint32_t aCount,
                   uint32_t* outWrittenCount)
 {
   FallibleTArray<nsCString>* decodedData =
     static_cast<FallibleTArray<nsCString>*>(aClosure);
   nsDependentCSubstring segment(aRawSegment, aCount);
   if (!decodedData->AppendElement(segment, fallible)) {
--- a/dom/security/nsCSPContext.cpp
+++ b/dom/security/nsCSPContext.cpp
@@ -1370,17 +1370,17 @@ NS_IMPL_ISUPPORTS(CSPViolationReportList
 CSPViolationReportListener::CSPViolationReportListener()
 {
 }
 
 CSPViolationReportListener::~CSPViolationReportListener()
 {
 }
 
-NS_METHOD
+nsresult
 AppendSegmentToString(nsIInputStream* aInputStream,
                       void* aClosure,
                       const char* aRawSegment,
                       uint32_t aToOffset,
                       uint32_t aCount,
                       uint32_t* outWrittenCount)
 {
   nsCString* decodedData = static_cast<nsCString*>(aClosure);
--- a/dom/xhr/XMLHttpRequestMainThread.cpp
+++ b/dom/xhr/XMLHttpRequestMainThread.cpp
@@ -1557,17 +1557,17 @@ XMLHttpRequestMainThread::PopulateNetwor
     return;
   }
   channel->SetNetworkInterfaceId(mNetworkInterfaceId);
 }
 
 /*
  * "Copy" from a stream.
  */
-NS_METHOD
+nsresult
 XMLHttpRequestMainThread::StreamReaderFunc(nsIInputStream* in,
                                            void* closure,
                                            const char* fromRawSegment,
                                            uint32_t toOffset,
                                            uint32_t count,
                                            uint32_t *writeCount)
 {
   XMLHttpRequestMainThread* xmlHttpRequest = static_cast<XMLHttpRequestMainThread*>(closure);
--- a/dom/xhr/XMLHttpRequestMainThread.h
+++ b/dom/xhr/XMLHttpRequestMainThread.h
@@ -506,22 +506,22 @@ protected:
     opened,           // open() has been successfully invoked.
     headers_received, // redirects followed and response headers received.
     loading,          // response body is being received.
     done,             // data transfer concluded, whether success or error.
   };
 
   nsresult DetectCharset();
   nsresult AppendToResponseText(const char * aBuffer, uint32_t aBufferLen);
-  static NS_METHOD StreamReaderFunc(nsIInputStream* in,
-                void* closure,
-                const char* fromRawSegment,
-                uint32_t toOffset,
-                uint32_t count,
-                uint32_t *writeCount);
+  static nsresult StreamReaderFunc(nsIInputStream* in,
+                                   void* closure,
+                                   const char* fromRawSegment,
+                                   uint32_t toOffset,
+                                   uint32_t count,
+                                   uint32_t *writeCount);
   nsresult CreateResponseParsedJSON(JSContext* aCx);
   void CreatePartialBlob(ErrorResult& aRv);
   bool CreateDOMBlob(nsIRequest *request);
   // Change the state of the object with this. The broadcast argument
   // determines if the onreadystatechange listener should be called.
   nsresult ChangeState(State aState, bool aBroadcast = true);
   already_AddRefed<nsILoadGroup> GetLoadGroup() const;
   nsIURI *GetBaseURI();
--- a/image/SourceBuffer.cpp
+++ b/image/SourceBuffer.cpp
@@ -414,17 +414,17 @@ SourceBuffer::Append(const char* aData, 
 
     // Resume any waiting readers now that there's new data.
     ResumeWaitingConsumers();
   }
 
   return NS_OK;
 }
 
-static NS_METHOD
+static nsresult
 AppendToSourceBuffer(nsIInputStream*,
                      void* aClosure,
                      const char* aFromRawSegment,
                      uint32_t,
                      uint32_t aCount,
                      uint32_t* aWriteCount)
 {
   SourceBuffer* sourceBuffer = static_cast<SourceBuffer*>(aClosure);
--- a/image/imgRequest.cpp
+++ b/image/imgRequest.cpp
@@ -871,17 +871,17 @@ imgRequest::OnStopRequest(nsIRequest* aR
 }
 
 struct mimetype_closure
 {
   nsACString* newType;
 };
 
 /* prototype for these defined below */
-static NS_METHOD
+static nsresult
 sniff_mimetype_callback(nsIInputStream* in, void* closure,
                         const char* fromRawSegment, uint32_t toOffset,
                         uint32_t count, uint32_t* writeCount);
 
 /** nsThreadRetargetableStreamListener methods **/
 NS_IMETHODIMP
 imgRequest::CheckListenerChain()
 {
@@ -1134,17 +1134,17 @@ imgRequest::SetProperties(const nsACStri
       do_CreateInstance("@mozilla.org/supports-cstring;1");
     if (contentDisposition) {
       contentDisposition->SetData(aContentDisposition);
       mProperties->Set("content-disposition", contentDisposition);
     }
   }
 }
 
-static NS_METHOD
+static nsresult
 sniff_mimetype_callback(nsIInputStream* in,
                         void* data,
                         const char* fromRawSegment,
                         uint32_t toOffset,
                         uint32_t count,
                         uint32_t* writeCount)
 {
   mimetype_closure* closure = static_cast<mimetype_closure*>(data);
--- a/netwerk/base/MemoryDownloader.cpp
+++ b/netwerk/base/MemoryDownloader.cpp
@@ -44,17 +44,17 @@ MemoryDownloader::OnStopRequest(nsIReque
   data.swap(mData);
   RefPtr<IObserver> observer;
   observer.swap(mObserver);
   observer->OnDownloadComplete(this, aRequest, aCtxt, aStatus,
                                mozilla::Move(data));
   return NS_OK;
 }
 
-NS_METHOD
+nsresult
 MemoryDownloader::ConsumeData(nsIInputStream* aIn,
                               void* aClosure,
                               const char* aFromRawSegment,
                               uint32_t aToOffset,
                               uint32_t aCount,
                               uint32_t* aWriteCount)
 {
   MemoryDownloader* self = static_cast<MemoryDownloader*>(aClosure);
--- a/netwerk/base/MemoryDownloader.h
+++ b/netwerk/base/MemoryDownloader.h
@@ -42,22 +42,22 @@ public:
                                     Data aData) = 0;
   };
 
   explicit MemoryDownloader(IObserver* aObserver);
 
 private:
   virtual ~MemoryDownloader();
 
-  static NS_METHOD ConsumeData(nsIInputStream *in,
-                               void           *closure,
-                               const char     *fromRawSegment,
-                               uint32_t        toOffset,
-                               uint32_t        count,
-                               uint32_t       *writeCount);
+  static nsresult ConsumeData(nsIInputStream *in,
+                              void           *closure,
+                              const char     *fromRawSegment,
+                              uint32_t        toOffset,
+                              uint32_t        count,
+                              uint32_t       *writeCount);
 
   RefPtr<IObserver> mObserver;
   Data mData;
   nsresult mStatus;
 };
 
 } // namespace net
 } // namespace mozilla
--- a/netwerk/base/nsBufferedStreams.cpp
+++ b/netwerk/base/nsBufferedStreams.cpp
@@ -664,17 +664,17 @@ nsBufferedOutputStream::Finish()
 
     // ... and close the buffered stream, so any further attempts to flush/close
     // the buffered stream won't cause errors.
     nsBufferedStream::Close();
 
     return rv;
 }
 
-static NS_METHOD
+static nsresult
 nsReadFromInputStream(nsIOutputStream* outStr,
                       void* closure,
                       char* toRawSegment, 
                       uint32_t offset,
                       uint32_t count,
                       uint32_t *readCount)
 {
     nsIInputStream* fromStream = (nsIInputStream*)closure;
--- a/netwerk/base/nsDownloader.cpp
+++ b/netwerk/base/nsDownloader.cpp
@@ -83,17 +83,17 @@ nsDownloader::OnStopRequest(nsIRequest  
     }
 
     mObserver->OnDownloadComplete(this, request, ctxt, status, mLocation);
     mObserver = nullptr;
 
     return NS_OK;
 }
 
-NS_METHOD
+nsresult
 nsDownloader::ConsumeData(nsIInputStream* in,
                           void* closure,
                           const char* fromRawSegment,
                           uint32_t toOffset,
                           uint32_t count,
                           uint32_t *writeCount)
 {
     nsDownloader *self = (nsDownloader *) closure;
--- a/netwerk/base/nsDownloader.h
+++ b/netwerk/base/nsDownloader.h
@@ -19,22 +19,22 @@ public:
     NS_DECL_NSIREQUESTOBSERVER
     NS_DECL_NSISTREAMLISTENER
 
     nsDownloader() : mLocationIsTemp(false) {}
 
 protected:
     virtual ~nsDownloader();
 
-    static NS_METHOD ConsumeData(nsIInputStream *in,
-                                 void           *closure,
-                                 const char     *fromRawSegment,
-                                 uint32_t        toOffset,
-                                 uint32_t        count,
-                                 uint32_t       *writeCount);
+    static nsresult ConsumeData(nsIInputStream *in,
+                                void           *closure,
+                                const char     *fromRawSegment,
+                                uint32_t        toOffset,
+                                uint32_t        count,
+                                uint32_t       *writeCount);
 
     nsCOMPtr<nsIDownloadObserver> mObserver;
     nsCOMPtr<nsIFile>             mLocation;
     nsCOMPtr<nsIOutputStream>     mSink;
     bool                          mLocationIsTemp;
 };
 
 #endif // nsDownloader_h__
--- a/netwerk/base/nsIncrementalStreamLoader.cpp
+++ b/netwerk/base/nsIncrementalStreamLoader.cpp
@@ -106,17 +106,17 @@ nsIncrementalStreamLoader::OnStopRequest
     ReleaseData();
     mRequest = 0;
     mObserver = 0;
     mContext = 0;
   }
   return NS_OK;
 }
 
-NS_METHOD
+nsresult
 nsIncrementalStreamLoader::WriteSegmentFun(nsIInputStream *inStr,
                                            void *closure,
                                            const char *fromSegment,
                                            uint32_t toOffset,
                                            uint32_t count,
                                            uint32_t *writeCount)
 {
   nsIncrementalStreamLoader *self = (nsIncrementalStreamLoader *) closure;
--- a/netwerk/base/nsIncrementalStreamLoader.h
+++ b/netwerk/base/nsIncrementalStreamLoader.h
@@ -27,18 +27,18 @@ public:
   nsIncrementalStreamLoader();
 
   static nsresult
   Create(nsISupports *aOuter, REFNSIID aIID, void **aResult);
 
 protected:
   ~nsIncrementalStreamLoader();
 
-  static NS_METHOD WriteSegmentFun(nsIInputStream *, void *, const char *,
-                                   uint32_t, uint32_t, uint32_t *);
+  static nsresult WriteSegmentFun(nsIInputStream *, void *, const char *,
+                                  uint32_t, uint32_t, uint32_t *);
 
   // Utility method to free mData, if present, and update other state to
   // reflect that no data has been allocated.
   void ReleaseData();
 
   nsCOMPtr<nsIIncrementalStreamLoaderObserver> mObserver;
   nsCOMPtr<nsISupports>             mContext;  // the observer's context
   nsCOMPtr<nsIRequest>              mRequest;
--- a/netwerk/base/nsInputStreamPump.cpp
+++ b/netwerk/base/nsInputStreamPump.cpp
@@ -75,17 +75,17 @@ nsInputStreamPump::Create(nsInputStreamP
 struct PeekData {
   PeekData(nsInputStreamPump::PeekSegmentFun fun, void* closure)
     : mFunc(fun), mClosure(closure) {}
 
   nsInputStreamPump::PeekSegmentFun mFunc;
   void* mClosure;
 };
 
-static NS_METHOD
+static nsresult
 CallPeekFunc(nsIInputStream *aInStream, void *aClosure,
              const char *aFromSegment, uint32_t aToOffset, uint32_t aCount,
              uint32_t *aWriteCount)
 {
   NS_ASSERTION(aToOffset == 0, "Called more than once?");
   NS_ASSERTION(aCount > 0, "Called without data?");
 
   PeekData* data = static_cast<PeekData*>(aClosure);
--- a/netwerk/base/nsMIMEInputStream.cpp
+++ b/netwerk/base/nsMIMEInputStream.cpp
@@ -45,19 +45,19 @@ private:
 
     void InitStreams();
 
     struct MOZ_STACK_CLASS ReadSegmentsState {
         nsCOMPtr<nsIInputStream> mThisStream;
         nsWriteSegmentFun mWriter;
         void* mClosure;
     };
-    static NS_METHOD ReadSegCb(nsIInputStream* aIn, void* aClosure,
-                               const char* aFromRawSegment, uint32_t aToOffset,
-                               uint32_t aCount, uint32_t *aWriteCount);
+    static nsresult ReadSegCb(nsIInputStream* aIn, void* aClosure,
+                              const char* aFromRawSegment, uint32_t aToOffset,
+                              uint32_t aCount, uint32_t *aWriteCount);
 
     nsCString mHeaders;
     nsCOMPtr<nsIStringInputStream> mHeaderStream;
     
     nsCString mContentLength;
     nsCOMPtr<nsIStringInputStream> mCLStream;
     
     nsCOMPtr<nsIInputStream> mData;
@@ -227,17 +227,17 @@ NS_IMETHODIMP nsMIMEInputStream::ReadSeg
     INITSTREAMS;
     ReadSegmentsState state;
     state.mThisStream = this;
     state.mWriter = aWriter;
     state.mClosure = aClosure;
     return mStream->ReadSegments(ReadSegCb, &state, aCount, _retval);
 }
 
-NS_METHOD
+nsresult
 nsMIMEInputStream::ReadSegCb(nsIInputStream* aIn, void* aClosure,
                              const char* aFromRawSegment,
                              uint32_t aToOffset, uint32_t aCount,
                              uint32_t *aWriteCount)
 {
     ReadSegmentsState* state = (ReadSegmentsState*)aClosure;
     return  (state->mWriter)(state->mThisStream,
                              state->mClosure,
--- a/netwerk/base/nsSocketTransport2.cpp
+++ b/netwerk/base/nsSocketTransport2.cpp
@@ -648,17 +648,17 @@ nsSocketOutputStream::Write(const char *
 NS_IMETHODIMP
 nsSocketOutputStream::WriteSegments(nsReadSegmentFun reader, void *closure,
                                     uint32_t count, uint32_t *countRead)
 {
     // socket stream is unbuffered
     return NS_ERROR_NOT_IMPLEMENTED;
 }
 
-NS_METHOD
+nsresult
 nsSocketOutputStream::WriteFromSegments(nsIInputStream *input,
                                         void *closure,
                                         const char *fromSegment,
                                         uint32_t offset,
                                         uint32_t count,
                                         uint32_t *countRead)
 {
     nsSocketOutputStream *self = (nsSocketOutputStream *) closure;
--- a/netwerk/base/nsSocketTransport2.h
+++ b/netwerk/base/nsSocketTransport2.h
@@ -89,19 +89,19 @@ public:
     bool     IsReferenced() { return mWriterRefCnt > 0; }
     nsresult Condition()    { return mCondition; }
     uint64_t ByteCount()    { return mByteCount; }
 
     // called by the socket transport on the socket thread...
     void OnSocketReady(nsresult condition); 
 
 private:
-    static NS_METHOD WriteFromSegments(nsIInputStream *, void *,
-                                       const char *, uint32_t offset,
-                                       uint32_t count, uint32_t *countRead);
+    static nsresult WriteFromSegments(nsIInputStream *, void *,
+                                      const char *, uint32_t offset,
+                                      uint32_t count, uint32_t *countRead);
 
     nsSocketTransport                *mTransport;
     ThreadSafeAutoRefCnt              mWriterRefCnt;
 
     // access to these is protected by mTransport->mLock
     nsresult                          mCondition;
     nsCOMPtr<nsIOutputStreamCallback> mCallback;
     uint32_t                          mCallbackFlags;
--- a/netwerk/base/nsStreamLoader.cpp
+++ b/netwerk/base/nsStreamLoader.cpp
@@ -119,17 +119,17 @@ nsStreamLoader::OnStopRequest(nsIRequest
   if (mRequestObserver) {
     mRequestObserver->OnStopRequest(request, ctxt, aStatus);
     mRequestObserver = nullptr;
   }
 
   return NS_OK;
 }
 
-NS_METHOD
+nsresult
 nsStreamLoader::WriteSegmentFun(nsIInputStream *inStr,
                                 void *closure,
                                 const char *fromSegment,
                                 uint32_t toOffset,
                                 uint32_t count,
                                 uint32_t *writeCount)
 {
   nsStreamLoader *self = (nsStreamLoader *) closure;
--- a/netwerk/base/nsStreamLoader.h
+++ b/netwerk/base/nsStreamLoader.h
@@ -30,18 +30,18 @@ public:
   nsStreamLoader();
 
   static nsresult
   Create(nsISupports *aOuter, REFNSIID aIID, void **aResult);
 
 protected:
   ~nsStreamLoader();
 
-  static NS_METHOD WriteSegmentFun(nsIInputStream *, void *, const char *,
-                                   uint32_t, uint32_t, uint32_t *);
+  static nsresult WriteSegmentFun(nsIInputStream *, void *, const char *,
+                                  uint32_t, uint32_t, uint32_t *);
 
   // Utility method to free mData, if present, and update other state to
   // reflect that no data has been allocated.
   void ReleaseData();
 
   nsCOMPtr<nsIStreamLoaderObserver> mObserver;
   nsCOMPtr<nsISupports>             mContext;  // the observer's context
   nsCOMPtr<nsIRequest>              mRequest;
--- a/netwerk/base/nsUnicharStreamLoader.cpp
+++ b/netwerk/base/nsUnicharStreamLoader.cpp
@@ -191,17 +191,17 @@ nsUnicharStreamLoader::DetermineCharset(
   rv = WriteSegmentFun(nullptr, this,
                        mRawData.BeginReading(),
                        0, mRawData.Length(),
                        &dummy);
   mRawData.Truncate();
   return rv;
 }
 
-NS_METHOD
+nsresult
 nsUnicharStreamLoader::WriteSegmentFun(nsIInputStream *,
                                        void *aClosure,
                                        const char *aSegment,
                                        uint32_t,
                                        uint32_t aCount,
                                        uint32_t *aWriteCount)
 {
   nsUnicharStreamLoader* self = static_cast<nsUnicharStreamLoader*>(aClosure);
--- a/netwerk/base/nsUnicharStreamLoader.h
+++ b/netwerk/base/nsUnicharStreamLoader.h
@@ -29,18 +29,18 @@ public:
 protected:
   virtual ~nsUnicharStreamLoader() {}
 
   nsresult DetermineCharset();
 
   /**
    * callback method used for ReadSegments
    */
-  static NS_METHOD WriteSegmentFun(nsIInputStream *, void *, const char *,
-                                   uint32_t, uint32_t, uint32_t *);
+  static nsresult WriteSegmentFun(nsIInputStream *, void *, const char *,
+                                  uint32_t, uint32_t, uint32_t *);
 
   nsCOMPtr<nsIUnicharStreamLoaderObserver> mObserver;
   nsCOMPtr<nsIUnicodeDecoder>              mDecoder;
   nsCOMPtr<nsISupports>                    mContext;
   nsCOMPtr<nsIChannel>                     mChannel;
   nsCString                                mCharset;
 
   // This holds the first up-to-512 bytes of the raw stream.
--- a/netwerk/protocol/about/nsAboutCacheEntry.cpp
+++ b/netwerk/protocol/about/nsAboutCacheEntry.cpp
@@ -546,18 +546,17 @@ nsAboutCacheEntry::Channel::OnDataAvaila
                                    uint64_t aOffset,
                                    uint32_t aCount)
 {
     uint32_t n;
     return aInputStream->ReadSegments(
         &nsAboutCacheEntry::Channel::PrintCacheData, this, aCount, &n);
 }
 
-// static
-NS_METHOD
+/* static */ nsresult
 nsAboutCacheEntry::Channel::PrintCacheData(nsIInputStream *aInStream,
                                            void *aClosure,
                                            const char *aFromSegment,
                                            uint32_t aToOffset,
                                            uint32_t aCount,
                                            uint32_t *aWriteCount)
 {
     nsAboutCacheEntry::Channel *a =
--- a/netwerk/protocol/about/nsAboutCacheEntry.h
+++ b/netwerk/protocol/about/nsAboutCacheEntry.h
@@ -59,17 +59,17 @@ private:
         nsresult OpenCacheEntry();
         nsresult WriteCacheEntryDescription(nsICacheEntry *);
         nsresult WriteCacheEntryUnavailable();
         nsresult ParseURI(nsIURI *uri, nsACString &storageName,
                           nsILoadContextInfo **loadInfo,
                           nsCString &enahnceID, nsIURI **cacheUri);
         void CloseContent();
 
-        static NS_METHOD
+        static nsresult
         PrintCacheData(nsIInputStream *aInStream,
                        void *aClosure,
                        const char *aFromSegment,
                        uint32_t aToOffset,
                        uint32_t aCount,
                        uint32_t *aWriteCount);
 
     private:
--- a/netwerk/protocol/http/PackagedAppService.cpp
+++ b/netwerk/protocol/http/PackagedAppService.cpp
@@ -677,17 +677,17 @@ PackagedAppService::PackagedAppDownloade
     return NS_OK;
   }
 
   mVerifier->OnStopRequest(nullptr, info, aStatusCode);
 
   return NS_OK;
 }
 
-NS_METHOD
+nsresult
 PackagedAppService::PackagedAppDownloader::ConsumeData(nsIInputStream *aStream,
                                                        void *aClosure,
                                                        const char *aFromRawSegment,
                                                        uint32_t aToOffset,
                                                        uint32_t aCount,
                                                        uint32_t *aWriteCount)
 {
   MOZ_ASSERT(aClosure, "The closure must not be null");
--- a/netwerk/protocol/http/PackagedAppService.h
+++ b/netwerk/protocol/http/PackagedAppService.h
@@ -143,22 +143,22 @@ private:
     void NotifyOnStartSignedPackageRequest(const nsACString& PackageOrigin);
 
   private:
     ~PackagedAppDownloader() { }
 
     // Static method used to write data into the cache entry or discard
     // if there's no writer. Used as a writer function of
     // nsIInputStream::ReadSegments.
-    static NS_METHOD ConsumeData(nsIInputStream *aStream,
-                                 void *aClosure,
-                                 const char *aFromRawSegment,
-                                 uint32_t aToOffset,
-                                 uint32_t aCount,
-                                 uint32_t *aWriteCount);
+    static nsresult ConsumeData(nsIInputStream *aStream,
+                                void *aClosure,
+                                const char *aFromRawSegment,
+                                uint32_t aToOffset,
+                                uint32_t aCount,
+                                uint32_t *aWriteCount);
 
     //---------------------------------------------------------------
     // For PackagedAppVerifierListener.
     //---------------------------------------------------------------
     virtual void OnManifestVerified(const ResourceCacheInfo* aInfo, bool aSuccess);
     virtual void OnResourceVerified(const ResourceCacheInfo* aInfo, bool aSuccess);
 
     // Handle all kinds of error during package downloading.
--- a/netwerk/protocol/http/PackagedAppVerifier.cpp
+++ b/netwerk/protocol/http/PackagedAppVerifier.cpp
@@ -122,17 +122,17 @@ PackagedAppVerifier::OnStartRequest(nsIR
 
   nsCOMPtr<nsIURI> uri = do_QueryInterface(aContext);
   NS_ENSURE_TRUE(uri, NS_ERROR_FAILURE);
   uri->GetAsciiSpec(mHashingResourceURI);
 
   return mHasher->Init(kResourceHashType);
 }
 
-NS_METHOD
+nsresult
 PackagedAppVerifier::WriteManifest(nsIInputStream* aStream,
                                    void* aManifest,
                                    const char* aFromRawSegment,
                                    uint32_t aToOffset,
                                    uint32_t aCount,
                                    uint32_t* aWriteCount)
 {
   LOG(("WriteManifest: length %u", aCount));
--- a/netwerk/protocol/http/PackagedAppVerifier.h
+++ b/netwerk/protocol/http/PackagedAppVerifier.h
@@ -131,17 +131,17 @@ private:
   //
   // 2) PackagedAppVerifierListener::OnResourceVerified.
   //    ------------------------------------------------------------------------
   //    Otherwise, the resource will be called back here.
   //
   void ProcessResourceCache(const ResourceCacheInfo* aInfo);
 
   // Callback for nsIInputStream::ReadSegment() to read manifest
-  static NS_METHOD WriteManifest(nsIInputStream* aStream,
+  static nsresult WriteManifest(nsIInputStream* aStream,
                                 void* aManifest,
                                 const char* aFromRawSegment,
                                 uint32_t aToOffset,
                                 uint32_t aCount,
                                 uint32_t* aWriteCount);
 
   // This two functions would call the actual verifier.
   void VerifyManifest(const ResourceCacheInfo* aInfo);
--- a/netwerk/protocol/http/nsHttpConnection.cpp
+++ b/netwerk/protocol/http/nsHttpConnection.cpp
@@ -1521,17 +1521,17 @@ nsHttpConnection::CloseTransaction(nsAHt
         Close(reason);
     }
 
     // flag the connection as reused here for convenience sake.  certainly
     // it might be going away instead ;-)
     mIsReused = true;
 }
 
-NS_METHOD
+nsresult
 nsHttpConnection::ReadFromStream(nsIInputStream *input,
                                  void *closure,
                                  const char *buf,
                                  uint32_t offset,
                                  uint32_t count,
                                  uint32_t *countRead)
 {
     // thunk for nsIInputStream instance
--- a/netwerk/protocol/http/nsHttpConnection.h
+++ b/netwerk/protocol/http/nsHttpConnection.h
@@ -142,18 +142,18 @@ public:
     nsresult ResumeRecv();
     int64_t  MaxBytesRead() {return mMaxBytesRead;}
     uint8_t GetLastHttpResponseVersion() { return mLastHttpResponseVersion; }
 
     friend class HttpConnectionForceIO;
     nsresult ForceSend();
     nsresult ForceRecv();
 
-    static NS_METHOD ReadFromStream(nsIInputStream *, void *, const char *,
-                                    uint32_t, uint32_t, uint32_t *);
+    static nsresult ReadFromStream(nsIInputStream *, void *, const char *,
+                                   uint32_t, uint32_t, uint32_t *);
 
     // When a persistent connection is in the connection manager idle
     // connection pool, the nsHttpConnection still reads errors and hangups
     // on the socket so that it can be proactively released if the server
     // initiates a termination. Only call on socket thread.
     void BeginIdleMonitoring();
     void EndIdleMonitoring();
 
--- a/netwerk/protocol/http/nsHttpPipeline.cpp
+++ b/netwerk/protocol/http/nsHttpPipeline.cpp
@@ -580,17 +580,17 @@ nsHttpPipeline::Available()
     uint64_t result = 0;
 
     int32_t i, count = mRequestQ.Length();
     for (i=0; i<count; ++i)
         result += Request(i)->Available();
     return result;
 }
 
-NS_METHOD
+nsresult
 nsHttpPipeline::ReadFromPipe(nsIInputStream *stream,
                              void *closure,
                              const char *buf,
                              uint32_t offset,
                              uint32_t count,
                              uint32_t *countRead)
 {
     nsHttpPipeline *self = (nsHttpPipeline *) closure;
--- a/netwerk/protocol/http/nsHttpPipeline.h
+++ b/netwerk/protocol/http/nsHttpPipeline.h
@@ -32,18 +32,18 @@ public:
     return true;
   }
 
 private:
     virtual ~nsHttpPipeline();
 
     nsresult FillSendBuf();
 
-    static NS_METHOD ReadFromPipe(nsIInputStream *, void *, const char *,
-                                  uint32_t, uint32_t, uint32_t *);
+    static nsresult ReadFromPipe(nsIInputStream *, void *, const char *,
+                                 uint32_t, uint32_t, uint32_t *);
 
     // convenience functions
     nsAHttpTransaction *Request(int32_t i)
     {
         if (mRequestQ.Length() == 0)
             return nullptr;
 
         return mRequestQ[i];
--- a/netwerk/protocol/http/nsHttpTransaction.cpp
+++ b/netwerk/protocol/http/nsHttpTransaction.cpp
@@ -654,17 +654,17 @@ uint64_t
 nsHttpTransaction::Available()
 {
     uint64_t size;
     if (NS_FAILED(mRequestStream->Available(&size)))
         size = 0;
     return size;
 }
 
-NS_METHOD
+nsresult
 nsHttpTransaction::ReadRequestSegment(nsIInputStream *stream,
                                       void *closure,
                                       const char *buf,
                                       uint32_t offset,
                                       uint32_t count,
                                       uint32_t *countRead)
 {
     nsHttpTransaction *trans = (nsHttpTransaction *) closure;
@@ -735,17 +735,17 @@ nsHttpTransaction::ReadSegments(nsAHttpS
                 rv = NS_ERROR_UNEXPECTED;
             }
         }
     }
 
     return rv;
 }
 
-NS_METHOD
+nsresult
 nsHttpTransaction::WritePipeSegment(nsIOutputStream *stream,
                                     void *closure,
                                     char *buf,
                                     uint32_t offset,
                                     uint32_t count,
                                     uint32_t *countWritten)
 {
     nsHttpTransaction *trans = (nsHttpTransaction *) closure;
--- a/netwerk/protocol/http/nsHttpTransaction.h
+++ b/netwerk/protocol/http/nsHttpTransaction.h
@@ -181,20 +181,20 @@ private:
     nsresult HandleContent(char *, uint32_t count, uint32_t *contentRead, uint32_t *contentRemaining);
     nsresult ProcessData(char *, uint32_t, uint32_t *);
     void     DeleteSelfOnConsumerThread();
     void     ReleaseBlockingTransaction();
 
     Classifier Classify();
     void       CancelPipeline(uint32_t reason);
 
-    static NS_METHOD ReadRequestSegment(nsIInputStream *, void *, const char *,
-                                        uint32_t, uint32_t, uint32_t *);
-    static NS_METHOD WritePipeSegment(nsIOutputStream *, void *, char *,
-                                      uint32_t, uint32_t, uint32_t *);
+    static nsresult ReadRequestSegment(nsIInputStream *, void *, const char *,
+                                       uint32_t, uint32_t, uint32_t *);
+    static nsresult WritePipeSegment(nsIOutputStream *, void *, char *,
+                                     uint32_t, uint32_t, uint32_t *);
 
     bool TimingEnabled() const { return mCaps & NS_HTTP_TIMING_ENABLED; }
 
     bool ResponseTimeoutEnabled() const final;
 
     void DisableSpdy() override;
     void ReuseConnectionOnRestartOK(bool reuseOk) override { mReuseOnRestart = reuseOk; }
 
--- a/netwerk/streamconv/converters/nsHTTPCompressConv.cpp
+++ b/netwerk/streamconv/converters/nsHTTPCompressConv.cpp
@@ -151,18 +151,17 @@ nsHTTPCompressConv::OnStopRequest(nsIReq
     if (fpChannel && !isPending) {
       fpChannel->ForcePending(false);
     }
   }
   return mListener->OnStopRequest(request, aContext, status);
 }
 
 
-// static
-NS_METHOD
+/* static */ nsresult
 nsHTTPCompressConv::BrotliHandler(nsIInputStream *stream, void *closure, const char *dataIn,
                                   uint32_t, uint32_t aAvail, uint32_t *countRead)
 {
   MOZ_ASSERT(stream);
   nsHTTPCompressConv *self = static_cast<nsHTTPCompressConv *>(closure);
   *countRead = 0;
 
   const size_t kOutSize = 128 * 1024; // just a chunk size, we call in a loop
--- a/netwerk/streamconv/converters/nsHTTPCompressConv.h
+++ b/netwerk/streamconv/converters/nsHTTPCompressConv.h
@@ -102,17 +102,17 @@ private:
     uint32_t	mOutBufferLen;
     uint32_t	mInpBufferLen;
 
     nsAutoPtr<BrotliWrapper> mBrotli;
 
     nsCOMPtr<nsISupports>   mAsyncConvContext;
     nsCOMPtr<nsIStringInputStream>  mStream;
 
-    static NS_METHOD
+    static nsresult
     BrotliHandler(nsIInputStream *stream, void *closure, const char *dataIn,
                   uint32_t, uint32_t avail, uint32_t *countRead);
 
     nsresult do_OnDataAvailable (nsIRequest *request, nsISupports *aContext,
                                  uint64_t aSourceOffset, const char *buffer,
                                  uint32_t aCount);
 
     bool        mCheckHeaderDone;
--- a/netwerk/streamconv/converters/nsUnknownDecoder.cpp
+++ b/netwerk/streamconv/converters/nsUnknownDecoder.cpp
@@ -38,17 +38,17 @@ nsUnknownDecoder::ConvertedStreamListene
 {
   mDecoder = aDecoder;
 }
 
 nsUnknownDecoder::ConvertedStreamListener::~ConvertedStreamListener()
 {
 }
 
-NS_IMETHODIMP
+nsresult
 nsUnknownDecoder::ConvertedStreamListener::
                   AppendDataToString(nsIInputStream* inputStream,
                                      void* closure,
                                      const char* rawSegment,
                                      uint32_t toOffset,
                                      uint32_t count,
                                      uint32_t* writeCount)
 {
--- a/netwerk/streamconv/converters/nsUnknownDecoder.h
+++ b/netwerk/streamconv/converters/nsUnknownDecoder.h
@@ -53,22 +53,22 @@ protected:
     explicit ConvertedStreamListener(nsUnknownDecoder *aDecoder);
 
     NS_DECL_ISUPPORTS
     NS_DECL_NSIREQUESTOBSERVER
     NS_DECL_NSISTREAMLISTENER
 
   private:
     virtual ~ConvertedStreamListener();
-    static NS_METHOD AppendDataToString(nsIInputStream* inputStream,
-                                        void* closure,
-                                        const char* rawSegment,
-                                        uint32_t toOffset,
-                                        uint32_t count,
-                                        uint32_t* writeCount);
+    static nsresult AppendDataToString(nsIInputStream* inputStream,
+                                       void* closure,
+                                       const char* rawSegment,
+                                       uint32_t toOffset,
+                                       uint32_t count,
+                                       uint32_t* writeCount);
     nsUnknownDecoder *mDecoder;
   };
 
 protected:
   nsCOMPtr<nsIStreamListener> mNextListener;
 
   // Function to use to check whether sniffing some potentially
   // dangerous types (eg HTML) is ok for this request.  We can disable
--- a/netwerk/test/TestStreamTransport.cpp
+++ b/netwerk/test/TestStreamTransport.cpp
@@ -130,22 +130,22 @@ public:
         if (NS_FAILED(rv)) return rv;
 
         mInput = do_QueryInterface(inStr);
         mOutput = do_QueryInterface(outStr);
 
         return mInput->AsyncWait(this, 0, 0, nullptr);
     }
 
-    static NS_METHOD FillOutputBuffer(nsIOutputStream *outStr,
-                                      void *closure,
-                                      char *buffer,
-                                      uint32_t offset,
-                                      uint32_t count,
-                                      uint32_t *countRead)
+    static nsresult FillOutputBuffer(nsIOutputStream *outStr,
+                                     void *closure,
+                                     char *buffer,
+                                     uint32_t offset,
+                                     uint32_t count,
+                                     uint32_t *countRead)
     {
         MyCopier *self = (MyCopier *) closure;
 
         nsresult rv = self->mInput->Read(buffer, count, countRead);
         if (NS_FAILED(rv))
             self->mInputCondition = rv;
         else if (*countRead == 0)
             self->mInputCondition = NS_BASE_STREAM_CLOSED;
--- a/parser/html/nsHtml5StreamParser.cpp
+++ b/parser/html/nsHtml5StreamParser.cpp
@@ -1187,18 +1187,17 @@ nsHtml5StreamParser::OnDataAvailable(nsI
     if (NS_FAILED(rv)) {
       NS_WARNING("Failed reading response data to parser");
       return rv;
     }
     return NS_OK;
   }
 }
 
-/* static */
-NS_METHOD
+/* static */ nsresult
 nsHtml5StreamParser::CopySegmentsToParser(nsIInputStream *aInStream,
                                           void *aClosure,
                                           const char *aFromSegment,
                                           uint32_t aToOffset,
                                           uint32_t aCount,
                                           uint32_t *aWriteCount)
 {
   nsHtml5StreamParser* parser = static_cast<nsHtml5StreamParser*>(aClosure);
--- a/parser/html/nsHtml5StreamParser.h
+++ b/parser/html/nsHtml5StreamParser.h
@@ -243,27 +243,27 @@ class nsHtml5StreamParser : public nsICh
 
     /**
      * Flushes the tree ops from the tree builder and disarms the flush
      * timer.
      */
     void FlushTreeOpsAndDisarmTimer();
 
     void ParseAvailableData();
-    
+
     void DoStopRequest();
-    
+
     void DoDataAvailable(const uint8_t* aBuffer, uint32_t aLength);
 
-    static NS_METHOD CopySegmentsToParser(nsIInputStream *aInStream,
-                                          void *aClosure,
-                                          const char *aFromSegment,
-                                          uint32_t aToOffset,
-                                          uint32_t aCount,
-                                          uint32_t *aWriteCount);
+    static nsresult CopySegmentsToParser(nsIInputStream *aInStream,
+                                         void *aClosure,
+                                         const char *aFromSegment,
+                                         uint32_t aToOffset,
+                                         uint32_t aCount,
+                                         uint32_t *aWriteCount);
 
     bool IsTerminatedOrInterrupted()
     {
       mozilla::MutexAutoLock autoLock(mTerminatedMutex);
       return mTerminated || mInterrupted;
     }
 
     bool IsTerminated()
--- a/parser/htmlparser/nsExpatDriver.cpp
+++ b/parser/htmlparser/nsExpatDriver.cpp
@@ -645,17 +645,17 @@ nsExpatDriver::HandleEndDoctypeDecl()
     MaybeStopParser(rv);
   }
   
   mInternalSubset.SetCapacity(0);
 
   return NS_OK;
 }
 
-static NS_METHOD
+static nsresult
 ExternalDTDStreamReaderFunc(nsIUnicharInputStream* aIn,
                             void* aClosure,
                             const char16_t* aFromSegment,
                             uint32_t aToOffset,
                             uint32_t aCount,
                             uint32_t *aWriteCount)
 {
   // Pass the buffer to expat for parsing.
--- a/parser/htmlparser/nsParser.cpp
+++ b/parser/htmlparser/nsParser.cpp
@@ -1689,17 +1689,17 @@ ExtractCharsetFromXmlDeclaration(const u
 inline char
 GetNextChar(nsACString::const_iterator& aStart,
             nsACString::const_iterator& aEnd)
 {
   NS_ASSERTION(aStart != aEnd, "end of buffer");
   return (++aStart != aEnd) ? *aStart : '\0';
 }
 
-static NS_METHOD
+static nsresult
 NoOpParserWriteFunc(nsIInputStream* in,
                 void* closure,
                 const char* fromRawSegment,
                 uint32_t toOffset,
                 uint32_t count,
                 uint32_t *writeCount)
 {
   *writeCount = count;
@@ -1714,17 +1714,17 @@ typedef struct {
 } ParserWriteStruct;
 
 /*
  * This function is invoked as a result of a call to a stream's
  * ReadSegments() method. It is called for each contiguous buffer
  * of data in the underlying stream or pipe. Using ReadSegments
  * allows us to avoid copying data to read out of the stream.
  */
-static NS_METHOD
+static nsresult
 ParserWriteFunc(nsIInputStream* in,
                 void* closure,
                 const char* fromRawSegment,
                 uint32_t toOffset,
                 uint32_t count,
                 uint32_t *writeCount)
 {
   nsresult result;
--- a/toolkit/components/downloads/ApplicationReputation.cpp
+++ b/toolkit/components/downloads/ApplicationReputation.cpp
@@ -1306,17 +1306,17 @@ PendingLookup::Notify(nsITimer* aTimer)
     true);
   mChannel->Cancel(NS_ERROR_NET_TIMEOUT);
   mTimeoutTimer->Cancel();
   return NS_OK;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 //// nsIStreamListener
-static NS_METHOD
+static nsresult
 AppendSegmentToString(nsIInputStream* inputStream,
                       void *closure,
                       const char *rawSegment,
                       uint32_t toOffset,
                       uint32_t count,
                       uint32_t *writeCount) {
   nsAutoCString* decodedData = static_cast<nsAutoCString*>(closure);
   decodedData->Append(rawSegment, count);
--- a/uriloader/prefetch/nsOfflineCacheUpdate.cpp
+++ b/uriloader/prefetch/nsOfflineCacheUpdate.cpp
@@ -136,22 +136,22 @@ public:
     NS_DECL_NSIINTERFACEREQUESTOR
 
     nsresult Begin();
 
 private:
 
     ~nsManifestCheck() {}
 
-    static NS_METHOD ReadManifest(nsIInputStream *aInputStream,
-                                  void *aClosure,
-                                  const char *aFromSegment,
-                                  uint32_t aOffset,
-                                  uint32_t aCount,
-                                  uint32_t *aBytesConsumed);
+    static nsresult ReadManifest(nsIInputStream *aInputStream,
+                                 void *aClosure,
+                                 const char *aFromSegment,
+                                 uint32_t aOffset,
+                                 uint32_t aCount,
+                                 uint32_t *aBytesConsumed);
 
     RefPtr<nsOfflineCacheUpdate> mUpdate;
     nsCOMPtr<nsIURI> mURI;
     nsCOMPtr<nsIURI> mReferrerURI;
     nsCOMPtr<nsIPrincipal> mLoadingPrincipal;
     nsCOMPtr<nsICryptoHash> mManifestHash;
     nsCOMPtr<nsIChannel> mChannel;
 };
@@ -201,18 +201,17 @@ nsManifestCheck::Begin()
 
     return mChannel->AsyncOpen2(this);
 }
 
 //-----------------------------------------------------------------------------
 // nsManifestCheck <public>
 //-----------------------------------------------------------------------------
 
-/* static */
-NS_METHOD
+/* static */ nsresult
 nsManifestCheck::ReadManifest(nsIInputStream *aInputStream,
                               void *aClosure,
                               const char *aFromSegment,
                               uint32_t aOffset,
                               uint32_t aCount,
                               uint32_t *aBytesConsumed)
 {
     nsManifestCheck *manifestCheck =
@@ -701,17 +700,17 @@ nsOfflineManifestItem::~nsOfflineManifes
 {
 }
 
 //-----------------------------------------------------------------------------
 // nsOfflineManifestItem <private>
 //-----------------------------------------------------------------------------
 
 /* static */
-NS_METHOD
+nsresult
 nsOfflineManifestItem::ReadManifest(nsIInputStream *aInputStream,
                                     void *aClosure,
                                     const char *aFromSegment,
                                     uint32_t aOffset,
                                     uint32_t aCount,
                                     uint32_t *aBytesConsumed)
 {
     nsOfflineManifestItem *manifest =
--- a/uriloader/prefetch/nsOfflineCacheUpdate.h
+++ b/uriloader/prefetch/nsOfflineCacheUpdate.h
@@ -120,22 +120,22 @@ public:
     bool ParseSucceeded()
         { return (mParserState != PARSE_INIT && mParserState != PARSE_ERROR); }
     bool NeedsUpdate() { return mParserState != PARSE_INIT && mNeedsUpdate; }
 
     void GetManifestHash(nsCString &aManifestHash)
         { aManifestHash = mManifestHashValue; }
 
 private:
-    static NS_METHOD ReadManifest(nsIInputStream *aInputStream,
-                                  void *aClosure,
-                                  const char *aFromSegment,
-                                  uint32_t aOffset,
-                                  uint32_t aCount,
-                                  uint32_t *aBytesConsumed);
+    static nsresult ReadManifest(nsIInputStream *aInputStream,
+                                 void *aClosure,
+                                 const char *aFromSegment,
+                                 uint32_t aOffset,
+                                 uint32_t aCount,
+                                 uint32_t *aBytesConsumed);
 
     nsresult AddNamespace(uint32_t namespaceType,
                           const nsCString &namespaceSpec,
                           const nsCString &data);
 
     nsresult HandleManifestLine(const nsCString::const_iterator &aBegin,
                                 const nsCString::const_iterator &aEnd);
 
--- a/xpcom/ds/nsPersistentProperties.cpp
+++ b/xpcom/ds/nsPersistentProperties.cpp
@@ -106,22 +106,22 @@ public:
 
     mProps->SetStringProperty(NS_ConvertUTF16toUTF8(mKey), mValue, aOldValue);
     mSpecialState = eParserSpecial_None;
     WaitForKey();
   }
 
   EParserState GetState() { return mState; }
 
-  static NS_METHOD SegmentWriter(nsIUnicharInputStream* aStream,
-                                 void* aClosure,
-                                 const char16_t* aFromSegment,
-                                 uint32_t aToOffset,
-                                 uint32_t aCount,
-                                 uint32_t* aWriteCount);
+  static nsresult SegmentWriter(nsIUnicharInputStream* aStream,
+                                void* aClosure,
+                                const char16_t* aFromSegment,
+                                uint32_t aToOffset,
+                                uint32_t aCount,
+                                uint32_t* aWriteCount);
 
   nsresult ParseBuffer(const char16_t* aBuffer, uint32_t aBufferLength);
 
 private:
   bool ParseValueCharacter(
     char16_t aChar,               // character that is just being parsed
     const char16_t* aCur,         // pointer to character aChar in the buffer
     const char16_t*& aTokenStart, // string copying is done in blocks as big as
@@ -338,17 +338,17 @@ nsPropertiesParser::ParseValueCharacter(
       }
 
       break;
   }
 
   return true;
 }
 
-NS_METHOD
+nsresult
 nsPropertiesParser::SegmentWriter(nsIUnicharInputStream* aStream,
                                   void* aClosure,
                                   const char16_t* aFromSegment,
                                   uint32_t aToOffset,
                                   uint32_t aCount,
                                   uint32_t* aWriteCount)
 {
   nsPropertiesParser* parser = static_cast<nsPropertiesParser*>(aClosure);
--- a/xpcom/io/Base64.cpp
+++ b/xpcom/io/Base64.cpp
@@ -90,17 +90,17 @@ template<typename T>
 struct EncodeInputStream_State
 {
   unsigned char c[3];
   uint8_t charsOnStack;
   typename T::char_type* buffer;
 };
 
 template<typename T>
-NS_METHOD
+nsresult
 EncodeInputStream_Encoder(nsIInputStream* aStream,
                           void* aClosure,
                           const char* aFromSegment,
                           uint32_t aToOffset,
                           uint32_t aCount,
                           uint32_t* aWriteCount)
 {
   NS_ASSERTION(aCount > 0, "Er, what?");
--- a/xpcom/io/nsBinaryStream.cpp
+++ b/xpcom/io/nsBinaryStream.cpp
@@ -433,17 +433,17 @@ struct MOZ_STACK_CLASS ReadSegmentsClosu
   nsCOMPtr<nsIInputStream> mRealInputStream;
   void* mRealClosure;
   nsWriteSegmentFun mRealWriter;
   nsresult mRealResult;
   uint32_t mBytesRead;  // to properly implement aToOffset
 };
 
 // the thunking function
-static NS_METHOD
+static nsresult
 ReadSegmentForwardingThunk(nsIInputStream* aStream,
                            void* aClosure,
                            const char* aFromSegment,
                            uint32_t aToOffset,
                            uint32_t aCount,
                            uint32_t* aWriteCount)
 {
   ReadSegmentsClosure* thunkClosure =
@@ -612,17 +612,17 @@ nsBinaryInputStream::ReadFloat(float* aF
 NS_IMETHODIMP
 nsBinaryInputStream::ReadDouble(double* aDouble)
 {
   NS_ASSERTION(sizeof(double) == sizeof(uint64_t),
                "False assumption about sizeof(double)");
   return Read64(reinterpret_cast<uint64_t*>(aDouble));
 }
 
-static NS_METHOD
+static nsresult
 WriteSegmentToCString(nsIInputStream* aStream,
                       void* aClosure,
                       const char* aFromSegment,
                       uint32_t aToOffset,
                       uint32_t aCount,
                       uint32_t* aWriteCount)
 {
   nsACString* outString = static_cast<nsACString*>(aClosure);
@@ -679,17 +679,17 @@ struct WriteStringClosure
 // * even length buffer, with carryover - the first byte needs to be
 //                              used with the previous carryover byte.
 //                              this gives you an odd length buffer,
 //                              so you have to save the last byte for
 //                              the next carryover
 
 
 // same version of the above, but with correct casting and endian swapping
-static NS_METHOD
+static nsresult
 WriteSegmentToString(nsIInputStream* aStream,
                      void* aClosure,
                      const char* aFromSegment,
                      uint32_t aToOffset,
                      uint32_t aCount,
                      uint32_t* aWriteCount)
 {
   NS_PRECONDITION(aCount > 0, "Why are we being told to write 0 bytes?");
--- a/xpcom/io/nsIInputStream.idl
+++ b/xpcom/io/nsIInputStream.idl
@@ -27,22 +27,22 @@ interface nsIInputStream;
  *
  * @return NS_OK and (*aWriteCount > 0) if consumed some data
  * @return <any-error> if not interested in consuming any data
  *
  * Errors are never passed to the caller of ReadSegments.
  *
  * NOTE: returning NS_OK and (*aWriteCount = 0) has undefined behavior.
  */
-typedef NS_CALLBACK(nsWriteSegmentFun)(nsIInputStream *aInStream,
-                                       void *aClosure,
-                                       const char *aFromSegment,
-                                       uint32_t aToOffset,
-                                       uint32_t aCount,
-                                       uint32_t *aWriteCount);
+typedef nsresult (*nsWriteSegmentFun)(nsIInputStream *aInStream,
+                                      void *aClosure,
+                                      const char *aFromSegment,
+                                      uint32_t aToOffset,
+                                      uint32_t aCount,
+                                      uint32_t *aWriteCount);
 %}
 
 native nsWriteSegmentFun(nsWriteSegmentFun);
 
 /**
  * nsIInputStream
  *
  * An interface describing a readable stream of data.  An input stream may be
--- a/xpcom/io/nsIOutputStream.idl
+++ b/xpcom/io/nsIOutputStream.idl
@@ -21,22 +21,22 @@ interface nsIInputStream;
  * @param aReadCount number of bytes written
  *
  * Implementers should return the following:
  *
  * @throws <any-error> if not interested in providing any data
  *
  * Errors are never passed to the caller of WriteSegments.
  */
-typedef NS_CALLBACK(nsReadSegmentFun)(nsIOutputStream *aOutStream,
-                                      void *aClosure,
-                                      char *aToSegment,
-                                      uint32_t aFromOffset,
-                                      uint32_t aCount,
-                                      uint32_t *aReadCount);
+typedef nsresult (*nsReadSegmentFun)(nsIOutputStream *aOutStream,
+                                     void *aClosure,
+                                     char *aToSegment,
+                                     uint32_t aFromOffset,
+                                     uint32_t aCount,
+                                     uint32_t *aReadCount);
 %}
 
 native nsReadSegmentFun(nsReadSegmentFun);
 
 /**
  * nsIOutputStream
  *
  * An interface describing a writable stream of data.  An output stream may be
--- a/xpcom/io/nsIUnicharInputStream.idl
+++ b/xpcom/io/nsIUnicharInputStream.idl
@@ -23,22 +23,22 @@ interface nsIInputStream;
  * Implementers should return the following:
  *
  * @throws <any-error> if not interested in consuming any data
  *
  * Errors are never passed to the caller of ReadSegments.
  *
  * NOTE: returning NS_OK and (*aWriteCount = 0) has undefined behavior.
  */
-typedef NS_CALLBACK(nsWriteUnicharSegmentFun)(nsIUnicharInputStream *aInStream,
-                                              void *aClosure,
-                                              const char16_t *aFromSegment,
-                                              uint32_t aToOffset,
-                                              uint32_t aCount,
-                                              uint32_t *aWriteCount);
+typedef nsresult (*nsWriteUnicharSegmentFun)(nsIUnicharInputStream *aInStream,
+                                             void *aClosure,
+                                             const char16_t *aFromSegment,
+                                             uint32_t aToOffset,
+                                             uint32_t aCount,
+                                             uint32_t *aWriteCount);
 %}
 native nsWriteUnicharSegmentFun(nsWriteUnicharSegmentFun);
 
 /**
  * Abstract unicode character input stream
  * @see nsIInputStream
  */
 [scriptable, uuid(d5e3bd80-6723-4b92-b0c9-22f6162fd94f)]
--- a/xpcom/io/nsInputStreamTee.cpp
+++ b/xpcom/io/nsInputStreamTee.cpp
@@ -39,18 +39,18 @@ public:
 
 private:
   ~nsInputStreamTee()
   {
   }
 
   nsresult TeeSegment(const char* aBuf, uint32_t aCount);
 
-  static NS_METHOD WriteSegmentFun(nsIInputStream*, void*, const char*,
-                                   uint32_t, uint32_t, uint32_t*);
+  static nsresult WriteSegmentFun(nsIInputStream*, void*, const char*,
+                                  uint32_t, uint32_t, uint32_t*);
 
 private:
   nsCOMPtr<nsIInputStream>  mSource;
   nsCOMPtr<nsIOutputStream> mSink;
   nsCOMPtr<nsIEventTarget>  mEventTarget;
   nsWriteSegmentFun         mWriter;  // for implementing ReadSegments
   void*                     mClosure; // for implementing ReadSegments
   nsAutoPtr<Mutex>          mLock; // synchronize access to mSinkIsValid
@@ -185,17 +185,17 @@ nsInputStreamTee::TeeSegment(const char*
       totalBytesWritten += bytesWritten;
       NS_ASSERTION(bytesWritten <= aCount, "wrote too much");
       aCount -= bytesWritten;
     }
     return NS_OK;
   }
 }
 
-NS_METHOD
+nsresult
 nsInputStreamTee::WriteSegmentFun(nsIInputStream* aIn, void* aClosure,
                                   const char* aFromSegment, uint32_t aOffset,
                                   uint32_t aCount, uint32_t* aWriteCount)
 {
   nsInputStreamTee* tee = reinterpret_cast<nsInputStreamTee*>(aClosure);
   nsresult rv = tee->mWriter(aIn, tee->mClosure, aFromSegment, aOffset,
                              aCount, aWriteCount);
   if (NS_FAILED(rv) || (*aWriteCount == 0)) {
--- a/xpcom/io/nsMultiplexInputStream.cpp
+++ b/xpcom/io/nsMultiplexInputStream.cpp
@@ -55,19 +55,19 @@ private:
   {
     nsCOMPtr<nsIInputStream> mThisStream;
     uint32_t mOffset;
     nsWriteSegmentFun mWriter;
     void* mClosure;
     bool mDone;
   };
 
-  static NS_METHOD ReadSegCb(nsIInputStream* aIn, void* aClosure,
-                             const char* aFromRawSegment, uint32_t aToOffset,
-                             uint32_t aCount, uint32_t* aWriteCount);
+  static nsresult ReadSegCb(nsIInputStream* aIn, void* aClosure,
+                            const char* aFromRawSegment, uint32_t aToOffset,
+                            uint32_t aCount, uint32_t* aWriteCount);
 
   Mutex mLock; // Protects access to all data members.
   nsTArray<nsCOMPtr<nsIInputStream>> mStreams;
   uint32_t mCurrentStream;
   bool mStartedReadingCurrent;
   nsresult mStatus;
 };
 
@@ -331,17 +331,17 @@ nsMultiplexInputStream::ReadSegments(nsW
     }
   }
 
   // if we successfully read some data, then this call succeeded.
   *aResult = state.mOffset;
   return state.mOffset ? NS_OK : rv;
 }
 
-NS_METHOD
+nsresult
 nsMultiplexInputStream::ReadSegCb(nsIInputStream* aIn, void* aClosure,
                                   const char* aFromRawSegment,
                                   uint32_t aToOffset, uint32_t aCount,
                                   uint32_t* aWriteCount)
 {
   nsresult rv;
   ReadSegmentsState* state = (ReadSegmentsState*)aClosure;
   rv = (state->mWriter)(state->mThisStream,
--- a/xpcom/io/nsPipe3.cpp
+++ b/xpcom/io/nsPipe3.cpp
@@ -1714,17 +1714,17 @@ nsPipeOutputStream::WriteSegments(nsRead
     if (segmentLen < originalLen) {
       mPipe->AdvanceWriteCursor(originalLen - segmentLen);
     }
   }
 
   return rv;
 }
 
-static NS_METHOD
+static nsresult
 nsReadFromRawBuffer(nsIOutputStream* aOutStr,
                     void* aClosure,
                     char* aToRawSegment,
                     uint32_t aOffset,
                     uint32_t aCount,
                     uint32_t* aReadCount)
 {
   const char* fromBuf = (const char*)aClosure;
@@ -1743,17 +1743,17 @@ nsPipeOutputStream::Write(const char* aF
 
 NS_IMETHODIMP
 nsPipeOutputStream::Flush(void)
 {
   // nothing to do
   return NS_OK;
 }
 
-static NS_METHOD
+static nsresult
 nsReadFromInputStream(nsIOutputStream* aOutStr,
                       void* aClosure,
                       char* aToRawSegment,
                       uint32_t aOffset,
                       uint32_t aCount,
                       uint32_t* aReadCount)
 {
   nsIInputStream* fromStream = (nsIInputStream*)aClosure;
--- a/xpcom/io/nsStreamUtils.cpp
+++ b/xpcom/io/nsStreamUtils.cpp
@@ -524,22 +524,22 @@ public:
 
   struct MOZ_STACK_CLASS ReadSegmentsState
   {
     // the nsIOutputStream will outlive the ReadSegmentsState on the stack
     nsIOutputStream* MOZ_NON_OWNING_REF mSink;
     nsresult         mSinkCondition;
   };
 
-  static NS_METHOD ConsumeInputBuffer(nsIInputStream* aInStr,
-                                      void* aClosure,
-                                      const char* aBuffer,
-                                      uint32_t aOffset,
-                                      uint32_t aCount,
-                                      uint32_t* aCountWritten)
+  static nsresult ConsumeInputBuffer(nsIInputStream* aInStr,
+                                     void* aClosure,
+                                     const char* aBuffer,
+                                     uint32_t aOffset,
+                                     uint32_t aCount,
+                                     uint32_t* aCountWritten)
   {
     ReadSegmentsState* state = (ReadSegmentsState*)aClosure;
 
     nsresult rv = state->mSink->Write(aBuffer, aCount, aCountWritten);
     if (NS_FAILED(rv)) {
       state->mSinkCondition = rv;
     } else if (*aCountWritten == 0) {
       state->mSinkCondition = NS_BASE_STREAM_CLOSED;
@@ -580,22 +580,22 @@ public:
 
   struct MOZ_STACK_CLASS WriteSegmentsState
   {
     // the nsIInputStream will outlive the WriteSegmentsState on the stack
     nsIInputStream* MOZ_NON_OWNING_REF mSource;
     nsresult        mSourceCondition;
   };
 
-  static NS_METHOD FillOutputBuffer(nsIOutputStream* aOutStr,
-                                    void* aClosure,
-                                    char* aBuffer,
-                                    uint32_t aOffset,
-                                    uint32_t aCount,
-                                    uint32_t* aCountRead)
+  static nsresult FillOutputBuffer(nsIOutputStream* aOutStr,
+                                   void* aClosure,
+                                   char* aBuffer,
+                                   uint32_t aOffset,
+                                   uint32_t aCount,
+                                   uint32_t* aCountRead)
   {
     WriteSegmentsState* state = (WriteSegmentsState*)aClosure;
 
     nsresult rv = state->mSource->Read(aBuffer, aCount, aCountRead);
     if (NS_FAILED(rv)) {
       state->mSourceCondition = rv;
     } else if (*aCountRead == 0) {
       state->mSourceCondition = NS_BASE_STREAM_CLOSED;
@@ -724,17 +724,17 @@ NS_ConsumeStream(nsIInputStream* aStream
     aMaxCount -= n;
   }
 
   return rv;
 }
 
 //-----------------------------------------------------------------------------
 
-static NS_METHOD
+static nsresult
 TestInputStream(nsIInputStream* aInStr,
                 void* aClosure,
                 const char* aBuffer,
                 uint32_t aOffset,
                 uint32_t aCount,
                 uint32_t* aCountWritten)
 {
   bool* result = static_cast<bool*>(aClosure);
@@ -751,17 +751,17 @@ NS_InputStreamIsBuffered(nsIInputStream*
   }
 
   bool result = false;
   uint32_t n;
   nsresult rv = aStream->ReadSegments(TestInputStream, &result, 1, &n);
   return result || NS_SUCCEEDED(rv);
 }
 
-static NS_METHOD
+static nsresult
 TestOutputStream(nsIOutputStream* aOutStr,
                  void* aClosure,
                  char* aBuffer,
                  uint32_t aOffset,
                  uint32_t aCount,
                  uint32_t* aCountRead)
 {
   bool* result = static_cast<bool*>(aClosure);
@@ -780,17 +780,17 @@ NS_OutputStreamIsBuffered(nsIOutputStrea
   bool result = false;
   uint32_t n;
   aStream->WriteSegments(TestOutputStream, &result, 1, &n);
   return result;
 }
 
 //-----------------------------------------------------------------------------
 
-NS_METHOD
+nsresult
 NS_CopySegmentToStream(nsIInputStream* aInStr,
                        void* aClosure,
                        const char* aBuffer,
                        uint32_t aOffset,
                        uint32_t aCount,
                        uint32_t* aCountWritten)
 {
   nsIOutputStream* outStr = static_cast<nsIOutputStream*>(aClosure);
@@ -803,59 +803,59 @@ NS_CopySegmentToStream(nsIInputStream* a
     }
     aBuffer += n;
     aCount -= n;
     *aCountWritten += n;
   }
   return NS_OK;
 }
 
-NS_METHOD
+nsresult
 NS_CopySegmentToBuffer(nsIInputStream* aInStr,
                        void* aClosure,
                        const char* aBuffer,
                        uint32_t aOffset,
                        uint32_t aCount,
                        uint32_t* aCountWritten)
 {
   char* toBuf = static_cast<char*>(aClosure);
   memcpy(&toBuf[aOffset], aBuffer, aCount);
   *aCountWritten = aCount;
   return NS_OK;
 }
 
-NS_METHOD
+nsresult
 NS_CopySegmentToBuffer(nsIOutputStream* aOutStr,
                        void* aClosure,
                        char* aBuffer,
                        uint32_t aOffset,
                        uint32_t aCount,
                        uint32_t* aCountRead)
 {
   const char* fromBuf = static_cast<const char*>(aClosure);
   memcpy(aBuffer, &fromBuf[aOffset], aCount);
   *aCountRead = aCount;
   return NS_OK;
 }
 
-NS_METHOD
+nsresult
 NS_DiscardSegment(nsIInputStream* aInStr,
                   void* aClosure,
                   const char* aBuffer,
                   uint32_t aOffset,
                   uint32_t aCount,
                   uint32_t* aCountWritten)
 {
   *aCountWritten = aCount;
   return NS_OK;
 }
 
 //-----------------------------------------------------------------------------
 
-NS_METHOD
+nsresult
 NS_WriteSegmentThunk(nsIInputStream* aInStr,
                      void* aClosure,
                      const char* aBuffer,
                      uint32_t aOffset,
                      uint32_t aCount,
                      uint32_t* aCountWritten)
 {
   nsWriteSegmentThunk* thunk = static_cast<nsWriteSegmentThunk*>(aClosure);
--- a/xpcom/io/nsStreamUtils.h
+++ b/xpcom/io/nsStreamUtils.h
@@ -177,70 +177,70 @@ NS_OutputStreamIsBuffered(nsIOutputStrea
 
 /**
  * This function is intended to be passed to nsIInputStream::ReadSegments to
  * copy data from the nsIInputStream into a nsIOutputStream passed as the
  * aClosure parameter to the ReadSegments function.
  *
  * @see nsIInputStream.idl for a description of this function's parameters.
  */
-extern NS_METHOD
+extern nsresult
 NS_CopySegmentToStream(nsIInputStream* aInputStream, void* aClosure,
                        const char* aFromSegment, uint32_t aToOffset,
                        uint32_t aCount, uint32_t* aWriteCount);
 
 /**
  * This function is intended to be passed to nsIInputStream::ReadSegments to
  * copy data from the nsIInputStream into a character buffer passed as the
  * aClosure parameter to the ReadSegments function.  The character buffer
  * must be at least as large as the aCount parameter passed to ReadSegments.
  *
  * @see nsIInputStream.idl for a description of this function's parameters.
  */
-extern NS_METHOD
+extern nsresult
 NS_CopySegmentToBuffer(nsIInputStream* aInputStream, void* aClosure,
                        const char* aFromSegment, uint32_t aToOffset,
                        uint32_t aCount, uint32_t* aWriteCount);
 
 /**
  * This function is intended to be passed to nsIOutputStream::WriteSegments to
  * copy data into the nsIOutputStream from a character buffer passed as the
  * aClosure parameter to the WriteSegments function.
  *
  * @see nsIOutputStream.idl for a description of this function's parameters.
  */
-extern NS_METHOD
+extern nsresult
 NS_CopySegmentToBuffer(nsIOutputStream* aOutputStream, void* aClosure,
                        char* aToSegment, uint32_t aFromOffset,
                        uint32_t aCount, uint32_t* aReadCount);
 
 /**
  * This function is intended to be passed to nsIInputStream::ReadSegments to
  * discard data from the nsIInputStream.  This can be used to efficiently read
  * data from the stream without actually copying any bytes.
  *
  * @see nsIInputStream.idl for a description of this function's parameters.
  */
-extern NS_METHOD
+extern nsresult
 NS_DiscardSegment(nsIInputStream* aInputStream, void* aClosure,
                   const char* aFromSegment, uint32_t aToOffset,
                   uint32_t aCount, uint32_t* aWriteCount);
 
 /**
  * This function is intended to be passed to nsIInputStream::ReadSegments to
  * adjust the aInputStream parameter passed to a consumer's WriteSegmentFun.
  * The aClosure parameter must be a pointer to a nsWriteSegmentThunk object.
  * The mStream and mClosure members of that object will be passed to the mFun
  * function, with the remainder of the parameters being what are passed to
  * NS_WriteSegmentThunk.
  *
  * This function comes in handy when implementing ReadSegments in terms of an
  * inner stream's ReadSegments.
  */
-extern NS_METHOD
+extern nsresult
 NS_WriteSegmentThunk(nsIInputStream* aInputStream, void* aClosure,
                      const char* aFromSegment, uint32_t aToOffset,
                      uint32_t aCount, uint32_t* aWriteCount);
 
 struct MOZ_STACK_CLASS nsWriteSegmentThunk
 {
   nsCOMPtr<nsIInputStream> mStream;
   nsWriteSegmentFun mFun;
--- a/xpcom/tests/gtest/TestPipes.cpp
+++ b/xpcom/tests/gtest/TestPipes.cpp
@@ -868,17 +868,17 @@ TEST(Pipes, Read_AsyncWait_Clone)
   ASSERT_TRUE(cb->Called());
   ASSERT_TRUE(cb2->Called());
 
   testing::ConsumeAndValidateStream(reader, inputData);
 }
 
 namespace {
 
-NS_METHOD
+nsresult
 CloseDuringReadFunc(nsIInputStream *aReader,
                     void* aClosure,
                     const char* aFromSegment,
                     uint32_t aToOffset,
                     uint32_t aCount,
                     uint32_t* aWriteCountOut)
 {
   MOZ_ASSERT(aReader);