Title: [202843] trunk
- Revision
- 202843
- Author
- [email protected]
- Date
- 2016-07-05 17:56:49 -0700 (Tue, 05 Jul 2016)
Log Message
Web Inspector: Sending XHR with UTF8 encoded data shows garbled data in Resource sidebar
https://bugs.webkit.org/show_bug.cgi?id=159358
Patch by Johan K. Jensen <[email protected]> on 2016-07-05
Reviewed by Joseph Pecoraro.
Source/WebCore:
Test: http/tests/inspector/network/xhr-request-data-encoded-correctly.html
* inspector/InspectorNetworkAgent.cpp:
(WebCore::buildObjectForResourceRequest):
* inspector/NetworkResourcesData.cpp:
(WebCore::NetworkResourcesData::setResourceContent):
LayoutTests:
* http/tests/inspector/network/xhr-request-data-encoded-correctly-expected.txt: Added.
* http/tests/inspector/network/xhr-request-data-encoded-correctly.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (202842 => 202843)
--- trunk/LayoutTests/ChangeLog 2016-07-06 00:53:17 UTC (rev 202842)
+++ trunk/LayoutTests/ChangeLog 2016-07-06 00:56:49 UTC (rev 202843)
@@ -1,3 +1,13 @@
+2016-07-05 Johan K. Jensen <[email protected]>
+
+ Web Inspector: Sending XHR with UTF8 encoded data shows garbled data in Resource sidebar
+ https://bugs.webkit.org/show_bug.cgi?id=159358
+
+ Reviewed by Joseph Pecoraro.
+
+ * http/tests/inspector/network/xhr-request-data-encoded-correctly-expected.txt: Added.
+ * http/tests/inspector/network/xhr-request-data-encoded-correctly.html: Added.
+
2016-07-05 Ryan Haddad <[email protected]>
Test gardening after r202835.
Added: trunk/LayoutTests/http/tests/inspector/network/xhr-request-data-encoded-correctly-expected.txt (0 => 202843)
--- trunk/LayoutTests/http/tests/inspector/network/xhr-request-data-encoded-correctly-expected.txt (rev 0)
+++ trunk/LayoutTests/http/tests/inspector/network/xhr-request-data-encoded-correctly-expected.txt 2016-07-06 00:56:49 UTC (rev 202843)
@@ -0,0 +1,9 @@
+Tests XHR network resource payload is shown with correct encoding.
+
+
+== Running test suite: XHRWithRequestDataEncoding
+-- Running test case: XHRWithRequestDataIsEncodedCorrectly
+PASS: Resource should be created.
+PASS: Request data should have expected content.
+PASS: Resource load should finish.
+
Added: trunk/LayoutTests/http/tests/inspector/network/xhr-request-data-encoded-correctly.html (0 => 202843)
--- trunk/LayoutTests/http/tests/inspector/network/xhr-request-data-encoded-correctly.html (rev 0)
+++ trunk/LayoutTests/http/tests/inspector/network/xhr-request-data-encoded-correctly.html 2016-07-06 00:56:49 UTC (rev 202843)
@@ -0,0 +1,41 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<script src=""
+<script>
+function createXHRResource() {
+ var request = new XMLHttpRequest();
+ request.open("POST", "resources/", true);
+ request.send("utf8=👍");
+}
+
+function test()
+{
+ let suite = InspectorTest.createAsyncSuite("XHRWithRequestDataEncoding");
+
+ suite.addTestCase({
+ name: "XHRWithRequestDataIsEncodedCorrectly",
+ description: "XHR with request data is encoded correctly.",
+ test: (resolve, reject) => {
+ InspectorTest.evaluateInPage("createXHRResource()");
+ WebInspector.Frame.singleFireEventListener(WebInspector.Frame.Event.ResourceWasAdded, (event) => {
+ let resource = event.data.resource;
+ InspectorTest.expectThat(resource instanceof WebInspector.Resource, "Resource should be created.");
+ InspectorTest.expectThat(resource.requestData === "utf8=👍", "Request data should have expected content.");
+ resource.singleFireEventListener(WebInspector.Resource.Event.LoadingDidFinish, (event) => {
+ InspectorTest.pass("Resource load should finish.");
+ resolve();
+ });
+ });
+ }
+ });
+
+ suite.runTestCasesAndFinish();
+}
+</script>
+</head>
+<body _onload_="runTest()">
+ <p>Tests XHR network resource payload is shown with correct encoding.</p>
+</body>
+</html>
\ No newline at end of file
Modified: trunk/Source/WebCore/ChangeLog (202842 => 202843)
--- trunk/Source/WebCore/ChangeLog 2016-07-06 00:53:17 UTC (rev 202842)
+++ trunk/Source/WebCore/ChangeLog 2016-07-06 00:56:49 UTC (rev 202843)
@@ -1,3 +1,17 @@
+2016-07-05 Johan K. Jensen <[email protected]>
+
+ Web Inspector: Sending XHR with UTF8 encoded data shows garbled data in Resource sidebar
+ https://bugs.webkit.org/show_bug.cgi?id=159358
+
+ Reviewed by Joseph Pecoraro.
+
+ Test: http/tests/inspector/network/xhr-request-data-encoded-correctly.html
+
+ * inspector/InspectorNetworkAgent.cpp:
+ (WebCore::buildObjectForResourceRequest):
+ * inspector/NetworkResourcesData.cpp:
+ (WebCore::NetworkResourcesData::setResourceContent):
+
2016-07-05 Chris Fleizach <[email protected]>
AX: Image attachment in email does not show up in AX tree
Modified: trunk/Source/WebCore/inspector/InspectorNetworkAgent.cpp (202842 => 202843)
--- trunk/Source/WebCore/inspector/InspectorNetworkAgent.cpp 2016-07-06 00:53:17 UTC (rev 202842)
+++ trunk/Source/WebCore/inspector/InspectorNetworkAgent.cpp 2016-07-06 00:56:49 UTC (rev 202843)
@@ -205,8 +205,11 @@
.setMethod(request.httpMethod())
.setHeaders(buildObjectForHeaders(request.httpHeaderFields()))
.release();
- if (request.httpBody() && !request.httpBody()->isEmpty())
- requestObject->setPostData(request.httpBody()->flattenToString());
+ if (request.httpBody() && !request.httpBody()->isEmpty()) {
+ Vector<char> bytes;
+ request.httpBody()->flatten(bytes);
+ requestObject->setPostData(String::fromUTF8WithLatin1Fallback(bytes.data(), bytes.size()));
+ }
return requestObject;
}
Modified: trunk/Source/WebCore/inspector/NetworkResourcesData.cpp (202842 => 202843)
--- trunk/Source/WebCore/inspector/NetworkResourcesData.cpp 2016-07-06 00:53:17 UTC (rev 202842)
+++ trunk/Source/WebCore/inspector/NetworkResourcesData.cpp 2016-07-06 00:56:49 UTC (rev 202843)
@@ -190,7 +190,7 @@
return;
if (ensureFreeSpace(dataLength) && !resourceData->isContentEvicted()) {
// We can not be sure that we didn't try to save this request data while it was loading, so remove it, if any.
- if (resourceData->hasContent())
+ if (resourceData->hasContent() || resourceData->hasData())
m_contentSize -= resourceData->removeContent();
m_requestIdsDeque.append(requestId);
resourceData->setContent(content, base64Encoded);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes