Title: [224051] trunk/Source/WebCore
Revision
224051
Author
[email protected]
Date
2017-10-26 14:41:19 -0700 (Thu, 26 Oct 2017)

Log Message

Implement ServiceWorkerContainer getRegistration
https://bugs.webkit.org/show_bug.cgi?id=178882

Patch by Youenn Fablet <[email protected]> on 2017-10-26
Reviewed by Chris Dumez.

Replace rejection promise by resolving the promise with a null value.
This helps in running WPT tests as WPT tests usually check for registered service workers before running tests.
For WTR, there should be no registered service worker anyway.

* workers/service/ServiceWorkerContainer.cpp:
(WebCore::ServiceWorkerContainer::getRegistration):
* workers/service/ServiceWorkerContainer.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (224050 => 224051)


--- trunk/Source/WebCore/ChangeLog	2017-10-26 21:36:36 UTC (rev 224050)
+++ trunk/Source/WebCore/ChangeLog	2017-10-26 21:41:19 UTC (rev 224051)
@@ -1,3 +1,18 @@
+2017-10-26  Youenn Fablet  <[email protected]>
+
+        Implement ServiceWorkerContainer getRegistration
+        https://bugs.webkit.org/show_bug.cgi?id=178882
+
+        Reviewed by Chris Dumez.
+
+        Replace rejection promise by resolving the promise with a null value.
+        This helps in running WPT tests as WPT tests usually check for registered service workers before running tests.
+        For WTR, there should be no registered service worker anyway.
+
+        * workers/service/ServiceWorkerContainer.cpp:
+        (WebCore::ServiceWorkerContainer::getRegistration):
+        * workers/service/ServiceWorkerContainer.h:
+
 2017-10-26  Dan Bernstein  <[email protected]>
 
         Account for Mail’s WebMessageDocument class being renamed

Modified: trunk/Source/WebCore/workers/service/ServiceWorkerContainer.cpp (224050 => 224051)


--- trunk/Source/WebCore/workers/service/ServiceWorkerContainer.cpp	2017-10-26 21:36:36 UTC (rev 224050)
+++ trunk/Source/WebCore/workers/service/ServiceWorkerContainer.cpp	2017-10-26 21:41:19 UTC (rev 224051)
@@ -180,9 +180,11 @@
     m_swConnection->scheduleJob(rawJob);
 }
 
-void ServiceWorkerContainer::getRegistration(const String&, Ref<DeferredPromise>&& promise)
+void ServiceWorkerContainer::getRegistration(const String&, RegistrationPromise&& promise)
 {
-    promise->reject(Exception { UnknownError, ASCIILiteral("serviceWorker.getRegistration() is not yet implemented") });
+    // FIXME: Implement getRegistration algorithm, for now pretend there is no registration.
+    // https://bugs.webkit.org/show_bug.cgi?id=178882
+    promise.resolve(nullptr);
 }
 
 void ServiceWorkerContainer::getRegistrations(Ref<DeferredPromise>&& promise)

Modified: trunk/Source/WebCore/workers/service/ServiceWorkerContainer.h (224050 => 224051)


--- trunk/Source/WebCore/workers/service/ServiceWorkerContainer.h	2017-10-26 21:36:36 UTC (rev 224050)
+++ trunk/Source/WebCore/workers/service/ServiceWorkerContainer.h	2017-10-26 21:41:19 UTC (rev 224051)
@@ -61,7 +61,9 @@
 
     void addRegistration(const String& scriptURL, const RegistrationOptions&, Ref<DeferredPromise>&&);
     void removeRegistration(const URL& scopeURL, Ref<DeferredPromise>&&);
-    void getRegistration(const String& url, Ref<DeferredPromise>&&);
+
+    using RegistrationPromise = DOMPromiseDeferred<IDLNullable<IDLInterface<ServiceWorkerRegistration>>>;
+    void getRegistration(const String& clientURL, RegistrationPromise&&);
     void getRegistrations(Ref<DeferredPromise>&&);
 
     void startMessages();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to