Skip to content

Address safer CPP warnings in NetworkTaskCocoa #47065

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

csaavedra
Copy link
Member

@csaavedra csaavedra commented Jun 23, 2025

3773fb9

Address safer CPP warnings in NetworkTaskCocoa
https://bugs.webkit.org/show_bug.cgi?id=294845

Reviewed by Chris Dumez.

* Source/WebKit/NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
(WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa):
* Source/WebKit/NetworkProcess/cocoa/NetworkTaskCocoa.h:
* Source/WebKit/NetworkProcess/cocoa/NetworkTaskCocoa.mm:
(WebKit::NetworkTaskCocoa::protectedTask const):
(WebKit::NetworkTaskCocoa::checkedNetworkSession const):
(WebKit::NetworkTaskCocoa::shouldApplyCookiePolicyForThirdPartyCloaking const):
(WebKit::NetworkTaskCocoa::setCookieTransformForFirstPartyRequest):
(WebKit::NetworkTaskCocoa::blockCookies):
(WebKit::NetworkTaskCocoa::unblockCookies):
(WebKit::NetworkTaskCocoa::requestThirdPartyCookieBlockingDecision const):
(WebKit::NetworkTaskCocoa::updateTaskWithFirstPartyForSameSiteCookies):
(WebKit::NetworkTaskCocoa::willPerformHTTPRedirection):
(WebKit::NetworkTaskCocoa::shouldRelaxThirdPartyCookieBlocking const):
* Source/WebKit/SaferCPPExpectations/UncheckedCallArgsCheckerExpectations:
* Source/WebKit/SaferCPPExpectations/UnretainedCallArgsCheckerExpectations:

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

36c4441

Misc iOS, visionOS, tvOS & watchOS macOS Linux Windows
✅ 🧪 style ✅ 🛠 ios ✅ 🛠 mac ✅ 🛠 wpe ✅ 🛠 win
✅ 🛠 ios-sim ✅ 🛠 mac-AS-debug ✅ 🧪 wpe-wk2 ⏳ 🧪 win-tests
✅ 🧪 webkitperl ✅ 🧪 ios-wk2 ✅ 🧪 api-mac ✅ 🧪 api-wpe
✅ 🧪 ios-wk2-wpt ✅ 🛠 wpe-cairo
✅ 🧪 api-ios ✅ 🧪 mac-wk2 ✅ 🛠 gtk
✅ 🛠 vision ✅ 🧪 mac-AS-debug-wk2 ✅ 🧪 gtk-wk2
✅ 🛠 vision-sim ✅ 🧪 mac-wk2-stress ✅ 🧪 api-gtk
✅ 🛠 🧪 merge ✅ 🧪 vision-wk2 ✅ 🧪 mac-intel-wk2 ✅ 🛠 playstation
✅ 🛠 tv ✅ 🛠 mac-safer-cpp
✅ 🛠 tv-sim
✅ 🛠 watch
✅ 🛠 watch-sim

@csaavedra csaavedra requested a review from cdumez as a code owner June 23, 2025 15:31
@csaavedra csaavedra self-assigned this Jun 23, 2025
@csaavedra csaavedra added the WebKit Misc. For miscellaneous bugs in the WebKit framework (and not JavaScriptCore or WebCore). label Jun 23, 2025
@webkit-ews-buildbot
Copy link
Collaborator

Safer C++ Build #41271 (194da3f)

❌ Found 2 failing files with 10 issues. Please address these issues before landing. See WebKit Guidelines for Safer C++ Programming.
(cc @rniwa)

@csaavedra csaavedra force-pushed the eng/Address-safer-CPP-warnings-in-NetworkTaskCocoa branch from 194da3f to 899ae1e Compare June 23, 2025 16:59
@webkit-ews-buildbot
Copy link
Collaborator

Safer C++ Build #41285 (899ae1e)

❌ Found 2 failing files with 10 issues. Please address these issues before landing. See WebKit Guidelines for Safer C++ Programming.
(cc @rniwa)

@csaavedra csaavedra force-pushed the eng/Address-safer-CPP-warnings-in-NetworkTaskCocoa branch from 899ae1e to e57cc1a Compare June 24, 2025 15:03
@webkit-ews-buildbot
Copy link
Collaborator

Safer C++ Build #41396 (e57cc1a)

