Bug 1471303 Fix CopyableErrorResult::operator==() to actually compile with ipdl types. r=bz

This commit is contained in:
Ben Kelly 2018-06-27 06:51:24 -07:00
Родитель 8f2baafcb6
Коммит 818897b5a1
2 изменённых файлов: 28 добавлений и 28 удалений

Просмотреть файл

@ -184,7 +184,7 @@ struct TErrorResult<CleanupPolicy>::Message {
return GetErrorArgCount(mErrorNumber) == mArgs.Length();
}
bool operator==(const TErrorResult<CleanupPolicy>::Message& aRight)
bool operator==(const TErrorResult<CleanupPolicy>::Message& aRight) const
{
return mErrorNumber == aRight.mErrorNumber &&
mArgs == aRight.mArgs;
@ -341,7 +341,7 @@ struct TErrorResult<CleanupPolicy>::DOMExceptionInfo {
nsCString mMessage;
nsresult mRv;
bool operator==(const TErrorResult<CleanupPolicy>::DOMExceptionInfo& aRight)
bool operator==(const TErrorResult<CleanupPolicy>::DOMExceptionInfo& aRight) const
{
return mRv == aRight.mRv &&
mMessage == aRight.mMessage;
@ -509,6 +509,32 @@ TErrorResult<CleanupPolicy>::operator=(TErrorResult<CleanupPolicy>&& aRHS)
return *this;
}
template<typename CleanupPolicy>
bool
TErrorResult<CleanupPolicy>::operator==(const ErrorResult& aRight) const
{
auto right = reinterpret_cast<const TErrorResult<CleanupPolicy>*>(&aRight);
if (mResult != right->mResult) {
return false;
}
if (IsJSException()) {
// js exceptions are always non-equal
return false;
}
if (IsErrorWithMessage()) {
return *mExtra.mMessage == *right->mExtra.mMessage;
}
if (IsDOMException()) {
return *mExtra.mDOMExceptionInfo == *right->mExtra.mDOMExceptionInfo;
}
return true;
}
template<typename CleanupPolicy>
void
TErrorResult<CleanupPolicy>::CloneTo(TErrorResult& aRv) const

Просмотреть файл

@ -646,32 +646,6 @@ binding_danger::TErrorResult<CleanupPolicy>::operator const ErrorResult&() const
reinterpret_cast<const TErrorResult<AssertAndSuppressCleanupPolicy>*>(this));
}
template<typename CleanupPolicy>
bool
binding_danger::TErrorResult<CleanupPolicy>::operator==(const ErrorResult& aRight) const
{
auto right = reinterpret_cast<const TErrorResult<CleanupPolicy>*>(&aRight);
if (mResult != right->mResult) {
return false;
}
if (IsJSException()) {
// js exceptions are always non-equal
return false;
}
if (IsErrorWithMessage()) {
return *mExtra.mMessage == *right->mExtra.mMessage;
}
if (IsDOMException()) {
return *mExtra.mDOMExceptionInfo == *right->mExtra.mDOMExceptionInfo;
}
return true;
}
// A class for use when an ErrorResult should just automatically be ignored.
// This doesn't inherit from ErrorResult so we don't make two separate calls to
// SuppressException.