Changeset 293264 in webkit
- Timestamp:
- Apr 22, 2022, 4:19:24 PM (4 years ago)
- Location:
- trunk
- Files:
-
- 9 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/http/tests/inspector/network/resource-response-source-disk-cache-expected.txt (modified) (2 diffs)
-
LayoutTests/http/tests/inspector/network/resource-response-source-disk-cache.html (modified) (1 diff)
-
LayoutTests/http/tests/inspector/network/resource-response-source-memory-cache-expected.txt (modified) (1 diff)
-
LayoutTests/http/tests/inspector/network/resource-response-source-memory-cache.html (modified) (1 diff)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/inspector/InspectorInstrumentation.cpp (modified) (1 diff)
-
Source/WebCore/inspector/InspectorInstrumentation.h (modified) (4 diffs)
-
Source/WebCore/loader/ResourceLoadNotifier.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r293260 r293264 1 2022-04-22 Patrick Angle <pangle@apple.com> 2 3 Web Inspector: Regression(r287684) Resources from the memory cache show empty content in Network, Sources, and Search tabs 4 https://bugs.webkit.org/show_bug.cgi?id=239667 5 6 Reviewed by Devin Rousso. 7 8 Add test steps to ensure that the resource has content, and that the base64Encoded value matches our 9 expectations. While only the memory cache was affected by this regression, add the test steps to both 10 the memory and disk caches to defend this functionality. 11 12 * http/tests/inspector/network/resource-response-source-memory-cache-expected.txt: 13 * http/tests/inspector/network/resource-response-source-memory-cache.html: 14 * http/tests/inspector/network/resource-response-source-disk-cache-expected.txt: 15 * http/tests/inspector/network/resource-response-source-disk-cache.html: 16 1 17 2022-04-22 Simon Fraser <simon.fraser@apple.com> 2 18 -
trunk/LayoutTests/http/tests/inspector/network/resource-response-source-disk-cache-expected.txt
r213621 r293264 7 7 PASS: Resource should be created. 8 8 PASS: Resource should receive a Response. 9 PASS: Response `body` should not be empty. 10 PASS: Response should be base64 encoded. 9 11 10 12 -- Running test case: Resource.ResponseSource.DiskCache … … 13 15 PASS: statusCode should be 200 14 16 PASS: responseSource should be Symbol(disk-cache) 17 PASS: Response `body` should not be empty. 18 PASS: Response should be base64 encoded. 15 19 -
trunk/LayoutTests/http/tests/inspector/network/resource-response-source-disk-cache.html
r220119 r293264 41 41 if (responseSource) 42 42 InspectorTest.expectEqual(resource.responseSource, responseSource, `responseSource should be ${String(responseSource)}`); 43 return resource.requestContentFromBackend(); 44 }).then((responseContent) => { 45 InspectorTest.expectTrue(responseContent.body.length, "Response `body` should not be empty."); 46 InspectorTest.expectTrue(responseContent.base64Encoded, "Response should be base64 encoded."); 43 47 }).then(resolve, reject); 44 48 } -
trunk/LayoutTests/http/tests/inspector/network/resource-response-source-memory-cache-expected.txt
r225007 r293264 7 7 PASS: statusCode should be 200 8 8 PASS: responseSource should be Symbol(memory-cache) 9 PASS: Response `body` should not be empty. 10 PASS: Response should not be base64 encoded. 9 11 -
trunk/LayoutTests/http/tests/inspector/network/resource-response-source-memory-cache.html
r236766 r293264 33 33 InspectorTest.expectEqual(resource.statusCode, statusCode, `statusCode should be ${statusCode}`); 34 34 InspectorTest.expectEqual(resource.responseSource, responseSource, `responseSource should be ${String(responseSource)}`); 35 return resource.requestContentFromBackend(); 36 }).then((responseContent) => { 37 InspectorTest.expectTrue(responseContent.body.length, "Response `body` should not be empty."); 38 InspectorTest.expectFalse(responseContent.base64Encoded, "Response should not be base64 encoded."); 35 39 }).then(resolve, reject); 36 40 } -
trunk/Source/WebCore/ChangeLog
r293260 r293264 1 2022-04-22 Patrick Angle <pangle@apple.com> 2 3 Web Inspector: Regression(r287684) Resources from the memory cache show empty content in Network, Sources, and Search tabs 4 https://bugs.webkit.org/show_bug.cgi?id=239667 5 6 Reviewed by Devin Rousso. 7 8 Updated tests: 9 - http/tests/inspector/network/resource-response-source-disk-cache.html 10 - http/tests/inspector/network/resource-response-source-memory-cache.html 11 12 r287684 introduced a subtle bug when calling InspectorInstrumentation::didReceiveData. We rely 13 on there being a difference between real, but empty, data buffer and not having a data buffer, 14 but after r287684 an empty SharedBuffer would be passed in the later case. Instead, we should 15 continue to pass nullptr if there is no buffer so that InspectorNetworkAgent::didReceiveData 16 can distiguish between the two. 17 18 The bug is the result of having a non-nullptr `data` in `InspectorNetworkAgent::didReceiveData`, 19 which causes us to call `maybeAddResourceData`, which means by the time 20 `InspectorNetworkAgent::getResponseBody` is called, the ResourceData for the request will have 21 an empty, not non-existant, `content()`, which means we will return the empty content instead, 22 since we believe the response had actual content. 23 24 * inspector/InspectorInstrumentation.cpp: 25 (WebCore::InspectorInstrumentation::didReceiveDataImpl): 26 * inspector/InspectorInstrumentation.h: 27 (WebCore::InspectorInstrumentation::didReceiveData): 28 * loader/ResourceLoadNotifier.cpp: 29 (WebCore::ResourceLoadNotifier::dispatchDidReceiveData): 30 1 31 2022-04-22 Simon Fraser <simon.fraser@apple.com> 2 32 -
trunk/Source/WebCore/inspector/InspectorInstrumentation.cpp
r290671 r293264 629 629 } 630 630 631 void InspectorInstrumentation::didReceiveDataImpl(InstrumentingAgents& instrumentingAgents, ResourceLoaderIdentifier identifier, const SharedBuffer &buffer, int encodedDataLength)632 { 633 if (auto* networkAgent = instrumentingAgents.enabledNetworkAgent()) 634 networkAgent->didReceiveData(identifier, &buffer, buffer.size(), encodedDataLength);631 void InspectorInstrumentation::didReceiveDataImpl(InstrumentingAgents& instrumentingAgents, ResourceLoaderIdentifier identifier, const SharedBuffer* buffer, int encodedDataLength) 632 { 633 if (auto* networkAgent = instrumentingAgents.enabledNetworkAgent()) 634 networkAgent->didReceiveData(identifier, buffer, buffer ? buffer->size() : 0, encodedDataLength); 635 635 } 636 636 -
trunk/Source/WebCore/inspector/InspectorInstrumentation.h
r290671 r293264 199 199 static void didReceiveResourceResponse(Frame&, ResourceLoaderIdentifier, DocumentLoader*, const ResourceResponse&, ResourceLoader*); 200 200 static void didReceiveThreadableLoaderResponse(DocumentThreadableLoader&, ResourceLoaderIdentifier); 201 static void didReceiveData(Frame*, ResourceLoaderIdentifier, const SharedBuffer &, int encodedDataLength);201 static void didReceiveData(Frame*, ResourceLoaderIdentifier, const SharedBuffer*, int encodedDataLength); 202 202 static void didFinishLoading(Frame*, DocumentLoader*, ResourceLoaderIdentifier, const NetworkLoadMetrics&, ResourceLoader*); 203 203 static void didFailLoading(Frame*, DocumentLoader*, ResourceLoaderIdentifier, const ResourceError&); … … 423 423 static void didReceiveResourceResponseImpl(InstrumentingAgents&, ResourceLoaderIdentifier, DocumentLoader*, const ResourceResponse&, ResourceLoader*); 424 424 static void didReceiveThreadableLoaderResponseImpl(InstrumentingAgents&, DocumentThreadableLoader&, ResourceLoaderIdentifier); 425 static void didReceiveDataImpl(InstrumentingAgents&, ResourceLoaderIdentifier, const SharedBuffer &, int encodedDataLength);425 static void didReceiveDataImpl(InstrumentingAgents&, ResourceLoaderIdentifier, const SharedBuffer*, int encodedDataLength); 426 426 static void didFinishLoadingImpl(InstrumentingAgents&, ResourceLoaderIdentifier, DocumentLoader*, const NetworkLoadMetrics&, ResourceLoader*); 427 427 static void didFailLoadingImpl(InstrumentingAgents&, ResourceLoaderIdentifier, DocumentLoader*, const ResourceError&); … … 1105 1105 } 1106 1106 1107 inline void InspectorInstrumentation::didReceiveData(Frame* frame, ResourceLoaderIdentifier identifier, const SharedBuffer &buffer, int encodedDataLength)1107 inline void InspectorInstrumentation::didReceiveData(Frame* frame, ResourceLoaderIdentifier identifier, const SharedBuffer* buffer, int encodedDataLength) 1108 1108 { 1109 1109 FAST_RETURN_IF_NO_FRONTENDS(void()); … … 1115 1115 { 1116 1116 FAST_RETURN_IF_NO_FRONTENDS(void()); 1117 didReceiveDataImpl(instrumentingAgents(globalScope), identifier, buffer, buffer.size());1117 didReceiveDataImpl(instrumentingAgents(globalScope), identifier, &buffer, buffer.size()); 1118 1118 } 1119 1119 -
trunk/Source/WebCore/loader/ResourceLoadNotifier.cpp
r287684 r293264 161 161 m_frame.loader().client().dispatchDidReceiveContentLength(loader, identifier, expectedDataLength); 162 162 163 InspectorInstrumentation::didReceiveData(&m_frame, identifier, buffer ? *buffer : SharedBuffer::create(), encodedDataLength);163 InspectorInstrumentation::didReceiveData(&m_frame, identifier, buffer, encodedDataLength); 164 164 } 165 165
Note:
See TracChangeset
for help on using the changeset viewer.