/src/serenity/Userland/Libraries/LibWeb/HTML/ServiceWorker.cpp
Line | Count | Source (jump to first uncovered line) |
1 | | /* |
2 | | * Copyright (c) 2024, Andrew Kaster <andrew@ladybird.org> |
3 | | * |
4 | | * SPDX-License-Identifier: BSD-2-Clause |
5 | | */ |
6 | | |
7 | | #include <LibJS/Heap/Heap.h> |
8 | | #include <LibJS/Runtime/Realm.h> |
9 | | #include <LibWeb/Bindings/Intrinsics.h> |
10 | | #include <LibWeb/HTML/EventNames.h> |
11 | | #include <LibWeb/HTML/ServiceWorker.h> |
12 | | |
13 | | namespace Web::HTML { |
14 | | |
15 | | ServiceWorker::ServiceWorker(JS::Realm& realm, String script_url) |
16 | 0 | : DOM::EventTarget(realm) |
17 | 0 | , m_script_url(move(script_url)) |
18 | 0 | { |
19 | 0 | } |
20 | | |
21 | 0 | ServiceWorker::~ServiceWorker() = default; |
22 | | |
23 | | JS::NonnullGCPtr<ServiceWorker> ServiceWorker::create(JS::Realm& realm) |
24 | 0 | { |
25 | 0 | return realm.heap().allocate<ServiceWorker>(realm, realm, ""_string); |
26 | 0 | } |
27 | | |
28 | | void ServiceWorker::initialize(JS::Realm& realm) |
29 | 0 | { |
30 | 0 | Base::initialize(realm); |
31 | 0 | WEB_SET_PROTOTYPE_FOR_INTERFACE(ServiceWorker); |
32 | 0 | } |
33 | | |
34 | | #undef __ENUMERATE |
35 | | #define __ENUMERATE(attribute_name, event_name) \ |
36 | | void ServiceWorker::set_##attribute_name(WebIDL::CallbackType* value) \ |
37 | 0 | { \ |
38 | 0 | set_event_handler_attribute(event_name, value); \ |
39 | 0 | } \ Unexecuted instantiation: Web::HTML::ServiceWorker::set_onstatechange(Web::WebIDL::CallbackType*) Unexecuted instantiation: Web::HTML::ServiceWorker::set_onerror(Web::WebIDL::CallbackType*) |
40 | | WebIDL::CallbackType* ServiceWorker::attribute_name() \ |
41 | 0 | { \ |
42 | 0 | return event_handler_attribute(event_name); \ |
43 | 0 | } Unexecuted instantiation: Web::HTML::ServiceWorker::onstatechange() Unexecuted instantiation: Web::HTML::ServiceWorker::onerror() |
44 | | ENUMERATE_SERVICE_WORKER_EVENT_HANDLERS(__ENUMERATE) |
45 | | #undef __ENUMERATE |
46 | | |
47 | | } |