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 "mozilla/dom/BaseBlobImpl.h"
8 #include "nsRFPService.h"
14 void BaseBlobImpl::GetName(nsAString
& aName
) const {
15 MOZ_ASSERT(mIsFile
, "Should only be called on files");
19 void BaseBlobImpl::GetDOMPath(nsAString
& aPath
) const {
20 MOZ_ASSERT(mIsFile
, "Should only be called on files");
24 void BaseBlobImpl::SetDOMPath(const nsAString
& aPath
) {
25 MOZ_ASSERT(mIsFile
, "Should only be called on files");
29 void BaseBlobImpl::GetMozFullPath(nsAString
& aFileName
,
30 SystemCallerGuarantee
/* unused */,
32 MOZ_ASSERT(mIsFile
, "Should only be called on files");
34 GetMozFullPathInternal(aFileName
, aRv
);
37 void BaseBlobImpl::GetMozFullPathInternal(nsAString
& aFileName
,
40 aRv
.Throw(NS_ERROR_FAILURE
);
47 void BaseBlobImpl::GetType(nsAString
& aType
) { aType
= mContentType
; }
49 int64_t BaseBlobImpl::GetLastModified(ErrorResult
& aRv
) {
50 MOZ_ASSERT(mIsFile
, "Should only be called on files");
51 return mLastModificationDate
/ PR_USEC_PER_MSEC
;
54 int64_t BaseBlobImpl::GetFileId() { return -1; }
57 uint64_t BaseBlobImpl::NextSerialNumber() {
58 static Atomic
<uint64_t> nextSerialNumber
;
59 return nextSerialNumber
++;
62 void BaseBlobImpl::SetLastModificationDatePrecisely(int64_t aDate
) {
63 MOZ_ASSERT(mIsFile
, "Should only be called on files");
64 mLastModificationDate
= aDate
;
67 void BaseBlobImpl::SetLastModificationDate(bool aCrossOriginIsolated
,
69 return SetLastModificationDatePrecisely(
70 nsRFPService::ReduceTimePrecisionAsUSecs(aDate
, 0,
71 /* aIsSystemPrincipal */ false,
72 aCrossOriginIsolated
));
73 // mLastModificationDate is an absolute timestamp so we supply a zero
78 } // namespace mozilla