Skip to content

[Site Isolation] Clear CORS preflight cache between tests#63637

Merged
webkit-commit-queue merged 1 commit into
WebKit:mainfrom
rniwa:fix313356-clear-cors-preflight-cache-between-tests
Apr 27, 2026
Merged

[Site Isolation] Clear CORS preflight cache between tests#63637
webkit-commit-queue merged 1 commit into
WebKit:mainfrom
rniwa:fix313356-clear-cors-preflight-cache-between-tests

Conversation

@rniwa
Copy link
Copy Markdown
Member

@rniwa rniwa commented Apr 26, 2026

c5b4561

[Site Isolation] Clear CORS preflight cache between tests
https://bugs.webkit.org/show_bug.cgi?id=313356

Reviewed by Anne van Kesteren.

Three tests were failing under site isolation because WebKitTestRunner does not clear the CORS preflight cache
in the network process between each test, meaning that CORS preflight from one test bleeds into another.

Added a new mechanism to clear CORS preflight cache for testing purposes and calling it in
TestController::resetStateToConsistentValues.

Co-authored with Claude.

Tests: http/tests/xmlhttprequest/access-control-basic-allow-preflight-cache-invalidation-by-header.html
       http/tests/xmlhttprequest/access-control-basic-allow-preflight-cache-invalidation-by-method.html
       http/tests/xmlhttprequest/access-control-basic-allow-preflight-cache.html

* LayoutTests/platform/ios-site-isolation/TestExpectations:
* LayoutTests/platform/mac-site-isolation/TestExpectations:
* Source/WebKit/NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::clearCrossOriginPreflightResultCacheForTesting):
* Source/WebKit/NetworkProcess/NetworkProcess.h:
* Source/WebKit/NetworkProcess/NetworkProcess.messages.in:
* Source/WebKit/UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
(WKWebsiteDataStoreClearCrossOriginPreflightResultCacheForTesting):
* Source/WebKit/UIProcess/API/C/WKWebsiteDataStoreRef.h:
* Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp:
(WebKit::WebsiteDataStore::clearCrossOriginPreflightResultCacheForTesting):
* Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h:
* Tools/WebKitTestRunner/TestController.cpp:
(WTR::TestController::resetStateToConsistentValues):

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

4aee8a7

Misc iOS, visionOS, tvOS & watchOS macOS Linux Windows Apple Internal
✅ 🧪 style ✅ 🛠 ios ✅ 🛠 mac ✅ 🛠 wpe ✅ 🛠 win ✅ 🛠 ios-apple
✅ 🧪 bindings ✅ 🛠 ios-sim ✅ 🛠 mac-AS-debug ✅ 🧪 wpe-wk2 ✅ 🧪 win-tests ✅ 🛠 mac-apple
✅ 🧪 webkitperl ✅ 🧪 ios-wk2 ✅ 🧪 api-mac ✅ 🧪 api-wpe ✅ 🛠 vision-apple
✅ 🧪 ios-wk2-wpt ✅ 🧪 api-mac-debug ✅ 🛠 gtk3-libwebrtc
✅ 🧪 api-ios ✅ 🧪 mac-wk1 ✅ 🛠 gtk
✅ 🛠 ios-safer-cpp ✅ 🧪 mac-wk2 ✅ 🧪 gtk-wk2
✅ 🛠 vision ✅ 🧪 mac-AS-debug-wk2 ✅ 🧪 api-gtk
✅ 🛠 vision-sim ✅ 🧪 mac-wk2-stress ✅ 🛠 playstation
✅ 🛠 🧪 unsafe-merge ✅ 🧪 vision-wk2 ✅ 🧪 mac-intel-wk2
✅ 🛠 tv ✅ 🛠 mac-safer-cpp
✅ 🛠 tv-sim
✅ 🛠 watch
✅ 🛠 watch-sim

@rniwa rniwa self-assigned this Apr 26, 2026
@rniwa rniwa requested review from JonWBedard and cdumez as code owners April 26, 2026 20:07
@rniwa rniwa added the New Bugs Unclassified bugs are placed in this component until the correct component can be determined. label Apr 26, 2026
Copy link
Copy Markdown
Contributor

@annevk annevk left a comment

Choose a reason for hiding this comment

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

This looks okay, modulo that I'm not 100% sure on the rules for API additions.

@webkit-ews-buildbot
Copy link
Copy Markdown
Collaborator

macOS Safer C++ Build #97414 (54b0ae6)

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

@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Apr 26, 2026
@webkit-ews-buildbot
Copy link
Copy Markdown
Collaborator

iOS Safer C++ Build #15892 (54b0ae6)

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

@rniwa rniwa removed the merging-blocked Applied to prevent a change from being merged label Apr 26, 2026
@rniwa rniwa force-pushed the fix313356-clear-cors-preflight-cache-between-tests branch from 54b0ae6 to 4aee8a7 Compare April 26, 2026 21:28
@rniwa rniwa added the unsafe-merge-queue Applied to send a pull request to merge-queue, but skip building and testing label Apr 27, 2026
https://bugs.webkit.org/show_bug.cgi?id=313356

Reviewed by Anne van Kesteren.

Three tests were failing under site isolation because WebKitTestRunner does not clear the CORS preflight cache
in the network process between each test, meaning that CORS preflight from one test bleeds into another.

Added a new mechanism to clear CORS preflight cache for testing purposes and calling it in
TestController::resetStateToConsistentValues.

Co-authored with Claude.

Tests: http/tests/xmlhttprequest/access-control-basic-allow-preflight-cache-invalidation-by-header.html
       http/tests/xmlhttprequest/access-control-basic-allow-preflight-cache-invalidation-by-method.html
       http/tests/xmlhttprequest/access-control-basic-allow-preflight-cache.html

* LayoutTests/platform/ios-site-isolation/TestExpectations:
* LayoutTests/platform/mac-site-isolation/TestExpectations:
* Source/WebKit/NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::clearCrossOriginPreflightResultCacheForTesting):
* Source/WebKit/NetworkProcess/NetworkProcess.h:
* Source/WebKit/NetworkProcess/NetworkProcess.messages.in:
* Source/WebKit/UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
(WKWebsiteDataStoreClearCrossOriginPreflightResultCacheForTesting):
* Source/WebKit/UIProcess/API/C/WKWebsiteDataStoreRef.h:
* Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp:
(WebKit::WebsiteDataStore::clearCrossOriginPreflightResultCacheForTesting):
* Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h:
* Tools/WebKitTestRunner/TestController.cpp:
(WTR::TestController::resetStateToConsistentValues):

Canonical link: https://commits.webkit.org/312058@main
@webkit-commit-queue webkit-commit-queue force-pushed the fix313356-clear-cors-preflight-cache-between-tests branch from 4aee8a7 to c5b4561 Compare April 27, 2026 00:59
@webkit-commit-queue
Copy link
Copy Markdown
Collaborator

Committed 312058@main (c5b4561): https://commits.webkit.org/312058@main

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

@webkit-commit-queue webkit-commit-queue merged commit c5b4561 into WebKit:main Apr 27, 2026
@webkit-commit-queue webkit-commit-queue removed the unsafe-merge-queue Applied to send a pull request to merge-queue, but skip building and testing label Apr 27, 2026
@rniwa rniwa deleted the fix313356-clear-cors-preflight-cache-between-tests branch April 27, 2026 04:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

New Bugs Unclassified bugs are placed in this component until the correct component can be determined.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants