Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: cf1df9607a4917b6a6e98c3adefe076eb4e0f774
      
https://github.com/WebKit/WebKit/commit/cf1df9607a4917b6a6e98c3adefe076eb4e0f774
  Author: Ryosuke Niwa <[email protected]>
  Date:   2026-05-01 (Fri, 01 May 2026)

  Changed paths:
    A LayoutTests/http/tests/storage/resources/storage-map-leaking-window.html
    M LayoutTests/http/tests/storage/storage-map-leaking.html
    M Source/WebCore/storage/StorageNamespaceProvider.cpp
    M Source/WebCore/storage/StorageNamespaceProvider.h
    M Source/WebKit/UIProcess/API/C/WKPage.cpp
    M Source/WebKit/UIProcess/API/C/WKPagePrivate.h
    M Source/WebKit/UIProcess/WebPageProxyTesting.cpp
    M Source/WebKit/UIProcess/WebPageProxyTesting.h
    M Source/WebKit/WebProcess/WebProcess.cpp
    M Source/WebKit/WebProcess/WebProcess.h
    M Source/WebKit/WebProcess/WebProcess.messages.in
    M Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl
    M Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp
    M Tools/WebKitTestRunner/InjectedBundle/TestRunner.h
    M Tools/WebKitTestRunner/TestController.cpp

  Log Message:
  -----------
  [Site Isolation] http/tests/storage/storage-map-leaking.html
https://bugs.webkit.org/show_bug.cgi?id=313794

Reviewed by Sihui Liu.

Under site isolation, cross-origin iframes run in separate web processes. The 
existing test
used internals.storageAreaMapCount, which only counted StorageAreaMap objects 
in the current
process. When the opened window's cross-origin iframes each got their own 
process, the main
test process couldn't see their StorageAreaMaps, so it couldn't detect whether 
they leaked.

This PR replaces internals.storageAreaMapCount with 
testRunner.storageAreaMapCount that
sends GetStorageAreaMapCountForTesting IPC to every web process, collects each 
process's
local StorageAreaMap count via 
StorageNamespaceProvider::localStorageAreaMapCountForTesting(),
and aggregates the results using a CallbackAggregator in the UI process. This 
gives the test
a global count across all web processes, making it work correctly under site 
isolation.

We can't get this information from the network process because StorageAreaMap 
is a proxy
object in web-process-side and lives in StorageNamespaceImpl::m_storageAreaMaps 
within each
web process. The network process has StorageArea objects (the server side), but 
those don't
correspond 1:1 with StorageAreaMap instances and don't reflect the leak we're 
testing for.
A StorageAreaMap leak means the web process is holding onto a proxy it should 
have released
- that's only observable from the web process itself.

In addition, this PR fixes a bug in the test that some of its iframes was 
pointing to
http://127.0.0.1:8443, but port 8443 is HTTPS-only in the test server, so that 
iframe never
loaded and window.onload never fired, causing the test to time out.

Test: http/tests/storage/storage-map-leaking.html

* LayoutTests/http/tests/storage/resources/storage-map-leaking-window.html: 
Added.
* LayoutTests/http/tests/storage/storage-map-leaking.html:
* Source/WebCore/storage/StorageNamespaceProvider.cpp:
(WebCore::StorageNamespaceProvider::localStorageAreaMapCountForTesting const):
* Source/WebCore/storage/StorageNamespaceProvider.h:
* Source/WebKit/UIProcess/API/C/WKPage.cpp:
(WKPageGetStorageAreaMapCountForTesting):
* Source/WebKit/UIProcess/API/C/WKPagePrivate.h:
* Source/WebKit/UIProcess/WebPageProxyTesting.cpp:
(WebKit::WebPageProxyTesting::storageAreaMapCount):
* Source/WebKit/UIProcess/WebPageProxyTesting.h:
* Source/WebKit/WebProcess/WebProcess.cpp:
(WebKit::WebProcess::getStorageAreaMapCountForTesting):
* Source/WebKit/WebProcess/WebProcess.h:
* Source/WebKit/WebProcess/WebProcess.messages.in:
* Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
* Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp:
(WTR::TestRunner::storageAreaMapCount):
* Tools/WebKitTestRunner/InjectedBundle/TestRunner.h:
* Tools/WebKitTestRunner/TestController.cpp:

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



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

Reply via email to