Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 0d58b764f34b86ecf520ac7954b7aa1ded15cc5e
      
https://github.com/WebKit/WebKit/commit/0d58b764f34b86ecf520ac7954b7aa1ded15cc5e
  Author: Alex Christensen <[email protected]>
  Date:   2026-09-03 (Thu, 03 Sep 2026)

  Changed paths:
    A LayoutTests/http/tests/cache/memory-cache-partition-drift-expected.txt
    A LayoutTests/http/tests/cache/memory-cache-partition-drift.html
    A 
LayoutTests/http/tests/cache/resources/memory-cache-partition-drift-frame.html
    A LayoutTests/http/tests/cache/resources/no-store-font.py
    M Source/WebCore/loader/FrameLoader.h
    M Source/WebCore/page/LocalFrame.cpp
    M Source/WebKit/WebProcess/WebPage/WebPage.cpp
    M Tools/TestWebKitAPI/SourcesCocoa.txt
    A Tools/TestWebKitAPI/Tests/WebKit/WKWebView/MemoryCachePartitioning.mm
    M Tools/WebKitTestRunner/TestController.cpp
    M Tools/WebKitTestRunner/TestOptions.cpp
    M Tools/WebKitTestRunner/TestOptions.h

  Log Message:
  -----------
  Fix crash in MemoryCache::add after 315967@main
https://bugs.webkit.org/show_bug.cgi?id=323053
rdar://182493844

Reviewed by Chris Dumez.

_WKUserStyleSheet can be used to load a font very early in the document 
creation process.
It was loading before the firstPartyForCookies was set, then later the 
firstPartyForCookies
was being updated, which caused inconsistent state in the memory cache which 
hit the
release assertion.

This adds a missing call to updateFirstPartyForCookies to update earlier if 
necessary.
The test also hit the debug assertion in FrameLoader::applyUserAgentIfNeeded 
because
the user agent was null.  I move the user agent setting to earlier in the 
WebPage constructor
to avoid calling initWithCoreMainFrame with a null user agent, which caused the 
debug assert.

I added a layout test that hits the MemoryCache issue, but it doesn't hit the 
user agent
issue, so I also added an API test that does.

Tests: Tools/TestWebKitAPI/Tests/WebKit/WKWebView/MemoryCachePartitioning.mm
       Tools/TestWebKitAPI/Tests/WebKit/WKWebView/SecurityFlags.mm
       http/tests/cache/memory-cache-partition-drift.html

* Source/WebCore/loader/FrameLoader.h:
* Source/WebCore/page/LocalFrame.cpp:
(WebCore::LocalFrame::setDocument):
* Source/WebKit/WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::WebPage):
(WebKit::m_allowsImmersiveEnvironments):
* Tools/TestWebKitAPI/SourcesCocoa.txt:
* Tools/TestWebKitAPI/Tests/WebKit/WKWebView/MemoryCachePartitioning.mm: Added.
(TestWebKitAPI::TEST(MemoryCache, FontFromUserStyleSheetKeepsCachePartition)):
* LayoutTests/http/tests/cache/memory-cache-partition-drift-expected.txt: Added.
* LayoutTests/http/tests/cache/memory-cache-partition-drift.html: Added.
* 
LayoutTests/http/tests/cache/resources/memory-cache-partition-drift-frame.html: 
Added.
* LayoutTests/http/tests/cache/resources/no-store-font.py: Added.
* Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* Tools/WebKitTestRunner/TestController.cpp:
(WTR::TestController::resetPreferencesToConsistentValues):
* Tools/WebKitTestRunner/TestOptions.cpp:
(WTR::TestOptions::defaults):
(WTR::TestOptions::keyTypeMapping):
* Tools/WebKitTestRunner/TestOptions.h:
(WTR::TestOptions::blockThirdPartyStorage const):

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



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

Reply via email to