1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 08:47:34 +00:00

AK: Make "foo"_string infallible

Stop worrying about tiny OOMs.

Work towards #20405.
This commit is contained in:
Andreas Kling 2023-08-07 11:12:38 +02:00
parent db2a8725c6
commit 34344120f2
181 changed files with 626 additions and 630 deletions

View file

@ -23,7 +23,7 @@ ErrorOr<NonnullRefPtr<GUI::Action>> make_cards_settings_action(GUI::Window* pare
GUI::Process::spawn_or_show_error(parent, "/bin/GamesSettings"sv, Array { "--open-tab", "cards" });
},
parent);
action->set_status_tip(TRY("Open the Game Settings for Cards"_string));
action->set_status_tip("Open the Game Settings for Cards"_string);
return action;
}

View file

@ -108,7 +108,7 @@ NonnullRefPtr<::Shell::AST::Node> ShellComprehensionEngine::DocumentData::parse(
if (auto node = parser.parse())
return node.release_nonnull();
return ::Shell::AST::make_ref_counted<::Shell::AST::SyntaxError>(::Shell::AST::Position {}, "Unable to parse file"_string.release_value_but_fixme_should_propagate_errors());
return ::Shell::AST::make_ref_counted<::Shell::AST::SyntaxError>(::Shell::AST::Position {}, "Unable to parse file"_string);
}
size_t ShellComprehensionEngine::resolve(ShellComprehensionEngine::DocumentData const& document, const GUI::TextPosition& position)

View file

