1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 05:48:12 +00:00

LibWeb: Make factory method of HTML::MessagePort fallible

This commit is contained in:
Kenneth Myhra 2023-02-12 22:30:39 +01:00 committed by Linus Groh
parent 7ec444047c
commit 471ad7ba01
4 changed files with 8 additions and 8 deletions

View file

@ -20,10 +20,10 @@ MessageChannel::MessageChannel(JS::Realm& realm)
: PlatformObject(realm)
{
// 1. Set this's port 1 to a new MessagePort in this's relevant Realm.
m_port1 = MessagePort::create(realm);
m_port1 = MessagePort::create(realm).release_value_but_fixme_should_propagate_errors();
// 2. Set this's port 2 to a new MessagePort in this's relevant Realm.
m_port2 = MessagePort::create(realm);
m_port2 = MessagePort::create(realm).release_value_but_fixme_should_propagate_errors();
// 3. Entangle this's port 1 and this's port 2.
m_port1->entangle_with(*m_port2);

View file

@ -14,9 +14,9 @@
namespace Web::HTML {
JS::NonnullGCPtr<MessagePort> MessagePort::create(JS::Realm& realm)
WebIDL::ExceptionOr<JS::NonnullGCPtr<MessagePort>> MessagePort::create(JS::Realm& realm)
{
return realm.heap().allocate<MessagePort>(realm, realm).release_allocated_value_but_fixme_should_propagate_errors();
return MUST_OR_THROW_OOM(realm.heap().allocate<MessagePort>(realm, realm));
}
MessagePort::MessagePort(JS::Realm& realm)

View file

@ -22,7 +22,7 @@ class MessagePort final : public DOM::EventTarget {
WEB_PLATFORM_OBJECT(MessagePort, DOM::EventTarget);
public:
static JS::NonnullGCPtr<MessagePort> create(JS::Realm&);
static WebIDL::ExceptionOr<JS::NonnullGCPtr<MessagePort>> create(JS::Realm&);
virtual ~MessagePort() override;

View file

@ -26,7 +26,7 @@ Worker::Worker(DeprecatedFlyString const& script_url, WorkerOptions const option
, m_worker_vm(JS::VM::create(adopt_own(m_custom_data)))
, m_interpreter(JS::Interpreter::create<JS::GlobalObject>(m_worker_vm))
, m_interpreter_scope(*m_interpreter)
, m_implicit_port(MessagePort::create(document.realm()))
, m_implicit_port(MessagePort::create(document.realm()).release_value_but_fixme_should_propagate_errors())
{
}
@ -80,7 +80,7 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<Worker>> Worker::create(DeprecatedFlyString
auto worker = MUST_OR_THROW_OOM(document.heap().allocate<Worker>(document.realm(), script_url, options, document));
// 7. Let outside port be a new MessagePort in outside settings's Realm.
auto outside_port = MessagePort::create(outside_settings.realm());
auto outside_port = TRY(MessagePort::create(outside_settings.realm()));
// 8. Associate the outside port with worker
worker->m_outside_port = outside_port;
@ -263,7 +263,7 @@ void Worker::run_a_worker(AK::URL& url, EnvironmentSettingsObject& outside_setti
// FIXME: Global scope association
// 16. Let inside port be a new MessagePort object in inside settings's Realm.
auto inside_port = MessagePort::create(m_inner_settings->realm());
auto inside_port = MessagePort::create(m_inner_settings->realm()).release_value_but_fixme_should_propagate_errors();
// 17. Associate inside port with worker global scope.
// FIXME: Global scope association