1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 06:37:43 +00:00

LibWeb: Make Document::open functions take a StringView

One of these functions doesn't make any use of the arguments at all, and
the other defers to an open helper which already takes a StringView.
This commit is contained in:
Shannon Booth 2023-09-12 22:29:43 +12:00 committed by Andreas Kling
parent 8ad05fff4a
commit e42bda5f19
2 changed files with 4 additions and 4 deletions

View file

@ -464,7 +464,7 @@ WebIDL::ExceptionOr<void> Document::run_the_document_write_steps(DeprecatedStrin
}
// https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#dom-document-open
WebIDL::ExceptionOr<Document*> Document::open(DeprecatedString const&, DeprecatedString const&)
WebIDL::ExceptionOr<Document*> Document::open(StringView, StringView)
{
// 1. If document is an XML document, then throw an "InvalidStateError" DOMException exception.
if (m_type == Type::XML)
@ -535,7 +535,7 @@ WebIDL::ExceptionOr<Document*> Document::open(DeprecatedString const&, Deprecate
}
// https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#dom-document-open-window
WebIDL::ExceptionOr<JS::GCPtr<HTML::WindowProxy>> Document::open(DeprecatedString const& url, DeprecatedString const& name, DeprecatedString const& features)
WebIDL::ExceptionOr<JS::GCPtr<HTML::WindowProxy>> Document::open(StringView url, StringView name, StringView features)
{
// 1. If this is not fully active, then throw an "InvalidAccessError" DOMException exception.
if (!is_fully_active())

View file

@ -319,8 +319,8 @@ public:
WebIDL::ExceptionOr<void> write(Vector<DeprecatedString> const& strings);
WebIDL::ExceptionOr<void> writeln(Vector<DeprecatedString> const& strings);
WebIDL::ExceptionOr<Document*> open(DeprecatedString const& = "", DeprecatedString const& = "");
WebIDL::ExceptionOr<JS::GCPtr<HTML::WindowProxy>> open(DeprecatedString const& url, DeprecatedString const& name, DeprecatedString const& features);
WebIDL::ExceptionOr<Document*> open(StringView = ""sv, StringView = ""sv);
WebIDL::ExceptionOr<JS::GCPtr<HTML::WindowProxy>> open(StringView url, StringView name, StringView features);
WebIDL::ExceptionOr<void> close();
HTML::Window* default_view() { return m_window.ptr(); }