Bug 1612891 - Use IgnoredErrorResult as the parsing easing error result. r=bzbarsky

IgnoredErrorResult works well as the auto suppressor class and it's
cleaner.

Differential Revision: https://phabricator.services.mozilla.com/D65810

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Boris Chiou 2020-03-06 21:04:07 +00:00
Родитель 4ce2700cf2
Коммит 0a08960bb5
1 изменённых файлов: 2 добавлений и 14 удалений

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

@ -373,17 +373,6 @@ static void GetKeyframeListFromKeyframeSequence(
}
}
// The class to suppress the exception of parsing easing automatically.
class MOZ_STACK_CLASS AutoErrorSuppressor final {
public:
explicit AutoErrorSuppressor(ErrorResult& aErrorResult)
: mErrorResult(aErrorResult) {}
~AutoErrorSuppressor() { mErrorResult.SuppressException(); }
private:
ErrorResult& mErrorResult;
};
/**
* Converts a JS object wrapped by the given JS::ForIfIterator to an
* IDL sequence<Keyframe> and stores the resulting Keyframe objects in
@ -394,11 +383,10 @@ static bool ConvertKeyframeSequence(JSContext* aCx, dom::Document* aDocument,
const char* aContext,
nsTArray<Keyframe>& aResult) {
JS::Rooted<JS::Value> value(aCx);
ErrorResult parseEasingResult;
// Parsing errors should only be reported after we have finished iterating
// through all values. If we have any early returns while iterating, we should
// suppress parsing errors.
AutoErrorSuppressor AutoErrorSuppressor(parseEasingResult);
// ignore parsing errors.
IgnoredErrorResult parseEasingResult;
for (;;) {
bool done;