mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-13 03:29:49 +00:00
LibWeb: Make DOMException take error message as a String
There was no need to use FlyString for error messages, and it just caused a bunch of churn since these strings typically only existed during the lifetime of the error.
This commit is contained in:
parent
5f9a36feac
commit
175f3febb8
Notes:
github-actions[bot]
2024-10-12 19:15:13 +00:00
Author: https://github.com/awesomekling
Commit: 175f3febb8
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1743
Reviewed-by: https://github.com/ADKaster
89 changed files with 464 additions and 462 deletions
|
@ -430,7 +430,7 @@ void Animation::cancel(ShouldInvalidate should_invalidate)
|
|||
reset_an_animations_pending_tasks();
|
||||
|
||||
// 2. Reject the current finished promise with a DOMException named "AbortError".
|
||||
auto dom_exception = WebIDL::AbortError::create(realm, "Animation was cancelled"_fly_string);
|
||||
auto dom_exception = WebIDL::AbortError::create(realm, "Animation was cancelled"_string);
|
||||
WebIDL::reject_promise(realm, current_finished_promise(), dom_exception);
|
||||
|
||||
// 3. Set the [[PromiseIsHandled]] internal slot of the current finished promise to true.
|
||||
|
@ -490,9 +490,9 @@ WebIDL::ExceptionOr<void> Animation::finish()
|
|||
// effect end is infinity, throw an "InvalidStateError" DOMException and abort these steps.
|
||||
auto effective_playback_rate = this->effective_playback_rate();
|
||||
if (effective_playback_rate == 0.0)
|
||||
return WebIDL::InvalidStateError::create(realm(), "Animation with a playback rate of 0 cannot be finished"_fly_string);
|
||||
return WebIDL::InvalidStateError::create(realm(), "Animation with a playback rate of 0 cannot be finished"_string);
|
||||
if (effective_playback_rate > 0.0 && isinf(associated_effect_end()))
|
||||
return WebIDL::InvalidStateError::create(realm(), "Animation with no end cannot be finished"_fly_string);
|
||||
return WebIDL::InvalidStateError::create(realm(), "Animation with no end cannot be finished"_string);
|
||||
|
||||
// 2. Apply any pending playback rate to animation.
|
||||
apply_any_pending_playback_rate();
|
||||
|
@ -591,7 +591,7 @@ WebIDL::ExceptionOr<void> Animation::play_an_animation(AutoRewind auto_rewind)
|
|||
// -> If associated effect end is positive infinity,
|
||||
if (isinf(associated_effect_end) && associated_effect_end > 0.0) {
|
||||
// throw an "InvalidStateError" DOMException and abort these steps.
|
||||
return WebIDL::InvalidStateError::create(realm(), "Cannot rewind an animation with an infinite effect end"_fly_string);
|
||||
return WebIDL::InvalidStateError::create(realm(), "Cannot rewind an animation with an infinite effect end"_string);
|
||||
}
|
||||
// -> Otherwise,
|
||||
// Set seek time to animation’s associated effect end.
|
||||
|
@ -711,7 +711,7 @@ WebIDL::ExceptionOr<void> Animation::pause()
|
|||
auto associated_effect_end = this->associated_effect_end();
|
||||
if (isinf(associated_effect_end) && associated_effect_end > 0.0) {
|
||||
// throw an "InvalidStateError" DOMException and abort these steps.
|
||||
return WebIDL::InvalidStateError::create(realm(), "Cannot pause an animation with an infinite effect end"_fly_string);
|
||||
return WebIDL::InvalidStateError::create(realm(), "Cannot pause an animation with an infinite effect end"_string);
|
||||
}
|
||||
|
||||
// Otherwise,
|
||||
|
@ -837,7 +837,7 @@ WebIDL::ExceptionOr<void> Animation::reverse()
|
|||
// 1. If there is no timeline associated with animation, or the associated timeline is inactive throw an
|
||||
// "InvalidStateError" DOMException and abort these steps.
|
||||
if (!m_timeline || m_timeline->is_inactive())
|
||||
return WebIDL::InvalidStateError::create(realm, "Cannot reverse an animation with an inactive timeline"_fly_string);
|
||||
return WebIDL::InvalidStateError::create(realm, "Cannot reverse an animation with an inactive timeline"_string);
|
||||
|
||||
// 2. Let original pending playback rate be animation’s pending playback rate.
|
||||
auto original_pending_playback_rate = m_pending_playback_rate;
|
||||
|
@ -1205,7 +1205,7 @@ void Animation::reset_an_animations_pending_tasks()
|
|||
apply_any_pending_playback_rate();
|
||||
|
||||
// 5. Reject animation’s current ready promise with a DOMException named "AbortError".
|
||||
auto dom_exception = WebIDL::AbortError::create(realm, "Animation was cancelled"_fly_string);
|
||||
auto dom_exception = WebIDL::AbortError::create(realm, "Animation was cancelled"_string);
|
||||
WebIDL::reject_promise(realm, current_ready_promise(), dom_exception);
|
||||
|
||||
// 6. Set the [[PromiseIsHandled]] internal slot of animation’s current ready promise to true.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue