[webkit-changes] [WebKit/WebKit] f0bfc4: Navigation preload ready message is lost if the IP...

youennf noreply at github.com
Thu Aug 29 08:05:35 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: f0bfc40dac3c35cdced3162988f7f8cc9eba0228
      https://github.com/WebKit/WebKit/commit/f0bfc40dac3c35cdced3162988f7f8cc9eba0228
  Author: Youenn Fablet <youenn at apple.com>
  Date:   2024-08-29 (Thu, 29 Aug 2024)

  Changed paths:
    A LayoutTests/http/wpt/service-workers/navigation-preload-without-worker-connection.https-expected.txt
    A LayoutTests/http/wpt/service-workers/navigation-preload-without-worker-connection.https.html
    A LayoutTests/http/wpt/service-workers/simple-fetch-service-worker-preload-worker.js
    M Source/WebKit/NetworkProcess/ServiceWorker/ServiceWorkerFetchTask.cpp
    M Source/WebKit/NetworkProcess/ServiceWorker/ServiceWorkerFetchTask.h
    M Source/WebKit/NetworkProcess/ServiceWorker/ServiceWorkerNavigationPreloader.cpp
    M Source/WebKit/NetworkProcess/ServiceWorker/ServiceWorkerNavigationPreloader.h

  Log Message:
  -----------
  Navigation preload ready message is lost if the IPC connection to the worker context is not already created
https://bugs.webkit.org/show_bug.cgi?id=278789
rdar://134853479

Reviewed by Chris Dumez.

Receiving a navigation preload response in network process may race with establishing the IPC connection to the service worker process.
If the former happens before the latter, we would never tell the service worker process that the navigation preload response is ready.

To prevent this, we store a boolean in ServiceWorkerNavigationPreloader telling whether the preload received a response (or a failure).
We send the message if the service worker process connection is available.
Otherwise, we wait for the service worker process connection to become available to send it.
In that case, we make sure to send the navigation preload response ready message after the fetch event messqge.

Covered by the new test, which often hits this issue as the local server can often beat the creation of the service worker process.
.
* LayoutTests/http/wpt/service-workers/navigation-preload-without-worker-connection.https-expected.txt: Added.
* LayoutTests/http/wpt/service-workers/navigation-preload-without-worker-connection.https.html: Added.
* LayoutTests/http/wpt/service-workers/simple-fetch-service-worker-preload-worker.js: Added.
(async event.event.request.url.includes.event.preloadResponse.async return):
* Source/WebKit/NetworkProcess/ServiceWorker/ServiceWorkerFetchTask.cpp:
(WebKit::ServiceWorkerFetchTask::startFetch):
(WebKit::ServiceWorkerFetchTask::loadResponseFromPreloader):
(WebKit::ServiceWorkerFetchTask::preloadResponseIsReady):
* Source/WebKit/NetworkProcess/ServiceWorker/ServiceWorkerFetchTask.h:
* Source/WebKit/NetworkProcess/ServiceWorker/ServiceWorkerNavigationPreloader.cpp:
(WebKit::ServiceWorkerNavigationPreloader::willSendRedirectedRequest):
(WebKit::ServiceWorkerNavigationPreloader::didFinishLoading):
* Source/WebKit/NetworkProcess/ServiceWorker/ServiceWorkerNavigationPreloader.h:

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



To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications


More information about the webkit-changes mailing list