Bug 1500370 - MemoryBlobImpl and TestNonBlockingAsyncInputStream must expose nsITellableInterface, r=mayhemer
authorAndrea Marchesini <amarchesini@mozilla.com>
Fri, 19 Oct 2018 15:31:36 +0200
changeset 490440 fc083f953b3e7afbfd697b8c1091bee5ad88ea74
parent 490439 16864944bab1d02697d9d08b7fdeaebaa62d8f59
child 490441 ab5f788c2759a9f9b0aa7977b504812879bf38b1
push id247
push userfmarier@mozilla.com
push dateSat, 27 Oct 2018 01:06:44 +0000
reviewersmayhemer
bugs1500370
milestone64.0a1
Bug 1500370 - MemoryBlobImpl and TestNonBlockingAsyncInputStream must expose nsITellableInterface, r=mayhemer
dom/file/MemoryBlobImpl.cpp
xpcom/tests/gtest/TestNonBlockingAsyncInputStream.cpp
--- a/dom/file/MemoryBlobImpl.cpp
+++ b/dom/file/MemoryBlobImpl.cpp
@@ -13,16 +13,17 @@ namespace mozilla {
 namespace dom {
 
 NS_IMPL_ADDREF(MemoryBlobImpl::DataOwnerAdapter)
 NS_IMPL_RELEASE(MemoryBlobImpl::DataOwnerAdapter)
 
 NS_INTERFACE_MAP_BEGIN(MemoryBlobImpl::DataOwnerAdapter)
   NS_INTERFACE_MAP_ENTRY(nsIInputStream)
   NS_INTERFACE_MAP_ENTRY(nsISeekableStream)
+  NS_INTERFACE_MAP_ENTRY(nsITellableStream)
   NS_INTERFACE_MAP_ENTRY(nsICloneableInputStream)
   NS_INTERFACE_MAP_ENTRY_CONDITIONAL(nsIIPCSerializableInputStream,
                                      mSerializableInputStream)
   NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIInputStream)
 NS_INTERFACE_MAP_END
 
 nsresult MemoryBlobImpl::DataOwnerAdapter::Create(DataOwner* aDataOwner,
                                                   uint32_t aStart,
--- a/xpcom/tests/gtest/TestNonBlockingAsyncInputStream.cpp
+++ b/xpcom/tests/gtest/TestNonBlockingAsyncInputStream.cpp
@@ -282,18 +282,20 @@ public:
   // nsIIPCSerializableInputStream
   void Serialize(mozilla::ipc::InputStreamParams&, FileDescriptorArray&) override {}
   bool Deserialize(const mozilla::ipc::InputStreamParams&,
                    const FileDescriptorArray&) override { return false; }
   mozilla::Maybe<uint64_t> ExpectedSerializedLength() override { return mozilla::Nothing(); }
 
   // nsISeekableStream
   NS_IMETHOD Seek(int32_t, int64_t) override { return NS_ERROR_NOT_IMPLEMENTED; }
+  NS_IMETHOD SetEOF() override { return NS_ERROR_NOT_IMPLEMENTED; }
+
+  // nsITellableStream
   NS_IMETHOD Tell(int64_t*) override { return NS_ERROR_NOT_IMPLEMENTED; }
-  NS_IMETHOD SetEOF() override { return NS_ERROR_NOT_IMPLEMENTED; }
 
 private:
   ~QIInputStream() = default;
 
   bool mNonBlockingError;
   bool mCloneable;
   bool mIPCSerializable;
   bool mSeekable;
@@ -302,16 +304,17 @@ private:
 NS_IMPL_ADDREF(QIInputStream);
 NS_IMPL_RELEASE(QIInputStream);
 
 NS_INTERFACE_MAP_BEGIN(QIInputStream)
   NS_INTERFACE_MAP_ENTRY(nsIInputStream)
   NS_INTERFACE_MAP_ENTRY_CONDITIONAL(nsICloneableInputStream, mCloneable)
   NS_INTERFACE_MAP_ENTRY_CONDITIONAL(nsIIPCSerializableInputStream, mIPCSerializable)
   NS_INTERFACE_MAP_ENTRY_CONDITIONAL(nsISeekableStream, mSeekable)
+  NS_INTERFACE_MAP_ENTRY_CONDITIONAL(nsITellableStream, mSeekable)
   NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIInputStream)
 NS_INTERFACE_MAP_END
 
 TEST(TestNonBlockingAsyncInputStream, QI) {
   // Let's test ::Create() returning error.
 
   nsCOMPtr<nsIAsyncInputStream> async;
   {