LibWeb: Rename ServiceWorker::ServiceWorker to ServiceWorkerRecord

This is to resolve naming conflicts between the ServiceWorker JS exposed
object and the internal representation of a ServiceWorker which is going
to be stored cross process.
This commit is contained in:
Shannon Booth 2024-11-30 17:27:25 +13:00 committed by Andreas Kling
commit 2918405360
Notes: github-actions[bot] 2024-11-30 10:20:48 +00:00
5 changed files with 10 additions and 10 deletions

View file

@ -670,7 +670,7 @@ set(SOURCES
SecureContexts/AbstractOperations.cpp
ServiceWorker/Job.cpp
ServiceWorker/Registration.cpp
ServiceWorker/ServiceWorker.cpp
ServiceWorker/ServiceWorkerRecord.cpp
SRI/SRI.cpp
StorageAPI/NavigatorStorage.cpp
StorageAPI/StorageKey.cpp

View file

@ -90,7 +90,7 @@ void Registration::remove(StorageAPI::StorageKey const& key, URL::URL const& sco
}
// https://w3c.github.io/ServiceWorker/#get-newest-worker
ServiceWorker* Registration::newest_worker() const
ServiceWorkerRecord* Registration::newest_worker() const
{
// FIXME: 1. Run the following steps atomically.

View file

@ -11,7 +11,7 @@
#include <AK/Traits.h>
#include <LibURL/URL.h>
#include <LibWeb/Bindings/ServiceWorkerRegistrationPrototype.h>
#include <LibWeb/ServiceWorker/ServiceWorker.h>
#include <LibWeb/ServiceWorker/ServiceWorkerRecord.h>
#include <LibWeb/StorageAPI/StorageKey.h>
namespace Web::ServiceWorker {
@ -41,7 +41,7 @@ public:
void set_last_update_check_time(MonotonicTime time) { m_last_update_check_time = time; }
ServiceWorker* newest_worker() const;
ServiceWorkerRecord* newest_worker() const;
bool is_stale() const;
private:
@ -50,10 +50,10 @@ private:
StorageAPI::StorageKey m_storage_key; // https://w3c.github.io/ServiceWorker/#service-worker-registration-storage-key
URL::URL m_scope_url; // https://w3c.github.io/ServiceWorker/#dfn-scope-url
// NOTE: These are "service workers", not "HTML::ServiceWorker"s
ServiceWorker* m_installing_worker { nullptr }; // https://w3c.github.io/ServiceWorker/#dfn-installing-worker
ServiceWorker* m_waiting_worker { nullptr }; // https://w3c.github.io/ServiceWorker/#dfn-waiting-worker
ServiceWorker* m_active_worker { nullptr }; // https://w3c.github.io/ServiceWorker/#dfn-active-worker
// NOTE: These are "service workers", not "ServiceWorker"s - (i.e, not what is exposed over JS)
ServiceWorkerRecord* m_installing_worker { nullptr }; // https://w3c.github.io/ServiceWorker/#dfn-installing-worker
ServiceWorkerRecord* m_waiting_worker { nullptr }; // https://w3c.github.io/ServiceWorker/#dfn-waiting-worker
ServiceWorkerRecord* m_active_worker { nullptr }; // https://w3c.github.io/ServiceWorker/#dfn-active-worker
Optional<MonotonicTime> m_last_update_check_time; // https://w3c.github.io/ServiceWorker/#dfn-last-update-check-time
Bindings::ServiceWorkerUpdateViaCache m_update_via_cache_mode = Bindings::ServiceWorkerUpdateViaCache::Imports; // https://w3c.github.io/ServiceWorker/#dfn-update-via-cache

View file

@ -4,7 +4,7 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibWeb/ServiceWorker/ServiceWorker.h>
#include <LibWeb/ServiceWorker/ServiceWorkerRecord.h>
namespace Web::ServiceWorker {
}

View file

@ -16,7 +16,7 @@ namespace Web::ServiceWorker {
// This class corresponds to "service worker", not "ServiceWorker"
// FIXME: This should be owned and managed at the user agent level
// FIXME: A lot of the fields for this struct actually need to live in the Agent for the service worker in the WebWorker process
struct ServiceWorker {
struct ServiceWorkerRecord {
Bindings::ServiceWorkerState state = Bindings::ServiceWorkerState::Parsed; // https://w3c.github.io/ServiceWorker/#dfn-state
URL::URL script_url; // https://w3c.github.io/ServiceWorker/#dfn-script-url
Bindings::WorkerType worker_type = Bindings::WorkerType::Classic; // https://w3c.github.io/ServiceWorker/#dfn-type