Changeset 249287 in webkit
- Timestamp:
- Aug 29, 2019, 12:24:46 PM (7 years ago)
- Location:
- trunk
- Files:
-
- 3 added
- 26 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/http/wpt/service-workers/skipFetchEvent-worker.js (added)
-
LayoutTests/http/wpt/service-workers/skipFetchEvent.https-expected.txt (added)
-
LayoutTests/http/wpt/service-workers/skipFetchEvent.https.html (added)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/workers/DedicatedWorkerThread.h (modified) (1 diff)
-
Source/WebCore/workers/WorkerMessagingProxy.cpp (modified) (1 diff)
-
Source/WebCore/workers/WorkerThread.cpp (modified) (1 diff)
-
Source/WebCore/workers/WorkerThread.h (modified) (2 diffs)
-
Source/WebCore/workers/service/context/SWContextManager.cpp (modified) (2 diffs)
-
Source/WebCore/workers/service/context/SWContextManager.h (modified) (3 diffs)
-
Source/WebCore/workers/service/context/ServiceWorkerThread.cpp (modified) (1 diff)
-
Source/WebCore/workers/service/context/ServiceWorkerThread.h (modified) (3 diffs)
-
Source/WebCore/workers/service/server/SWServer.h (modified) (1 diff)
-
Source/WebCore/workers/service/server/SWServerJobQueue.cpp (modified) (1 diff)
-
Source/WebCore/workers/service/server/SWServerRegistration.cpp (modified) (1 diff)
-
Source/WebCore/workers/service/server/SWServerRegistration.h (modified) (2 diffs)
-
Source/WebCore/workers/service/server/SWServerToContextConnection.cpp (modified) (1 diff)
-
Source/WebCore/workers/service/server/SWServerToContextConnection.h (modified) (2 diffs)
-
Source/WebCore/workers/service/server/SWServerWorker.cpp (modified) (2 diffs)
-
Source/WebCore/workers/service/server/SWServerWorker.h (modified) (3 diffs)
-
Source/WebKit/ChangeLog (modified) (1 diff)
-
Source/WebKit/NetworkProcess/ServiceWorker/WebSWServerConnection.cpp (modified) (2 diffs)
-
Source/WebKit/NetworkProcess/ServiceWorker/WebSWServerToContextConnection.cpp (modified) (1 diff)
-
Source/WebKit/NetworkProcess/ServiceWorker/WebSWServerToContextConnection.h (modified) (1 diff)
-
Source/WebKit/NetworkProcess/ServiceWorker/WebSWServerToContextConnection.messages.in (modified) (1 diff)
-
Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.cpp (modified) (2 diffs)
-
Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.h (modified) (2 diffs)
-
Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.messages.in (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r249278 r249287 1 2019-08-29 Youenn Fablet <youenn@apple.com> 2 3 Skip fetch event dispatching if no fetch event handler is added at script evaluation time 4 https://bugs.webkit.org/show_bug.cgi?id=201174 5 6 Reviewed by Chris Dumez. 7 8 * http/wpt/service-workers/skipFetchEvent-worker.js: Added. 9 (async.doTest): 10 * http/wpt/service-workers/skipFetchEvent.https-expected.txt: Added. 11 * http/wpt/service-workers/skipFetchEvent.https.html: Added. 12 1 13 2019-08-29 Alicia Boya García <aboya@igalia.com> 2 14 -
trunk/Source/WebCore/ChangeLog
r249286 r249287 1 2019-08-29 Youenn Fablet <youenn@apple.com> 2 3 Skip fetch event dispatching if no fetch event handler is added at script evaluation time 4 https://bugs.webkit.org/show_bug.cgi?id=201174 5 6 Reviewed by Chris Dumez. 7 8 At end of worker script evaluation, store whether a fetch event handler is registered. 9 Send it back to the SWServer that will store it in the corresponding SWServerWorker. 10 11 Add support for soft update directly from the registration. 12 This will trigger a soft-update from the worker context itself. 13 In theory, this should be started by the job queue but we do not have a way yet to implement this as per spec. 14 15 Test: http/wpt/service-workers/skipFetchEvent.https.html 16 17 * workers/DedicatedWorkerThread.h: 18 (WebCore::DedicatedWorkerThread::start): 19 * workers/WorkerMessagingProxy.cpp: 20 (WebCore::WorkerMessagingProxy::startWorkerGlobalScope): 21 * workers/WorkerThread.cpp: 22 (WebCore::WorkerThread::workerThread): 23 * workers/WorkerThread.h: 24 (WebCore::WorkerThread::finishedEvaluatingScript): 25 * workers/service/context/SWContextManager.cpp: 26 (WebCore::SWContextManager::registerServiceWorkerThreadForInstall): 27 (WebCore::SWContextManager::startedServiceWorker): 28 (WebCore::SWContextManager::softUpdate): 29 * workers/service/context/SWContextManager.h: 30 * workers/service/context/ServiceWorkerThread.cpp: 31 (WebCore::ServiceWorkerThread::postFetchTask): 32 (WebCore::ServiceWorkerThread::softUpdate): 33 (WebCore::ServiceWorkerThread::finishedEvaluatingScript): 34 (WebCore::ServiceWorkerThread::start): 35 * workers/service/context/ServiceWorkerThread.h: 36 (WebCore::ServiceWorkerThread::doesHandleFetch const): 37 * workers/service/server/SWServer.h: 38 * workers/service/server/SWServerRegistration.cpp: 39 (WebCore::SWServerRegistration::shouldSoftUpdate const): 40 (WebCore::SWServerRegistration::softUpdate): 41 * workers/service/server/SWServerRegistration.h: 42 (WebCore::SWServerRegistration::isStale const): 43 * workers/service/server/SWServerToContextConnection.cpp: 44 (WebCore::SWServerToContextConnection::generateConnectionIdentifier): 45 (WebCore::SWServerToContextConnection::SWServerToContextConnection): 46 (WebCore::SWServerToContextConnection::scriptContextStarted): 47 * workers/service/server/SWServerToContextConnection.h: 48 * workers/service/server/SWServerWorker.cpp: 49 (WebCore::SWServerWorker::scriptContextStarted): 50 (WebCore::SWServerWorker::setState): 51 * workers/service/server/SWServerWorker.h: 52 (WebCore::SWServerWorker::shouldSkipFetchEvent const): 53 1 54 2019-08-29 Keith Rollin <krollin@apple.com> 2 55 -
trunk/Source/WebCore/workers/DedicatedWorkerThread.h
r235159 r249287 48 48 49 49 WorkerObjectProxy& workerObjectProxy() const { return m_workerObjectProxy; } 50 void start() { WorkerThread::start(nullptr); } 50 51 51 52 protected: -
trunk/Source/WebCore/workers/WorkerMessagingProxy.cpp
r248846 r249287 92 92 93 93 workerThreadCreated(thread.get()); 94 thread->start( nullptr);94 thread->start(); 95 95 96 96 m_inspectorProxy->workerStarted(m_scriptExecutionContext.get(), thread.ptr(), scriptURL); -
trunk/Source/WebCore/workers/WorkerThread.cpp
r248846 r249287 194 194 scriptController->evaluate(ScriptSourceCode(m_startupData->m_sourceCode, URL(m_startupData->m_scriptURL)), &exceptionMessage); 195 195 196 finishedEvaluatingScript(); 197 196 198 callOnMainThread([evaluateCallback = WTFMove(m_evaluateCallback), message = exceptionMessage.isolatedCopy()] { 197 199 if (evaluateCallback) -
trunk/Source/WebCore/workers/WorkerThread.h
r241739 r249287 66 66 static Lock& workerThreadsMutex(); 67 67 68 WEBCORE_EXPORT void start(WTF::Function<void(const String&)>&& evaluateCallback);69 68 void stop(WTF::Function<void()>&& terminatedCallback); 70 69 … … 105 104 SocketProvider* socketProvider(); 106 105 106 void start(Function<void(const String&)>&& evaluateCallback); 107 107 108 private: 108 109 void workerThread(); 109 110 virtual bool isServiceWorkerThread() const { return false; } 111 112 virtual void finishedEvaluatingScript() { } 110 113 111 114 RefPtr<Thread> m_thread; -
trunk/Source/WebCore/workers/service/context/SWContextManager.cpp
r248846 r249287 60 60 ASSERT_UNUSED(result, result.isNewEntry); 61 61 62 threadProxy->thread().start([jobDataIdentifier, serviceWorkerIdentifier](const String& exceptionMessage ) {63 SWContextManager::singleton().startedServiceWorker(jobDataIdentifier, serviceWorkerIdentifier, exceptionMessage );62 threadProxy->thread().start([jobDataIdentifier, serviceWorkerIdentifier](const String& exceptionMessage, bool doesHandleFetch) { 63 SWContextManager::singleton().startedServiceWorker(jobDataIdentifier, serviceWorkerIdentifier, exceptionMessage, doesHandleFetch); 64 64 }); 65 65 } 66 66 67 void SWContextManager::startedServiceWorker(Optional<ServiceWorkerJobDataIdentifier> jobDataIdentifier, ServiceWorkerIdentifier serviceWorkerIdentifier, const String& exceptionMessage )67 void SWContextManager::startedServiceWorker(Optional<ServiceWorkerJobDataIdentifier> jobDataIdentifier, ServiceWorkerIdentifier serviceWorkerIdentifier, const String& exceptionMessage, bool doesHandleFetch) 68 68 { 69 connection()->serviceWorkerStartedWithMessage(jobDataIdentifier, serviceWorkerIdentifier, exceptionMessage);70 69 if (m_serviceWorkerCreationCallback) 71 70 m_serviceWorkerCreationCallback(serviceWorkerIdentifier.toUInt64()); 71 if (!exceptionMessage.isEmpty()) { 72 connection()->serviceWorkerFailedToStart(jobDataIdentifier, serviceWorkerIdentifier, exceptionMessage); 73 return; 74 } 75 connection()->serviceWorkerStarted(jobDataIdentifier, serviceWorkerIdentifier, doesHandleFetch); 72 76 } 73 77 … … 103 107 104 108 serviceWorker->thread().fireActivateEvent(); 109 } 110 111 void SWContextManager::softUpdate(ServiceWorkerIdentifier identifier) 112 { 113 auto* serviceWorker = m_workerMap.get(identifier); 114 if (!serviceWorker) 115 return; 116 117 serviceWorker->thread().softUpdate(); 105 118 } 106 119 -
trunk/Source/WebCore/workers/service/context/SWContextManager.h
r245299 r249287 51 51 52 52 virtual void postMessageToServiceWorkerClient(const ServiceWorkerClientIdentifier& destinationIdentifier, MessageWithMessagePorts&&, ServiceWorkerIdentifier source, const String& sourceOrigin) = 0; 53 virtual void serviceWorkerStartedWithMessage(Optional<ServiceWorkerJobDataIdentifier>, ServiceWorkerIdentifier, const String& exceptionMessage) = 0; 53 virtual void serviceWorkerStarted(Optional<ServiceWorkerJobDataIdentifier>, ServiceWorkerIdentifier, bool doesHandleFetch) = 0; 54 virtual void serviceWorkerFailedToStart(Optional<ServiceWorkerJobDataIdentifier>, ServiceWorkerIdentifier, const String& message) = 0; 54 55 virtual void didFinishInstall(Optional<ServiceWorkerJobDataIdentifier>, ServiceWorkerIdentifier, bool wasSuccessful) = 0; 55 56 virtual void didFinishActivation(ServiceWorkerIdentifier) = 0; … … 75 76 WEBCORE_EXPORT void fireInstallEvent(ServiceWorkerIdentifier); 76 77 WEBCORE_EXPORT void fireActivateEvent(ServiceWorkerIdentifier); 78 WEBCORE_EXPORT void softUpdate(ServiceWorkerIdentifier); 77 79 WEBCORE_EXPORT void terminateWorker(ServiceWorkerIdentifier, Seconds timeout, Function<void()>&&); 78 80 … … 89 91 SWContextManager() = default; 90 92 91 void startedServiceWorker(Optional<ServiceWorkerJobDataIdentifier>, ServiceWorkerIdentifier, const String& exceptionMessage );93 void startedServiceWorker(Optional<ServiceWorkerJobDataIdentifier>, ServiceWorkerIdentifier, const String& exceptionMessage, bool doesHandleFetch); 92 94 NO_RETURN_DUE_TO_CRASH void serviceWorkerFailedToTerminate(ServiceWorkerIdentifier); 93 95 -
trunk/Source/WebCore/workers/service/context/ServiceWorkerThread.cpp
r246490 r249287 185 185 } 186 186 187 void ServiceWorkerThread::softUpdate() 188 { 189 runLoop().postTask([](auto& context) mutable { 190 auto& serviceWorkerGlobalScope = downcast<ServiceWorkerGlobalScope>(context); 191 serviceWorkerGlobalScope.registration().scheduleSoftUpdate(); 192 }); 193 } 194 195 void ServiceWorkerThread::finishedEvaluatingScript() 196 { 197 m_doesHandleFetch = workerGlobalScope()->hasEventListeners(eventNames().fetchEvent); 198 } 199 200 void ServiceWorkerThread::start(Function<void(const String&, bool)>&& callback) 201 { 202 WorkerThread::start([callback = WTFMove(callback), serviceWorkerIdentifier = this->identifier()](auto& errorMessage) mutable { 203 bool doesHandleFetch = true; 204 if (auto* threadProxy = SWContextManager::singleton().workerByID(serviceWorkerIdentifier)) 205 doesHandleFetch = threadProxy->thread().doesHandleFetch(); 206 callback(errorMessage, doesHandleFetch); 207 }); 208 } 209 187 210 } // namespace WebCore 188 211 -
trunk/Source/WebCore/workers/service/context/ServiceWorkerThread.h
r239427 r249287 56 56 WorkerObjectProxy& workerObjectProxy() const { return m_workerObjectProxy; } 57 57 58 void start(Function<void(const String&, bool)>&&); 58 59 WEBCORE_EXPORT void postFetchTask(Ref<ServiceWorkerFetch::Client>&&, Optional<ServiceWorkerClientIdentifier>&&, ResourceRequest&&, String&& referrer, FetchOptions&&); 59 60 WEBCORE_EXPORT void postMessageToServiceWorker(MessageWithMessagePorts&&, ServiceWorkerOrClientData&& sourceData); … … 61 62 void fireInstallEvent(); 62 63 void fireActivateEvent(); 64 void softUpdate(); 63 65 64 66 const ServiceWorkerContextData& contextData() const { return m_data; } 65 67 66 68 ServiceWorkerIdentifier identifier() const { return m_data.serviceWorkerIdentifier; } 69 bool doesHandleFetch() const { return m_doesHandleFetch; } 67 70 68 71 protected: … … 74 77 75 78 bool isServiceWorkerThread() const final { return true; } 79 void finishedEvaluatingScript() final; 76 80 77 81 ServiceWorkerContextData m_data; 78 82 WorkerObjectProxy& m_workerObjectProxy; 83 bool m_doesHandleFetch { false }; 79 84 }; 80 85 -
trunk/Source/WebCore/workers/service/server/SWServer.h
r247104 r249287 131 131 WEBCORE_EXPORT void endSuspension(); 132 132 133 SWServerRegistration* getRegistration(const ServiceWorkerRegistrationKey&);133 WEBCORE_EXPORT SWServerRegistration* getRegistration(const ServiceWorkerRegistrationKey&); 134 134 void addRegistration(std::unique_ptr<SWServerRegistration>&&); 135 135 void removeRegistration(const ServiceWorkerRegistrationKey&); -
trunk/Source/WebCore/workers/service/server/SWServerJobQueue.cpp
r248846 r249287 351 351 // current time minus registration's last update check time is greater than 86400. 352 352 if (registration->updateViaCache() != ServiceWorkerUpdateViaCache::All 353 || (newestWorker && registration-> lastUpdateTime() && (WallTime::now() - registration->lastUpdateTime()) > 86400_s)) {353 || (newestWorker && registration->isStale())) { 354 354 cachePolicy = FetchOptions::Cache::NoCache; 355 355 } -
trunk/Source/WebCore/workers/service/server/SWServerRegistration.cpp
r240661 r249287 363 363 } 364 364 365 bool SWServerRegistration::shouldSoftUpdate(const FetchOptions& options) const 366 { 367 if (options.mode == FetchOptions::Mode::Navigate) 368 return true; 369 370 return WebCore::isNonSubresourceRequest(options.destination) && isStale(); 371 } 372 373 // https://w3c.github.io/ServiceWorker/#soft-update 374 void SWServerRegistration::softUpdate() 375 { 376 auto* worker = getNewestWorker(); 377 if (!worker) 378 return; 379 380 // FIXME: We should schedule an update job. 381 m_server.runServiceWorkerIfNecessary(worker->identifier(), [serviceWorkerIdentifier = worker->identifier()](auto* contextConnection) { 382 if (contextConnection) 383 contextConnection->softUpdate(serviceWorkerIdentifier); 384 }); 385 } 386 365 387 } // namespace WebCore 366 388 -
trunk/Source/WebCore/workers/service/server/SWServerRegistration.h
r237110 r249287 63 63 void setLastUpdateTime(WallTime); 64 64 WallTime lastUpdateTime() const { return m_lastUpdateTime; } 65 bool isStale() const { return m_lastUpdateTime && (WallTime::now() - m_lastUpdateTime) > 86400_s; } 65 66 66 67 void setUpdateViaCache(ServiceWorkerUpdateViaCache); … … 97 98 void forEachConnection(const WTF::Function<void(SWServer::Connection&)>&); 98 99 100 WEBCORE_EXPORT bool shouldSoftUpdate(const FetchOptions&) const; 101 WEBCORE_EXPORT void softUpdate(); 102 99 103 private: 100 104 void activate(); -
trunk/Source/WebCore/workers/service/server/SWServerToContextConnection.cpp
r244115 r249287 72 72 } 73 73 74 void SWServerToContextConnection::scriptContextStarted(const Optional<ServiceWorkerJobDataIdentifier>& jobDataIdentifier, ServiceWorkerIdentifier serviceWorkerIdentifier )74 void SWServerToContextConnection::scriptContextStarted(const Optional<ServiceWorkerJobDataIdentifier>& jobDataIdentifier, ServiceWorkerIdentifier serviceWorkerIdentifier, bool doesHandleFetch) 75 75 { 76 76 if (auto* worker = SWServerWorker::existingWorkerForIdentifier(serviceWorkerIdentifier)) 77 worker->scriptContextStarted(jobDataIdentifier );77 worker->scriptContextStarted(jobDataIdentifier, doesHandleFetch); 78 78 } 79 79 -
trunk/Source/WebCore/workers/service/server/SWServerToContextConnection.h
r245299 r249287 57 57 virtual void fireInstallEvent(ServiceWorkerIdentifier) = 0; 58 58 virtual void fireActivateEvent(ServiceWorkerIdentifier) = 0; 59 virtual void softUpdate(ServiceWorkerIdentifier) = 0; 59 60 virtual void terminateWorker(ServiceWorkerIdentifier) = 0; 60 61 virtual void syncTerminateWorker(ServiceWorkerIdentifier) = 0; … … 66 67 // Messages back from the SW host process 67 68 WEBCORE_EXPORT void scriptContextFailedToStart(const Optional<ServiceWorkerJobDataIdentifier>&, ServiceWorkerIdentifier, const String& message); 68 WEBCORE_EXPORT void scriptContextStarted(const Optional<ServiceWorkerJobDataIdentifier>&, ServiceWorkerIdentifier );69 WEBCORE_EXPORT void scriptContextStarted(const Optional<ServiceWorkerJobDataIdentifier>&, ServiceWorkerIdentifier, bool doesHandleFetch); 69 70 WEBCORE_EXPORT void didFinishInstall(const Optional<ServiceWorkerJobDataIdentifier>&, ServiceWorkerIdentifier, bool wasSuccessful); 70 71 WEBCORE_EXPORT void didFinishActivation(ServiceWorkerIdentifier); -
trunk/Source/WebCore/workers/service/server/SWServerWorker.cpp
r247705 r249287 109 109 } 110 110 111 void SWServerWorker::scriptContextStarted(const Optional<ServiceWorkerJobDataIdentifier>& jobDataIdentifier) 112 { 111 void SWServerWorker::scriptContextStarted(const Optional<ServiceWorkerJobDataIdentifier>& jobDataIdentifier, bool doesHandleFetch) 112 { 113 m_shouldSkipHandleFetch = !doesHandleFetch; 113 114 ASSERT(m_server); 114 115 if (m_server) … … 241 242 ASSERT(state != State::Running || m_server->getRegistration(m_registrationKey)); 242 243 m_state = state; 244 245 if (state == State::Running) 246 m_shouldSkipHandleFetch = false; 243 247 } 244 248 -
trunk/Source/WebCore/workers/service/server/SWServerWorker.h
r247705 r249287 89 89 90 90 void scriptContextFailedToStart(const Optional<ServiceWorkerJobDataIdentifier>&, const String& message); 91 void scriptContextStarted(const Optional<ServiceWorkerJobDataIdentifier>& );91 void scriptContextStarted(const Optional<ServiceWorkerJobDataIdentifier>&, bool doesHandleFetch); 92 92 void didFinishInstall(const Optional<ServiceWorkerJobDataIdentifier>&, bool wasSuccessful); 93 93 void didFinishActivation(); … … 113 113 String userAgent() const; 114 114 115 bool shouldSkipFetchEvent() const { return m_shouldSkipHandleFetch; } 116 115 117 private: 116 118 SWServerWorker(SWServer&, SWServerRegistration&, const URL&, const String& script, const ContentSecurityPolicyResponseHeaders&, String&& referrerPolicy, WorkerType, ServiceWorkerIdentifier, HashMap<URL, ServiceWorkerContextData::ImportedScript>&&); … … 131 133 Vector<Function<void(bool)>> m_whenActivatedHandlers; 132 134 HashMap<URL, ServiceWorkerContextData::ImportedScript> m_scriptResourceMap; 135 bool m_shouldSkipHandleFetch; 133 136 }; 134 137 -
trunk/Source/WebKit/ChangeLog
r249286 r249287 1 2019-08-29 Youenn Fablet <youenn@apple.com> 2 3 Skip fetch event dispatching if no fetch event handler is added at script evaluation time 4 https://bugs.webkit.org/show_bug.cgi?id=201174 5 6 Reviewed by Chris Dumez. 7 8 Store whether a fetch event handler is set at script evaluation time. 9 If not, we skip the fetch event entirely so that the network load can start sooner. 10 If fetch event is skipped, we trigger soft update, as defined in 11 https://w3c.github.io/ServiceWorker/#handle-fetch step 16. 12 13 * NetworkProcess/ServiceWorker/WebSWServerConnection.cpp: 14 (WebKit::WebSWServerConnection::startFetch): 15 * NetworkProcess/ServiceWorker/WebSWServerToContextConnection.cpp: 16 (WebKit::WebSWServerToContextConnection::softUpdate): 17 * NetworkProcess/ServiceWorker/WebSWServerToContextConnection.h: 18 * NetworkProcess/ServiceWorker/WebSWServerToContextConnection.messages.in: 19 * WebProcess/Storage/WebSWContextManagerConnection.cpp: 20 (WebKit::WebSWContextManagerConnection::serviceWorkerStarted): 21 (WebKit::WebSWContextManagerConnection::serviceWorkerFailedToStart): 22 (WebKit::WebSWContextManagerConnection::softUpdate): 23 * WebProcess/Storage/WebSWContextManagerConnection.h: 24 * WebProcess/Storage/WebSWContextManagerConnection.messages.in: 25 1 26 2019-08-29 Keith Rollin <krollin@apple.com> 2 27 -
trunk/Source/WebKit/NetworkProcess/ServiceWorker/WebSWServerConnection.cpp
r245796 r249287 184 184 m_networkProcess->createServerToContextConnection(worker->registrableDomain(), server().sessionID()); 185 185 186 server().runServiceWorkerIfNecessary(serviceWorkerIdentifier, [weakThis = WTFMove(weakThis), this, fetchIdentifier, serviceWorkerIdentifier, request = WTFMove(request), options = WTFMove(options), formData = WTFMove(formData), referrer = WTFMove(referrer) ](auto* contextConnection) {186 server().runServiceWorkerIfNecessary(serviceWorkerIdentifier, [weakThis = WTFMove(weakThis), this, fetchIdentifier, serviceWorkerIdentifier, request = WTFMove(request), options = WTFMove(options), formData = WTFMove(formData), referrer = WTFMove(referrer), shouldSkipFetchEvent = worker->shouldSkipFetchEvent()](auto* contextConnection) { 187 187 if (!weakThis) 188 188 return; … … 198 198 }; 199 199 200 if (worker->shouldSkipFetchEvent()) { 201 m_contentConnection->send(Messages::ServiceWorkerClientFetch::DidNotHandle { }, fetchIdentifier); 202 auto* registration = server().getRegistration(worker->registrationKey()); 203 if (registration && registration->shouldSoftUpdate(options)) 204 registration->softUpdate(); 205 return; 206 } 207 200 208 if (worker->state() == ServiceWorkerState::Activating) { 201 209 worker->whenActivated(WTFMove(runServerWorkerAndStartFetch)); -
trunk/Source/WebKit/NetworkProcess/ServiceWorker/WebSWServerToContextConnection.cpp
r245299 r249287 79 79 { 80 80 send(Messages::WebSWContextManagerConnection::FireActivateEvent(serviceWorkerIdentifier)); 81 } 82 83 void WebSWServerToContextConnection::softUpdate(ServiceWorkerIdentifier serviceWorkerIdentifier) 84 { 85 send(Messages::WebSWContextManagerConnection::SoftUpdate(serviceWorkerIdentifier)); 81 86 } 82 87 -
trunk/Source/WebKit/NetworkProcess/ServiceWorker/WebSWServerToContextConnection.h
r245299 r249287 87 87 void fireInstallEvent(WebCore::ServiceWorkerIdentifier) final; 88 88 void fireActivateEvent(WebCore::ServiceWorkerIdentifier) final; 89 void softUpdate(WebCore::ServiceWorkerIdentifier) final; 89 90 void terminateWorker(WebCore::ServiceWorkerIdentifier) final; 90 91 void syncTerminateWorker(WebCore::ServiceWorkerIdentifier) final; -
trunk/Source/WebKit/NetworkProcess/ServiceWorker/WebSWServerToContextConnection.messages.in
r239427 r249287 27 27 28 28 ScriptContextFailedToStart(Optional<WebCore::ServiceWorkerJobDataIdentifier> jobDataIdentifier, WebCore::ServiceWorkerIdentifier serviceWorkerIdentifier, String message); 29 ScriptContextStarted(Optional<WebCore::ServiceWorkerJobDataIdentifier> jobDataIdentifier, WebCore::ServiceWorkerIdentifier serviceWorkerIdentifier );29 ScriptContextStarted(Optional<WebCore::ServiceWorkerJobDataIdentifier> jobDataIdentifier, WebCore::ServiceWorkerIdentifier serviceWorkerIdentifier, bool doesHandleFetch); 30 30 DidFinishInstall(Optional<WebCore::ServiceWorkerJobDataIdentifier> jobDataIdentifier, WebCore::ServiceWorkerIdentifier serviceWorkerIdentifier, bool wasSuccessful); 31 31 DidFinishActivation(WebCore::ServiceWorkerIdentifier identifier); -
trunk/Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.cpp
r248846 r249287 176 176 } 177 177 178 void WebSWContextManagerConnection::serviceWorkerStartedWithMessage(Optional<ServiceWorkerJobDataIdentifier> jobDataIdentifier, ServiceWorkerIdentifier serviceWorkerIdentifier, const String& exceptionMessage) 179 { 180 if (exceptionMessage.isEmpty()) 181 m_connectionToNetworkProcess->send(Messages::WebSWServerToContextConnection::ScriptContextStarted(jobDataIdentifier, serviceWorkerIdentifier), 0); 182 else 183 m_connectionToNetworkProcess->send(Messages::WebSWServerToContextConnection::ScriptContextFailedToStart(jobDataIdentifier, serviceWorkerIdentifier, exceptionMessage), 0); 178 void WebSWContextManagerConnection::serviceWorkerStarted(Optional<ServiceWorkerJobDataIdentifier> jobDataIdentifier, ServiceWorkerIdentifier serviceWorkerIdentifier, bool doesHandleFetch) 179 { 180 m_connectionToNetworkProcess->send(Messages::WebSWServerToContextConnection::ScriptContextStarted { jobDataIdentifier, serviceWorkerIdentifier, doesHandleFetch }, 0); 181 } 182 183 void WebSWContextManagerConnection::serviceWorkerFailedToStart(Optional<ServiceWorkerJobDataIdentifier> jobDataIdentifier, ServiceWorkerIdentifier serviceWorkerIdentifier, const String& exceptionMessage) 184 { 185 m_connectionToNetworkProcess->send(Messages::WebSWServerToContextConnection::ScriptContextFailedToStart { jobDataIdentifier, serviceWorkerIdentifier, exceptionMessage }, 0); 184 186 } 185 187 … … 262 264 } 263 265 266 void WebSWContextManagerConnection::softUpdate(WebCore::ServiceWorkerIdentifier identifier) 267 { 268 SWContextManager::singleton().softUpdate(identifier); 269 } 270 264 271 void WebSWContextManagerConnection::terminateWorker(ServiceWorkerIdentifier identifier) 265 272 { -
trunk/Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.h
r245796 r249287 77 77 78 78 // IPC messages. 79 void serviceWorkerStartedWithMessage(Optional<WebCore::ServiceWorkerJobDataIdentifier>, WebCore::ServiceWorkerIdentifier, const String& exceptionMessage) final; 79 void serviceWorkerStarted(Optional<WebCore::ServiceWorkerJobDataIdentifier>, WebCore::ServiceWorkerIdentifier, bool doesHandleFetch) final; 80 void serviceWorkerFailedToStart(Optional<WebCore::ServiceWorkerJobDataIdentifier>, WebCore::ServiceWorkerIdentifier, const String& exceptionMessage) final; 80 81 void installServiceWorker(const WebCore::ServiceWorkerContextData&, PAL::SessionID, String&& userAgent); 81 82 void startFetch(WebCore::SWServerConnectionIdentifier, WebCore::ServiceWorkerIdentifier, WebCore::FetchIdentifier, WebCore::ResourceRequest&&, WebCore::FetchOptions&&, IPC::FormDataReference&&, String&& referrer); … … 85 86 void fireInstallEvent(WebCore::ServiceWorkerIdentifier); 86 87 void fireActivateEvent(WebCore::ServiceWorkerIdentifier); 88 void softUpdate(WebCore::ServiceWorkerIdentifier); 87 89 void terminateWorker(WebCore::ServiceWorkerIdentifier); 88 90 void syncTerminateWorker(WebCore::ServiceWorkerIdentifier, Messages::WebSWContextManagerConnection::SyncTerminateWorker::DelayedReply&&); -
trunk/Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.messages.in
r245299 r249287 31 31 FireInstallEvent(WebCore::ServiceWorkerIdentifier identifier) 32 32 FireActivateEvent(WebCore::ServiceWorkerIdentifier identifier) 33 SoftUpdate(WebCore::ServiceWorkerIdentifier identifier) 33 34 TerminateWorker(WebCore::ServiceWorkerIdentifier identifier) 34 35 SyncTerminateWorker(WebCore::ServiceWorkerIdentifier identifier) -> () Synchronous
Note:
See TracChangeset
for help on using the changeset viewer.