LibWeb: Follow-up fixes for Linus's comments in #17658

This commit is contained in:
Andreas Kling 2023-02-28 13:14:51 +01:00
parent 4d0277cd9a
commit 3a5802540e
Notes: sideshowbarker 2024-07-16 23:38:47 +09:00
5 changed files with 14 additions and 14 deletions

View file

@ -11,9 +11,9 @@
namespace Web::HTML {
MimeType::MimeType(JS::Realm& realm, String const& type)
MimeType::MimeType(JS::Realm& realm, String type)
: Bindings::PlatformObject(realm)
, m_type(type)
, m_type(move(type))
{
}
@ -38,7 +38,7 @@ String const& MimeType::type() const
JS::ThrowCompletionOr<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(), String::from_utf8("Portable Document Format"sv));
static String description_string = TRY_OR_THROW_OOM(vm(), "Portable Document Format"_string);
return description_string;
}
@ -46,7 +46,7 @@ JS::ThrowCompletionOr<String> MimeType::description() const
String const& MimeType::suffixes() const
{
// The MimeType interface's suffixes getter steps are to return "pdf".
static String suffixes_string = String::from_utf8_short_string("pdf"sv);
static String suffixes_string = "pdf"_short_string;
return suffixes_string;
}

View file

@ -23,7 +23,7 @@ public:
JS::NonnullGCPtr<Plugin> enabled_plugin() const;
private:
MimeType(JS::Realm&, String const& type);
MimeType(JS::Realm&, String type);
virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override;

View file

@ -12,9 +12,9 @@
namespace Web::HTML {
Plugin::Plugin(JS::Realm& realm, String const& name)
Plugin::Plugin(JS::Realm& realm, String name)
: Bindings::LegacyPlatformObject(realm)
, m_name(name)
, m_name(move(name))
{
}

View file

@ -25,7 +25,7 @@ public:
JS::GCPtr<MimeType> named_item(String const& name) const;
private:
Plugin(JS::Realm&, String const& name);
Plugin(JS::Realm&, String name);
// https://html.spec.whatwg.org/multipage/system-state.html#concept-plugin-name
String m_name;

View file

@ -1080,12 +1080,12 @@ Vector<JS::NonnullGCPtr<Plugin>> Window::pdf_viewer_plugin_objects()
return {};
if (m_pdf_viewer_plugin_objects.is_empty()) {
// FIXME: Remove the MUSTs and propagate the errors instead.
m_pdf_viewer_plugin_objects.append(realm().heap().allocate<Plugin>(realm(), realm(), MUST(String::from_utf8("PDF Viewer"sv))).release_allocated_value_but_fixme_should_propagate_errors());
m_pdf_viewer_plugin_objects.append(realm().heap().allocate<Plugin>(realm(), realm(), MUST(String::from_utf8("Chrome PDF Viewer"sv))).release_allocated_value_but_fixme_should_propagate_errors());
m_pdf_viewer_plugin_objects.append(realm().heap().allocate<Plugin>(realm(), realm(), MUST(String::from_utf8("Chromium PDF Viewer"sv))).release_allocated_value_but_fixme_should_propagate_errors());
m_pdf_viewer_plugin_objects.append(realm().heap().allocate<Plugin>(realm(), realm(), MUST(String::from_utf8("Microsoft Edge PDF Viewer"sv))).release_allocated_value_but_fixme_should_propagate_errors());
m_pdf_viewer_plugin_objects.append(realm().heap().allocate<Plugin>(realm(), realm(), MUST(String::from_utf8("WebKit built-in PDF"sv))).release_allocated_value_but_fixme_should_propagate_errors());
// 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());
}
return m_pdf_viewer_plugin_objects;