Coverage Report

Created: 2018-09-25 14:53

/src/mozilla-central/dom/file/EmptyBlobImpl.cpp
Line
Count
Source (jump to first uncovered line)
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/. */
6
7
#include "EmptyBlobImpl.h"
8
#include "nsStringStream.h"
9
10
namespace mozilla {
11
namespace dom {
12
13
already_AddRefed<BlobImpl>
14
EmptyBlobImpl::CreateSlice(uint64_t aStart, uint64_t aLength,
15
                           const nsAString& aContentType,
16
                           ErrorResult& aRv)
17
0
{
18
0
  MOZ_ASSERT(!aStart && !aLength);
19
0
  RefPtr<BlobImpl> impl = new EmptyBlobImpl(aContentType);
20
0
21
0
  DebugOnly<bool> isMutable;
22
0
  MOZ_ASSERT(NS_SUCCEEDED(impl->GetMutable(&isMutable)));
23
0
  MOZ_ASSERT(!isMutable);
24
0
25
0
  return impl.forget();
26
0
}
27
28
void
29
EmptyBlobImpl::CreateInputStream(nsIInputStream** aStream,
30
                                 ErrorResult& aRv)
31
0
{
32
0
  if (NS_WARN_IF(!aStream)) {
33
0
    aRv.Throw(NS_ERROR_FAILURE);
34
0
    return;
35
0
  }
36
0
37
0
  nsresult rv = NS_NewCStringInputStream(aStream, EmptyCString());
38
0
  if (NS_WARN_IF(NS_FAILED(rv))) {
39
0
    aRv.Throw(rv);
40
0
    return;
41
0
  }
42
0
}
43
44
} // namespace dom
45
} // namespace mozilla