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

LibWeb/HTML: Replace ThrowCompletionOr with ExceptionOr in Location

The former should not be used in LibWeb unless required due to
overriding a JS::Object virtual method, for example.
This commit is contained in:
Linus Groh 2023-03-04 22:19:14 +00:00
parent 7d50be0b09
commit 0b8ebfb618
2 changed files with 16 additions and 16 deletions

View file

@ -81,7 +81,7 @@ WebIDL::ExceptionOr<String> Location::href() const
} }
// https://html.spec.whatwg.org/multipage/history.html#the-location-interface:dom-location-href-2 // https://html.spec.whatwg.org/multipage/history.html#the-location-interface:dom-location-href-2
JS::ThrowCompletionOr<void> Location::set_href(String const& new_href) WebIDL::ExceptionOr<void> Location::set_href(String const& new_href)
{ {
auto& vm = this->vm(); auto& vm = this->vm();
auto& window = verify_cast<HTML::Window>(HTML::current_global_object()); auto& window = verify_cast<HTML::Window>(HTML::current_global_object());
@ -121,7 +121,7 @@ WebIDL::ExceptionOr<String> Location::protocol() const
return TRY_OR_THROW_OOM(vm, String::formatted("{}:", url().scheme())); return TRY_OR_THROW_OOM(vm, String::formatted("{}:", url().scheme()));
} }
JS::ThrowCompletionOr<void> Location::set_protocol(String const&) WebIDL::ExceptionOr<void> Location::set_protocol(String const&)
{ {
auto& vm = this->vm(); auto& vm = this->vm();
return vm.throw_completion<JS::InternalError>(JS::ErrorType::NotImplemented, "Location.protocol setter"); return vm.throw_completion<JS::InternalError>(JS::ErrorType::NotImplemented, "Location.protocol setter");
@ -149,7 +149,7 @@ WebIDL::ExceptionOr<String> Location::host() const
return TRY_OR_THROW_OOM(vm, String::formatted("{}:{}", url.host(), *url.port())); return TRY_OR_THROW_OOM(vm, String::formatted("{}:{}", url.host(), *url.port()));
} }
JS::ThrowCompletionOr<void> Location::set_host(String const&) WebIDL::ExceptionOr<void> Location::set_host(String const&)
{ {
auto& vm = this->vm(); auto& vm = this->vm();
return vm.throw_completion<JS::InternalError>(JS::ErrorType::NotImplemented, "Location.host setter"); return vm.throw_completion<JS::InternalError>(JS::ErrorType::NotImplemented, "Location.host setter");
@ -172,7 +172,7 @@ WebIDL::ExceptionOr<String> Location::hostname() const
return TRY_OR_THROW_OOM(vm, String::from_deprecated_string(url.host())); return TRY_OR_THROW_OOM(vm, String::from_deprecated_string(url.host()));
} }
JS::ThrowCompletionOr<void> Location::set_hostname(String const&) WebIDL::ExceptionOr<void> Location::set_hostname(String const&)
{ {
auto& vm = this->vm(); auto& vm = this->vm();
return vm.throw_completion<JS::InternalError>(JS::ErrorType::NotImplemented, "Location.hostname setter"); return vm.throw_completion<JS::InternalError>(JS::ErrorType::NotImplemented, "Location.hostname setter");
@ -195,7 +195,7 @@ WebIDL::ExceptionOr<String> Location::port() const
return TRY_OR_THROW_OOM(vm, String::number(*url.port())); return TRY_OR_THROW_OOM(vm, String::number(*url.port()));
} }
JS::ThrowCompletionOr<void> Location::set_port(String const&) WebIDL::ExceptionOr<void> Location::set_port(String const&)
{ {
auto& vm = this->vm(); auto& vm = this->vm();
return vm.throw_completion<JS::InternalError>(JS::ErrorType::NotImplemented, "Location.port setter"); return vm.throw_completion<JS::InternalError>(JS::ErrorType::NotImplemented, "Location.port setter");
@ -212,7 +212,7 @@ WebIDL::ExceptionOr<String> Location::pathname() const
return TRY_OR_THROW_OOM(vm, String::from_deprecated_string(url().path())); return TRY_OR_THROW_OOM(vm, String::from_deprecated_string(url().path()));
} }
JS::ThrowCompletionOr<void> Location::set_pathname(String const&) WebIDL::ExceptionOr<void> Location::set_pathname(String const&)
{ {
auto& vm = this->vm(); auto& vm = this->vm();
return vm.throw_completion<JS::InternalError>(JS::ErrorType::NotImplemented, "Location.pathname setter"); return vm.throw_completion<JS::InternalError>(JS::ErrorType::NotImplemented, "Location.pathname setter");
@ -235,7 +235,7 @@ WebIDL::ExceptionOr<String> Location::search() const
return TRY_OR_THROW_OOM(vm, String::formatted("?{}", url.query())); return TRY_OR_THROW_OOM(vm, String::formatted("?{}", url.query()));
} }
JS::ThrowCompletionOr<void> Location::set_search(String const&) WebIDL::ExceptionOr<void> Location::set_search(String const&)
{ {
auto& vm = this->vm(); auto& vm = this->vm();
return vm.throw_completion<JS::InternalError>(JS::ErrorType::NotImplemented, "Location.search setter"); return vm.throw_completion<JS::InternalError>(JS::ErrorType::NotImplemented, "Location.search setter");
@ -259,7 +259,7 @@ WebIDL::ExceptionOr<String> Location::hash() const
} }
// https://html.spec.whatwg.org/multipage/nav-history-apis.html#dom-location-hash // https://html.spec.whatwg.org/multipage/nav-history-apis.html#dom-location-hash
JS::ThrowCompletionOr<void> Location::set_hash(String const& value) WebIDL::ExceptionOr<void> Location::set_hash(String const& value)
{ {
// The hash setter steps are: // The hash setter steps are:
// 1. If this's relevant Document is null, then return. // 1. If this's relevant Document is null, then return.

View file

@ -23,30 +23,30 @@ public:
virtual ~Location() override; virtual ~Location() override;
WebIDL::ExceptionOr<String> href() const; WebIDL::ExceptionOr<String> href() const;
JS::ThrowCompletionOr<void> set_href(String const&); WebIDL::ExceptionOr<void> set_href(String const&);
WebIDL::ExceptionOr<String> origin() const; WebIDL::ExceptionOr<String> origin() const;
WebIDL::ExceptionOr<String> protocol() const; WebIDL::ExceptionOr<String> protocol() const;
JS::ThrowCompletionOr<void> set_protocol(String const&); WebIDL::ExceptionOr<void> set_protocol(String const&);
WebIDL::ExceptionOr<String> host() const; WebIDL::ExceptionOr<String> host() const;
JS::ThrowCompletionOr<void> set_host(String const&); WebIDL::ExceptionOr<void> set_host(String const&);
WebIDL::ExceptionOr<String> hostname() const; WebIDL::ExceptionOr<String> hostname() const;
JS::ThrowCompletionOr<void> set_hostname(String const&); WebIDL::ExceptionOr<void> set_hostname(String const&);
WebIDL::ExceptionOr<String> port() const; WebIDL::ExceptionOr<String> port() const;
JS::ThrowCompletionOr<void> set_port(String const&); WebIDL::ExceptionOr<void> set_port(String const&);
WebIDL::ExceptionOr<String> pathname() const; WebIDL::ExceptionOr<String> pathname() const;
JS::ThrowCompletionOr<void> set_pathname(String const&); WebIDL::ExceptionOr<void> set_pathname(String const&);
WebIDL::ExceptionOr<String> search() const; WebIDL::ExceptionOr<String> search() const;
JS::ThrowCompletionOr<void> set_search(String const&); WebIDL::ExceptionOr<void> set_search(String const&);
WebIDL::ExceptionOr<String> hash() const; WebIDL::ExceptionOr<String> hash() const;
JS::ThrowCompletionOr<void> set_hash(String const&); WebIDL::ExceptionOr<void> set_hash(String const&);
void replace(String const& url) const; void replace(String const& url) const;
void reload() const; void reload() const;