mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 20:17:44 +00:00
AK: Make "foo"_fly_string infallible
Stop worrying about tiny OOMs. Work towards #20405.
This commit is contained in:
parent
34344120f2
commit
25eee91811
30 changed files with 59 additions and 72 deletions
|
@ -13,7 +13,7 @@ namespace AttributeNames {
|
|||
ENUMERATE_HTML_ATTRIBUTES
|
||||
#undef __ENUMERATE_HTML_ATTRIBUTE
|
||||
|
||||
ErrorOr<void> initialize_strings()
|
||||
void initialize_strings()
|
||||
{
|
||||
static bool s_initialized = false;
|
||||
VERIFY(!s_initialized);
|
||||
|
@ -34,7 +34,6 @@ ErrorOr<void> initialize_strings()
|
|||
http_equiv = "http-equiv";
|
||||
|
||||
s_initialized = true;
|
||||
return {};
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -242,7 +242,7 @@ namespace AttributeNames {
|
|||
ENUMERATE_HTML_ATTRIBUTES
|
||||
#undef __ENUMERATE_HTML_ATTRIBUTE
|
||||
|
||||
ErrorOr<void> initialize_strings();
|
||||
void initialize_strings();
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -12,18 +12,17 @@ namespace Web::HTML::CustomElementReactionNames {
|
|||
ENUMERATE_CUSTOM_ELEMENT_REACTION_NAMES
|
||||
#undef __ENUMERATE_CUSTOM_ELEMENT_REACTION_NAME
|
||||
|
||||
ErrorOr<void> initialize_strings()
|
||||
void initialize_strings()
|
||||
{
|
||||
static bool s_initialized = false;
|
||||
VERIFY(!s_initialized);
|
||||
|
||||
#define __ENUMERATE_CUSTOM_ELEMENT_REACTION_NAME(name) \
|
||||
name = TRY(#name##_fly_string);
|
||||
name = #name##_fly_string;
|
||||
ENUMERATE_CUSTOM_ELEMENT_REACTION_NAMES
|
||||
#undef __ENUMERATE_CUSTOM_ELEMENT_REACTION_NAME
|
||||
|
||||
s_initialized = true;
|
||||
return {};
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -25,6 +25,6 @@ namespace Web::HTML::CustomElementReactionNames {
|
|||
ENUMERATE_CUSTOM_ELEMENT_REACTION_NAMES
|
||||
#undef __ENUMERATE_CUSTOM_ELEMENT_REACTION_NAME
|
||||
|
||||
ErrorOr<void> initialize_strings();
|
||||
void initialize_strings();
|
||||
|
||||
}
|
||||
|
|
|
@ -12,18 +12,17 @@ namespace Web::HTML::EventNames {
|
|||
ENUMERATE_HTML_EVENTS
|
||||
#undef __ENUMERATE_HTML_EVENT
|
||||
|
||||
ErrorOr<void> initialize_strings()
|
||||
void initialize_strings()
|
||||
{
|
||||
static bool s_initialized = false;
|
||||
VERIFY(!s_initialized);
|
||||
|
||||
#define __ENUMERATE_HTML_EVENT(name) \
|
||||
name = TRY(#name##_fly_string);
|
||||
name = #name##_fly_string;
|
||||
ENUMERATE_HTML_EVENTS
|
||||
#undef __ENUMERATE_HTML_EVENT
|
||||
|
||||
s_initialized = true;
|
||||
return {};
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -106,6 +106,6 @@ namespace Web::HTML::EventNames {
|
|||
ENUMERATE_HTML_EVENTS
|
||||
#undef __ENUMERATE_HTML_EVENT
|
||||
|
||||
ErrorOr<void> initialize_strings();
|
||||
void initialize_strings();
|
||||
|
||||
}
|
||||
|
|
|
@ -510,7 +510,7 @@ WebIDL::ExceptionOr<void> HTMLMediaElement::load_element()
|
|||
|
||||
// 2. Take pending play promises and reject pending play promises with the result and an "AbortError" DOMException.
|
||||
auto promises = take_pending_play_promises();
|
||||
reject_pending_play_promises<WebIDL::AbortError>(promises, TRY_OR_THROW_OOM(vm, "Media playback was aborted"_fly_string));
|
||||
reject_pending_play_promises<WebIDL::AbortError>(promises, "Media playback was aborted"_fly_string);
|
||||
}
|
||||
|
||||
// 7. If seeking is true, set it to false.
|
||||
|
@ -1251,7 +1251,7 @@ WebIDL::ExceptionOr<void> HTMLMediaElement::handle_media_source_failure(Span<JS:
|
|||
dispatch_event(TRY(DOM::Event::create(realm, HTML::EventNames::error)));
|
||||
|
||||
// 6. Reject pending play promises with promises and a "NotSupportedError" DOMException.
|
||||
reject_pending_play_promises<WebIDL::NotSupportedError>(promises, TRY_OR_THROW_OOM(vm, "Media is not supported"_fly_string));
|
||||
reject_pending_play_promises<WebIDL::NotSupportedError>(promises, "Media is not supported"_fly_string);
|
||||
|
||||
// 7. Set the element's delaying-the-load-event flag to false. This stops delaying the load event.
|
||||
m_delaying_the_load_event.clear();
|
||||
|
@ -1477,7 +1477,7 @@ WebIDL::ExceptionOr<void> HTMLMediaElement::pause_element()
|
|||
dispatch_event(DOM::Event::create(realm, HTML::EventNames::pause).release_value_but_fixme_should_propagate_errors());
|
||||
|
||||
// 3. Reject pending play promises with promises and an "AbortError" DOMException.
|
||||
reject_pending_play_promises<WebIDL::AbortError>(promises, "Media playback was paused"_fly_string.release_value_but_fixme_should_propagate_errors());
|
||||
reject_pending_play_promises<WebIDL::AbortError>(promises, "Media playback was paused"_fly_string);
|
||||
});
|
||||
|
||||
// 4. Set the official playback position to the current playback position.
|
||||
|
@ -1724,7 +1724,7 @@ WebIDL::ExceptionOr<void> HTMLMediaElement::reached_end_of_media_playback()
|
|||
|
||||
// 3. Take pending play promises and reject pending play promises with the result and an "AbortError" DOMException.
|
||||
auto promises = take_pending_play_promises();
|
||||
reject_pending_play_promises<WebIDL::AbortError>(promises, "Media playback has ended"_fly_string.release_value_but_fixme_should_propagate_errors());
|
||||
reject_pending_play_promises<WebIDL::AbortError>(promises, "Media playback has ended"_fly_string);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ namespace Web::HTML::TagNames {
|
|||
ENUMERATE_HTML_TAGS
|
||||
#undef __ENUMERATE_HTML_TAG
|
||||
|
||||
ErrorOr<void> initialize_strings()
|
||||
void initialize_strings()
|
||||
{
|
||||
static bool s_initialized = false;
|
||||
VERIFY(!s_initialized);
|
||||
|
@ -25,7 +25,6 @@ ErrorOr<void> initialize_strings()
|
|||
template_ = "template";
|
||||
|
||||
s_initialized = true;
|
||||
return {};
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -161,6 +161,6 @@ namespace Web::HTML::TagNames {
|
|||
ENUMERATE_HTML_TAGS
|
||||
#undef __ENUMERATE_HTML_TAG
|
||||
|
||||
ErrorOr<void> initialize_strings();
|
||||
void initialize_strings();
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue