mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-24 10:12:25 -05:00
LibWeb: Implement Navigator.serviceWorker
This currently returns a stubbed `ServiceWorkerContainer` object.
This commit is contained in:
parent
53ab6fa403
commit
f3405b6eb2
Notes:
github-actions[bot]
2024-08-25 10:54:02 +00:00
Author: https://github.com/tcl3 Commit: https://github.com/LadybirdBrowser/ladybird/commit/f3405b6eb22 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1173
3 changed files with 18 additions and 0 deletions
|
@ -12,6 +12,7 @@
|
|||
#include <LibWeb/Clipboard/Clipboard.h>
|
||||
#include <LibWeb/HTML/Navigator.h>
|
||||
#include <LibWeb/HTML/Scripting/Environments.h>
|
||||
#include <LibWeb/HTML/ServiceWorkerContainer.h>
|
||||
#include <LibWeb/HTML/Window.h>
|
||||
#include <LibWeb/Loader/ResourceLoader.h>
|
||||
#include <LibWeb/Page/Page.h>
|
||||
|
@ -64,6 +65,7 @@ void Navigator::visit_edges(Cell::Visitor& visitor)
|
|||
visitor.visit(m_plugin_array);
|
||||
visitor.visit(m_clipboard);
|
||||
visitor.visit(m_user_activation);
|
||||
visitor.visit(m_service_worker_container);
|
||||
}
|
||||
|
||||
JS::NonnullGCPtr<MimeTypeArray> Navigator::mime_types()
|
||||
|
@ -113,4 +115,11 @@ Optional<FlyString> Navigator::do_not_track() const
|
|||
return {};
|
||||
}
|
||||
|
||||
JS::NonnullGCPtr<ServiceWorkerContainer> Navigator::service_worker()
|
||||
{
|
||||
if (!m_service_worker_container)
|
||||
m_service_worker_container = heap().allocate<ServiceWorkerContainer>(realm(), realm());
|
||||
return *m_service_worker_container;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -54,6 +54,8 @@ public:
|
|||
|
||||
Optional<FlyString> do_not_track() const;
|
||||
|
||||
JS::NonnullGCPtr<ServiceWorkerContainer> service_worker();
|
||||
|
||||
static WebIDL::Long max_touch_points();
|
||||
|
||||
virtual ~Navigator() override;
|
||||
|
@ -77,6 +79,9 @@ private:
|
|||
|
||||
// https://html.spec.whatwg.org/multipage/interaction.html#dom-navigator-useractivation
|
||||
JS::GCPtr<UserActivation> m_user_activation;
|
||||
|
||||
// https://w3c.github.io/ServiceWorker/#navigator-serviceworker
|
||||
JS::GCPtr<ServiceWorkerContainer> m_service_worker_container;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#import <HTML/NavigatorOnLine.idl>
|
||||
#import <HTML/NavigatorConcurrentHardware.idl>
|
||||
#import <HTML/PluginArray.idl>
|
||||
#import <HTML/ServiceWorkerContainer.idl>
|
||||
#import <HTML/UserActivation.idl>
|
||||
#import <StorageAPI/NavigatorStorage.idl>
|
||||
|
||||
|
@ -25,6 +26,9 @@ interface Navigator {
|
|||
|
||||
// https://www.w3.org/TR/tracking-dnt/#dom-navigator-donottrack
|
||||
readonly attribute DOMString? doNotTrack;
|
||||
|
||||
// https://w3c.github.io/ServiceWorker/#navigator-serviceworker
|
||||
[SecureContext, SameObject] readonly attribute ServiceWorkerContainer serviceWorker;
|
||||
};
|
||||
|
||||
// NOTE: As NavigatorContentUtils, NavigatorCookies, NavigatorPlugins, and NavigatorAutomationInformation
|
||||
|
|
Loading…
Add table
Reference in a new issue