@ -116,14 +116,14 @@ ErrorOr<Vector<String>> StandardPaths::font_directories()
{
return Vector { {
#if defined(AK_OS_SERENITY)
TRY("/res/fonts"_string),
"/res/fonts"_string,
#elif defined(AK_OS_MACOS)
TRY("/System/Library/Fonts"_string),
TRY("/Library/Fonts"_string),
"/System/Library/Fonts"_string,
"/Library/Fonts"_string,
TRY(String::formatted("{}/Library/Fonts"sv, home_directory())),
#else
TRY("/usr/share/fonts"_string),
TRY("/usr/local/share/fonts"_string),
"/usr/share/fonts"_string,
"/usr/local/share/fonts"_string,
TRY(String::formatted("{}/.local/share/fonts"sv, home_directory())),
#endif
} };

View file

@ -15,8 +15,8 @@ ErrorOr<NonnullOwnPtr<LinkedShader>> Linker::link(Vector<ObjectFile const*> cons
GPU::IR::Shader shader;
auto input_name = TRY("input0"_string);
auto output_name = TRY("output0"_string);
auto input_name = "input0"_string;
auto output_name = "output0"_string;
TRY(shader.inputs.try_append({ move(input_name), GPU::IR::StorageType::Vector4 }));
TRY(shader.outputs.try_append({ move(output_name), GPU::IR::StorageType::Vector4 }));
GPU::IR::Instruction instruction {

View file

@ -108,7 +108,7 @@ AutocompleteBox::AutocompleteBox(TextEditor& editor)
apply_suggestion();
};
m_no_suggestions_view = main_widget->add<GUI::Label>("No suggestions"_string.release_value_but_fixme_should_propagate_errors());
m_no_suggestions_view = main_widget->add<GUI::Label>("No suggestions"_string);
}
void AutocompleteBox::update_suggestions(Vector<CodeComprehension::AutocompleteResultEntry>&& suggestions)

View file

@ -218,7 +218,7 @@ void ColorPicker::build_ui()
build_ui_palette(tab_palette);
auto& tab_custom_color = tab_widget.add_tab<Widget>("Custom Color"_string.release_value_but_fixme_should_propagate_errors());
auto& tab_custom_color = tab_widget.add_tab<Widget>("Custom Color"_string);
tab_custom_color.set_layout<VerticalBoxLayout>(4, 4);
build_ui_custom(tab_custom_color);
@ -412,7 +412,7 @@ void ColorPicker::build_ui_custom(Widget& root_container)
make_spinbox(Blue, m_color.blue());
make_spinbox(Alpha, m_color.alpha());
m_selector_button = vertical_container.add<GUI::Button>("Select on Screen"_string.release_value_but_fixme_should_propagate_errors());
m_selector_button = vertical_container.add<GUI::Button>("Select on Screen"_string);
m_selector_button->on_click = [this](auto) {
auto selector = ColorSelectOverlay::construct();
auto original_color = m_color;

View file

@ -28,42 +28,42 @@ NonnullRefPtr<Action> make_about_action(DeprecatedString const& app_name, Icon c
weak_parent)
.release_value_but_fixme_should_propagate_errors();
});
action->set_status_tip("Show application about box"_string.release_value_but_fixme_should_propagate_errors());
action->set_status_tip("Show application about box"_string);
return action;
}
NonnullRefPtr<Action> make_open_action(Function<void(Action&)> callback, Core::EventReceiver* parent)
{
auto action = Action::create("&Open...", { Mod_Ctrl, Key_O }, Gfx::Bitmap::load_from_file("/res/icons/16x16/open.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
action->set_status_tip("Open an existing file"_string.release_value_but_fixme_should_propagate_errors());
action->set_status_tip("Open an existing file"_string);
return action;
}
NonnullRefPtr<Action> make_save_action(Function<void(Action&)> callback, Core::EventReceiver* parent)
{
auto action = Action::create("&Save", { Mod_Ctrl, Key_S }, Gfx::Bitmap::load_from_file("/res/icons/16x16/save.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
action->set_status_tip("Save the current file"_string.release_value_but_fixme_should_propagate_errors());
action->set_status_tip("Save the current file"_string);
return action;
}
NonnullRefPtr<Action> make_save_as_action(Function<void(Action&)> callback, Core::EventReceiver* parent)
{
auto action = Action::create("Save &As...", { Mod_Ctrl | Mod_Shift, Key_S }, Gfx::Bitmap::load_from_file("/res/icons/16x16/save-as.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
action->set_status_tip("Save the current file with a new name"_string.release_value_but_fixme_should_propagate_errors());
action->set_status_tip("Save the current file with a new name"_string);
return action;
}
NonnullRefPtr<Action> make_move_to_front_action(Function<void(Action&)> callback, Core::EventReceiver* parent)
{
auto action = Action::create("Move to &Front", { Mod_Ctrl | Mod_Shift, Key_Up }, Gfx::Bitmap::load_from_file("/res/icons/16x16/move-to-front.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
action->set_status_tip("Move to the top of the stack"_string.release_value_but_fixme_should_propagate_errors());
action->set_status_tip("Move to the top of the stack"_string);
return action;
}
NonnullRefPtr<Action> make_move_to_back_action(Function<void(Action&)> callback, Core::EventReceiver* parent)
{
auto action = Action::create("Move to &Back", { Mod_Ctrl | Mod_Shift, Key_Down }, Gfx::Bitmap::load_from_file("/res/icons/16x16/move-to-back.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
action->set_status_tip("Move to the bottom of the stack"_string.release_value_but_fixme_should_propagate_errors());
action->set_status_tip("Move to the bottom of the stack"_string);
return action;
}
@ -85,35 +85,35 @@ NonnullRefPtr<Action> make_delete_action(Function<void(Action&)> callback, Core:
NonnullRefPtr<Action> make_cut_action(Function<void(Action&)> callback, Core::EventReceiver* parent)
{
auto action = Action::create("Cu&t", { Mod_Ctrl, Key_X }, Gfx::Bitmap::load_from_file("/res/icons/16x16/edit-cut.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
action->set_status_tip("Cut to clipboard"_string.release_value_but_fixme_should_propagate_errors());
action->set_status_tip("Cut to clipboard"_string);
return action;
}
NonnullRefPtr<Action> make_copy_action(Function<void(Action&)> callback, Core::EventReceiver* parent)
{
auto action = Action::create("&Copy", { Mod_Ctrl, Key_C }, Gfx::Bitmap::load_from_file("/res/icons/16x16/edit-copy.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
action->set_status_tip("Copy to clipboard"_string.release_value_but_fixme_should_propagate_errors());
action->set_status_tip("Copy to clipboard"_string);
return action;
}
NonnullRefPtr<Action> make_paste_action(Function<void(Action&)> callback, Core::EventReceiver* parent)
{
auto action = Action::create("&Paste", { Mod_Ctrl, Key_V }, Gfx::Bitmap::load_from_file("/res/icons/16x16/paste.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
action->set_status_tip("Paste from clipboard"_string.release_value_but_fixme_should_propagate_errors());
action->set_status_tip("Paste from clipboard"_string);
return action;
}
NonnullRefPtr<Action> make_insert_emoji_action(Function<void(Action&)> callback, Core::EventReceiver* parent)
{
auto action = Action::create("&Insert Emoji...", { Mod_Ctrl | Mod_Alt, Key_Space }, Gfx::Bitmap::load_from_file("/res/icons/16x16/emoji.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
action->set_status_tip("Open the Emoji Picker"_string.release_value_but_fixme_should_propagate_errors());
action->set_status_tip("Open the Emoji Picker"_string);
return action;
}
NonnullRefPtr<Action> make_fullscreen_action(Function<void(Action&)> callback, Core::EventReceiver* parent)
{
auto action = Action::create("&Fullscreen", { Mod_None, Key_F11 }, move(callback), parent);
action->set_status_tip("Enter fullscreen mode"_string.release_value_but_fixme_should_propagate_errors());
action->set_status_tip("Enter fullscreen mode"_string);
action->set_icon(Gfx::Bitmap::load_from_file("/res/icons/16x16/fullscreen.png"sv).release_value_but_fixme_should_propagate_errors());
return action;
}
@ -121,28 +121,28 @@ NonnullRefPtr<Action> make_fullscreen_action(Function<void(Action&)> callback, C
NonnullRefPtr<Action> make_quit_action(Function<void(Action&)> callback)
{
auto action = Action::create("&Quit", { Mod_Alt, Key_F4 }, move(callback));
action->set_status_tip("Quit the application"_string.release_value_but_fixme_should_propagate_errors());
action->set_status_tip("Quit the application"_string);
return action;
}
NonnullRefPtr<Action> make_help_action(Function<void(Action&)> callback, Core::EventReceiver* parent)
{
auto action = Action::create("&Manual", { Mod_None, Key_F1 }, Gfx::Bitmap::load_from_file("/res/icons/16x16/app-help.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
action->set_status_tip("Show help contents"_string.release_value_but_fixme_should_propagate_errors());
action->set_status_tip("Show help contents"_string);
return action;
}
NonnullRefPtr<Action> make_go_back_action(Function<void(Action&)> callback, Core::EventReceiver* parent)
{
auto action = Action::create("Go &Back", { Mod_Alt, Key_Left }, { MouseButton::Backward }, Gfx::Bitmap::load_from_file("/res/icons/16x16/go-back.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
action->set_status_tip("Move one step backward in history"_string.release_value_but_fixme_should_propagate_errors());
action->set_status_tip("Move one step backward in history"_string);
return action;
}
NonnullRefPtr<Action> make_go_forward_action(Function<void(Action&)> callback, Core::EventReceiver* parent)
{
auto action = Action::create("Go &Forward", { Mod_Alt, Key_Right }, { MouseButton::Forward }, Gfx::Bitmap::load_from_file("/res/icons/16x16/go-forward.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
action->set_status_tip("Move one step forward in history"_string.release_value_but_fixme_should_propagate_errors());
action->set_status_tip("Move one step forward in history"_string);
return action;
}
@ -154,7 +154,7 @@ NonnullRefPtr<Action> make_go_home_action(Function<void(Action&)> callback, Core
NonnullRefPtr<Action> make_close_tab_action(Function<void(Action&)> callback, Core::EventReceiver* parent)
{
auto action = Action::create("&Close Tab", { Mod_Ctrl, Key_W }, Gfx::Bitmap::load_from_file("/res/icons/16x16/close-tab.png"sv).release_value_but_fixme_should_propagate_errors(), move(callback), parent);
action->set_status_tip("Close current tab"_string.release_value_but_fixme_should_propagate_errors());
action->set_status_tip("Close current tab"_string);
return action;
}
@ -214,7 +214,7 @@ NonnullRefPtr<Action> make_command_palette_action(Window* window)
action->flash_menubar_menu(*window);
action->activate();
});
action->set_status_tip("Open the command palette"_string.release_value_but_fixme_should_propagate_errors());
action->set_status_tip("Open the command palette"_string);
return action;
}

View file

@ -59,7 +59,7 @@ ErrorOr<NonnullRefPtr<Menu>> make_accessibility_menu(ColorFilterer& filterer)
group->add_action(*achromatomaly_accessibility_action);
(void)group.leak_ptr();
auto menu = TRY(Menu::try_create(TRY("&Accessibility"_string)));
auto menu = TRY(Menu::try_create("&Accessibility"_string));
menu->add_action(default_accessibility_action);
menu->add_action(pratanopia_accessibility_action);
menu->add_action(pratanomaly_accessibility_action);

View file

@ -778,11 +778,11 @@ ErrorOr<String> FileSystemModel::column_name(int column) const
case Column::Permissions:
return "Mode"_short_string;
case Column::ModificationTime:
return TRY("Modified"_string);
return "Modified"_string;
case Column::Inode:
return "Inode"_short_string;
case Column::SymlinkTarget:
return TRY("Symlink target"_string);
return "Symlink target"_string;
}
VERIFY_NOT_REACHED();
}

View file

@ -89,7 +89,7 @@ ErrorOr<Dialog::ExecResult> MessageBox::try_ask_about_unsaved_changes(Window* pa
box->set_icon(parent_window->icon());
if (path.is_empty())
box->m_yes_button->set_text(TRY("Save As..."_string));
box->m_yes_button->set_text("Save As..."_string);
else
box->m_yes_button->set_text("Save"_short_string);
box->m_no_button->set_text("Discard"_short_string);

View file

@ -43,7 +43,7 @@ ErrorOr<NonnullRefPtr<SettingsWindow>> SettingsWindow::create(DeprecatedString t
TRY(button_container->try_set_layout<GUI::HorizontalBoxLayout>(GUI::Margins {}, 6));
if (show_defaults_button == ShowDefaultsButton::Yes) {
window->m_reset_button = TRY(button_container->try_add<GUI::DialogButton>(TRY("Defaults"_string)));
window->m_reset_button = TRY(button_container->try_add<GUI::DialogButton>("Defaults"_string));
window->m_reset_button->on_click = [window = window->make_weak_ptr<SettingsWindow>()](auto) {
window->reset_default_values();
};

View file

@ -171,7 +171,7 @@ ErrorOr<void> Toolbar::create_overflow_objects()
m_overflow_action = Action::create("Overflow Menu", { Mod_Ctrl | Mod_Shift, Key_O }, TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/overflow-menu.png"sv)), [&](auto&) {
m_overflow_menu->popup(m_overflow_button->screen_relative_rect().bottom_left().moved_up(1), {}, m_overflow_button->rect());
});
m_overflow_action->set_status_tip(TRY("Show hidden toolbar actions"_string));
m_overflow_action->set_status_tip("Show hidden toolbar actions"_string);
m_overflow_action->set_enabled(false);
TRY(add_spacer());

View file

@ -300,7 +300,7 @@ Interpreter::ValueAndFrame Interpreter::run_and_return_frame(Realm& realm, Execu
for (size_t i = 0; i < registers().size(); ++i) {
String value_string;
if (registers()[i].is_empty())
value_string = MUST("(empty)"_string);
value_string = "(empty)"_string;
else
value_string = MUST(registers()[i].to_string_without_side_effects());
dbgln("[{:3}] {}", i, value_string);

View file

@ -142,7 +142,7 @@ ThrowCompletionOr<Value> Console::trace()
for (ssize_t i = execution_context_stack.size() - 2; i >= 0; --i) {
auto const& function_name = execution_context_stack[i]->function_name;
trace.stack.append(function_name.is_empty()
? TRY_OR_THROW_OOM(vm, "<anonymous>"_string)
? "<anonymous>"_string
: TRY_OR_THROW_OOM(vm, String::from_deprecated_string(function_name)));
}
@ -259,8 +259,6 @@ ThrowCompletionOr<Value> Console::count_reset()
// 1.3.1. group(...data), https://console.spec.whatwg.org/#group
ThrowCompletionOr<Value> Console::group()
{
auto& vm = realm().vm();
// 1. Let group be a new group.
Group group;
@ -273,7 +271,7 @@ ThrowCompletionOr<Value> Console::group()
}
// ... Otherwise, let groupLabel be an implementation-chosen label representing a group.
else {
group_label = TRY_OR_THROW_OOM(vm, "Group"_string);
group_label = "Group"_string;
}
// 3. Incorporate groupLabel as a label for group.
@ -295,8 +293,6 @@ ThrowCompletionOr<Value> Console::group()
// 1.3.2. groupCollapsed(...data), https://console.spec.whatwg.org/#groupcollapsed
ThrowCompletionOr<Value> Console::group_collapsed()
{
auto& vm = realm().vm();
// 1. Let group be a new group.
Group group;
@ -309,7 +305,7 @@ ThrowCompletionOr<Value> Console::group_collapsed()
}
// ... Otherwise, let groupLabel be an implementation-chosen label representing a group.
else {
group_label = TRY_OR_THROW_OOM(vm, "Group"_string);
group_label = "Group"_string;
}
// 3. Incorporate groupLabel as a label for group.

View file

@ -831,7 +831,7 @@ Token Lexer::next()
if (m_hit_invalid_unicode.has_value()) {
value_start = m_hit_invalid_unicode.value() - 1;
m_current_token = Token(TokenType::Invalid, "Invalid unicode codepoint in source"_string.release_value_but_fixme_should_propagate_errors(),
m_current_token = Token(TokenType::Invalid, "Invalid unicode codepoint in source"_string,
""sv, // Since the invalid unicode can occur anywhere in the current token the trivia is not correct
m_source.substring_view(value_start + 1, min(4u, m_source.length() - value_start - 2)),
m_filename,

View file

@ -47,7 +47,7 @@ JS_DEFINE_NATIVE_FUNCTION(ErrorPrototype::to_string)
// 4. If name is undefined, set name to "Error"; otherwise set name to ? ToString(name).
auto name = name_property.is_undefined()
? TRY_OR_THROW_OOM(vm, "Error"_string)
? "Error"_string
: TRY(name_property.to_string(vm));
// 5. Let msg be ? Get(O, "message").
@ -90,7 +90,7 @@ JS_DEFINE_NATIVE_FUNCTION(ErrorPrototype::stack_getter)
if (auto name_property = TRY(error.get(vm.names.name)); !name_property.is_undefined())
name = TRY(name_property.to_string(vm));
else
name = TRY_OR_THROW_OOM(vm, "Error"_string);
name = "Error"_string;
String message {};
if (auto message_property = TRY(error.get(vm.names.message)); !message_property.is_undefined())

View file

@ -463,7 +463,7 @@ ThrowCompletionOr<LocaleResult> resolve_locale(VM& vm, Vector<String> const& req
// 4. Else if keyLocaleData contains "true", then
else if (key_locale_data.contains_slow("true"sv)) {
// a. Let value be "true".
value = TRY_OR_THROW_OOM(vm, "true"_string);
value = "true"_string;
// b. Let supportedExtensionAddition be the string-concatenation of "-" and key.
supported_extension_addition = ::Locale::Keyword { TRY_OR_THROW_OOM(vm, String::from_utf8(key)), {} };
@ -486,7 +486,7 @@ ThrowCompletionOr<LocaleResult> resolve_locale(VM& vm, Vector<String> const& req
// 3. If optionsValue is the empty String, then
if (options_value->is_empty()) {
// a. Let optionsValue be "true".
options_value = TRY_OR_THROW_OOM(vm, "true"_string);
options_value = "true"_string;
}
}

View file

@ -83,7 +83,7 @@ static ThrowCompletionOr<Collator*> initialize_collator(VM& vm, Collator& collat
// 21. Let collation be r.[[co]].
// 22. If collation is null, let collation be "default".
// 23. Set collator.[[Collation]] to collation.
collator.set_collation(result.co.has_value() ? result.co.release_value() : TRY_OR_THROW_OOM(vm, "default"_string));
collator.set_collation(result.co.has_value() ? result.co.release_value() : "default"_string);
// 24. If relevantExtensionKeys contains "kn", then
if (relevant_extension_keys.span().contains_slow("kn"sv) && result.kn.has_value()) {

View file

@ -159,7 +159,7 @@ ThrowCompletionOr<String> to_temporal_overflow(VM& vm, Object const* options)
{
// 1. If options is undefined, return "constrain".
if (options == nullptr)
return TRY_OR_THROW_OOM(vm, "constrain"_string);
return "constrain"_string;
// 2. Return ? GetOption(options, "overflow", "string", « "constrain", "reject" », "constrain").
auto option = TRY(get_option(vm, *options, vm.names.overflow, OptionType::String, { "constrain"sv, "reject"sv }, "constrain"sv));
@ -173,7 +173,7 @@ ThrowCompletionOr<String> to_temporal_disambiguation(VM& vm, Object const* optio
{
// 1. If options is undefined, return "compatible".
if (options == nullptr)
return TRY_OR_THROW_OOM(vm, "compatible"_string);
return "compatible"_string;
// 2. Return ? GetOption(options, "disambiguation", "string", « "compatible", "earlier", "later", "reject" », "compatible").
auto option = TRY(get_option(vm, *options, vm.names.disambiguation, OptionType::String, { "compatible"sv, "earlier"sv, "later"sv, "reject"sv }, "compatible"sv));
@ -1425,7 +1425,7 @@ ThrowCompletionOr<TemporalInstant> parse_temporal_instant_string(VM& vm, StringV
// 4. If result.[[TimeZone]].[[Z]] is true, then
if (result.time_zone.z) {
// a. Set offsetString to "+00:00".
offset_string = TRY_OR_THROW_OOM(vm, "+00:00"_string);
offset_string = "+00:00"_string;
}
// 6. Assert: offsetString is not undefined.
@ -1460,7 +1460,7 @@ ThrowCompletionOr<String> parse_temporal_calendar_string(VM& vm, StringView iso_
// b. If calendar is undefined, return "iso8601".
if (!calendar.has_value())
return TRY_OR_THROW_OOM(vm, "iso8601"_string);
return "iso8601"_string;
// c. Else, return calendar.
else
return calendar.release_value();

View file

@ -99,7 +99,7 @@ ThrowCompletionOr<Calendar*> get_builtin_calendar(VM& vm, String const& identifi
Calendar* get_iso8601_calendar(VM& vm)
{
// 1. Return ! GetBuiltinCalendar("iso8601").
return MUST(get_builtin_calendar(vm, "iso8601"_string.release_value_but_fixme_should_propagate_errors()));
return MUST(get_builtin_calendar(vm, "iso8601"_string));
}
// 12.2.4 CalendarFields ( calendar, fieldNames ), https://tc39.es/proposal-temporal/#sec-temporal-calendarfields
@ -825,9 +825,9 @@ ThrowCompletionOr<ISODateRecord> iso_date_from_fields(VM& vm, Object const& fiel
// 2. Set fields to ? PrepareTemporalFields(fields, « "day", "month", "monthCode", "year" », « "year", "day" »).
auto* prepared_fields = TRY(prepare_temporal_fields(vm, fields,
{ "day"_short_string,
TRY_OR_THROW_OOM(vm, "month"_string),
TRY_OR_THROW_OOM(vm, "monthCode"_string),
TRY_OR_THROW_OOM(vm, "year"_string) },
"month"_string,
"monthCode"_string,
"year"_string },
Vector<StringView> { "year"sv, "day"sv }));
// 3. Let overflow be ? ToTemporalOverflow(options).
@ -859,9 +859,9 @@ ThrowCompletionOr<ISOYearMonth> iso_year_month_from_fields(VM& vm, Object const&
// 2. Set fields to ? PrepareTemporalFields(fields, « "month", "monthCode", "year" », « "year" »).
auto* prepared_fields = TRY(prepare_temporal_fields(vm, fields,
{ TRY_OR_THROW_OOM(vm, "month"_string),
TRY_OR_THROW_OOM(vm, "monthCode"_string),
TRY_OR_THROW_OOM(vm, "year"_string) },
{ "month"_string,
"monthCode"_string,
"year"_string },
Vector<StringView> { "year"sv }));
// 3. Let overflow be ? ToTemporalOverflow(options).
@ -891,9 +891,9 @@ ThrowCompletionOr<ISOMonthDay> iso_month_day_from_fields(VM& vm, Object const& f
// 2. Set fields to ? PrepareTemporalFields(fields, « "day", "month", "monthCode", "year" », « "day" »).
auto* prepared_fields = TRY(prepare_temporal_fields(vm, fields,
{ "day"_short_string,
TRY_OR_THROW_OOM(vm, "month"_string),
TRY_OR_THROW_OOM(vm, "monthCode"_string),
TRY_OR_THROW_OOM(vm, "year"_string) },
"month"_string,
"monthCode"_string,
"year"_string },
Vector<StringView> { "day"sv }));
// 3. Let overflow be ? ToTemporalOverflow(options).

View file

@ -369,7 +369,7 @@ JS_DEFINE_NATIVE_FUNCTION(DurationPrototype::round)
smallest_unit_present = false;
// b. Set smallestUnit to "nanosecond".
smallest_unit = TRY_OR_THROW_OOM(vm, "nanosecond"_string);
smallest_unit = "nanosecond"_string;
}
// 10. Let defaultLargestUnit be ! DefaultTemporalLargestUnit(duration.[[Years]], duration.[[Months]], duration.[[Weeks]], duration.[[Days]], duration.[[Hours]], duration.[[Minutes]], duration.[[Seconds]], duration.[[Milliseconds]], duration.[[Microseconds]]).

View file

@ -344,12 +344,12 @@ ThrowCompletionOr<TemporalTimeLikeRecord> to_temporal_time_record(VM& vm, Object
// 2. Let partial be ? PrepareTemporalFields(temporalTimeLike, « "hour", "microsecond", "millisecond", "minute", "nanosecond", "second" », partial).
auto* partial = TRY(prepare_temporal_fields(vm, temporal_time_like,
{ TRY_OR_THROW_OOM(vm, "hour"_string),
TRY_OR_THROW_OOM(vm, "microsecond"_string),
TRY_OR_THROW_OOM(vm, "millisecond"_string),
TRY_OR_THROW_OOM(vm, "minute"_string),
TRY_OR_THROW_OOM(vm, "nanosecond"_string),
TRY_OR_THROW_OOM(vm, "second"_string) },
{ "hour"_string,
"microsecond"_string,
"millisecond"_string,
"minute"_string,
"nanosecond"_string,
"second"_string },
PrepareTemporalFieldsPartial {}));
TemporalTimeLikeRecord result;

View file

@ -150,10 +150,10 @@ ThrowCompletionOr<ZonedDateTime*> to_temporal_zoned_date_time(VM& vm, Value item
auto field_names = TRY(calendar_fields(vm, *calendar, { "day"sv, "hour"sv, "microsecond"sv, "millisecond"sv, "minute"sv, "month"sv, "monthCode"sv, "nanosecond"sv, "second"sv, "year"sv }));
// d. Append "timeZone" to fieldNames.
field_names.append(TRY_OR_THROW_OOM(vm, "timeZone"_string));
field_names.append("timeZone"_string);
// e. Append "offset" to fieldNames.
field_names.append(TRY_OR_THROW_OOM(vm, "offset"_string));
field_names.append("offset"_string);
// f. Let fields be ? PrepareTemporalFields(item, fieldNames, « "timeZone" »).
auto* fields = TRY(prepare_temporal_fields(vm, item_object, field_names, Vector<StringView> { "timeZone"sv }));

View file

@ -769,7 +769,7 @@ JS_DEFINE_NATIVE_FUNCTION(ZonedDateTimePrototype::with)
auto field_names = TRY(calendar_fields(vm, calendar, { "day"sv, "hour"sv, "microsecond"sv, "millisecond"sv, "minute"sv, "month"sv, "monthCode"sv, "nanosecond"sv, "second"sv, "year"sv }));
// 7. Append "offset" to fieldNames.
field_names.append(TRY_OR_THROW_OOM(vm, "offset"_string));
field_names.append("offset"_string);
// 8. Let partialZonedDateTime be ? PrepareTemporalFields(temporalZonedDateTimeLike, fieldNames, partial).
auto* partial_zoned_date_time = TRY(prepare_temporal_fields(vm, temporal_zoned_date_time_like.as_object(), field_names, PrepareTemporalFieldsPartial {}));
@ -787,7 +787,7 @@ JS_DEFINE_NATIVE_FUNCTION(ZonedDateTimePrototype::with)
auto& time_zone = zoned_date_time->time_zone();
// 13. Append "timeZone" to fieldNames.
field_names.append(TRY_OR_THROW_OOM(vm, "timeZone"_string));
field_names.append("timeZone"_string);
// 14. Let fields be ? PrepareTemporalFields(zonedDateTime, fieldNames, « "timeZone", "offset" »).
auto* fields = TRY(prepare_temporal_fields(vm, zoned_date_time, field_names, Vector<StringView> { "timeZone"sv, "offset"sv }));

View file

@ -44,7 +44,7 @@ ErrorOr<NonnullRefPtr<VM>> VM::create(OwnPtr<CustomData> custom_data)
WellKnownSymbols well_known_symbols {
#define __JS_ENUMERATE(SymbolName, snake_name) \
Symbol::create(*vm, TRY("Symbol." #SymbolName##_string), false),
Symbol::create(*vm, "Symbol." #SymbolName##_string, false),
JS_ENUMERATE_WELL_KNOWN_SYMBOLS
#undef __JS_ENUMERATE
};

View file

@ -420,14 +420,14 @@ ThrowCompletionOr<String> Value::to_string(VM& vm) const
return vm.throw_completion<TypeError>(ErrorType::Convert, "symbol", "string");
// 3. If argument is undefined, return "undefined".
case UNDEFINED_TAG:
return TRY_OR_THROW_OOM(vm, "undefined"_string);
return "undefined"_string;
// 4. If argument is null, return "null".
case NULL_TAG:
return TRY_OR_THROW_OOM(vm, "null"_string);
return "null"_string;
// 5. If argument is true, return "true".
// 6. If argument is false, return "false".
case BOOLEAN_TAG:
return TRY_OR_THROW_OOM(vm, as_bool() ? "true"_string : "false"_string);
return as_bool() ? "true"_string : "false"_string;
// 7. If argument is a Number, return Number::toString(argument, 10).
case INT32_TAG:
return TRY_OR_THROW_OOM(vm, String::number(as_i32()));

View file

@ -34,7 +34,7 @@ unsigned PageNode::section_number() const
ErrorOr<NonnullRefPtr<PageNode>> PageNode::help_index_page()
{
static NonnullRefPtr<PageNode> const help_index_page = TRY(try_make_ref_counted<PageNode>(sections[7 - 1], TRY("Help-index"_string)));
static NonnullRefPtr<PageNode> const help_index_page = TRY(try_make_ref_counted<PageNode>(sections[7 - 1], "Help-index"_string));
return help_index_page;
}

View file

@ -466,7 +466,7 @@ WebIDL::ExceptionOr<Optional<JS::NonnullGCPtr<PendingResponse>>> main_fetch(JS::
// - should internalResponse to request be blocked due to nosniff
|| TRY_OR_IGNORE(Infrastructure::should_response_to_request_be_blocked_due_to_nosniff(internal_response, request)) == Infrastructure::RequestOrResponseBlocking::Blocked)) {
// then set response and internalResponse to a network error.
response = internal_response = Infrastructure::Response::network_error(vm, TRY_OR_IGNORE("Response was blocked"_string));
response = internal_response = Infrastructure::Response::network_error(vm, "Response was blocked"_string);
}
// 20. If responses type is "opaque", internalResponses status is 206, internalResponses range-requested
@ -479,7 +479,7 @@ WebIDL::ExceptionOr<Optional<JS::NonnullGCPtr<PendingResponse>>> main_fetch(JS::
&& internal_response->status() == 206
&& internal_response->range_requested()
&& !request->header_list()->contains("Range"sv.bytes())) {
response = internal_response = Infrastructure::Response::network_error(vm, TRY_OR_IGNORE("Response has status 206 and 'range-requested' flag set, but request has no 'Range' header"_string));
response = internal_response = Infrastructure::Response::network_error(vm, "Response has status 206 and 'range-requested' flag set, but request has no 'Range' header"_string);
}
// 21. If response is not a network error and either requests method is `HEAD` or `CONNECT`, or
@ -834,8 +834,8 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<PendingResponse>> scheme_fetch(JS::Realm& r
// 4. Return a network error.
auto message = request->current_url().scheme() == "about"sv
? TRY_OR_THROW_OOM(vm, "Request has invalid 'about:' URL, only 'about:blank' can be fetched"_string)
: TRY_OR_THROW_OOM(vm, "Request URL has invalid scheme, must be one of 'about', 'blob', 'data', 'file', 'http', or 'https'"_string);
? "Request has invalid 'about:' URL, only 'about:blank' can be fetched"_string
: "Request URL has invalid scheme, must be one of 'about', 'blob', 'data', 'file', 'http', or 'https'"_string;
return PendingResponse::create(vm, request, Infrastructure::Response::network_error(vm, move(message)));
}
@ -983,7 +983,7 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<PendingResponse>> http_fetch(JS::Realm& rea
// a service worker for that matter, it is applied here.
if (request->response_tainting() == Infrastructure::Request::ResponseTainting::CORS
&& !TRY_OR_IGNORE(cors_check(request, *response))) {
returned_pending_response->resolve(Infrastructure::Response::network_error(vm, TRY_OR_IGNORE("Request with 'cors' response tainting failed CORS check"_string)));
returned_pending_response->resolve(Infrastructure::Response::network_error(vm, "Request with 'cors' response tainting failed CORS check"_string));
return;
}
@ -1001,7 +1001,7 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<PendingResponse>> http_fetch(JS::Realm& rea
if ((request->response_tainting() == Infrastructure::Request::ResponseTainting::Opaque || response->type() == Infrastructure::Response::Type::Opaque)
&& false // FIXME: "and the cross-origin resource policy check with requests origin, requests client, requests destination, and actualResponse returns blocked"
) {
returned_pending_response->resolve(Infrastructure::Response::network_error(vm, TRY_OR_IGNORE("Response was blocked by cross-origin resource policy check"_string)));
returned_pending_response->resolve(Infrastructure::Response::network_error(vm, "Response was blocked by cross-origin resource policy check"_string));
return;
}
@ -1018,7 +1018,7 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<PendingResponse>> http_fetch(JS::Realm& rea
// -> "error"
case Infrastructure::Request::RedirectMode::Error:
// Set response to a network error.
response = Infrastructure::Response::network_error(vm, TRY_OR_IGNORE("Request with 'error' redirect mode received redirect response"_string));
response = Infrastructure::Response::network_error(vm, "Request with 'error' redirect mode received redirect response"_string);
break;
// -> "manual"
case Infrastructure::Request::RedirectMode::Manual:
@ -1583,7 +1583,7 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<PendingResponse>> http_network_or_cache_fet
if (!request->body().has<Empty>()) {
// 1. If requests bodys source is null, then return a network error.
if (request->body().get<Infrastructure::Body>().source().has<Empty>()) {
returned_pending_response->resolve(Infrastructure::Response::network_error(vm, TRY_OR_IGNORE("Request has body but no body source"_string)));
returned_pending_response->resolve(Infrastructure::Response::network_error(vm, "Request has body but no body source"_string));
return;
}
@ -1629,7 +1629,7 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<PendingResponse>> http_network_or_cache_fet
// 1. If requests window is "no-window", then return a network error.
if (request->window().has<Infrastructure::Request::Window>()
&& request->window().get<Infrastructure::Request::Window>() == Infrastructure::Request::Window::NoWindow) {
returned_pending_response->resolve(Infrastructure::Response::network_error(vm, TRY_OR_IGNORE("Request requires proxy authentication but has 'no-window' set"_string)));
returned_pending_response->resolve(Infrastructure::Response::network_error(vm, "Request requires proxy authentication but has 'no-window' set"_string));
return;
}
@ -1783,7 +1783,7 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<PendingResponse>> nonstandard_resource_load
auto response = Infrastructure::Response::create(vm);
// FIXME: This is ugly, ResourceLoader should tell us.
if (status_code.value_or(0) == 0) {
response = Infrastructure::Response::network_error(vm, TRY_OR_IGNORE("HTTP request failed"_string));
response = Infrastructure::Response::network_error(vm, "HTTP request failed"_string);
} else {
response->set_type(Infrastructure::Response::Type::Error);
response->set_status(status_code.value_or(400));
@ -1874,12 +1874,12 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<PendingResponse>> cors_preflight_fetch(JS::
// 3. If either methods or headerNames is failure, return a network error.
if (methods_or_failure.has<Infrastructure::ExtractHeaderParseFailure>()) {
returned_pending_response->resolve(Infrastructure::Response::network_error(vm, TRY_OR_IGNORE("The Access-Control-Allow-Methods in the CORS-preflight response is syntactically invalid"_string)));
returned_pending_response->resolve(Infrastructure::Response::network_error(vm, "The Access-Control-Allow-Methods in the CORS-preflight response is syntactically invalid"_string));
return;
}
if (header_names_or_failure.has<Infrastructure::ExtractHeaderParseFailure>()) {
returned_pending_response->resolve(Infrastructure::Response::network_error(vm, TRY_OR_IGNORE("The Access-Control-Allow-Headers in the CORS-preflight response is syntactically invalid"_string)));
returned_pending_response->resolve(Infrastructure::Response::network_error(vm, "The Access-Control-Allow-Headers in the CORS-preflight response is syntactically invalid"_string));
return;
}
@ -1976,7 +1976,7 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<PendingResponse>> cors_preflight_fetch(JS::
}
// 8. Otherwise, return a network error.
returned_pending_response->resolve(Infrastructure::Response::network_error(vm, TRY_OR_IGNORE("CORS-preflight check failed"_string)));
returned_pending_response->resolve(Infrastructure::Response::network_error(vm, "CORS-preflight check failed"_string));
});
return returned_pending_response;

View file

@ -401,7 +401,7 @@ ErrorOr<Optional<MimeSniff::MimeType>> HeaderList::extract_mime_type() const
}
// 5. Otherwise, if mimeTypes parameters["charset"] does not exist, and charset is non-null, set mimeTypes parameters["charset"] to charset.
else if (!mime_type->parameters().contains("charset"sv) && charset.has_value()) {
TRY(mime_type->set_parameter(TRY("charset"_string), charset.release_value()));
TRY(mime_type->set_parameter("charset"_string, charset.release_value()));
}
}

View file

@ -543,7 +543,7 @@ WebIDL::ExceptionOr<String> Request::referrer() const
return String {};
// 2. If thiss requests referrer is "client", then return "about:client".
case Infrastructure::Request::Referrer::Client:
return TRY_OR_THROW_OOM(vm, "about:client"_string);
return "about:client"_string;
default:
VERIFY_NOT_REACHED();
}

View file

@ -226,10 +226,10 @@ JS::ThrowCompletionOr<void> CustomElementRegistry::define(String const& name, We
disabled_features = TRY(convert_value_to_sequence_of_strings(vm, disabled_features_iterable));
// 9. Set disableInternals to true if disabledFeatures contains "internals".
disable_internals = disabled_features.contains_slow(TRY_OR_THROW_OOM(vm, "internals"_string));
disable_internals = disabled_features.contains_slow("internals"_string);
// 10. Set disableShadow to true if disabledFeatures contains "shadow".
disable_shadow = disabled_features.contains_slow(TRY_OR_THROW_OOM(vm, "shadow"_string));
disable_shadow = disabled_features.contains_slow("shadow"_string);
// 11. Let formAssociatedValue be ? Get( constructor, "formAssociated").
auto form_associated_value = TRY(constructor->callback->get(JS::PropertyKey { "formAssociated" }));

View file

@ -37,7 +37,7 @@ WebIDL::ExceptionOr<XHR::FormDataEntry> create_entry(JS::Realm& realm, String co
if (filename.has_value())
name_attribute = filename.value();
else
name_attribute = TRY_OR_THROW_OOM(vm, "blob"_string);
name_attribute = "blob"_string;
return JS::make_handle(TRY(FileAPI::File::create(realm, { JS::make_handle(*blob) }, move(name_attribute), {})));
}));
@ -136,7 +136,7 @@ WebIDL::ExceptionOr<Optional<Vector<XHR::FormDataEntry>>> construct_entry_list(J
// 1. If there are no selected files, then create an entry with name and a new File object with an empty name, application/octet-stream as type, and an empty body, and append it to entry list.
if (file_element->files()->length() == 0) {
FileAPI::FilePropertyBag options {};
options.type = TRY_OR_THROW_OOM(vm, "application/octet-stream"_string);
options.type = "application/octet-stream"_string;
auto file = TRY(FileAPI::File::create(realm, {}, String {}, options));
TRY_OR_THROW_OOM(vm, entry_list.try_append(XHR::FormDataEntry { .name = move(name), .value = JS::make_handle(file) }));
}
@ -151,7 +151,7 @@ WebIDL::ExceptionOr<Optional<Vector<XHR::FormDataEntry>>> construct_entry_list(J
// 9. Otherwise, if the field element is an input element whose type attribute is in the Hidden state and name is an ASCII case-insensitive match for "_charset_":
else if (auto* hidden_input = dynamic_cast<HTML::HTMLInputElement*>(control.ptr()); hidden_input && hidden_input->type_state() == HTMLInputElement::TypeAttributeState::Hidden && Infra::is_ascii_case_insensitive_match(name, "_charset_"sv)) {
// 1. Let charset be the name of encoding if encoding is given, and "UTF-8" otherwise.
auto charset = encoding.has_value() ? encoding.value() : TRY_OR_THROW_OOM(vm, "UTF-8"_string);
auto charset = encoding.has_value() ? encoding.value() : "UTF-8"_string;
// 2. Create an entry with name and charset, and append it to entry list.
TRY_OR_THROW_OOM(vm, entry_list.try_append(XHR::FormDataEntry { .name = move(name), .value = move(charset) }));

View file

@ -829,7 +829,7 @@ WebIDL::ExceptionOr<void> HTMLMediaElement::select_resource()
// 1. ⌛ If the src attribute's value is the empty string, then end the synchronous section, and jump down to the failed with attribute step below.
auto source = attribute(HTML::AttributeNames::src);
if (source.is_empty()) {
failed_with_attribute(TRY_OR_THROW_OOM(vm, "The 'src' attribute is empty"_string));
failed_with_attribute("The 'src' attribute is empty"_string);
return {};
}
@ -850,7 +850,7 @@ WebIDL::ExceptionOr<void> HTMLMediaElement::select_resource()
return {};
}
failed_with_attribute(TRY_OR_THROW_OOM(vm, "Failed to parse 'src' attribute as a URL"_string));
failed_with_attribute("Failed to parse 'src' attribute as a URL"_string);
// 8. Return. The element won't attempt to load another resource until this algorithm is triggered again.
return {};

View file

@ -98,7 +98,7 @@ void MessagePort::post_message(JS::Value message)
main_thread_event_loop().task_queue().add(HTML::Task::create(HTML::Task::Source::PostedMessage, nullptr, [target_port, message] {
MessageEventInit event_init {};
event_init.data = message;
event_init.origin = "<origin>"_string.release_value_but_fixme_should_propagate_errors();
event_init.origin = "<origin>"_string;
target_port->dispatch_event(MessageEvent::create(target_port->realm(), HTML::EventNames::message, event_init).release_value_but_fixme_should_propagate_errors());
}));
}

View file

@ -35,10 +35,10 @@ String const& MimeType::type() const
}
// https://html.spec.whatwg.org/multipage/system-state.html#dom-mimetype-description
JS::ThrowCompletionOr<String> MimeType::description() const
String MimeType::description() const
{
// The MimeType interface's description getter steps are to return "Portable Document Format".
static String description_string = TRY_OR_THROW_OOM(vm(), "Portable Document Format"_string);
static String description_string = "Portable Document Format"_string;
return description_string;
}

View file

@ -18,7 +18,7 @@ public:
virtual ~MimeType() override;
String const& type() const;
JS::ThrowCompletionOr<String> description() const;
String description() const;
String const& suffixes() const;
JS::NonnullGCPtr<Plugin> enabled_plugin() const;

View file

@ -36,18 +36,18 @@ String const& Plugin::name() const
}
// https://html.spec.whatwg.org/multipage/system-state.html#dom-plugin-description
JS::ThrowCompletionOr<String> Plugin::description() const
String Plugin::description() const
{
// The Plugin interface's description getter steps are to return "Portable Document Format".
static String description_string = TRY_OR_THROW_OOM(vm(), "Portable Document Format"_string);
static String description_string = "Portable Document Format"_string;
return description_string;
}
// https://html.spec.whatwg.org/multipage/system-state.html#dom-plugin-filename
JS::ThrowCompletionOr<String> Plugin::filename() const
String Plugin::filename() const
{
// The Plugin interface's filename getter steps are to return "internal-pdf-viewer".
static String filename_string = TRY_OR_THROW_OOM(vm(), "internal-pdf-viewer"_string);
static String filename_string = "internal-pdf-viewer"_string;
return filename_string;
}

View file

@ -18,8 +18,8 @@ public:
virtual ~Plugin() override;
String const& name() const;
JS::ThrowCompletionOr<String> description() const;
JS::ThrowCompletionOr<String> filename() const;
String description() const;
String filename() const;
size_t length() const;
JS::GCPtr<MimeType> item(u32 index) const;
JS::GCPtr<MimeType> named_item(String const& name) const;

View file

@ -730,11 +730,11 @@ Vector<JS::NonnullGCPtr<Plugin>> Window::pdf_viewer_plugin_objects()
if (m_pdf_viewer_plugin_objects.is_empty()) {
// FIXME: Propagate errors.
m_pdf_viewer_plugin_objects.append(realm().heap().allocate<Plugin>(realm(), realm(), "PDF Viewer"_string.release_value_but_fixme_should_propagate_errors()).release_allocated_value_but_fixme_should_propagate_errors());
m_pdf_viewer_plugin_objects.append(realm().heap().allocate<Plugin>(realm(), realm(), "Chrome PDF Viewer"_string.release_value_but_fixme_should_propagate_errors()).release_allocated_value_but_fixme_should_propagate_errors());
m_pdf_viewer_plugin_objects.append(realm().heap().allocate<Plugin>(realm(), realm(), "Chromium PDF Viewer"_string.release_value_but_fixme_should_propagate_errors()).release_allocated_value_but_fixme_should_propagate_errors());
m_pdf_viewer_plugin_objects.append(realm().heap().allocate<Plugin>(realm(), realm(), "Microsoft Edge PDF Viewer"_string.release_value_but_fixme_should_propagate_errors()).release_allocated_value_but_fixme_should_propagate_errors());
m_pdf_viewer_plugin_objects.append(realm().heap().allocate<Plugin>(realm(), realm(), "WebKit built-in PDF"_string.release_value_but_fixme_should_propagate_errors()).release_allocated_value_but_fixme_should_propagate_errors());
m_pdf_viewer_plugin_objects.append(realm().heap().allocate<Plugin>(realm(), realm(), "PDF Viewer"_string).release_allocated_value_but_fixme_should_propagate_errors());
m_pdf_viewer_plugin_objects.append(realm().heap().allocate<Plugin>(realm(), realm(), "Chrome PDF Viewer"_string).release_allocated_value_but_fixme_should_propagate_errors());
m_pdf_viewer_plugin_objects.append(realm().heap().allocate<Plugin>(realm(), realm(), "Chromium PDF Viewer"_string).release_allocated_value_but_fixme_should_propagate_errors());
m_pdf_viewer_plugin_objects.append(realm().heap().allocate<Plugin>(realm(), realm(), "Microsoft Edge PDF Viewer"_string).release_allocated_value_but_fixme_should_propagate_errors());
m_pdf_viewer_plugin_objects.append(realm().heap().allocate<Plugin>(realm(), realm(), "WebKit built-in PDF"_string).release_allocated_value_but_fixme_should_propagate_errors());
}
return m_pdf_viewer_plugin_objects;
@ -753,8 +753,8 @@ Vector<JS::NonnullGCPtr<MimeType>> Window::pdf_viewer_mime_type_objects()
return {};
if (m_pdf_viewer_mime_type_objects.is_empty()) {
m_pdf_viewer_mime_type_objects.append(realm().heap().allocate<MimeType>(realm(), realm(), "application/pdf"_string.release_value_but_fixme_should_propagate_errors()).release_allocated_value_but_fixme_should_propagate_errors());
m_pdf_viewer_mime_type_objects.append(realm().heap().allocate<MimeType>(realm(), realm(), "text/pdf"_string.release_value_but_fixme_should_propagate_errors()).release_allocated_value_but_fixme_should_propagate_errors());
m_pdf_viewer_mime_type_objects.append(realm().heap().allocate<MimeType>(realm(), realm(), "application/pdf"_string).release_allocated_value_but_fixme_should_propagate_errors());
m_pdf_viewer_mime_type_objects.append(realm().heap().allocate<MimeType>(realm(), realm(), "text/pdf"_string).release_allocated_value_but_fixme_should_propagate_errors());
}
return m_pdf_viewer_mime_type_objects;
@ -1042,7 +1042,7 @@ void Window::post_message(JS::Value message, String const&)
queue_global_task(Task::Source::PostedMessage, *this, [this, message] {
MessageEventInit event_init {};
event_init.data = message;
event_init.origin = "<origin>"_string.release_value_but_fixme_should_propagate_errors();
event_init.origin = "<origin>"_string;
dispatch_event(MessageEvent::create(realm(), EventNames::message, event_init).release_value_but_fixme_should_propagate_errors());
});
}

View file

@ -169,7 +169,7 @@ void Worker::run_a_worker(AK::URL& url, EnvironmentSettingsObject& outside_setti
event_loop.task_queue().add(HTML::Task::create(HTML::Task::Source::PostedMessage, nullptr, [this, message] {
MessageEventInit event_init {};
event_init.data = message;
event_init.origin = "<origin>"_string.release_value_but_fixme_should_propagate_errors();
event_init.origin = "<origin>"_string;
dispatch_event(MessageEvent::create(*m_worker_realm, HTML::EventNames::message, event_init).release_value_but_fixme_should_propagate_errors());
}));

View file

@ -26,8 +26,8 @@
namespace Web::HTML {
struct WorkerOptions {
String type { "classic"_string.release_value_but_fixme_should_propagate_errors() };
String credentials { "same-origin"_string.release_value_but_fixme_should_propagate_errors() };
String type { "classic"_string };
String credentials { "same-origin"_string };
String name { String {} };
};

View file

@ -221,7 +221,7 @@ static ErrorOr<String> get_event_key(KeyCode platform_key, u32 code_point)
// 5. Return key as the key attribute value for this key event.
if (key.has_value())
return key.release_value();
return TRY("Unidentified"_string);
return "Unidentified"_string;
}
// 3. Keyboard Event code Value Tables, https://www.w3.org/TR/uievents-code/#code-value-tables

View file

@ -75,7 +75,7 @@ private:
ErrorOr<void> establish_web_socket_connection(AK::URL& url_record, Vector<String>& protocols, HTML::EnvironmentSettingsObject& client);
AK::URL m_url;
String m_binary_type { "blob"_string.release_value_but_fixme_should_propagate_errors() };
String m_binary_type { "blob"_string };
RefPtr<WebSocketClientSocket> m_websocket;
};

View file

@ -267,7 +267,7 @@ ErrorOr<MimeSniff::MimeType> XMLHttpRequest::get_response_mime_type() const
// 2. If mimeType is failure, then set mimeType to text/xml.
if (!mime_type.has_value())
return MimeSniff::MimeType::create(TRY("text"_string), "xml"_short_string);
return MimeSniff::MimeType::create("text"_string, "xml"_short_string);
// 3. Return mimeType.
return mime_type.release_value();
@ -498,7 +498,7 @@ WebIDL::ExceptionOr<void> XMLHttpRequest::send(Optional<DocumentOrXMLHttpRequest
auto charset_parameter_iterator = content_type_record->parameters().find("charset"sv);
if (charset_parameter_iterator != content_type_record->parameters().end() && !Infra::is_ascii_case_insensitive_match(charset_parameter_iterator->value, "UTF-8"sv)) {
// 1. Set contentTypeRecords parameters["charset"] to "UTF-8".
TRY_OR_THROW_OOM(vm, content_type_record->set_parameter(TRY_OR_THROW_OOM(vm, "charset"_string), TRY_OR_THROW_OOM(vm, "UTF-8"_string)));
TRY_OR_THROW_OOM(vm, content_type_record->set_parameter("charset"_string, "UTF-8"_string));
// 2. Let newContentTypeSerialized be the result of serializing contentTypeRecord.
auto new_content_type_serialized = TRY_OR_THROW_OOM(vm, content_type_record->serialized());
@ -925,7 +925,7 @@ WebIDL::ExceptionOr<void> XMLHttpRequest::override_mime_type(String const& mime)
// 3. If thiss override MIME type is failure, then set thiss override MIME type to application/octet-stream.
if (!m_override_mime_type.has_value())
m_override_mime_type = TRY_OR_THROW_OOM(vm, MimeSniff::MimeType::create(TRY_OR_THROW_OOM(vm, "application"_string), TRY_OR_THROW_OOM(vm, "octet-stream"_string)));
m_override_mime_type = TRY_OR_THROW_OOM(vm, MimeSniff::MimeType::create("application"_string, "octet-stream"_string));
return {};
}