mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-01 13:49:16 +00:00
LibWeb: Create separate DedicatedWorkerGlobalScope class
This is how it's supposed to have been from the beginning, we were just lazy :).
This commit is contained in:
parent
f99c7ad85d
commit
40a2bb32c3
Notes:
sideshowbarker
2024-07-17 02:08:15 +09:00
Author: https://github.com/ADKaster
Commit: 40a2bb32c3
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/543
13 changed files with 179 additions and 43 deletions
|
@ -5,7 +5,6 @@
|
|||
*/
|
||||
|
||||
#include <AK/Vector.h>
|
||||
#include <LibWeb/Bindings/DedicatedWorkerExposedInterfaces.h>
|
||||
#include <LibWeb/Bindings/Intrinsics.h>
|
||||
#include <LibWeb/Bindings/WorkerGlobalScopePrototype.h>
|
||||
#include <LibWeb/CSS/FontFaceSet.h>
|
||||
|
@ -31,16 +30,11 @@ WorkerGlobalScope::WorkerGlobalScope(JS::Realm& realm, JS::NonnullGCPtr<Web::Pag
|
|||
|
||||
WorkerGlobalScope::~WorkerGlobalScope() = default;
|
||||
|
||||
void WorkerGlobalScope::initialize_web_interfaces(Badge<WorkerEnvironmentSettingsObject>)
|
||||
void WorkerGlobalScope::initialize_web_interfaces_impl()
|
||||
{
|
||||
auto& realm = this->realm();
|
||||
Base::initialize(realm);
|
||||
|
||||
// FIXME: Handle shared worker
|
||||
add_dedicated_worker_exposed_interfaces(*this);
|
||||
|
||||
WEB_SET_PROTOTYPE_FOR_INTERFACE(WorkerGlobalScope);
|
||||
|
||||
WindowOrWorkerGlobalScopeMixin::initialize(realm);
|
||||
|
||||
m_navigator = WorkerNavigator::create(*this);
|
||||
|
@ -71,7 +65,7 @@ void WorkerGlobalScope::set_internal_port(JS::NonnullGCPtr<MessagePort> port)
|
|||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/workers.html#close-a-worker
|
||||
void WorkerGlobalScope::close()
|
||||
void WorkerGlobalScope::close_a_worker()
|
||||
{
|
||||
// 1. Discard any tasks that have been added to workerGlobal's relevant agent's event loop's task queues.
|
||||
relevant_settings_object(*this).responsible_event_loop().task_queue().remove_tasks_matching([](HTML::Task const&) {
|
||||
|
@ -147,11 +141,6 @@ JS::NonnullGCPtr<WorkerNavigator> WorkerGlobalScope::navigator() const
|
|||
return *m_navigator;
|
||||
}
|
||||
|
||||
WebIDL::ExceptionOr<void> WorkerGlobalScope::post_message(JS::Value message, StructuredSerializeOptions const& options)
|
||||
{
|
||||
return m_internal_port->post_message(message, options);
|
||||
}
|
||||
|
||||
#undef __ENUMERATE
|
||||
#define __ENUMERATE(attribute_name, event_name) \
|
||||
void WorkerGlobalScope::set_##attribute_name(WebIDL::CallbackType* value) \
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue