Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 789de687c180affa6a3ba252403720d2c12433a7
      
https://github.com/WebKit/WebKit/commit/789de687c180affa6a3ba252403720d2c12433a7
  Author: Qianlang Chen <[email protected]>
  Date:   2026-09-23 (Wed, 23 Sep 2026)

  Changed paths:
    A 
LayoutTests/http/tests/site-isolation/inspector/network/cross-origin-iframe-get-response-body-memory-cache-expected.txt
    A 
LayoutTests/http/tests/site-isolation/inspector/network/cross-origin-iframe-get-response-body-memory-cache.html
    M 
LayoutTests/http/tests/site-isolation/inspector/network/cross-origin-iframe-network-memory-cache-source-map-url-expected.txt
    M 
LayoutTests/http/tests/site-isolation/inspector/network/cross-origin-iframe-network-memory-cache-source-map-url.html
    A 
LayoutTests/http/tests/site-isolation/inspector/network/get-response-body-after-reload-expected.txt
    A 
LayoutTests/http/tests/site-isolation/inspector/network/get-response-body-after-reload.html
    A 
LayoutTests/http/tests/site-isolation/inspector/network/resources/memory-cache-frame-stylesheet.css
    A 
LayoutTests/http/tests/site-isolation/inspector/network/resources/reload-memory-cached.css
    A 
LayoutTests/http/tests/site-isolation/inspector/network/resources/reload-memory-cached.js
    M 
LayoutTests/http/tests/site-isolation/inspector/network/resources/stylesheet-with-source-map-header-cacheable.py
    M Source/WebKit/WebProcess/Inspector/BackendResourceDataStore.h
    M Source/WebKit/WebProcess/Inspector/FrameNetworkAgentProxy.cpp

  Log Message:
  -----------
  [Site Isolation] Web Inspector: Sources are not available after reloading a 
page
rdar://184277031
https://bugs.webkit.org/show_bug.cgi?id=323032

Reviewed by BJ Burg.

After a reload with the inspector already open, every same-origin
subresource in the Sources tab fails to load its content, and
Network.getResponseBody reports "Missing content of resource for given
requestId". Only a reload shows this: requestContentFromBackend switches
from Page.getResourceContent to Network.getResponseBody once a resource
has a requestIdentifier, and on the initial load the inspector usually
attaches too late for the subresources to have one.

Those subresources come from the memory cache, and a memory cache hit
delivers no body to the inspector:
FrameLoader::loadedResourceFromMemoryCache synthesizes the loader
callbacks with a null buffer, so didReceiveData carries nothing.
InspectorNetworkAgent survives this because NetworkResourcesData keeps a
CachedResource pointer per entry and reads the body out of the cache as
a last resort in getResponseBody. BackendResourceDataStore holds no
WebCore references by design, so it has to copy the body itself.

FrameNetworkAgentProxy::didLoadResourceFromMemoryCache already makes
that copy, but these loads never reach it.
FrameLoader::loadedResourceFromMemoryCache notifies the inspector
directly only while memory cache client calls are disabled, which
Style::PostResolutionCallbackDisabler does for the span of a style
resolution, or when the frame loader client reports memory cache loads,
which WebLocalFrameLoaderClient does not implement. A stylesheet or
script fetched for a <link> or <script> element misses both, so the hit
arrives as synthesized loader callbacks instead.

Make the same copy in didFinishLoading, gated on the entry having ended
up with neither content nor buffered data. Observing that no body
arrived, rather than predicting it from the response source, also covers
the other loads that finish without data, including a 304 revalidation
-- only its content, not the mime type and status patch-up that
InspectorNetworkAgent does for XHR and Fetch in didReceiveResponse,
which still has no Site Isolation equivalent. The resource is found by
URL because this path has no ResourceLoader to ask for its
CachedResource.

Tests: 
http/tests/site-isolation/inspector/network/cross-origin-iframe-get-response-body-memory-cache.html
       
http/tests/site-isolation/inspector/network/get-response-body-after-reload.html

The two new tests cover the two ways a memory cache hit can reach the
inspector under Site Isolation: the reported case, a main frame's own
subresources across a reload, and a cross-origin frame served out of its
own process's cache without a reload.

The same finding corrects an adjacent test.
cross-origin-iframe-network-memory-cache-source-map-url.html said it
covered Network.requestServedFromMemoryCache, but its stylesheet comes
from a <link>, so the event it exercises is Network.loadingFinished. Its
spy also kept a single shared variable while loading one URL twice, so
the cold load's value could satisfy an assertion about the cached load;
it is now keyed by the resource the value was forwarded for. With that
fixed, a second case covers the inline sourceMappingURL comment. Unlike
a SourceMap header, which is captured from the response, that value is
read out of the stylesheet text, so it reaches the frontend for a memory
cache hit only because of the recovery above -- it is the one place the
recovered body is observable without asking for the body itself.

* 
LayoutTests/http/tests/site-isolation/inspector/network/cross-origin-iframe-get-response-body-memory-cache-expected.txt:
 Added.
* 
LayoutTests/http/tests/site-isolation/inspector/network/cross-origin-iframe-get-response-body-memory-cache.html:
 Added.
* 
LayoutTests/http/tests/site-isolation/inspector/network/cross-origin-iframe-network-memory-cache-source-map-url-expected.txt:
* 
LayoutTests/http/tests/site-isolation/inspector/network/cross-origin-iframe-network-memory-cache-source-map-url.html:
* 
LayoutTests/http/tests/site-isolation/inspector/network/get-response-body-after-reload-expected.txt:
 Added.
* 
LayoutTests/http/tests/site-isolation/inspector/network/get-response-body-after-reload.html:
 Added.
* 
LayoutTests/http/tests/site-isolation/inspector/network/resources/memory-cache-frame-stylesheet.css:
 Added.
(p):
* 
LayoutTests/http/tests/site-isolation/inspector/network/resources/reload-memory-cached.css:
 Added.
(body):
* 
LayoutTests/http/tests/site-isolation/inspector/network/resources/reload-memory-cached.js:
 Added.
* 
LayoutTests/http/tests/site-isolation/inspector/network/resources/stylesheet-with-source-map-header-cacheable.py:
* Source/WebKit/WebProcess/Inspector/FrameNetworkAgentProxy.cpp:
(WebKit::finishedWithoutContent):
(WebKit::FrameNetworkAgentProxy::didFinishLoading):
(WebKit::FrameNetworkAgentProxy::didLoadResourceFromMemoryCache):
* Source/WebKit/WebProcess/Inspector/BackendResourceDataStore.h:
(WebKit::BackendResourceDataStore::ResourceData::receivedNoContent const):

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



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

Reply via email to