Bug 1434686 part 1. Introduce a mozilla::IgnoreErrors which can be used as a temporary to pass to an ErrorResult& arg when the error should be ignored. r=mystor

Once bug 1434689 is fixed, we can mark this thing as being required to be a temporary.

MozReview-Commit-ID: 7VX0XSYVOc4
This commit is contained in:
Boris Zbarsky 2018-02-01 14:21:14 -05:00
Родитель 275f452928
Коммит f7f6285330
2 изменённых файлов: 16 добавлений и 0 удалений

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

@ -602,6 +602,21 @@ class IgnoredErrorResult :
{
};
// A class for use when an ErrorResult should just automatically be
// ignored. This is designed to be passed as a temporary only, like
// so:
//
// foo->Bar(IgnoreErrors());
class IgnoreErrors {
public:
operator ErrorResult&() && { return mInner; }
private:
// We don't use an ErrorResult member here so we don't make two separate calls
// to SuppressException (one from us, one from the ErrorResult destructor
// after asserting).
binding_danger::TErrorResult<binding_danger::JustSuppressCleanupPolicy> mInner;
};
namespace dom {
namespace binding_detail {
class FastErrorResult :

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

@ -336,6 +336,7 @@ function extraRootedPointers()
'mozilla::ErrorResult',
'mozilla::IgnoredErrorResult',
'mozilla::IgnoreErrors',
'mozilla::dom::binding_detail::FastErrorResult',
];
}