Title: [224496] trunk/Source/WebCore
Revision
224496
Author
[email protected]
Date
2017-11-06 09:47:58 -0800 (Mon, 06 Nov 2017)

Log Message

ServiceWorkerContainer should take a PendingActivity while a service worker job is pending
https://bugs.webkit.org/show_bug.cgi?id=179321

Reviewed by Youenn Fablet.

ServiceWorkerContainer should take a PendingActivity while a service worker job is pending.
ServiceWorkerContainer is an ActiveDOMObject and taking such pending activity makes sure
the object stays alive while a job is pending (and a promise is not resolved yet). It also
makes sure the document does not get suspended in the middle of a job.

* workers/service/ServiceWorkerContainer.cpp:
(WebCore::ServiceWorkerContainer::scheduleJob):
(WebCore::ServiceWorkerContainer::jobDidFinish):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (224495 => 224496)


--- trunk/Source/WebCore/ChangeLog	2017-11-06 17:45:50 UTC (rev 224495)
+++ trunk/Source/WebCore/ChangeLog	2017-11-06 17:47:58 UTC (rev 224496)
@@ -1,3 +1,19 @@
+2017-11-06  Chris Dumez  <[email protected]>
+
+        ServiceWorkerContainer should take a PendingActivity while a service worker job is pending
+        https://bugs.webkit.org/show_bug.cgi?id=179321
+
+        Reviewed by Youenn Fablet.
+
+        ServiceWorkerContainer should take a PendingActivity while a service worker job is pending.
+        ServiceWorkerContainer is an ActiveDOMObject and taking such pending activity makes sure
+        the object stays alive while a job is pending (and a promise is not resolved yet). It also
+        makes sure the document does not get suspended in the middle of a job.
+
+        * workers/service/ServiceWorkerContainer.cpp:
+        (WebCore::ServiceWorkerContainer::scheduleJob):
+        (WebCore::ServiceWorkerContainer::jobDidFinish):
+
 2017-11-06  Antti Koivisto  <[email protected]>
 
         @media rules ignored in user agent style sheet html.css

Modified: trunk/Source/WebCore/workers/service/ServiceWorkerContainer.cpp (224495 => 224496)


--- trunk/Source/WebCore/workers/service/ServiceWorkerContainer.cpp	2017-11-06 17:45:50 UTC (rev 224495)
+++ trunk/Source/WebCore/workers/service/ServiceWorkerContainer.cpp	2017-11-06 17:47:58 UTC (rev 224496)
@@ -194,6 +194,8 @@
 {
     ASSERT(m_swConnection);
 
+    setPendingActivity(this);
+
     ServiceWorkerJob& rawJob = job.get();
     auto result = m_jobMap.add(rawJob.data().identifier(), WTFMove(job));
     ASSERT_UNUSED(result, result.isNewEntry);
@@ -384,6 +386,8 @@
 {
     auto taken = m_jobMap.take(job.data().identifier());
     ASSERT_UNUSED(taken, !taken || taken->ptr() == &job);
+
+    unsetPendingActivity(this);
 }
 
 uint64_t ServiceWorkerContainer::connectionIdentifier()
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to