mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-22 10:19:20 +00:00
LibWeb: Reject invalid AnimationEffect duration string values
This commit is contained in:
parent
3e221fbb2d
commit
1965943026
Notes:
sideshowbarker
2024-07-17 11:29:41 +09:00
Author: https://github.com/mattco98
Commit: 1965943026
Pull-request: https://github.com/SerenityOS/serenity/pull/24474
3 changed files with 14 additions and 1 deletions
|
@ -140,7 +140,16 @@ WebIDL::ExceptionOr<void> AnimationEffect::update_timing(OptionalEffectTiming ti
|
|||
// abort this procedure.
|
||||
// Note: "auto", the only valid string value, is treated as 0.
|
||||
auto& duration = timing.duration;
|
||||
if (duration.has_value() && duration->has<double>() && (duration->get<double>() < 0.0 || isnan(duration->get<double>())))
|
||||
auto has_valid_duration_value = [&] {
|
||||
if (!duration.has_value())
|
||||
return true;
|
||||
if (duration->has<double>() && (duration->get<double>() < 0.0 || isnan(duration->get<double>())))
|
||||
return false;
|
||||
if (duration->has<String>() && (duration->get<String>() != "auto"))
|
||||
return false;
|
||||
return true;
|
||||
}();
|
||||
if (!has_valid_duration_value)
|
||||
return WebIDL::SimpleException { WebIDL::SimpleExceptionType::TypeError, "Invalid duration value"sv };
|
||||
|
||||
// 4. If the easing member of input exists but cannot be parsed using the <easing-function> production
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue