Bug 841802 - Part 1: Add ErrorResult::ClearMessage(). r=bz

This commit is contained in:
Masatoshi Kimura 2013-02-19 22:30:28 +09:00
parent 685963d17c
commit 2ffa472ad4
2 changed files with 11 additions and 2 deletions

View File

@ -95,8 +95,16 @@ ErrorResult::ReportTypeError(JSContext* aCx)
static_cast<const unsigned>(message->mErrorNumber),
argCount > 0 ? args : nullptr);
delete message;
mMessage = nullptr;
ClearMessage();
}
void
ErrorResult::ClearMessage()
{
if (IsTypeError()) {
delete mMessage;
mMessage = nullptr;
}
}
namespace dom {

View File

@ -51,6 +51,7 @@ public:
void ThrowTypeError(const dom::ErrNum errorNumber, ...);
void ReportTypeError(JSContext* cx);
void ClearMessage();
bool IsTypeError() const { return ErrorCode() == NS_ERROR_TYPE_ERR; }
// In the future, we can add overloads of Throw that take more