Changeset 225622 in webkit
- Timestamp:
- Dec 6, 2017 11:37:50 PM (6 years ago)
- Location:
- trunk
- Files:
-
- 3 added
- 23 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r225616 r225622 1 2017-12-06 Chris Dumez <cdumez@apple.com> 2 3 We should be able to recover after a Service Worker process crash 4 https://bugs.webkit.org/show_bug.cgi?id=180477 5 6 Reviewed by Brady Eidson and Youenn Fablet. 7 8 Add layout test coverage. 9 10 * http/tests/workers/service/postmessage-after-sw-process-crash.https-expected.txt: Added. 11 * http/tests/workers/service/postmessage-after-sw-process-crash.https.html: Added. 12 * http/tests/workers/service/resources/postmessage-after-sw-process-crash.js: Added. 13 1 14 2017-12-06 Said Abou-Hallawa <sabouhallawa@apple.com> 2 15 -
trunk/Source/WebCore/ChangeLog
r225621 r225622 1 2017-12-06 Chris Dumez <cdumez@apple.com> 2 3 We should be able to recover after a Service Worker process crash 4 https://bugs.webkit.org/show_bug.cgi?id=180477 5 6 Reviewed by Brady Eidson and Youenn Fablet. 7 8 Test: http/tests/workers/service/postmessage-after-sw-process-crash.https.html 9 10 * workers/service/server/SWServer.cpp: 11 (WebCore::SWServer::serverToContextConnectionCreated): 12 Once the connection with the context process is established, process "run service worker" 13 requests that ocurred while establishing the connection. 14 15 (WebCore::SWServer::runServiceWorkerIfNecessary): 16 Take in a lambda function that gets called after the "run service worker" request 17 is processed. We used to assert that we had a connection to the context process. 18 We now wait for the connection to be established to process the request, thus 19 making the operation asynchronous. 20 21 (WebCore::SWServer::runServiceWorker): 22 Split some logic out of runServiceWorkerIfNecessary() to reuse in serverToContextConnectionCreated(). 23 24 (WebCore::SWServer::markAllWorkersAsTerminated): 25 Add method to mark all service workers as terminated. This is called when the Service 26 Worker process crashes. 27 28 * workers/service/server/SWServer.h: 29 1 30 2017-12-06 Saam Barati <sbarati@apple.com> 2 31 -
trunk/Source/WebCore/workers/service/server/SWServer.cpp
r225610 r225622 422 422 void SWServer::serverToContextConnectionCreated() 423 423 { 424 ASSERT(SWServerToContextConnection::globalServerToContextConnection());425 for (auto& data : m_pendingContextDatas)426 installContextData(data);427 428 m_pendingContextDatas.clear();429 }430 431 void SWServer::installContextData(const ServiceWorkerContextData& data)432 {433 m_registrationStore.updateRegistration(data);434 435 424 auto* connection = SWServerToContextConnection::globalServerToContextConnection(); 436 425 ASSERT(connection); 437 426 427 auto pendingContextDatas = WTFMove(m_pendingContextDatas); 428 for (auto& data : pendingContextDatas) 429 installContextData(data); 430 431 auto serviceWorkerRunRequests = WTFMove(m_serviceWorkerRunRequests); 432 for (auto& item : serviceWorkerRunRequests) { 433 bool success = runServiceWorker(item.key); 434 for (auto& callback : item.value) 435 callback(success, *connection); 436 } 437 } 438 439 void SWServer::installContextData(const ServiceWorkerContextData& data) 440 { 441 m_registrationStore.updateRegistration(data); 442 443 auto* connection = SWServerToContextConnection::globalServerToContextConnection(); 444 ASSERT(connection); 445 438 446 auto* registration = m_registrations.get(data.registration.key); 439 447 RELEASE_ASSERT(registration); … … 447 455 } 448 456 449 bool SWServer::invokeRunServiceWorker(ServiceWorkerIdentifier identifier) 450 { 457 void SWServer::runServiceWorkerIfNecessary(ServiceWorkerIdentifier identifier, RunServiceWorkerCallback&& callback) 458 { 459 auto* connection = SWServerToContextConnection::globalServerToContextConnection(); 451 460 if (auto* worker = m_runningOrTerminatingWorkers.get(identifier)) { 452 if (worker->isRunning()) 453 return true; 454 } 455 456 // Nobody should have a ServiceWorkerIdentifier for a SWServerWorker that doesn't exist. 461 if (worker->isRunning()) { 462 ASSERT(connection); 463 callback(true, *connection); 464 return; 465 } 466 } 467 468 if (!connection) { 469 m_serviceWorkerRunRequests.ensure(identifier, [&] { 470 return Vector<RunServiceWorkerCallback> { }; 471 }).iterator->value.append(WTFMove(callback)); 472 return; 473 } 474 475 callback(runServiceWorker(identifier), *connection); 476 } 477 478 bool SWServer::runServiceWorker(ServiceWorkerIdentifier identifier) 479 { 457 480 auto* worker = workerByID(identifier); 458 ASSERT(worker); 481 if (!worker) 482 return false; 459 483 460 484 // If the registration for a working has been removed then the request to run … … 463 487 return false; 464 488 465 m_runningOrTerminatingWorkers.add(identifier, *worker); 489 auto addResult = m_runningOrTerminatingWorkers.add(identifier, *worker); 490 ASSERT_UNUSED(addResult, addResult.isNewEntry); 491 466 492 worker->setState(SWServerWorker::State::Running); 467 493 … … 469 495 ASSERT(connection); 470 496 connection->installServiceWorkerContext(worker->contextData()); 471 497 472 498 return true; 473 499 } … … 506 532 } 507 533 534 void SWServer::markAllWorkersAsTerminated() 535 { 536 while (!m_runningOrTerminatingWorkers.isEmpty()) 537 workerContextTerminated(m_runningOrTerminatingWorkers.begin()->value); 538 } 539 508 540 void SWServer::workerContextTerminated(SWServerWorker& worker) 509 541 { 510 ASSERT(worker.isTerminating());511 512 542 worker.setState(SWServerWorker::State::NotRunning); 513 543 -
trunk/Source/WebCore/workers/service/server/SWServer.h
r225610 r225622 141 141 void fireActivateEvent(SWServerWorker&); 142 142 WEBCORE_EXPORT SWServerWorker* workerByID(ServiceWorkerIdentifier) const; 143 144 WEBCORE_EXPORT void markAllWorkersAsTerminated(); 143 145 144 146 Connection* getConnection(SWServerConnectionIdentifier identifier) { return m_connections.get(identifier); } … … 161 163 WEBCORE_EXPORT void unregisterServiceWorkerClient(const ClientOrigin&, ServiceWorkerClientIdentifier); 162 164 163 WEBCORE_EXPORT bool invokeRunServiceWorker(ServiceWorkerIdentifier); 165 using RunServiceWorkerCallback = WTF::Function<void(bool, SWServerToContextConnection&)>; 166 WEBCORE_EXPORT void runServiceWorkerIfNecessary(ServiceWorkerIdentifier, RunServiceWorkerCallback&&); 164 167 165 168 void setClientActiveWorker(ServiceWorkerClientIdentifier, ServiceWorkerIdentifier); … … 181 184 182 185 WEBCORE_EXPORT SWServerRegistration* doRegistrationMatching(const SecurityOriginData& topOrigin, const URL& clientURL); 186 bool runServiceWorker(ServiceWorkerIdentifier); 183 187 184 188 void installContextData(const ServiceWorkerContextData&); … … 217 221 RegistrationStore m_registrationStore; 218 222 Deque<ServiceWorkerContextData> m_pendingContextDatas; 223 HashMap<ServiceWorkerIdentifier, Vector<RunServiceWorkerCallback>> m_serviceWorkerRunRequests; 219 224 }; 220 225 -
trunk/Source/WebKit/ChangeLog
r225618 r225622 1 2017-12-06 Chris Dumez <cdumez@apple.com> 2 3 We should be able to recover after a Service Worker process crash 4 https://bugs.webkit.org/show_bug.cgi?id=180477 5 6 Reviewed by Brady Eidson and Youenn Fablet. 7 8 * StorageProcess/ServiceWorker/WebSWServerConnection.cpp: 9 (WebKit::WebSWServerConnection::startFetch): 10 (WebKit::WebSWServerConnection::postMessageToServiceWorkerFromClient): 11 (WebKit::WebSWServerConnection::postMessageToServiceWorkerFromServiceWorker): 12 Update calls to SWServer::runServiceWorkerIfNecessary() that that it is asynchronous 13 and takes in a lambda. 14 15 * StorageProcess/ServiceWorker/WebSWServerConnection.h: 16 (WebKit::WebSWServerConnection::ipcConnection const): 17 Add getter for the underlying IPC connection. 18 19 * StorageProcess/StorageProcess.cpp: 20 (WebKit::StorageProcess::didClose): 21 (WebKit::StorageProcess::connectionToContextProcessWasClosed): 22 Move some code to connectionToContextProcessWasClosed() to avoid duplication. 23 Also, relaunch the Service Worker process if it has exited but we still 24 have SWServer connections to regular Web Processes. 25 26 (WebKit::StorageProcess::needsServerToContextConnection const): 27 Utility function to determine if we still need the service worker process. 28 The current rule is that we need the service worker (aka "context") process 29 if we still have SWServer connections to regular Web Processes. 30 31 * StorageProcess/StorageProcess.h: 32 33 * StorageProcess/StorageToWebProcessConnection.cpp: 34 (WebKit::StorageToWebProcessConnection::didClose): 35 If didClose() is called for the connection to the service worker context, 36 let the StorageProcess know so that it can clear its state and relaunch 37 the process if necessary. 38 39 * UIProcess/API/C/WKContext.cpp: 40 (WKContextTerminateServiceWorkerProcess): 41 * UIProcess/API/C/WKContextPrivate.h: 42 * UIProcess/API/Cocoa/WKProcessPool.mm: 43 (-[WKProcessPool _terminateServiceWorkerProcess]): 44 * UIProcess/API/Cocoa/WKProcessPoolPrivate.h: 45 Add SPI to terminate the service worker process. 46 47 * UIProcess/WebProcessPool.cpp: 48 (WebKit::m_serviceWorkerProcessTerminationTimer): 49 (WebKit::WebProcessPool::createNewWebProcess): 50 (WebKit::WebProcessPool::disconnectProcess): 51 (WebKit::WebProcessPool::terminateServiceWorkerProcess): 52 * UIProcess/WebProcessPool.h: 53 We used to shutdown the ServiceWorker process right away as soon as the last regular 54 WebProcess was gone. We now give it a grace period of 5 seconds in case a new 55 WebProcess gets launched shortly after. 56 1 57 2017-12-02 Darin Adler <darin@apple.com> 2 58 -
trunk/Source/WebKit/StorageProcess/ServiceWorker/WebSWServerConnection.cpp
r225531 r225622 117 117 } 118 118 119 void WebSWServerConnection::startFetch(uint64_t fetchIdentifier, std::optional<ServiceWorkerIdentifier> serviceWorkerIdentifier, const ResourceRequest& request, const FetchOptions& options, const IPC::FormDataReference& formData)119 void WebSWServerConnection::startFetch(uint64_t fetchIdentifier, std::optional<ServiceWorkerIdentifier> serviceWorkerIdentifier, ResourceRequest&& request, FetchOptions&& options, IPC::FormDataReference&& formData) 120 120 { 121 121 // It's possible this specific worker cannot be re-run (e.g. its registration has been removed) 122 if (serviceWorkerIdentifier && !server().invokeRunServiceWorker(*serviceWorkerIdentifier)) 123 return; 122 if (serviceWorkerIdentifier) { 123 server().runServiceWorkerIfNecessary(*serviceWorkerIdentifier, [contentConnection = m_contentConnection.copyRef(), connectionIdentifier = identifier(), fetchIdentifier, serviceWorkerIdentifier = *serviceWorkerIdentifier, request = WTFMove(request), options = WTFMove(options), formData = WTFMove(formData)](bool success, auto& contextConnection) { 124 if (success) 125 sendToContextProcess(contextConnection, Messages::WebSWContextManagerConnection::StartFetch { connectionIdentifier, fetchIdentifier, serviceWorkerIdentifier, request, options, formData }); 126 else 127 contentConnection->send(Messages::ServiceWorkerClientFetch::DidNotHandle { }, fetchIdentifier); 128 }); 129 return; 130 } 124 131 125 132 // FIXME: If we don't have a ServiceWorkerIdentifier here then we need to create and run the appropriate Service Worker, … … 129 136 } 130 137 131 void WebSWServerConnection::postMessageToServiceWorkerFromClient(ServiceWorkerIdentifier destinationIdentifier, const IPC::DataReference& message, ServiceWorkerClientIdentifier sourceIdentifier, ServiceWorkerClientData&& sourceData)138 void WebSWServerConnection::postMessageToServiceWorkerFromClient(ServiceWorkerIdentifier destinationIdentifier, IPC::DataReference&& message, ServiceWorkerClientIdentifier sourceIdentifier, ServiceWorkerClientData&& sourceData) 132 139 { 133 140 // It's possible this specific worker cannot be re-run (e.g. its registration has been removed) 134 if (!server().invokeRunServiceWorker(destinationIdentifier)) 135 return; 136 137 sendToContextProcess(Messages::WebSWContextManagerConnection::PostMessageToServiceWorkerFromClient { destinationIdentifier, message, sourceIdentifier, WTFMove(sourceData) }); 138 } 139 140 void WebSWServerConnection::postMessageToServiceWorkerFromServiceWorker(ServiceWorkerIdentifier destinationIdentifier, const IPC::DataReference& message, ServiceWorkerIdentifier sourceIdentifier) 141 { 142 // It's possible this specific worker cannot be re-run (e.g. its registration has been removed) 143 if (!server().invokeRunServiceWorker(destinationIdentifier)) 144 return; 145 141 server().runServiceWorkerIfNecessary(destinationIdentifier, [destinationIdentifier, message = WTFMove(message), sourceIdentifier, sourceData = WTFMove(sourceData)](bool success, auto& contextConnection) mutable { 142 if (success) 143 sendToContextProcess(contextConnection, Messages::WebSWContextManagerConnection::PostMessageToServiceWorkerFromClient { destinationIdentifier, message, sourceIdentifier, WTFMove(sourceData) }); 144 }); 145 } 146 147 void WebSWServerConnection::postMessageToServiceWorkerFromServiceWorker(ServiceWorkerIdentifier destinationIdentifier, IPC::DataReference&& message, ServiceWorkerIdentifier sourceIdentifier) 148 { 146 149 auto* sourceWorker = server().workerByID(sourceIdentifier); 147 150 if (!sourceWorker) 148 151 return; 149 152 150 sendToContextProcess(Messages::WebSWContextManagerConnection::PostMessageToServiceWorkerFromServiceWorker { destinationIdentifier, message, sourceWorker->data() }); 153 // It's possible this specific worker cannot be re-run (e.g. its registration has been removed) 154 server().runServiceWorkerIfNecessary(destinationIdentifier, [destinationIdentifier, message = WTFMove(message), sourceIdentifier, sourceData = sourceWorker->data()](bool success, auto& contextConnection) mutable { 155 if (!success) 156 return; 157 158 sendToContextProcess(contextConnection, Messages::WebSWContextManagerConnection::PostMessageToServiceWorkerFromServiceWorker { destinationIdentifier, message, WTFMove(sourceData) }); 159 }); 151 160 } 152 161 … … 233 242 } 234 243 244 template<typename U> void WebSWServerConnection::sendToContextProcess(WebCore::SWServerToContextConnection& connection, U&& message) 245 { 246 static_cast<WebSWServerToContextConnection&>(connection).send(WTFMove(message)); 247 } 248 235 249 } // namespace WebKit 236 250 -
trunk/Source/WebKit/StorageProcess/ServiceWorker/WebSWServerConnection.h
r225531 r225622 53 53 ~WebSWServerConnection() final; 54 54 55 IPC::Connection& ipcConnection() const { return m_contentConnection.get(); } 56 55 57 void disconnectedFromWebProcess(); 56 58 void didReceiveMessage(IPC::Connection&, IPC::Decoder&) final; … … 80 82 void registrationReady(uint64_t registrationReadyRequestIdentifier, WebCore::ServiceWorkerRegistrationData&&) final; 81 83 82 void startFetch(uint64_t fetchIdentifier, std::optional<WebCore::ServiceWorkerIdentifier>, const WebCore::ResourceRequest&, const WebCore::FetchOptions&, const IPC::FormDataReference&);84 void startFetch(uint64_t fetchIdentifier, std::optional<WebCore::ServiceWorkerIdentifier>, WebCore::ResourceRequest&&, WebCore::FetchOptions&&, IPC::FormDataReference&&); 83 85 84 void postMessageToServiceWorkerFromClient(WebCore::ServiceWorkerIdentifier destination, const IPC::DataReference& message, WebCore::ServiceWorkerClientIdentifier sourceIdentifier, WebCore::ServiceWorkerClientData&& source);85 void postMessageToServiceWorkerFromServiceWorker(WebCore::ServiceWorkerIdentifier destination, const IPC::DataReference& message, WebCore::ServiceWorkerIdentifier source);86 void postMessageToServiceWorkerFromClient(WebCore::ServiceWorkerIdentifier destination, IPC::DataReference&& message, WebCore::ServiceWorkerClientIdentifier sourceIdentifier, WebCore::ServiceWorkerClientData&& source); 87 void postMessageToServiceWorkerFromServiceWorker(WebCore::ServiceWorkerIdentifier destination, IPC::DataReference&& message, WebCore::ServiceWorkerIdentifier source); 86 88 87 89 void matchRegistration(uint64_t registrationMatchRequestIdentifier, const WebCore::SecurityOriginData& topOrigin, const WebCore::URL& clientURL); … … 95 97 96 98 template<typename U> void sendToContextProcess(U&& message); 99 template<typename U> static void sendToContextProcess(WebCore::SWServerToContextConnection&, U&& message); 97 100 98 101 PAL::SessionID m_sessionID; 99 102 Ref<IPC::Connection> m_contentConnection; 100 RefPtr<IPC::Connection> m_contextConnection;101 103 HashMap<WebCore::DocumentIdentifier, WebCore::ClientOrigin> m_clientOrigins; 102 104 }; -
trunk/Source/WebKit/StorageProcess/StorageProcess.cpp
r225510 r225622 87 87 #if ENABLE(SERVICE_WORKER) 88 88 if (m_serverToContextConnection && m_serverToContextConnection->ipcConnection() == &connection) { 89 m_serverToContextConnection->connectionClosed(); 90 m_serverToContextConnection = nullptr; 89 connectionToContextProcessWasClosed(); 91 90 return; 92 91 } … … 96 95 stopRunLoop(); 97 96 } 97 98 #if ENABLE(SERVICE_WORKER) 99 void StorageProcess::connectionToContextProcessWasClosed() 100 { 101 if (!m_serverToContextConnection) 102 return; 103 104 bool shouldRelaunch = needsServerToContextConnection(); 105 106 m_serverToContextConnection->connectionClosed(); 107 m_serverToContextConnection = nullptr; 108 109 for (auto& swServer : m_swServers.values()) 110 swServer->markAllWorkersAsTerminated(); 111 112 if (shouldRelaunch) 113 createServerToContextConnection(); 114 } 115 116 // The rule is that we need a context process (and a connection to it) as long as we have SWServerConnections to regular WebProcesses. 117 bool StorageProcess::needsServerToContextConnection() const 118 { 119 if (m_swServerConnections.isEmpty()) 120 return false; 121 122 // If the last SWServerConnection is to the context process, then we no longer need the context connection. 123 if (m_swServerConnections.size() == 1 && m_serverToContextConnection && &m_swServerConnections.begin()->value->ipcConnection() == m_serverToContextConnection->ipcConnection()) 124 return false; 125 126 return true; 127 } 128 #endif 98 129 99 130 void StorageProcess::didReceiveMessage(IPC::Connection& connection, IPC::Decoder& decoder) -
trunk/Source/WebKit/StorageProcess/StorageProcess.h
r225490 r225622 99 99 void didReceiveStorageProcessMessage(IPC::Connection&, IPC::Decoder&); 100 100 101 #if ENABLE(SERVICE_WORKER) 102 void connectionToContextProcessWasClosed(); 103 #endif 104 101 105 private: 102 106 StorageProcess(); … … 134 138 void postMessageToServiceWorkerClient(const WebCore::ServiceWorkerClientIdentifier& destinationIdentifier, const IPC::DataReference& message, WebCore::ServiceWorkerIdentifier sourceIdentifier, const String& sourceOrigin); 135 139 WebSWOriginStore& swOriginStoreForSession(PAL::SessionID); 140 bool needsServerToContextConnection() const; 136 141 #endif 137 142 #if ENABLE(INDEXED_DATABASE) -
trunk/Source/WebKit/StorageProcess/StorageToWebProcessConnection.cpp
r225403 r225622 121 121 } 122 122 123 void StorageToWebProcessConnection::didClose(IPC::Connection&) 124 { 123 void StorageToWebProcessConnection::didClose(IPC::Connection& connection) 124 { 125 UNUSED_PARAM(connection); 126 127 #if ENABLE(SERVICE_WORKER) 128 if (StorageProcess::singleton().globalServerToContextConnection() && StorageProcess::singleton().globalServerToContextConnection()->ipcConnection() == &connection) { 129 // Service Worker process exited. 130 StorageProcess::singleton().connectionToContextProcessWasClosed(); 131 } 132 #endif 133 125 134 #if ENABLE(INDEXED_DATABASE) 126 135 auto idbConnections = m_webIDBConnections; -
trunk/Source/WebKit/UIProcess/API/C/WKContext.cpp
r224373 r225622 615 615 } 616 616 617 void WKContextTerminateServiceWorkerProcess(WKContextRef context) 618 { 619 toImpl(context)->terminateServiceWorkerProcess(); 620 } 621 617 622 ProcessID WKContextGetNetworkProcessIdentifier(WKContextRef contextRef) 618 623 { -
trunk/Source/WebKit/UIProcess/API/C/WKContextPrivate.h
r224250 r225622 90 90 91 91 WK_EXPORT void WKContextTerminateNetworkProcess(WKContextRef); 92 WK_EXPORT void WKContextTerminateServiceWorkerProcess(WKContextRef); 92 93 93 94 WK_EXPORT void WKContextSetAllowsAnySSLCertificateForWebSocketTesting(WKContextRef, bool); -
trunk/Source/WebKit/UIProcess/API/Cocoa/WKProcessPool.mm
r225309 r225622 413 413 } 414 414 415 - (void)_terminateServiceWorkerProcess 416 { 417 _processPool->terminateServiceWorkerProcess(); 418 } 419 415 420 - (pid_t)_networkProcessIdentifier 416 421 { -
trunk/Source/WebKit/UIProcess/API/Cocoa/WKProcessPoolPrivate.h
r225006 r225622 75 75 - (void)_terminateStorageProcess; 76 76 - (void)_terminateNetworkProcess; 77 - (void)_terminateServiceWorkerProcess; 77 78 78 79 // Test only. -
trunk/Source/WebKit/UIProcess/WebProcessPool.cpp
r225490 r225622 116 116 DEFINE_DEBUG_ONLY_GLOBAL(WTF::RefCountedLeakCounter, processPoolCounter, ("WebProcessPool")); 117 117 118 static const Seconds serviceWorkerTerminationDelay { 5_s }; 119 118 120 static uint64_t generateListenerIdentifier() 119 121 { … … 245 247 , m_hiddenPageThrottlingAutoIncreasesCounter([this](RefCounterEvent) { m_hiddenPageThrottlingTimer.startOneShot(0_s); }) 246 248 , m_hiddenPageThrottlingTimer(RunLoop::main(), this, &WebProcessPool::updateHiddenPageThrottlingAutoIncreaseLimit) 249 , m_serviceWorkerProcessTerminationTimer(RunLoop::main(), this, &WebProcessPool::terminateServiceWorkerProcess) 247 250 { 248 251 if (m_configuration->shouldHaveLegacyDataStore()) … … 698 701 initializeNewWebProcess(process, websiteDataStore); 699 702 m_processes.append(WTFMove(processProxy)); 703 704 if (m_serviceWorkerProcessTerminationTimer.isActive()) 705 m_serviceWorkerProcessTerminationTimer.stop(); 706 700 707 return process; 701 708 } … … 944 951 // whenever there is no regular WebContent process remaining. 945 952 if (m_processes.size() == 1 && m_processes[0] == m_serviceWorkerProcess) { 946 m_serviceWorkerProcess = nullptr;947 m_processes.clear();953 if (!m_serviceWorkerProcessTerminationTimer.isActive()) 954 m_serviceWorkerProcessTerminationTimer.startOneShot(serviceWorkerTerminationDelay); 948 955 } 949 956 #endif … … 1409 1416 } 1410 1417 1418 void WebProcessPool::terminateServiceWorkerProcess() 1419 { 1420 #if ENABLE(SERVICE_WORKER) 1421 if (!m_serviceWorkerProcess) 1422 return; 1423 1424 m_serviceWorkerProcess->requestTermination(ProcessTerminationReason::RequestedByClient); 1425 ASSERT(!m_processes.contains(m_serviceWorkerProcess)); 1426 ASSERT(!m_serviceWorkerProcess); 1427 #endif 1428 } 1429 1411 1430 void WebProcessPool::syncNetworkProcessCookies() 1412 1431 { -
trunk/Source/WebKit/UIProcess/WebProcessPool.h
r225490 r225622 263 263 void terminateStorageProcess(); 264 264 void terminateNetworkProcess(); 265 void terminateServiceWorkerProcess(); 265 266 266 267 void syncNetworkProcessCookies(); … … 634 635 635 636 HashMap<PAL::SessionID, HashSet<WebPageProxy*>> m_sessionToPagesMap; 637 RunLoop::Timer<WebProcessPool> m_serviceWorkerProcessTerminationTimer; 636 638 }; 637 639 -
trunk/Tools/ChangeLog
r225618 r225622 1 2017-12-06 Chris Dumez <cdumez@apple.com> 2 3 We should be able to recover after a Service Worker process crash 4 https://bugs.webkit.org/show_bug.cgi?id=180477 5 6 Reviewed by Brady Eidson and Youenn Fablet. 7 8 Add testRunner API to terminate the Service Worker process. 9 10 * WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl: 11 * WebKitTestRunner/InjectedBundle/TestRunner.cpp: 12 (WTR::TestRunner::terminateServiceWorkerProcess): 13 * WebKitTestRunner/InjectedBundle/TestRunner.h: 14 * WebKitTestRunner/TestController.cpp: 15 (WTR::TestController::terminateServiceWorkerProcess): 16 * WebKitTestRunner/TestController.h: 17 * WebKitTestRunner/TestInvocation.cpp: 18 (WTR::TestInvocation::didReceiveMessageFromInjectedBundle): 19 1 20 2017-12-02 Darin Adler <darin@apple.com> 2 21 -
trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl
r225598 r225622 305 305 306 306 void terminateNetworkProcess(); 307 void terminateServiceWorkerProcess(); 307 308 308 309 void removeAllSessionCredentials(object callback); -
trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp
r225598 r225622 1139 1139 } 1140 1140 1141 void TestRunner::terminateServiceWorkerProcess() 1142 { 1143 WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("TerminateServiceWorkerProcess")); 1144 WKBundlePagePostMessage(InjectedBundle::singleton().page()->page(), messageName.get(), nullptr); 1145 } 1146 1141 1147 static unsigned nextUIScriptCallbackID() 1142 1148 { -
trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h
r225598 r225622 403 403 404 404 void terminateNetworkProcess(); 405 void terminateServiceWorkerProcess(); 405 406 406 407 void removeAllSessionCredentials(JSValueRef); -
trunk/Tools/WebKitTestRunner/TestController.cpp
r225006 r225622 2275 2275 } 2276 2276 2277 void TestController::terminateServiceWorkerProcess() 2278 { 2279 WKContextTerminateServiceWorkerProcess(platformContext()); 2280 } 2281 2277 2282 #if !PLATFORM(COCOA) 2278 2283 void TestController::platformWillRunTest(const TestInvocation&) -
trunk/Tools/WebKitTestRunner/TestController.h
r225006 r225622 189 189 190 190 void terminateNetworkProcess(); 191 void terminateServiceWorkerProcess(); 191 192 192 193 void removeAllSessionCredentials(); -
trunk/Tools/WebKitTestRunner/TestInvocation.cpp
r225598 r225622 745 745 } 746 746 747 if (WKStringIsEqualToUTF8CString(messageName, "TerminateServiceWorkerProcess")) { 748 ASSERT(!messageBody); 749 TestController::singleton().terminateServiceWorkerProcess(); 750 return; 751 } 752 747 753 if (WKStringIsEqualToUTF8CString(messageName, "RunUIProcessScript")) { 748 754 WKDictionaryRef messageBodyDictionary = static_cast<WKDictionaryRef>(messageBody);
Note: See TracChangeset
for help on using the changeset viewer.