LibWeb: Tidy up return types of BroadcastChannel

Use GC::Ptr over a raw pointer and make the name() function const
qualfied returning a reference instead of a copy.
This commit is contained in:
Shannon Booth 2024-11-23 16:26:03 +13:00 committed by Andreas Kling
commit 473bebc9a8
Notes: github-actions[bot] 2024-11-23 15:45:09 +00:00
2 changed files with 14 additions and 16 deletions

View file

@ -17,14 +17,19 @@ class BroadcastChannel final : public DOM::EventTarget {
public:
[[nodiscard]] static GC::Ref<BroadcastChannel> construct_impl(JS::Realm&, FlyString const& name);
FlyString name();
// https://html.spec.whatwg.org/multipage/web-messaging.html#dom-broadcastchannel-name
FlyString const& name() const
{
// The name getter steps are to return this's channel name.
return m_channel_name;
}
void close();
void set_onmessage(WebIDL::CallbackType*);
WebIDL::CallbackType* onmessage();
void set_onmessageerror(WebIDL::CallbackType*);
WebIDL::CallbackType* onmessageerror();
void set_onmessage(GC::Ptr<WebIDL::CallbackType>);
GC::Ptr<WebIDL::CallbackType> onmessage();
void set_onmessageerror(GC::Ptr<WebIDL::CallbackType>);
GC::Ptr<WebIDL::CallbackType> onmessageerror();
private:
BroadcastChannel(JS::Realm&, FlyString const& name);