Title: [227808] branches/safari-605-branch

Diff

Modified: branches/safari-605-branch/LayoutTests/imported/w3c/ChangeLog (227807 => 227808)


--- branches/safari-605-branch/LayoutTests/imported/w3c/ChangeLog	2018-01-30 18:50:16 UTC (rev 227807)
+++ branches/safari-605-branch/LayoutTests/imported/w3c/ChangeLog	2018-01-30 18:50:19 UTC (rev 227808)
@@ -1,5 +1,21 @@
 2018-01-30  Jason Marcell  <[email protected]>
 
+        Cherry-pick r227638. rdar://problem/37019454
+
+    2018-01-25  Chris Dumez  <[email protected]>
+
+            Clients.get(id) should only returns clients in the service worker's origin
+            https://bugs.webkit.org/show_bug.cgi?id=182149
+            <rdar://problem/36882310>
+
+            Reviewed by Youenn Fablet.
+
+            Rebase WPT test that is now passing.
+
+            * web-platform-tests/service-workers/service-worker/clients-get-cross-origin.https-expected.txt:
+
+2018-01-30  Jason Marcell  <[email protected]>
+
         Cherry-pick r227635. rdar://problem/37019482
 
     2018-01-25  Youenn Fablet  <[email protected]>

Modified: branches/safari-605-branch/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/clients-get-cross-origin.https-expected.txt (227807 => 227808)


--- branches/safari-605-branch/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/clients-get-cross-origin.https-expected.txt	2018-01-30 18:50:16 UTC (rev 227807)
+++ branches/safari-605-branch/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/clients-get-cross-origin.https-expected.txt	2018-01-30 18:50:19 UTC (rev 227808)
@@ -1,3 +1,3 @@
 
-FAIL Test Clients.get() cross origin assert_equals: iframe client ID expected (undefined) undefined but got (object) [["visible", true, "https://localhost:9443/service-workers/service-worker/resources/clients-get-frame.html", "window", "nested"]]
+PASS Test Clients.get() cross origin 
 

Modified: branches/safari-605-branch/Source/WebCore/ChangeLog (227807 => 227808)


--- branches/safari-605-branch/Source/WebCore/ChangeLog	2018-01-30 18:50:16 UTC (rev 227807)
+++ branches/safari-605-branch/Source/WebCore/ChangeLog	2018-01-30 18:50:19 UTC (rev 227808)
@@ -1,5 +1,30 @@
 2018-01-30  Jason Marcell  <[email protected]>
 
+        Cherry-pick r227638. rdar://problem/37019454
+
+    2018-01-25  Chris Dumez  <[email protected]>
+
+            Clients.get(id) should only returns clients in the service worker's origin
+            https://bugs.webkit.org/show_bug.cgi?id=182149
+            <rdar://problem/36882310>
+
+            Reviewed by Youenn Fablet.
+
+            When looking for SW clients with a given identifier, only look in the list of
+            clients that have the same origin as the service worker.
+
+            No new tests, rebaselined existing test.
+
+            * workers/service/server/SWServer.cpp:
+            (WebCore::SWServer::serviceWorkerClientWithOriginByID const):
+            (WebCore::SWServer::serviceWorkerClientByID const): Deleted.
+            * workers/service/server/SWServer.h:
+            * workers/service/server/SWServerWorker.cpp:
+            (WebCore::SWServerWorker::findClientByIdentifier const):
+            * workers/service/server/SWServerWorker.h:
+
+2018-01-30  Jason Marcell  <[email protected]>
+
         Cherry-pick r227637. rdar://problem/37019468
 
     2018-01-25  Youenn Fablet  <[email protected]>

Modified: branches/safari-605-branch/Source/WebCore/workers/service/server/SWServer.cpp (227807 => 227808)


--- branches/safari-605-branch/Source/WebCore/workers/service/server/SWServer.cpp	2018-01-30 18:50:16 UTC (rev 227807)
+++ branches/safari-605-branch/Source/WebCore/workers/service/server/SWServer.cpp	2018-01-30 18:50:19 UTC (rev 227808)
@@ -93,12 +93,18 @@
     return worker;
 }
 
-std::optional<ServiceWorkerClientData> SWServer::serviceWorkerClientByID(const ServiceWorkerClientIdentifier& clientIdentifier) const
+std::optional<ServiceWorkerClientData> SWServer::serviceWorkerClientWithOriginByID(const ClientOrigin& clientOrigin, const ServiceWorkerClientIdentifier& clientIdentifier) const
 {
-    auto iterator = m_clientsById.find(clientIdentifier);
-    if (iterator == m_clientsById.end())
+    auto iterator = m_clientIdentifiersPerOrigin.find(clientOrigin);
+    if (iterator == m_clientIdentifiersPerOrigin.end())
         return std::nullopt;
-    return iterator->value;
+
+    if (!iterator->value.identifiers.contains(clientIdentifier))
+        return std::nullopt;
+
+    auto clientIterator = m_clientsById.find(clientIdentifier);
+    ASSERT(clientIterator != m_clientsById.end());
+    return clientIterator->value;
 }
 
 SWServerWorker* SWServer::activeWorkerFromRegistrationID(ServiceWorkerRegistrationIdentifier identifier)

Modified: branches/safari-605-branch/Source/WebCore/workers/service/server/SWServer.h (227807 => 227808)


