Explorar o código

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.
Shannon Booth hai 8 meses
pai
achega
2918405360

+ 1 - 1
Libraries/LibWeb/CMakeLists.txt

@@ -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

+ 1 - 1
Libraries/LibWeb/ServiceWorker/Registration.cpp

@@ -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.
 

+ 6 - 6
Libraries/LibWeb/ServiceWorker/Registration.h

@@ -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

+ 1 - 1
Libraries/LibWeb/ServiceWorker/ServiceWorker.cpp → Libraries/LibWeb/ServiceWorker/ServiceWorkerRecord.cpp

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

+ 1 - 1
Libraries/LibWeb/ServiceWorker/ServiceWorker.h → Libraries/LibWeb/ServiceWorker/ServiceWorkerRecord.h

@@ -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