Bug 1322979 - Migrating from NS_ASSERTION to MOZ_ASSERT in dom/file, r=qdot

This commit is contained in:
Andrea Marchesini 2016-12-13 02:25:37 +01:00
parent 1ec1f6a9b0
commit e1fcb9149b
4 changed files with 26 additions and 27 deletions

View File

@ -82,7 +82,7 @@ private:
mSeekableStream(do_QueryInterface(aStream)),
mSerializableInputStream(do_QueryInterface(aStream))
{
NS_ASSERTION(mSeekableStream, "Somebody gave us the wrong stream!");
MOZ_ASSERT(mSeekableStream, "Somebody gave us the wrong stream!");
}
RefPtr<DataOwner> mDataOwner;
@ -108,7 +108,7 @@ nsresult DataOwnerAdapter::Create(DataOwner* aDataOwner,
nsIInputStream** _retval)
{
nsresult rv;
NS_ASSERTION(aDataOwner, "Uh ...");
MOZ_ASSERT(aDataOwner, "Uh ...");
nsCOMPtr<nsIInputStream> stream;
@ -672,28 +672,28 @@ NS_IMPL_ISUPPORTS_INHERITED0(BlobImplFile, BlobImpl)
void
BlobImplBase::GetName(nsAString& aName) const
{
NS_ASSERTION(mIsFile, "Should only be called on files");
MOZ_ASSERT(mIsFile, "Should only be called on files");
aName = mName;
}
void
BlobImplBase::GetPath(nsAString& aPath) const
{
NS_ASSERTION(mIsFile, "Should only be called on files");
MOZ_ASSERT(mIsFile, "Should only be called on files");
aPath = mPath;
}
void
BlobImplBase::SetPath(const nsAString& aPath)
{
NS_ASSERTION(mIsFile, "Should only be called on files");
MOZ_ASSERT(mIsFile, "Should only be called on files");
mPath = aPath;
}
void
BlobImplBase::GetMozFullPath(nsAString& aFileName, ErrorResult& aRv) const
{
NS_ASSERTION(mIsFile, "Should only be called on files");
MOZ_ASSERT(mIsFile, "Should only be called on files");
aFileName.Truncate();
@ -733,7 +733,7 @@ BlobImplBase::GetType(nsAString& aType)
int64_t
BlobImplBase::GetLastModified(ErrorResult& aRv)
{
NS_ASSERTION(mIsFile, "Should only be called on files");
MOZ_ASSERT(mIsFile, "Should only be called on files");
if (IsDateUnknown()) {
mLastModificationDate = PR_Now();
}
@ -840,7 +840,7 @@ BlobImplFile::CreateSlice(uint64_t aStart, uint64_t aLength,
void
BlobImplFile::GetMozFullPathInternal(nsAString& aFilename, ErrorResult& aRv) const
{
NS_ASSERTION(mIsFile, "Should only be called on files");
MOZ_ASSERT(mIsFile, "Should only be called on files");
aRv = mFile->GetPath(aFilename);
}
@ -848,7 +848,7 @@ uint64_t
BlobImplFile::GetSize(ErrorResult& aRv)
{
if (BlobImplBase::IsSizeUnknown()) {
NS_ASSERTION(mWholeFile,
MOZ_ASSERT(mWholeFile,
"Should only use lazy size when using the whole file");
int64_t fileSize;
aRv = mFile->GetFileSize(&fileSize);
@ -907,8 +907,8 @@ BlobImplFile::GetType(nsAString& aType)
aType.Truncate();
if (mContentType.IsVoid()) {
NS_ASSERTION(mWholeFile,
"Should only use lazy ContentType when using the whole file");
MOZ_ASSERT(mWholeFile,
"Should only use lazy ContentType when using the whole file");
if (!NS_IsMainThread()) {
WorkerPrivate* workerPrivate = GetCurrentThreadWorkerPrivate();
@ -952,7 +952,7 @@ BlobImplFile::GetType(nsAString& aType)
int64_t
BlobImplFile::GetLastModified(ErrorResult& aRv)
{
NS_ASSERTION(mIsFile, "Should only be called on files");
MOZ_ASSERT(mIsFile, "Should only be called on files");
if (BlobImplBase::IsDateUnknown()) {
PRTime msecs;
aRv = mFile->GetLastModifiedTime(&msecs);

View File

@ -394,8 +394,7 @@ public:
, mLastModificationDate(INT64_MAX)
, mSerialNumber(NextSerialNumber())
{
NS_ASSERTION(aLength != UINT64_MAX,
"Must know length when creating slice");
MOZ_ASSERT(aLength != UINT64_MAX, "Must know length when creating slice");
// Ensure non-null mContentType by default
mContentType.SetIsVoid(false);
}
@ -551,7 +550,7 @@ public:
: BlobImplBase(aName, aContentType, aLength, aLastModifiedDate)
, mDataOwner(new DataOwner(aMemoryBuffer, aLength))
{
NS_ASSERTION(mDataOwner && mDataOwner->mData, "must have data");
MOZ_ASSERT(mDataOwner && mDataOwner->mData, "must have data");
}
BlobImplMemory(void* aMemoryBuffer, uint64_t aLength,
@ -559,7 +558,7 @@ public:
: BlobImplBase(aContentType, aLength)
, mDataOwner(new DataOwner(aMemoryBuffer, aLength))
{
NS_ASSERTION(mDataOwner && mDataOwner->mData, "must have data");
MOZ_ASSERT(mDataOwner && mDataOwner->mData, "must have data");
}
virtual void GetInternalStream(nsIInputStream** aStream,
@ -626,7 +625,7 @@ private:
: BlobImplBase(aContentType, aOther->mStart + aStart, aLength)
, mDataOwner(aOther->mDataOwner)
{
NS_ASSERTION(mDataOwner && mDataOwner->mData, "must have data");
MOZ_ASSERT(mDataOwner && mDataOwner->mData, "must have data");
mImmutable = aOther->mImmutable;
}
@ -683,7 +682,7 @@ public:
, mWholeFile(true)
, mIsTemporary(aTemporary)
{
NS_ASSERTION(mFile, "must have file");
MOZ_ASSERT(mFile, "must have file");
// Lazily get the content type and size
mContentType.SetIsVoid(true);
mFile->GetLeafName(mName);
@ -697,7 +696,7 @@ public:
, mWholeFile(true)
, mIsTemporary(false)
{
NS_ASSERTION(mFile, "must have file");
MOZ_ASSERT(mFile, "must have file");
}
BlobImplFile(const nsAString& aName, const nsAString& aContentType,
@ -708,7 +707,7 @@ public:
, mWholeFile(true)
, mIsTemporary(false)
{
NS_ASSERTION(mFile, "must have file");
MOZ_ASSERT(mFile, "must have file");
}
// Create as a file with custom name
@ -719,7 +718,7 @@ public:
, mWholeFile(true)
, mIsTemporary(false)
{
NS_ASSERTION(mFile, "must have file");
MOZ_ASSERT(mFile, "must have file");
if (aContentType.IsEmpty()) {
// Lazily get the content type and size
mContentType.SetIsVoid(true);
@ -766,7 +765,7 @@ private:
, mWholeFile(false)
, mIsTemporary(false)
{
NS_ASSERTION(mFile, "must have file");
MOZ_ASSERT(mFile, "must have file");
mImmutable = aOther->mImmutable;
}

View File

@ -303,7 +303,7 @@ FileReader::DoReadData(uint64_t aCount)
if (mDataFormat == FILE_AS_BINARY) {
//Continuously update our binary string as data comes in
uint32_t oldLen = mResult.Length();
NS_ASSERTION(mResult.Length() == mDataLen, "unexpected mResult length");
MOZ_ASSERT(mResult.Length() == mDataLen, "unexpected mResult length");
if (uint64_t(oldLen) + aCount > UINT32_MAX)
return NS_ERROR_OUT_OF_MEMORY;
char16_t *buf = nullptr;
@ -313,7 +313,7 @@ FileReader::DoReadData(uint64_t aCount)
uint32_t bytesRead = 0;
mAsyncStream->ReadSegments(ReadFuncBinaryString, buf + oldLen, aCount,
&bytesRead);
NS_ASSERTION(bytesRead == aCount, "failed to read data");
MOZ_ASSERT(bytesRead == aCount, "failed to read data");
}
else {
CheckedInt<uint64_t> size = mDataLen;
@ -334,7 +334,7 @@ FileReader::DoReadData(uint64_t aCount)
uint32_t bytesRead = 0;
mAsyncStream->Read(mFileData + mDataLen, aCount, &bytesRead);
NS_ASSERTION(bytesRead == aCount, "failed to read data");
MOZ_ASSERT(bytesRead == aCount, "failed to read data");
}
mDataLen += aCount;

View File

@ -328,7 +328,7 @@ MultipartBlobImpl::InitializeChromeFile(Blob& aBlob,
const ChromeFilePropertyBag& aBag,
ErrorResult& aRv)
{
NS_ASSERTION(!mImmutable, "Something went wrong ...");
MOZ_ASSERT(!mImmutable, "Something went wrong ...");
if (mImmutable) {
aRv.Throw(NS_ERROR_UNEXPECTED);
@ -362,7 +362,7 @@ MultipartBlobImpl::InitializeChromeFile(nsPIDOMWindowInner* aWindow,
bool aIsFromNsIFile,
ErrorResult& aRv)
{
NS_ASSERTION(!mImmutable, "Something went wrong ...");
MOZ_ASSERT(!mImmutable, "Something went wrong ...");
if (mImmutable) {
aRv.Throw(NS_ERROR_UNEXPECTED);
return;