Title: [224601] trunk
Revision
224601
Author
[email protected]
Date
2017-11-08 15:15:03 -0800 (Wed, 08 Nov 2017)

Log Message

Some SW Container and Registration tweaks.
https://bugs.webkit.org/show_bug.cgi?id=179450

Reviewed by Chris Dumez.

LayoutTests/imported/w3c:

* web-platform-tests/service-workers/service-worker/claim-with-redirect.https-expected.txt:

Source/WebCore:

No new tests (Progression in an existing test).

* workers/service/ServiceWorkerContainer.cpp:
(WebCore::ServiceWorkerContainer::jobResolvedWithRegistration):
* workers/service/ServiceWorkerRegistration.cpp:
(WebCore::ServiceWorkerRegistration::ServiceWorkerRegistration):

Modified Paths

Diff

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (224600 => 224601)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2017-11-08 23:13:42 UTC (rev 224600)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2017-11-08 23:15:03 UTC (rev 224601)
@@ -1,3 +1,12 @@
+2017-11-08  Brady Eidson  <[email protected]>
+
+        Some SW Container and Registration tweaks.
+        https://bugs.webkit.org/show_bug.cgi?id=179450
+
+        Reviewed by Chris Dumez.
+
+        * web-platform-tests/service-workers/service-worker/claim-with-redirect.https-expected.txt:
+
 2017-11-08  Maciej Stachowiak  <[email protected]>
 
         Switch encoding WPT test suite to updating via import-w3c-tests

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/claim-with-redirect.https-expected.txt (224600 => 224601)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/claim-with-redirect.https-expected.txt	2017-11-08 23:13:42 UTC (rev 224600)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/claim-with-redirect.https-expected.txt	2017-11-08 23:15:03 UTC (rev 224601)
@@ -1,4 +1,4 @@
-CONSOLE MESSAGE: line 27: Unhandled Promise Rejection: InvalidStateError: newestWorker is null
+CONSOLE MESSAGE: Unhandled Promise Rejection: TypeError: Cannot update a null/nonexistent service worker registration
   
 
 FAIL Claim works after redirection to another origin assert_equals: expected (string) "updated" but got (undefined) undefined

Modified: trunk/Source/WebCore/ChangeLog (224600 => 224601)


--- trunk/Source/WebCore/ChangeLog	2017-11-08 23:13:42 UTC (rev 224600)
+++ trunk/Source/WebCore/ChangeLog	2017-11-08 23:15:03 UTC (rev 224601)
@@ -1,3 +1,17 @@
+2017-11-08  Brady Eidson  <[email protected]>
+
+        Some SW Container and Registration tweaks.
+        https://bugs.webkit.org/show_bug.cgi?id=179450
+
+        Reviewed by Chris Dumez.
+
+        No new tests (Progression in an existing test).
+
+        * workers/service/ServiceWorkerContainer.cpp:
+        (WebCore::ServiceWorkerContainer::jobResolvedWithRegistration):
+        * workers/service/ServiceWorkerRegistration.cpp:
+        (WebCore::ServiceWorkerRegistration::ServiceWorkerRegistration):
+
 2017-11-08  Antti Koivisto  <[email protected]>
 
         Move inlineElementContinuation function to RenderBoxModelObject and rename to inlineContinuation

Modified: trunk/Source/WebCore/workers/service/ServiceWorkerContainer.cpp (224600 => 224601)


--- trunk/Source/WebCore/workers/service/ServiceWorkerContainer.cpp	2017-11-08 23:13:42 UTC (rev 224600)
+++ trunk/Source/WebCore/workers/service/ServiceWorkerContainer.cpp	2017-11-08 23:15:03 UTC (rev 224601)
@@ -345,19 +345,12 @@
         return;
     }
 
-    ASSERT(data.installingServiceWorkerIdentifier);
-    auto installingServiceWorkerIdentifier = *data.installingServiceWorkerIdentifier;
-
     RefPtr<ServiceWorkerRegistration> registration = m_registrations.get(data.key);
     if (!registration)
         registration = ServiceWorkerRegistration::create(*context, *this, WTFMove(data));
 
-    registration->updateStateFromServer(ServiceWorkerRegistrationState::Installing, installingServiceWorkerIdentifier);
-    ASSERT(registration->installing());
-    registration->installing()->updateWorkerState(ServiceWorkerState::Installing, ServiceWorker::DoNotFireStateChangeEvent);
-
     // FIXME: Implement proper selection of service workers.
-    context->setActiveServiceWorker(registration->installing());
+    context->setActiveServiceWorker(registration->getNewestWorker());
 
     LOG(ServiceWorker, "Container %p resolved job with registration %p", this, registration.get());
 

Modified: trunk/Source/WebCore/workers/service/ServiceWorkerRegistration.cpp (224600 => 224601)


--- trunk/Source/WebCore/workers/service/ServiceWorkerRegistration.cpp	2017-11-08 23:13:42 UTC (rev 224600)
+++ trunk/Source/WebCore/workers/service/ServiceWorkerRegistration.cpp	2017-11-08 23:15:03 UTC (rev 224601)
@@ -44,6 +44,22 @@
 {
     LOG(ServiceWorker, "Creating registration %p for registration key %s", this, m_registrationData.key.loggingString().utf8().data());
     suspendIfNeeded();
+
+    // FIXME: Reconcile worker state properly (see below)
+    if (m_registrationData.installingServiceWorkerIdentifier) {
+        m_installingWorker = ServiceWorker::create(context, *m_registrationData.installingServiceWorkerIdentifier, m_registrationData.scriptURL);
+        m_installingWorker->updateWorkerState(ServiceWorker::State::Installing);
+    }
+    if (m_registrationData.waitingServiceWorkerIdentifier) {
+        m_waitingWorker = ServiceWorker::create(context, *m_registrationData.waitingServiceWorkerIdentifier, m_registrationData.scriptURL);
+        // FIXME: Installed or Activating? This is why we have to have more data here...
+        m_waitingWorker->updateWorkerState(ServiceWorker::State::Installed);
+    }
+    if (m_registrationData.activeServiceWorkerIdentifier) {
+        m_activeWorker = ServiceWorker::create(context, *m_registrationData.activeServiceWorkerIdentifier, m_registrationData.scriptURL);
+        m_activeWorker->updateWorkerState(ServiceWorker::State::Activated);
+    }
+
     m_container->addRegistration(*this);
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to