❌ Found 1 failing file with 1 issue. Please address these issues before landing. See WebKit Guidelines for Safer C++ Programming.
(cc @rniwa)

@csaavedra csaavedra force-pushed the eng/Address-safer-CPP-warnings-in-NetworkTaskCocoa branch from e57cc1a to 02f9e0d Compare June 24, 2025 19:25
@csaavedra
Copy link
Member Author

@cdumez made an additional change to fix the remaining warning, please take a look again.

@csaavedra csaavedra requested a review from cdumez June 24, 2025 19:26
@@ -67,7 +78,10 @@ static bool shouldCapCookieExpiryForThirdPartyIPAddress(const WebCore::IPAddress

bool NetworkTaskCocoa::shouldApplyCookiePolicyForThirdPartyCloaking() const
{
return m_networkSession->networkStorageSession() && m_networkSession->networkStorageSession()->trackingPreventionEnabled();
if (CheckedPtr networkStorageSession = checkedNetworkSession()->networkStorageSession())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would have written:

CheckedPtr networkStorageSession = checkedNetworkSession()->networkStorageSession();
return networkStorageSession && networkStorageSession->trackingPreventionEnabled();

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, will update.

@csaavedra csaavedra force-pushed the eng/Address-safer-CPP-warnings-in-NetworkTaskCocoa branch from 02f9e0d to 36c4441 Compare June 24, 2025 20:37
@csaavedra csaavedra added the safe-merge-queue Applied to automatically send a pull-request to merge-queue after passing EWS checks label Jun 24, 2025
@webkit-ews-buildbot webkit-ews-buildbot added merge-queue Applied to send a pull request to merge-queue and removed safe-merge-queue Applied to automatically send a pull-request to merge-queue after passing EWS checks labels Jun 25, 2025
@webkit-ews-buildbot
Copy link
Collaborator

Safe-Merge-Queue: Build #61322.

@webkit-commit-queue webkit-commit-queue force-pushed the eng/Address-safer-CPP-warnings-in-NetworkTaskCocoa branch from 36c4441 to a0b7e27 Compare June 25, 2025 00:49
https://bugs.webkit.org/show_bug.cgi?id=294845

Reviewed by Chris Dumez.

* Source/WebKit/NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
(WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa):
* Source/WebKit/NetworkProcess/cocoa/NetworkTaskCocoa.h:
* Source/WebKit/NetworkProcess/cocoa/NetworkTaskCocoa.mm:
(WebKit::NetworkTaskCocoa::protectedTask const):
(WebKit::NetworkTaskCocoa::checkedNetworkSession const):
(WebKit::NetworkTaskCocoa::shouldApplyCookiePolicyForThirdPartyCloaking const):
(WebKit::NetworkTaskCocoa::setCookieTransformForFirstPartyRequest):
(WebKit::NetworkTaskCocoa::blockCookies):
(WebKit::NetworkTaskCocoa::unblockCookies):
(WebKit::NetworkTaskCocoa::requestThirdPartyCookieBlockingDecision const):
(WebKit::NetworkTaskCocoa::updateTaskWithFirstPartyForSameSiteCookies):
(WebKit::NetworkTaskCocoa::willPerformHTTPRedirection):
(WebKit::NetworkTaskCocoa::shouldRelaxThirdPartyCookieBlocking const):
* Source/WebKit/SaferCPPExpectations/UncheckedCallArgsCheckerExpectations:
* Source/WebKit/SaferCPPExpectations/UnretainedCallArgsCheckerExpectations:

Canonical link: https://commits.webkit.org/296591@main
@webkit-commit-queue webkit-commit-queue force-pushed the eng/Address-safer-CPP-warnings-in-NetworkTaskCocoa branch from a0b7e27 to 3773fb9 Compare June 25, 2025 00:51
@webkit-commit-queue
Copy link
Collaborator

Committed 296591@main (3773fb9): https://commits.webkit.org/296591@main

Reviewed commits have been landed. Closing PR #47065 and removing active labels.

@webkit-commit-queue webkit-commit-queue merged commit 3773fb9 into WebKit:main Jun 25, 2025
@webkit-commit-queue webkit-commit-queue removed the merge-queue Applied to send a pull request to merge-queue label Jun 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
WebKit Misc. For miscellaneous bugs in the WebKit framework (and not JavaScriptCore or WebCore).
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants