Bug 248458 - [Curl] Register/Unregister NetworkDataTaskCurl to NetworkSession
Summary: [Curl] Register/Unregister NetworkDataTaskCurl to NetworkSession
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Platform (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2022-11-28 23:42 PST by Kenji Shukuwa
Modified: 2022-11-29 16:25 PST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Comment 1 Kenji Shukuwa 2022-11-28 23:50:13 PST
It seems that by registering to the NetworkSession, NetworkDataTask::invalidateAndCancel is called 
when the WebsiteDataStore is destroyed.

https://github.com/WebKit/WebKit/blob/main/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp#L170-L171
---
WebsiteDataStore::~WebsiteDataStore()
{
    if (m_networkProcess)
        m_networkProcess->removeSession(*this);
---

https://github.com/WebKit/WebKit/blob/main/Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp#L1427-L1428
---
void NetworkProcessProxy::removeSession(WebsiteDataStore& websiteDataStore)
{
    if (canSendMessage())
        send(Messages::NetworkProcess::DestroySession { websiteDataStore.sessionID() }, 0);
---

https://github.com/WebKit/WebKit/blob/main/Source/WebKit/NetworkProcess/NetworkProcess.cpp#L560
---
void NetworkProcess::destroySession(PAL::SessionID sessionID)
{
    if (auto session = m_networkSessions.take(sessionID)) {
        session->invalidateAndCancel();
---

https://github.com/WebKit/WebKit/blob/main/Source/WebKit/NetworkProcess/NetworkSession.cpp#L215-L216
---
void NetworkSession::invalidateAndCancel()
{
    for (auto& task : m_dataTaskSet)
        task.invalidateAndCancel();
---
Comment 2 Kenji Shukuwa 2022-11-28 23:59:11 PST
Pull request: https://github.com/WebKit/WebKit/pull/6910
Comment 3 EWS 2022-11-29 16:24:22 PST
Committed 257150@main (8ba585344147): <https://commits.webkit.org/257150@main>

Reviewed commits have been landed. Closing PR #6910 and removing active labels.
Comment 4 Radar WebKit Bug Importer 2022-11-29 16:25:18 PST
<rdar://problem/102789640>