Title: [293367] trunk
- Revision
- 293367
- Author
- [email protected]
- Date
- 2022-04-25 15:56:06 -0700 (Mon, 25 Apr 2022)
Log Message
Web Inspector: crash when a subresource is intercepted by a skip network local override with an error status code
https://bugs.webkit.org/show_bug.cgi?id=239675
Reviewed by Patrick Angle.
Source/WebCore:
Test: http/tests/inspector/network/intercept-request-subresource-with-response-error-status-code.html
* inspector/agents/InspectorNetworkAgent.cpp:
(WebCore::InspectorNetworkAgent::interceptRequestWithResponse):
`SubresourceLoader::didReceiveResponse` will eventually cause `releaseResources` (via `cancel`),
which will clear the `m_resource`, which is needed in order to provide the response content.
We should only provide the response content if we're still processing the load.
LayoutTests:
* http/tests/inspector/network/intercept-request-subresource-with-response-error-status-code.html: Added.
* http/tests/inspector/network/intercept-request-subresource-with-response-error-status-code-expected.txt: Added.
* platform/mac-wk1/TestExpectations:
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (293366 => 293367)
--- trunk/LayoutTests/ChangeLog 2022-04-25 22:55:51 UTC (rev 293366)
+++ trunk/LayoutTests/ChangeLog 2022-04-25 22:56:06 UTC (rev 293367)
@@ -1,3 +1,15 @@
+2022-04-25 Devin Rousso <[email protected]>
+
+ Web Inspector: crash when a subresource is intercepted by a skip network local override with an error status code
+ https://bugs.webkit.org/show_bug.cgi?id=239675
+
+ Reviewed by Patrick Angle.
+
+ * http/tests/inspector/network/intercept-request-subresource-with-response-error-status-code.html: Added.
+ * http/tests/inspector/network/intercept-request-subresource-with-response-error-status-code-expected.txt: Added.
+
+ * platform/mac-wk1/TestExpectations:
+
2022-04-22 Yusuke Suzuki <[email protected]>
[JSC] Enable change-array-by-copy
Added: trunk/LayoutTests/http/tests/inspector/network/intercept-request-subresource-with-response-error-status-code-expected.txt (0 => 293367)
--- trunk/LayoutTests/http/tests/inspector/network/intercept-request-subresource-with-response-error-status-code-expected.txt (rev 0)
+++ trunk/LayoutTests/http/tests/inspector/network/intercept-request-subresource-with-response-error-status-code-expected.txt 2022-04-25 22:56:06 UTC (rev 293367)
@@ -0,0 +1,8 @@
+ALERT: DEFAULT override.js TEXT
+Test request interception with response that has an error status code for the subresource load.
+
+
+== Running test suite: Network.interceptRequestWithResponse
+-- Running test case: Network.interceptRequestWithResponse.Subresource.StatusCode.Error
+Failed to load resource: the server responded with a status of 418 (PASS)
+
Added: trunk/LayoutTests/http/tests/inspector/network/intercept-request-subresource-with-response-error-status-code.html (0 => 293367)
--- trunk/LayoutTests/http/tests/inspector/network/intercept-request-subresource-with-response-error-status-code.html (rev 0)
+++ trunk/LayoutTests/http/tests/inspector/network/intercept-request-subresource-with-response-error-status-code.html 2022-04-25 22:56:06 UTC (rev 293367)
@@ -0,0 +1,45 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<script src=""
+<script>
+function test()
+{
+ let suite = InspectorTest.createAsyncSuite("Network.interceptRequestWithResponse");
+
+ suite.addTestCase({
+ name: "Network.interceptRequestWithResponse.Subresource.StatusCode.Error",
+ description: "Subresource uses request interception with response",
+ async test() {
+ let localResourceOverride = WI.LocalResourceOverride.create("http://127.0.0.1:8000/inspector/network/resources/override.js", WI.LocalResourceOverride.InterceptType.ResponseSkippingNetwork, {
+ responseMIMEType: "text/_javascript_",
+ responseContent: `alert("FAIL");`,
+ responseBase64Encoded: false,
+ responseStatusCode: 418,
+ responseStatusText: "PASS",
+ responseHeaders: {},
+ });
+ WI.networkManager.addLocalResourceOverride(localResourceOverride);
+
+ let [messageAddedEvent] = await Promise.all([
+ WI.consoleManager.awaitEvent(WI.ConsoleManager.Event.MessageAdded),
+ InspectorTest.reloadPage({ignoreCache: false, revalidateAllResources: true}),
+ ]);
+
+ let {message} = messageAddedEvent.data;
+ InspectorTest.log(message.messageText);
+
+ WI.networkManager.removeLocalResourceOverride(localResourceOverride);
+ }
+ });
+
+ suite.runTestCasesAndFinish();
+}
+</script>
+</head>
+<body _onload_="runTest()">
+<p>Test request interception with response that has an error status code for the subresource load.</p>
+<script src=""
+</body>
+</html>
Modified: trunk/LayoutTests/platform/mac-wk1/TestExpectations (293366 => 293367)
--- trunk/LayoutTests/platform/mac-wk1/TestExpectations 2022-04-25 22:55:51 UTC (rev 293366)
+++ trunk/LayoutTests/platform/mac-wk1/TestExpectations 2022-04-25 22:56:06 UTC (rev 293367)
@@ -923,6 +923,7 @@
http/tests/inspector/network/intercept-request-properties.html [ Skip ]
http/tests/inspector/network/intercept-request-subresource.html [ Skip ]
http/tests/inspector/network/intercept-request-subresource-with-response.html [ Skip ]
+http/tests/inspector/network/intercept-request-subresource-with-response-error-status-code.html [ Skip ]
http/tests/inspector/network/intercept-request-with-response.html [ Skip ]
http/tests/inspector/network/local-resource-override-basic.html [ Skip ]
http/tests/inspector/network/local-resource-override-main-resource.html [ Skip ]
Modified: trunk/Source/WebCore/ChangeLog (293366 => 293367)
--- trunk/Source/WebCore/ChangeLog 2022-04-25 22:55:51 UTC (rev 293366)
+++ trunk/Source/WebCore/ChangeLog 2022-04-25 22:56:06 UTC (rev 293367)
@@ -1,3 +1,18 @@
+2022-04-25 Devin Rousso <[email protected]>
+
+ Web Inspector: crash when a subresource is intercepted by a skip network local override with an error status code
+ https://bugs.webkit.org/show_bug.cgi?id=239675
+
+ Reviewed by Patrick Angle.
+
+ Test: http/tests/inspector/network/intercept-request-subresource-with-response-error-status-code.html
+
+ * inspector/agents/InspectorNetworkAgent.cpp:
+ (WebCore::InspectorNetworkAgent::interceptRequestWithResponse):
+ `SubresourceLoader::didReceiveResponse` will eventually cause `releaseResources` (via `cancel`),
+ which will clear the `m_resource`, which is needed in order to provide the response content.
+ We should only provide the response content if we're still processing the load.
+
2022-04-25 Chris Fleizach <[email protected]>
AX: Don't expose aria-roledescription value on "generic" elements (e.g. div and span) unless explicit role value is also defined
Modified: trunk/Source/WebCore/inspector/agents/InspectorNetworkAgent.cpp (293366 => 293367)
--- trunk/Source/WebCore/inspector/agents/InspectorNetworkAgent.cpp 2022-04-25 22:55:51 UTC (rev 293366)
+++ trunk/Source/WebCore/inspector/agents/InspectorNetworkAgent.cpp 2022-04-25 22:56:06 UTC (rev 293367)
@@ -1295,6 +1295,9 @@
response.setHTTPHeaderFields(WTFMove(explicitHeaders));
response.setHTTPHeaderField(HTTPHeaderName::ContentType, response.mimeType());
loader->didReceiveResponse(response, [loader, buffer = data.releaseNonNull()]() {
+ if (loader->reachedTerminalState())
+ return;
+
if (buffer->size())
loader->didReceiveData(buffer, buffer->size(), DataPayloadWholeResource);
loader->didFinishLoading(NetworkLoadMetrics());
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes