Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: ff4eced3ff239c434ef397c0c059a8a027a54db5
      
https://github.com/WebKit/WebKit/commit/ff4eced3ff239c434ef397c0c059a8a027a54db5
  Author: Youenn Fablet <youe...@gmail.com>
  Date:   2023-05-19 (Fri, 19 May 2023)

  Changed paths:
    M LayoutTests/TestExpectations
    A 
LayoutTests/http/wpt/service-workers/changing-service-worker-lengthy-worker.py
    A 
LayoutTests/http/wpt/service-workers/service-worker-process-crashing-between-installed-and-activating-expected.txt
    A 
LayoutTests/http/wpt/service-workers/service-worker-process-crashing-between-installed-and-activating.html
    M Source/WebCore/workers/service/server/SWServer.cpp
    M Source/WebCore/workers/service/server/SWServer.h
    M Source/WebCore/workers/service/server/SWServerRegistration.cpp

  Log Message:
  -----------
  Make sure to run a service worker before firing its activate event
https://bugs.webkit.org/show_bug.cgi?id=256893
rdar://109411104

Reviewed by Ben Nham.

As per spec, we should run the service worker before firing the activate event.
We were not doing so and there might be cases where the service worker will no 
longer be running between installed and activating steps.
This happens for instance in case the process is terminated due to memory 
issues.
We align the implementation with the spec by renaming fireActivateEvent to 
runServiceWorkerAndFireActivateEvent.
Internally, it calls runServiceWorkerIfNecessary before firing the event.
Small refactoring to allow either running a service worker from its object or 
from its ID.

* LayoutTests/TestExpectations:
* 
LayoutTests/http/wpt/service-workers/changing-service-worker-lengthy-worker.py: 
Added.
(main):
* 
LayoutTests/http/wpt/service-workers/service-worker-process-crashing-between-installed-and-activating-expected.txt:
 Added.
* 
LayoutTests/http/wpt/service-workers/service-worker-process-crashing-between-installed-and-activating.html:
 Added.
* Source/WebCore/workers/service/server/SWServer.cpp:
(WebCore::SWServer::runServiceWorkerIfNecessary):
(WebCore::SWServer::runServiceWorker):
(WebCore::SWServer::runServiceWorkerAndFireActivateEvent):
(WebCore::SWServer::fireActivateEvent): Deleted.
* Source/WebCore/workers/service/server/SWServer.h:
* Source/WebCore/workers/service/server/SWServerRegistration.cpp:
(WebCore::SWServerRegistration::activate):

Canonical link: https://commits.webkit.org/264242@main


_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to