1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #include "EmptyBlobImpl.h"
8 #include "nsStringStream.h"
10 namespace mozilla::dom
{
12 already_AddRefed
<BlobImpl
> EmptyBlobImpl::CreateSlice(
13 uint64_t aStart
, uint64_t aLength
, const nsAString
& aContentType
,
14 ErrorResult
& aRv
) const {
15 MOZ_ASSERT(!aStart
&& !aLength
);
16 RefPtr
<BlobImpl
> impl
= new EmptyBlobImpl(aContentType
);
20 void EmptyBlobImpl::CreateInputStream(nsIInputStream
** aStream
,
21 ErrorResult
& aRv
) const {
22 if (NS_WARN_IF(!aStream
)) {
23 aRv
.Throw(NS_ERROR_FAILURE
);
27 nsresult rv
= NS_NewCStringInputStream(aStream
, ""_ns
);
28 if (NS_WARN_IF(NS_FAILED(rv
))) {
34 } // namespace mozilla::dom