From 237bcbff360d5000ab45da2ca63f196064ab5210 Mon Sep 17 00:00:00 2001 From: Andrew Kaster Date: Thu, 5 Sep 2024 14:35:06 -0600 Subject: [PATCH] LibWeb: Add ServiceWorker discarded flag to ESO Looking at the spec it doesn't seem like there's a chance for a service worker client to be an environment but not an environment settings object. In the case that that changes in the implementation, we can move it. --- Userland/Libraries/LibWeb/HTML/Scripting/Environments.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Userland/Libraries/LibWeb/HTML/Scripting/Environments.h b/Userland/Libraries/LibWeb/HTML/Scripting/Environments.h index 7fe69688949..57ab5cd7b19 100644 --- a/Userland/Libraries/LibWeb/HTML/Scripting/Environments.h +++ b/Userland/Libraries/LibWeb/HTML/Scripting/Environments.h @@ -124,6 +124,9 @@ public: JS::NonnullGCPtr storage_manager(); + [[nodiscard]] bool discarded() const { return m_discarded; } + void set_discarded(bool b) { m_discarded = b; } + protected: explicit EnvironmentSettingsObject(NonnullOwnPtr); @@ -149,6 +152,10 @@ private: // https://storage.spec.whatwg.org/#api // Each environment settings object has an associated StorageManager object. JS::GCPtr m_storage_manager; + + // https://w3c.github.io/ServiceWorker/#service-worker-client-discarded-flag + // A service worker client has an associated discarded flag. It is initially unset. + bool m_discarded { false }; }; EnvironmentSettingsObject& incumbent_settings_object();