1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-24 22:17:42 +00:00

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
5 changed files with 14 additions and 14 deletions

View file

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

View file

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

View file

@ -12,9 +12,9 @@
namespace Web::HTML { namespace Web::HTML {
Plugin::Plugin(JS::Realm& realm, String const& name) Plugin::Plugin(JS::Realm& realm, String name)
: Bindings::LegacyPlatformObject(realm) : 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; JS::GCPtr<MimeType> named_item(String const& name) const;
private: private:
Plugin(JS::Realm&, String const& name); Plugin(JS::Realm&, String name);
// https://html.spec.whatwg.org/multipage/system-state.html#concept-plugin-name // https://html.spec.whatwg.org/multipage/system-state.html#concept-plugin-name
String m_name; String m_name;

View file

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