mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-22 17:24:48 -05:00
LibWeb: Stub the ServiceWorkerRegistration
interface
This commit is contained in:
parent
70fdf7affb
commit
0c0a4a6042
Notes:
github-actions[bot]
2024-08-25 10:54:13 +00:00
Author: https://github.com/tcl3 Commit: https://github.com/LadybirdBrowser/ladybird/commit/0c0a4a6042f Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1173
8 changed files with 88 additions and 0 deletions
|
@ -85,6 +85,7 @@ static bool is_platform_object(Type const& type)
|
|||
"ReadableStream"sv,
|
||||
"Request"sv,
|
||||
"Selection"sv,
|
||||
"ServiceWorkerRegistration"sv,
|
||||
"SVGTransform"sv,
|
||||
"ShadowRoot"sv,
|
||||
"Table"sv,
|
||||
|
|
|
@ -317,6 +317,7 @@ SVGUseElement
|
|||
Screen
|
||||
ScreenOrientation
|
||||
Selection
|
||||
ServiceWorkerRegistration
|
||||
Set
|
||||
ShadowRealm
|
||||
ShadowRoot
|
||||
|
|
|
@ -442,6 +442,7 @@ set(SOURCES
|
|||
HTML/Scripting/SerializedEnvironmentSettingsObject.cpp
|
||||
HTML/SelectedFile.cpp
|
||||
HTML/SelectItem.cpp
|
||||
HTML/ServiceWorkerRegistration.cpp
|
||||
HTML/SessionHistoryEntry.cpp
|
||||
HTML/SessionHistoryTraversalQueue.cpp
|
||||
HTML/SharedResourceRequest.cpp
|
||||
|
|
|
@ -485,6 +485,7 @@ class Plugin;
|
|||
class PluginArray;
|
||||
class PromiseRejectionEvent;
|
||||
class SelectedFile;
|
||||
class ServiceWorkerRegistration;
|
||||
class SharedResourceRequest;
|
||||
class Storage;
|
||||
class SubmitEvent;
|
||||
|
|
31
Userland/Libraries/LibWeb/HTML/ServiceWorkerRegistration.cpp
Normal file
31
Userland/Libraries/LibWeb/HTML/ServiceWorkerRegistration.cpp
Normal file
|
@ -0,0 +1,31 @@
|
|||
/*
|
||||
* Copyright (c) 2024, Tim Ledbetter <tim.ledbetter@ladybird.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <LibJS/Runtime/Realm.h>
|
||||
#include <LibWeb/Bindings/Intrinsics.h>
|
||||
#include <LibWeb/Bindings/ServiceWorkerRegistrationPrototype.h>
|
||||
#include <LibWeb/HTML/ServiceWorkerRegistration.h>
|
||||
|
||||
namespace Web::HTML {
|
||||
|
||||
JS_DEFINE_ALLOCATOR(ServiceWorkerRegistration);
|
||||
|
||||
ServiceWorkerRegistration::ServiceWorkerRegistration(JS::Realm& realm)
|
||||
: DOM::EventTarget(realm)
|
||||
{
|
||||
}
|
||||
|
||||
void ServiceWorkerRegistration::initialize(JS::Realm& realm)
|
||||
{
|
||||
Base::initialize(realm);
|
||||
WEB_SET_PROTOTYPE_FOR_INTERFACE(ServiceWorkerRegistration);
|
||||
}
|
||||
|
||||
JS::NonnullGCPtr<ServiceWorkerRegistration> ServiceWorkerRegistration::create(JS::Realm& realm)
|
||||
{
|
||||
return realm.heap().allocate<ServiceWorkerRegistration>(realm, realm);
|
||||
}
|
||||
}
|
26
Userland/Libraries/LibWeb/HTML/ServiceWorkerRegistration.h
Normal file
26
Userland/Libraries/LibWeb/HTML/ServiceWorkerRegistration.h
Normal file
|
@ -0,0 +1,26 @@
|
|||
/*
|
||||
* Copyright (c) 2024, Tim Ledbetter <tim.ledbetter@ladybird.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <LibWeb/DOM/EventTarget.h>
|
||||
|
||||
namespace Web::HTML {
|
||||
|
||||
class ServiceWorkerRegistration : public DOM::EventTarget {
|
||||
WEB_PLATFORM_OBJECT(ServiceWorkerRegistration, DOM::EventTarget);
|
||||
JS_DECLARE_ALLOCATOR(ServiceWorkerRegistration);
|
||||
|
||||
public:
|
||||
[[nodiscard]] static JS::NonnullGCPtr<ServiceWorkerRegistration> create(JS::Realm& realm);
|
||||
|
||||
explicit ServiceWorkerRegistration(JS::Realm&);
|
||||
virtual ~ServiceWorkerRegistration() override = default;
|
||||
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
};
|
||||
|
||||
}
|
26
Userland/Libraries/LibWeb/HTML/ServiceWorkerRegistration.idl
Normal file
26
Userland/Libraries/LibWeb/HTML/ServiceWorkerRegistration.idl
Normal file
|
@ -0,0 +1,26 @@
|
|||
#import <DOM/EventTarget.idl>
|
||||
#import <DOM/EventHandler.idl>
|
||||
|
||||
// https://w3c.github.io/ServiceWorker/#serviceworkerregistration-interface
|
||||
[SecureContext, Exposed=(Window,Worker)]
|
||||
interface ServiceWorkerRegistration : EventTarget {
|
||||
[FIXME] readonly attribute ServiceWorker? installing;
|
||||
[FIXME] readonly attribute ServiceWorker? waiting;
|
||||
[FIXME] readonly attribute ServiceWorker? active;
|
||||
[FIXME, SameObject] readonly attribute NavigationPreloadManager navigationPreload;
|
||||
|
||||
[FIXME] readonly attribute USVString scope;
|
||||
[FIXME] readonly attribute ServiceWorkerUpdateViaCache updateViaCache;
|
||||
|
||||
[FIXME, NewObject] Promise<undefined> update();
|
||||
[FIXME, NewObject] Promise<boolean> unregister();
|
||||
|
||||
// event
|
||||
[FIXME] attribute EventHandler onupdatefound;
|
||||
};
|
||||
|
||||
enum ServiceWorkerUpdateViaCache {
|
||||
"imports",
|
||||
"all",
|
||||
"none"
|
||||
};
|
|
@ -213,6 +213,7 @@ libweb_js_bindings(HTML/Plugin)
|
|||
libweb_js_bindings(HTML/PluginArray)
|
||||
libweb_js_bindings(HTML/PopStateEvent)
|
||||
libweb_js_bindings(HTML/PromiseRejectionEvent)
|
||||
libweb_js_bindings(HTML/ServiceWorkerRegistration)
|
||||
libweb_js_bindings(HTML/Storage)
|
||||
libweb_js_bindings(HTML/SubmitEvent)
|
||||
libweb_js_bindings(HTML/TextMetrics)
|
||||
|
|
Loading…
Reference in a new issue