mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-05 05:30:29 +00:00
Bug 1586761 - P4 - Use new methods in dom/file and dom/events; r=baku
For the usecases in dom/file, I'm not so sure how to get the global at callsites, so I let aIsSystemPrincipal and aCrossOriginIsolated to be false for now. Differential Revision: https://phabricator.services.mozilla.com/D63905 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
b05759de17
commit
3d9adc5e80
@ -723,20 +723,22 @@ double Event::TimeStamp() {
|
|||||||
double ret =
|
double ret =
|
||||||
perf->GetDOMTiming()->TimeStampToDOMHighRes(mEvent->mTimeStamp);
|
perf->GetDOMTiming()->TimeStampToDOMHighRes(mEvent->mTimeStamp);
|
||||||
MOZ_ASSERT(mOwner->PrincipalOrNull());
|
MOZ_ASSERT(mOwner->PrincipalOrNull());
|
||||||
if (mOwner->PrincipalOrNull()->IsSystemPrincipal()) return ret;
|
|
||||||
|
|
||||||
return nsRFPService::ReduceTimePrecisionAsMSecs(
|
return nsRFPService::ReduceTimePrecisionAsMSecs(
|
||||||
ret, perf->GetRandomTimelineSeed());
|
ret, perf->GetRandomTimelineSeed(),
|
||||||
|
mOwner->PrincipalOrNull()->IsSystemPrincipal(),
|
||||||
|
mOwner->CrossOriginIsolated());
|
||||||
}
|
}
|
||||||
|
|
||||||
WorkerPrivate* workerPrivate = GetCurrentThreadWorkerPrivate();
|
WorkerPrivate* workerPrivate = GetCurrentThreadWorkerPrivate();
|
||||||
MOZ_ASSERT(workerPrivate);
|
MOZ_ASSERT(workerPrivate);
|
||||||
|
|
||||||
double ret = workerPrivate->TimeStampToDOMHighRes(mEvent->mTimeStamp);
|
double ret = workerPrivate->TimeStampToDOMHighRes(mEvent->mTimeStamp);
|
||||||
if (workerPrivate->UsesSystemPrincipal()) return ret;
|
|
||||||
|
|
||||||
return nsRFPService::ReduceTimePrecisionAsMSecs(
|
return nsRFPService::ReduceTimePrecisionAsMSecs(
|
||||||
ret, workerPrivate->GetRandomTimelineSeed());
|
ret, workerPrivate->GetRandomTimelineSeed(),
|
||||||
|
workerPrivate->UsesSystemPrincipal(),
|
||||||
|
workerPrivate->CrossOriginIsolated());
|
||||||
}
|
}
|
||||||
|
|
||||||
void Event::Serialize(IPC::Message* aMsg, bool aSerializeInterfaceType) {
|
void Event::Serialize(IPC::Message* aMsg, bool aSerializeInterfaceType) {
|
||||||
|
@ -59,5 +59,20 @@ uint64_t BaseBlobImpl::NextSerialNumber() {
|
|||||||
return nextSerialNumber++;
|
return nextSerialNumber++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BaseBlobImpl::SetLastModificationDatePrecisely(int64_t aDate) {
|
||||||
|
MOZ_ASSERT(mIsFile, "Should only be called on files");
|
||||||
|
mLastModificationDate = aDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
void BaseBlobImpl::SetLastModificationDate(bool aCrossOriginIsolated,
|
||||||
|
int64_t aDate) {
|
||||||
|
return SetLastModificationDatePrecisely(
|
||||||
|
nsRFPService::ReduceTimePrecisionAsUSecs(aDate, 0,
|
||||||
|
/* aIsSystemPrincipal */ false,
|
||||||
|
aCrossOriginIsolated));
|
||||||
|
// mLastModificationDate is an absolute timestamp so we supply a zero
|
||||||
|
// context mix-in
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace dom
|
} // namespace dom
|
||||||
} // namespace mozilla
|
} // namespace mozilla
|
||||||
|
@ -26,8 +26,8 @@ class BaseBlobImpl : public BlobImpl {
|
|||||||
mName(aName),
|
mName(aName),
|
||||||
mStart(0),
|
mStart(0),
|
||||||
mLength(aLength),
|
mLength(aLength),
|
||||||
mLastModificationDate(aLastModifiedDate),
|
mSerialNumber(NextSerialNumber()),
|
||||||
mSerialNumber(NextSerialNumber()) {
|
mLastModificationDate(aLastModifiedDate) {
|
||||||
// Ensure non-null mContentType by default
|
// Ensure non-null mContentType by default
|
||||||
mContentType.SetIsVoid(false);
|
mContentType.SetIsVoid(false);
|
||||||
}
|
}
|
||||||
@ -38,8 +38,8 @@ class BaseBlobImpl : public BlobImpl {
|
|||||||
mContentType(aContentType),
|
mContentType(aContentType),
|
||||||
mStart(0),
|
mStart(0),
|
||||||
mLength(aLength),
|
mLength(aLength),
|
||||||
mLastModificationDate(0),
|
mSerialNumber(NextSerialNumber()),
|
||||||
mSerialNumber(NextSerialNumber()) {
|
mLastModificationDate(0) {
|
||||||
// Ensure non-null mContentType by default
|
// Ensure non-null mContentType by default
|
||||||
mContentType.SetIsVoid(false);
|
mContentType.SetIsVoid(false);
|
||||||
}
|
}
|
||||||
@ -50,8 +50,8 @@ class BaseBlobImpl : public BlobImpl {
|
|||||||
mContentType(aContentType),
|
mContentType(aContentType),
|
||||||
mStart(aStart),
|
mStart(aStart),
|
||||||
mLength(aLength),
|
mLength(aLength),
|
||||||
mLastModificationDate(0),
|
mSerialNumber(NextSerialNumber()),
|
||||||
mSerialNumber(NextSerialNumber()) {
|
mLastModificationDate(0) {
|
||||||
// Ensure non-null mContentType by default
|
// Ensure non-null mContentType by default
|
||||||
mContentType.SetIsVoid(false);
|
mContentType.SetIsVoid(false);
|
||||||
}
|
}
|
||||||
@ -108,7 +108,7 @@ class BaseBlobImpl : public BlobImpl {
|
|||||||
mName = aName;
|
mName = aName;
|
||||||
mContentType = aContentType;
|
mContentType = aContentType;
|
||||||
mLength = aLength;
|
mLength = aLength;
|
||||||
mLastModificationDate = aLastModifiedDate;
|
SetLastModificationDatePrecisely(aLastModifiedDate);
|
||||||
mIsFile = !aName.IsVoid();
|
mIsFile = !aName.IsVoid();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -130,6 +130,17 @@ class BaseBlobImpl : public BlobImpl {
|
|||||||
*/
|
*/
|
||||||
static uint64_t NextSerialNumber();
|
static uint64_t NextSerialNumber();
|
||||||
|
|
||||||
|
void SetLastModificationDate(bool aCrossOriginIsolated, int64_t aDate);
|
||||||
|
void SetLastModificationDatePrecisely(int64_t aDate);
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
|
bool IsLastModificationDateUnset() const {
|
||||||
|
return mLastModificationDate == INT64_MAX;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
const nsString mBlobImplType;
|
||||||
|
|
||||||
bool mIsFile;
|
bool mIsFile;
|
||||||
|
|
||||||
nsString mContentType;
|
nsString mContentType;
|
||||||
@ -139,9 +150,10 @@ class BaseBlobImpl : public BlobImpl {
|
|||||||
uint64_t mStart;
|
uint64_t mStart;
|
||||||
uint64_t mLength;
|
uint64_t mLength;
|
||||||
|
|
||||||
int64_t mLastModificationDate;
|
|
||||||
|
|
||||||
const uint64_t mSerialNumber;
|
const uint64_t mSerialNumber;
|
||||||
|
|
||||||
|
private:
|
||||||
|
int64_t mLastModificationDate;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace dom
|
} // namespace dom
|
||||||
|
@ -147,7 +147,8 @@ already_AddRefed<File> Blob::ToFile(const nsAString& aName,
|
|||||||
mImpl->GetType(contentType);
|
mImpl->GetType(contentType);
|
||||||
|
|
||||||
RefPtr<MultipartBlobImpl> impl =
|
RefPtr<MultipartBlobImpl> impl =
|
||||||
MultipartBlobImpl::Create(std::move(blobImpls), aName, contentType, aRv);
|
MultipartBlobImpl::Create(std::move(blobImpls), aName, contentType,
|
||||||
|
mGlobal->CrossOriginIsolated(), aRv);
|
||||||
if (NS_WARN_IF(aRv.Failed())) {
|
if (NS_WARN_IF(aRv.Failed())) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
@ -216,13 +217,16 @@ already_AddRefed<Blob> Blob::Constructor(
|
|||||||
const BlobPropertyBag& aBag, ErrorResult& aRv) {
|
const BlobPropertyBag& aBag, ErrorResult& aRv) {
|
||||||
RefPtr<MultipartBlobImpl> impl = new MultipartBlobImpl();
|
RefPtr<MultipartBlobImpl> impl = new MultipartBlobImpl();
|
||||||
|
|
||||||
|
nsCOMPtr<nsIGlobalObject> global = do_QueryInterface(aGlobal.GetAsSupports());
|
||||||
|
MOZ_ASSERT(global);
|
||||||
if (aData.WasPassed()) {
|
if (aData.WasPassed()) {
|
||||||
nsAutoString type(aBag.mType);
|
nsAutoString type(aBag.mType);
|
||||||
MakeValidBlobType(type);
|
MakeValidBlobType(type);
|
||||||
impl->InitializeBlob(aData.Value(), type,
|
impl->InitializeBlob(aData.Value(), type,
|
||||||
aBag.mEndings == EndingType::Native, aRv);
|
aBag.mEndings == EndingType::Native,
|
||||||
|
global->CrossOriginIsolated(), aRv);
|
||||||
} else {
|
} else {
|
||||||
impl->InitializeBlob(aRv);
|
impl->InitializeBlob(global->CrossOriginIsolated(), aRv);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (NS_WARN_IF(aRv.Failed())) {
|
if (NS_WARN_IF(aRv.Failed())) {
|
||||||
@ -231,9 +235,6 @@ already_AddRefed<Blob> Blob::Constructor(
|
|||||||
|
|
||||||
MOZ_ASSERT(!impl->IsFile());
|
MOZ_ASSERT(!impl->IsFile());
|
||||||
|
|
||||||
nsCOMPtr<nsIGlobalObject> global = do_QueryInterface(aGlobal.GetAsSupports());
|
|
||||||
MOZ_ASSERT(global);
|
|
||||||
|
|
||||||
RefPtr<Blob> blob = Blob::Create(global, impl);
|
RefPtr<Blob> blob = Blob::Create(global, impl);
|
||||||
return blob.forget();
|
return blob.forget();
|
||||||
}
|
}
|
||||||
|
@ -55,8 +55,11 @@ already_AddRefed<File> File::CreateMemoryFileWithCustomLastModified(
|
|||||||
already_AddRefed<File> File::CreateMemoryFileWithLastModifiedNow(
|
already_AddRefed<File> File::CreateMemoryFileWithLastModifiedNow(
|
||||||
nsIGlobalObject* aGlobal, void* aMemoryBuffer, uint64_t aLength,
|
nsIGlobalObject* aGlobal, void* aMemoryBuffer, uint64_t aLength,
|
||||||
const nsAString& aName, const nsAString& aContentType) {
|
const nsAString& aName, const nsAString& aContentType) {
|
||||||
|
MOZ_ASSERT(aGlobal);
|
||||||
|
|
||||||
RefPtr<MemoryBlobImpl> blobImpl = MemoryBlobImpl::CreateWithLastModifiedNow(
|
RefPtr<MemoryBlobImpl> blobImpl = MemoryBlobImpl::CreateWithLastModifiedNow(
|
||||||
aMemoryBuffer, aLength, aName, aContentType);
|
aMemoryBuffer, aLength, aName, aContentType,
|
||||||
|
aGlobal->CrossOriginIsolated());
|
||||||
MOZ_ASSERT(blobImpl);
|
MOZ_ASSERT(blobImpl);
|
||||||
|
|
||||||
RefPtr<File> file = File::Create(aGlobal, blobImpl);
|
RefPtr<File> file = File::Create(aGlobal, blobImpl);
|
||||||
@ -138,9 +141,13 @@ already_AddRefed<File> File::Constructor(const GlobalObject& aGlobal,
|
|||||||
|
|
||||||
RefPtr<MultipartBlobImpl> impl = new MultipartBlobImpl(name);
|
RefPtr<MultipartBlobImpl> impl = new MultipartBlobImpl(name);
|
||||||
|
|
||||||
|
nsCOMPtr<nsIGlobalObject> global = do_QueryInterface(aGlobal.GetAsSupports());
|
||||||
|
MOZ_ASSERT(global);
|
||||||
|
|
||||||
nsAutoString type(aBag.mType);
|
nsAutoString type(aBag.mType);
|
||||||
MakeValidBlobType(type);
|
MakeValidBlobType(type);
|
||||||
impl->InitializeBlob(aData, type, aBag.mEndings == EndingType::Native, aRv);
|
impl->InitializeBlob(aData, type, aBag.mEndings == EndingType::Native,
|
||||||
|
global->CrossOriginIsolated(), aRv);
|
||||||
if (aRv.Failed()) {
|
if (aRv.Failed()) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
@ -150,9 +157,6 @@ already_AddRefed<File> File::Constructor(const GlobalObject& aGlobal,
|
|||||||
impl->SetLastModified(aBag.mLastModified.Value());
|
impl->SetLastModified(aBag.mLastModified.Value());
|
||||||
}
|
}
|
||||||
|
|
||||||
nsCOMPtr<nsIGlobalObject> global = do_QueryInterface(aGlobal.GetAsSupports());
|
|
||||||
MOZ_ASSERT(global);
|
|
||||||
|
|
||||||
RefPtr<File> file = new File(global, impl);
|
RefPtr<File> file = new File(global, impl);
|
||||||
return file.forget();
|
return file.forget();
|
||||||
}
|
}
|
||||||
|
@ -37,9 +37,10 @@ already_AddRefed<MemoryBlobImpl> MemoryBlobImpl::CreateWithCustomLastModified(
|
|||||||
// static
|
// static
|
||||||
already_AddRefed<MemoryBlobImpl> MemoryBlobImpl::CreateWithLastModifiedNow(
|
already_AddRefed<MemoryBlobImpl> MemoryBlobImpl::CreateWithLastModifiedNow(
|
||||||
void* aMemoryBuffer, uint64_t aLength, const nsAString& aName,
|
void* aMemoryBuffer, uint64_t aLength, const nsAString& aName,
|
||||||
const nsAString& aContentType) {
|
const nsAString& aContentType, bool aCrossOriginIsolated) {
|
||||||
int64_t lastModificationDate =
|
int64_t lastModificationDate = nsRFPService::ReduceTimePrecisionAsUSecs(
|
||||||
nsRFPService::ReduceTimePrecisionAsUSecs(PR_Now(), 0);
|
PR_Now(), 0,
|
||||||
|
/* aIsSystemPrincipal */ false, aCrossOriginIsolated);
|
||||||
return CreateWithCustomLastModified(aMemoryBuffer, aLength, aName,
|
return CreateWithCustomLastModified(aMemoryBuffer, aLength, aName,
|
||||||
aContentType, lastModificationDate);
|
aContentType, lastModificationDate);
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,7 @@ class MemoryBlobImpl final : public BaseBlobImpl {
|
|||||||
// File constructor.
|
// File constructor.
|
||||||
static already_AddRefed<MemoryBlobImpl> CreateWithLastModifiedNow(
|
static already_AddRefed<MemoryBlobImpl> CreateWithLastModifiedNow(
|
||||||
void* aMemoryBuffer, uint64_t aLength, const nsAString& aName,
|
void* aMemoryBuffer, uint64_t aLength, const nsAString& aName,
|
||||||
const nsAString& aContentType);
|
const nsAString& aContentType, bool aCrossOriginIsolated);
|
||||||
|
|
||||||
// File constructor with custom lastModified attribue value. You should
|
// File constructor with custom lastModified attribue value. You should
|
||||||
// probably use CreateWithLastModifiedNow() instead of this one.
|
// probably use CreateWithLastModifiedNow() instead of this one.
|
||||||
|
@ -23,10 +23,11 @@ using namespace mozilla::dom;
|
|||||||
/* static */
|
/* static */
|
||||||
already_AddRefed<MultipartBlobImpl> MultipartBlobImpl::Create(
|
already_AddRefed<MultipartBlobImpl> MultipartBlobImpl::Create(
|
||||||
nsTArray<RefPtr<BlobImpl>>&& aBlobImpls, const nsAString& aName,
|
nsTArray<RefPtr<BlobImpl>>&& aBlobImpls, const nsAString& aName,
|
||||||
const nsAString& aContentType, ErrorResult& aRv) {
|
const nsAString& aContentType, bool aCrossOriginIsolated,
|
||||||
|
ErrorResult& aRv) {
|
||||||
RefPtr<MultipartBlobImpl> blobImpl =
|
RefPtr<MultipartBlobImpl> blobImpl =
|
||||||
new MultipartBlobImpl(std::move(aBlobImpls), aName, aContentType);
|
new MultipartBlobImpl(std::move(aBlobImpls), aName, aContentType);
|
||||||
blobImpl->SetLengthAndModifiedDate(aRv);
|
blobImpl->SetLengthAndModifiedDate(Some(aCrossOriginIsolated), aRv);
|
||||||
if (NS_WARN_IF(aRv.Failed())) {
|
if (NS_WARN_IF(aRv.Failed())) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
@ -40,7 +41,7 @@ already_AddRefed<MultipartBlobImpl> MultipartBlobImpl::Create(
|
|||||||
ErrorResult& aRv) {
|
ErrorResult& aRv) {
|
||||||
RefPtr<MultipartBlobImpl> blobImpl =
|
RefPtr<MultipartBlobImpl> blobImpl =
|
||||||
new MultipartBlobImpl(std::move(aBlobImpls), aContentType);
|
new MultipartBlobImpl(std::move(aBlobImpls), aContentType);
|
||||||
blobImpl->SetLengthAndModifiedDate(aRv);
|
blobImpl->SetLengthAndModifiedDate(/* aCrossOriginIsolated */ Nothing(), aRv);
|
||||||
if (NS_WARN_IF(aRv.Failed())) {
|
if (NS_WARN_IF(aRv.Failed())) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
@ -174,14 +175,17 @@ already_AddRefed<BlobImpl> MultipartBlobImpl::CreateSlice(
|
|||||||
return impl.forget();
|
return impl.forget();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MultipartBlobImpl::InitializeBlob(ErrorResult& aRv) {
|
void MultipartBlobImpl::InitializeBlob(bool aCrossOriginIsolated,
|
||||||
SetLengthAndModifiedDate(aRv);
|
ErrorResult& aRv) {
|
||||||
|
SetLengthAndModifiedDate(Some(aCrossOriginIsolated), aRv);
|
||||||
NS_WARNING_ASSERTION(!aRv.Failed(), "SetLengthAndModifiedDate failed");
|
NS_WARNING_ASSERTION(!aRv.Failed(), "SetLengthAndModifiedDate failed");
|
||||||
}
|
}
|
||||||
|
|
||||||
void MultipartBlobImpl::InitializeBlob(const Sequence<Blob::BlobPart>& aData,
|
void MultipartBlobImpl::InitializeBlob(const Sequence<Blob::BlobPart>& aData,
|
||||||
const nsAString& aContentType,
|
const nsAString& aContentType,
|
||||||
bool aNativeEOL, ErrorResult& aRv) {
|
bool aNativeEOL,
|
||||||
|
bool aCrossOriginIsolated,
|
||||||
|
ErrorResult& aRv) {
|
||||||
mContentType = aContentType;
|
mContentType = aContentType;
|
||||||
BlobSet blobSet;
|
BlobSet blobSet;
|
||||||
|
|
||||||
@ -227,14 +231,14 @@ void MultipartBlobImpl::InitializeBlob(const Sequence<Blob::BlobPart>& aData,
|
|||||||
}
|
}
|
||||||
|
|
||||||
mBlobImpls = blobSet.GetBlobImpls();
|
mBlobImpls = blobSet.GetBlobImpls();
|
||||||
SetLengthAndModifiedDate(aRv);
|
SetLengthAndModifiedDate(Some(aCrossOriginIsolated), aRv);
|
||||||
NS_WARNING_ASSERTION(!aRv.Failed(), "SetLengthAndModifiedDate failed");
|
NS_WARNING_ASSERTION(!aRv.Failed(), "SetLengthAndModifiedDate failed");
|
||||||
}
|
}
|
||||||
|
|
||||||
void MultipartBlobImpl::SetLengthAndModifiedDate(ErrorResult& aRv) {
|
void MultipartBlobImpl::SetLengthAndModifiedDate(
|
||||||
|
const Maybe<bool>& aCrossOriginIsolated, ErrorResult& aRv) {
|
||||||
MOZ_ASSERT(mLength == MULTIPARTBLOBIMPL_UNKNOWN_LENGTH);
|
MOZ_ASSERT(mLength == MULTIPARTBLOBIMPL_UNKNOWN_LENGTH);
|
||||||
MOZ_ASSERT_IF(mIsFile, mLastModificationDate ==
|
MOZ_ASSERT_IF(mIsFile, IsLastModificationDateUnset());
|
||||||
MULTIPARTBLOBIMPL_UNKNOWN_LAST_MODIFIED);
|
|
||||||
|
|
||||||
uint64_t totalLength = 0;
|
uint64_t totalLength = 0;
|
||||||
int64_t lastModified = 0;
|
int64_t lastModified = 0;
|
||||||
@ -259,7 +263,7 @@ void MultipartBlobImpl::SetLengthAndModifiedDate(ErrorResult& aRv) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (lastModified < partLastModified) {
|
if (lastModified < partLastModified) {
|
||||||
lastModified = partLastModified;
|
lastModified = partLastModified * PR_USEC_PER_MSEC;
|
||||||
lastModifiedSet = true;
|
lastModifiedSet = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -268,14 +272,17 @@ void MultipartBlobImpl::SetLengthAndModifiedDate(ErrorResult& aRv) {
|
|||||||
mLength = totalLength;
|
mLength = totalLength;
|
||||||
|
|
||||||
if (mIsFile) {
|
if (mIsFile) {
|
||||||
// We cannot use PR_Now() because bug 493756 and, for this reason:
|
if (lastModifiedSet) {
|
||||||
// var x = new Date(); var f = new File(...);
|
SetLastModificationDatePrecisely(lastModified);
|
||||||
// x.getTime() < f.dateModified.getTime()
|
} else {
|
||||||
// could fail.
|
MOZ_ASSERT(aCrossOriginIsolated.isSome());
|
||||||
mLastModificationDate = nsRFPService::ReduceTimePrecisionAsUSecs(
|
|
||||||
lastModifiedSet ? lastModified * PR_USEC_PER_MSEC : JS_Now(), 0);
|
// We cannot use PR_Now() because bug 493756 and, for this reason:
|
||||||
// mLastModificationDate is an absolute timestamp so we supply a zero
|
// var x = new Date(); var f = new File(...);
|
||||||
// context mix-in
|
// x.getTime() < f.dateModified.getTime()
|
||||||
|
// could fail.
|
||||||
|
SetLastModificationDate(aCrossOriginIsolated.value(), JS_Now());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -327,5 +334,5 @@ void MultipartBlobImpl::GetBlobImplType(nsAString& aBlobImplType) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void MultipartBlobImpl::SetLastModified(int64_t aLastModified) {
|
void MultipartBlobImpl::SetLastModified(int64_t aLastModified) {
|
||||||
mLastModificationDate = aLastModified * PR_USEC_PER_MSEC;
|
SetLastModificationDatePrecisely(aLastModified * PR_USEC_PER_MSEC);
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
|
|
||||||
#include "mozilla/Attributes.h"
|
#include "mozilla/Attributes.h"
|
||||||
#include "mozilla/ErrorResult.h"
|
#include "mozilla/ErrorResult.h"
|
||||||
|
#include "mozilla/Maybe.h"
|
||||||
#include "mozilla/dom/BaseBlobImpl.h"
|
#include "mozilla/dom/BaseBlobImpl.h"
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
@ -28,7 +29,8 @@ class MultipartBlobImpl final : public BaseBlobImpl {
|
|||||||
// Create as a file
|
// Create as a file
|
||||||
static already_AddRefed<MultipartBlobImpl> Create(
|
static already_AddRefed<MultipartBlobImpl> Create(
|
||||||
nsTArray<RefPtr<BlobImpl>>&& aBlobImpls, const nsAString& aName,
|
nsTArray<RefPtr<BlobImpl>>&& aBlobImpls, const nsAString& aName,
|
||||||
const nsAString& aContentType, ErrorResult& aRv);
|
const nsAString& aContentType, bool aCrossOriginIsolated,
|
||||||
|
ErrorResult& aRv);
|
||||||
|
|
||||||
// Create as a blob
|
// Create as a blob
|
||||||
static already_AddRefed<MultipartBlobImpl> Create(
|
static already_AddRefed<MultipartBlobImpl> Create(
|
||||||
@ -44,11 +46,11 @@ class MultipartBlobImpl final : public BaseBlobImpl {
|
|||||||
MultipartBlobImpl()
|
MultipartBlobImpl()
|
||||||
: BaseBlobImpl(EmptyString(), MULTIPARTBLOBIMPL_UNKNOWN_LENGTH) {}
|
: BaseBlobImpl(EmptyString(), MULTIPARTBLOBIMPL_UNKNOWN_LENGTH) {}
|
||||||
|
|
||||||
void InitializeBlob(ErrorResult& aRv);
|
void InitializeBlob(bool aCrossOriginIsolated, ErrorResult& aRv);
|
||||||
|
|
||||||
void InitializeBlob(const Sequence<Blob::BlobPart>& aData,
|
void InitializeBlob(const Sequence<Blob::BlobPart>& aData,
|
||||||
const nsAString& aContentType, bool aNativeEOL,
|
const nsAString& aContentType, bool aNativeEOL,
|
||||||
ErrorResult& aRv);
|
bool aCrossOriginIsolated, ErrorResult& aRv);
|
||||||
|
|
||||||
already_AddRefed<BlobImpl> CreateSlice(uint64_t aStart, uint64_t aLength,
|
already_AddRefed<BlobImpl> CreateSlice(uint64_t aStart, uint64_t aLength,
|
||||||
const nsAString& aContentType,
|
const nsAString& aContentType,
|
||||||
@ -89,7 +91,8 @@ class MultipartBlobImpl final : public BaseBlobImpl {
|
|||||||
|
|
||||||
~MultipartBlobImpl() = default;
|
~MultipartBlobImpl() = default;
|
||||||
|
|
||||||
void SetLengthAndModifiedDate(ErrorResult& aRv);
|
void SetLengthAndModifiedDate(const Maybe<bool>& aCrossOriginIsolated,
|
||||||
|
ErrorResult& aRv);
|
||||||
|
|
||||||
nsTArray<RefPtr<BlobImpl>> mBlobImpls;
|
nsTArray<RefPtr<BlobImpl>> mBlobImpls;
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user