[webkit-changes] [WebKit/WebKit] 08f56b: Add CookieChangeListener base class and make WebCo...

Rupin Mittal noreply at github.com
Thu Aug 3 21:52:40 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 08f56b30694ca5a973f159ad51c86a6b294fcbce
      https://github.com/WebKit/WebKit/commit/08f56b30694ca5a973f159ad51c86a6b294fcbce
  Author: Rupin Mittal <rupin at apple.com>
  Date:   2023-08-03 (Thu, 03 Aug 2023)

  Changed paths:
    M Source/WebCore/Headers.cmake
    M Source/WebCore/WebCore.xcodeproj/project.pbxproj
    A Source/WebCore/loader/CookieChangeListener.h
    M Source/WebCore/loader/CookieJar.cpp
    M Source/WebCore/loader/CookieJar.h
    M Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.cpp
    M Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.h
    M Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.messages.in
    M Source/WebKit/WebProcess/Network/NetworkProcessConnection.cpp
    M Source/WebKit/WebProcess/Network/NetworkProcessConnection.h
    M Source/WebKit/WebProcess/WebPage/WebCookieCache.cpp
    M Source/WebKit/WebProcess/WebPage/WebCookieCache.h
    M Source/WebKit/WebProcess/WebPage/WebCookieJar.cpp
    M Source/WebKit/WebProcess/WebPage/WebCookieJar.h

  Log Message:
  -----------
  Add CookieChangeListener base class and make WebCookieCache a CookieChangeListener
https://bugs.webkit.org/show_bug.cgi?id=259710

Reviewed by Chris Dumez.

This patch is a step towards implementing the notifications upon
changes in cookies part of the new Cookie Store API. We would like
the CookieStore to listen for changes in cookies. So we add a
CookieChangeListener abstract base class which requires subclasses
to define what should happen when a cookie is added or deleted.

Currently, we have a WebCookieCache in the Web Process which listens
to updates in cookies (per host) from the Network Process. It sends
an IPC to NetworkConnectionToWebProcess to subscribe to cookie-update
notifications. When a change happends, NetworkConnectionToWebProcess
sends an IPC with the update to WebCookieaJar, which notifies the
WebCookieCache.

The new design is that: WebCookieCache is a subclass of
CookieChangeListener (so it specifies what to do on cookie add/delete).
As before, when it receives a request to obtain cookies for a host and
it's the first request for this host, WebCookieCache will subscribe to
listen to updates. Except, instead of directly sending an IPC to the
NetworkProcess, it will register itself as a listener with the
WebCookieJar. The WebCookieJar will maintain a map from hosts to their
listeners. The WebCookieJar will send an IPC to the Network Process
to subscribe the listener. On updates, the WebCookieJar will be sent
an IPC and it will notify the relevant listeners for that host. When
the WebCookieCache wants to unsubscribe to notifications for a certain
host, it will tell the WebCookieJar, which will send the IPC to the
Network Process to unsubscribe the listener. It will also update it's
map accordingly.

A future patch will make the CookieStore a CookieChangeListener too.

* Source/WebCore/Headers.cmake:
* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
* Source/WebCore/loader/CookieChangeListener.h: Copied from Source/WebKit/WebProcess/WebPage/WebCookieCache.h.
(WebCore::CookieChangeListener::~CookieChangeListener):
* Source/WebCore/loader/CookieJar.cpp:
(WebCore::CookieJar::addChangeListener):
(WebCore::CookieJar::removeChangeListener):
* Source/WebCore/loader/CookieJar.h:
* Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.cpp:
(WebKit::NetworkConnectionToWebProcess::domCookiesForHost):
(WebKit::NetworkConnectionToWebProcess::subscribeToCookieChangeNotifications):
(WebKit::NetworkConnectionToWebProcess::unsubscribeFromCookieChangeNotifications):
* Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.h:
* Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.messages.in:
* Source/WebKit/WebProcess/Network/NetworkProcessConnection.cpp:
(WebKit::NetworkProcessConnection::cookiesAdded):
(WebKit::NetworkProcessConnection::cookiesDeleted):
* Source/WebKit/WebProcess/Network/NetworkProcessConnection.h:
* Source/WebKit/WebProcess/WebPage/WebCookieCache.cpp:
(WebKit::WebCookieCache::cookiesForDOM):
(WebKit::WebCookieCache::cookiesAdded):
(WebKit::WebCookieCache::clear):
(WebKit::WebCookieCache::clearForHost):
* Source/WebKit/WebProcess/WebPage/WebCookieCache.h:
* Source/WebKit/WebProcess/WebPage/WebCookieJar.cpp:
(WebKit::WebCookieJar::cookiesAdded):
(WebKit::WebCookieJar::cookiesDeleted):
(WebKit::WebCookieJar::addChangeListener):
(WebKit::WebCookieJar::removeChangeListener):
* Source/WebKit/WebProcess/WebPage/WebCookieJar.h:

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




More information about the webkit-changes mailing list