--- branches/safari-605-branch/Source/WebCore/workers/service/server/SWServer.h	2018-01-30 18:50:16 UTC (rev 227807)
+++ branches/safari-605-branch/Source/WebCore/workers/service/server/SWServer.h	2018-01-30 18:50:19 UTC (rev 227808)
@@ -147,7 +147,7 @@
     void fireActivateEvent(SWServerWorker&);
 
     WEBCORE_EXPORT SWServerWorker* workerByID(ServiceWorkerIdentifier) const;
-    WEBCORE_EXPORT std::optional<ServiceWorkerClientData> serviceWorkerClientByID(const ServiceWorkerClientIdentifier&) const;
+    std::optional<ServiceWorkerClientData> serviceWorkerClientWithOriginByID(const ClientOrigin&, const ServiceWorkerClientIdentifier&) const;
     WEBCORE_EXPORT SWServerWorker* activeWorkerFromRegistrationID(ServiceWorkerRegistrationIdentifier);
 
     WEBCORE_EXPORT void markAllWorkersAsTerminated();

Modified: branches/safari-605-branch/Source/WebCore/workers/service/server/SWServerWorker.cpp (227807 => 227808)


--- branches/safari-605-branch/Source/WebCore/workers/service/server/SWServerWorker.cpp	2018-01-30 18:50:16 UTC (rev 227807)
+++ branches/safari-605-branch/Source/WebCore/workers/service/server/SWServerWorker.cpp	2018-01-30 18:50:19 UTC (rev 227808)
@@ -117,7 +117,7 @@
 
 std::optional<ServiceWorkerClientData> SWServerWorker::findClientByIdentifier(const ServiceWorkerClientIdentifier& clientId) const
 {
-    return m_server.serviceWorkerClientByID(clientId);
+    return m_server.serviceWorkerClientWithOriginByID(origin(), clientId);
 }
 
 void SWServerWorker::matchAll(const ServiceWorkerClientQueryOptions& options, ServiceWorkerClientsMatchAllCallback&& callback)

Modified: branches/safari-605-branch/Source/WebCore/workers/service/server/SWServerWorker.h (227807 => 227808)


--- branches/safari-605-branch/Source/WebCore/workers/service/server/SWServerWorker.h	2018-01-30 18:50:16 UTC (rev 227807)
+++ branches/safari-605-branch/Source/WebCore/workers/service/server/SWServerWorker.h	2018-01-30 18:50:19 UTC (rev 227808)
@@ -92,7 +92,7 @@
     void didFinishInstall(const std::optional<ServiceWorkerJobDataIdentifier>&, bool wasSuccessful);
     void didFinishActivation();
     void contextTerminated();
-    std::optional<ServiceWorkerClientData> findClientByIdentifier(const ServiceWorkerClientIdentifier&) const;
+    WEBCORE_EXPORT std::optional<ServiceWorkerClientData> findClientByIdentifier(const ServiceWorkerClientIdentifier&) const;
     void matchAll(const ServiceWorkerClientQueryOptions&, ServiceWorkerClientsMatchAllCallback&&);
     void claim();
 

Modified: branches/safari-605-branch/Source/WebKit/ChangeLog (227807 => 227808)


--- branches/safari-605-branch/Source/WebKit/ChangeLog	2018-01-30 18:50:16 UTC (rev 227807)
+++ branches/safari-605-branch/Source/WebKit/ChangeLog	2018-01-30 18:50:19 UTC (rev 227808)
@@ -1,5 +1,20 @@
 2018-01-30  Jason Marcell  <[email protected]>
 
+        Cherry-pick r227638. rdar://problem/37019454
+
+    2018-01-25  Chris Dumez  <[email protected]>
+
+            Clients.get(id) should only returns clients in the service worker's origin
+            https://bugs.webkit.org/show_bug.cgi?id=182149
+            <rdar://problem/36882310>
+
+            Reviewed by Youenn Fablet.
+
+            * StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
+            (WebKit::WebSWServerConnection::postMessageToServiceWorker):
+
+2018-01-30  Jason Marcell  <[email protected]>
+
         Cherry-pick r227637. rdar://problem/37019468
 
     2018-01-25  Youenn Fablet  <[email protected]>

Modified: branches/safari-605-branch/Source/WebKit/StorageProcess/ServiceWorker/WebSWServerConnection.cpp (227807 => 227808)


--- branches/safari-605-branch/Source/WebKit/StorageProcess/ServiceWorker/WebSWServerConnection.cpp	2018-01-30 18:50:16 UTC (rev 227807)
+++ branches/safari-605-branch/Source/WebKit/StorageProcess/ServiceWorker/WebSWServerConnection.cpp	2018-01-30 18:50:19 UTC (rev 227808)
@@ -170,7 +170,11 @@
         if (auto* sourceWorker = server().workerByID(identifier))
             sourceData = ServiceWorkerOrClientData { sourceWorker->data() };
     }, [&](ServiceWorkerClientIdentifier identifier) {
-        if (auto clientData = server().serviceWorkerClientByID(identifier))
+        auto* destinationWorker = server().workerByID(destinationIdentifier);
+        if (!destinationWorker)
+            return;
+
+        if (auto clientData = destinationWorker->findClientByIdentifier(identifier))
             sourceData = ServiceWorkerOrClientData { *clientData };
     });
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to