Diff
Modified: trunk/LayoutTests/ChangeLog (256496 => 256497)
--- trunk/LayoutTests/ChangeLog 2020-02-13 02:13:12 UTC (rev 256496)
+++ trunk/LayoutTests/ChangeLog 2020-02-13 02:18:29 UTC (rev 256497)
@@ -1,3 +1,16 @@
+2020-02-12 Pavel Feldman <[email protected]>
+
+ Web Inspector: encode binary web socket frames using base64
+ https://bugs.webkit.org/show_bug.cgi?id=207448
+
+ Previous representation of binary frames is lossy using fromUTF8WithLatin1Fallback,
+ this patch consistently encodes binary data using base64.
+
+ Reviewed by Timothy Hatcher.
+
+ * http/tests/websocket/tests/hybi/inspector/binary-expected.txt:
+ * http/tests/websocket/tests/hybi/inspector/binary.html:
+
2020-02-12 Ryan Haddad <[email protected]>
Unreviewed, rolling out r256010.
Modified: trunk/LayoutTests/http/tests/websocket/tests/hybi/inspector/binary-expected.txt (256496 => 256497)
--- trunk/LayoutTests/http/tests/websocket/tests/hybi/inspector/binary-expected.txt 2020-02-13 02:13:12 UTC (rev 256496)
+++ trunk/LayoutTests/http/tests/websocket/tests/hybi/inspector/binary-expected.txt 2020-02-13 02:18:29 UTC (rev 256497)
@@ -6,6 +6,7 @@
PASS: Resource size should be 13 bytes.
PASS: Frame should not have data.
PASS: Frame should be binary.
+PASS: Binary frames should be base64 encoded.
PASS: Frame should be outgoing.
PASS: Frame should have walltime.
PASS: Resource size should increase by 13 bytes.
@@ -33,6 +34,7 @@
PASS: Resource size should be 13 bytes.
PASS: Frame should not have data.
PASS: Frame should be binary.
+PASS: Binary frames should be base64 encoded.
PASS: Frame should be outgoing.
PASS: Frame should have walltime.
PASS: Resource size should increase by 13 bytes.
Modified: trunk/LayoutTests/http/tests/websocket/tests/hybi/inspector/binary.html (256496 => 256497)
--- trunk/LayoutTests/http/tests/websocket/tests/hybi/inspector/binary.html 2020-02-13 02:13:12 UTC (rev 256496)
+++ trunk/LayoutTests/http/tests/websocket/tests/hybi/inspector/binary.html 2020-02-13 02:18:29 UTC (rev 256497)
@@ -56,6 +56,7 @@
InspectorTest.expectEqual(frame.opcode, WI.WebSocketResource.OpCodes.BinaryFrame, "Frame should be binary.");
if (frameAddedCount === 1) {
+ InspectorTest.expectEqual(atob(frame.dataForTest), "Hello, world!", "Binary frames should be base64 encoded.");
InspectorTest.expectThat(frame.isOutgoing, "Frame should be outgoing.");
InspectorTest.expectThat(typeof frame.walltime === "number", "Frame should have walltime.");
} else {
Modified: trunk/Source/_javascript_Core/ChangeLog (256496 => 256497)
--- trunk/Source/_javascript_Core/ChangeLog 2020-02-13 02:13:12 UTC (rev 256496)
+++ trunk/Source/_javascript_Core/ChangeLog 2020-02-13 02:18:29 UTC (rev 256497)
@@ -1,3 +1,15 @@
+2020-02-12 Pavel Feldman <[email protected]>
+
+ Web Inspector: encode binary web socket frames using base64
+ https://bugs.webkit.org/show_bug.cgi?id=207448
+
+ Previous representation of binary frames is lossy using fromUTF8WithLatin1Fallback,
+ this patch consistently encodes binary data using base64.
+
+ Reviewed by Timothy Hatcher.
+
+ * inspector/protocol/Network.json:
+
2020-02-12 Simon Fraser <[email protected]>
Remove CSS_DEVICE_ADAPTATION
Modified: trunk/Source/_javascript_Core/inspector/protocol/Network.json (256496 => 256497)
--- trunk/Source/_javascript_Core/inspector/protocol/Network.json 2020-02-13 02:13:12 UTC (rev 256496)
+++ trunk/Source/_javascript_Core/inspector/protocol/Network.json 2020-02-13 02:18:29 UTC (rev 256497)
@@ -123,7 +123,7 @@
"properties": [
{ "name": "opcode", "type": "number", "description": "WebSocket frame opcode." },
{ "name": "mask", "type": "boolean", "description": "WebSocket frame mask." },
- { "name": "payloadData", "type": "string", "description": "WebSocket frame payload data." },
+ { "name": "payloadData", "type": "string", "description": "WebSocket frame payload data, binary frames (opcode = 2) are base64-encoded." },
{ "name": "payloadLength", "type": "number", "description": "WebSocket frame payload length in bytes." }
]
},
Modified: trunk/Source/WebCore/ChangeLog (256496 => 256497)
--- trunk/Source/WebCore/ChangeLog 2020-02-13 02:13:12 UTC (rev 256496)
+++ trunk/Source/WebCore/ChangeLog 2020-02-13 02:18:29 UTC (rev 256497)
@@ -1,5 +1,20 @@
2020-02-12 Pavel Feldman <[email protected]>
+ Web Inspector: encode binary web socket frames using base64
+ https://bugs.webkit.org/show_bug.cgi?id=207448
+
+ Previous representation of binary frames is lossy using fromUTF8WithLatin1Fallback,
+ this patch consistently encodes binary data using base64.
+
+ Reviewed by Timothy Hatcher.
+
+ * inspector/agents/InspectorNetworkAgent.cpp:
+ (WebCore::Inspector::buildWebSocketMessage):
+ (WebCore::InspectorNetworkAgent::didReceiveWebSocketFrame):
+ (WebCore::InspectorNetworkAgent::didSendWebSocketFrame):
+
+2020-02-12 Pavel Feldman <[email protected]>
+
[WK2][Soup] Implement NetworkStorageSession::getAllCookies
https://bugs.webkit.org/show_bug.cgi?id=207449
Modified: trunk/Source/WebCore/inspector/agents/InspectorNetworkAgent.cpp (256496 => 256497)
--- trunk/Source/WebCore/inspector/agents/InspectorNetworkAgent.cpp 2020-02-13 02:13:12 UTC (rev 256496)
+++ trunk/Source/WebCore/inspector/agents/InspectorNetworkAgent.cpp 2020-02-13 02:18:29 UTC (rev 256497)
@@ -171,6 +171,16 @@
int m_statusCode;
};
+Ref<Inspector::Protocol::Network::WebSocketFrame> buildWebSocketMessage(const WebSocketFrame& frame)
+{
+ return Inspector::Protocol::Network::WebSocketFrame::create()
+ .setOpcode(frame.opCode)
+ .setMask(frame.masked)
+ .setPayloadData(frame.opCode == 1 ? String::fromUTF8WithLatin1Fallback(frame.payload, frame.payloadLength) : base64Encode(frame.payload, frame.payloadLength))
+ .setPayloadLength(frame.payloadLength)
+ .release();
+}
+
} // namespace
InspectorNetworkAgent::InspectorNetworkAgent(WebAgentContext& context)
@@ -770,24 +780,11 @@
void InspectorNetworkAgent::didReceiveWebSocketFrame(unsigned long identifier, const WebSocketFrame& frame)
{
- auto frameObject = Inspector::Protocol::Network::WebSocketFrame::create()
- .setOpcode(frame.opCode)
- .setMask(frame.masked)
- .setPayloadData(String::fromUTF8WithLatin1Fallback(frame.payload, frame.payloadLength))
- .setPayloadLength(frame.payloadLength)
- .release();
- m_frontendDispatcher->webSocketFrameReceived(IdentifiersFactory::requestId(identifier), timestamp(), WTFMove(frameObject));
+ m_frontendDispatcher->webSocketFrameReceived(IdentifiersFactory::requestId(identifier), timestamp(), buildWebSocketMessage(frame));
}
-
void InspectorNetworkAgent::didSendWebSocketFrame(unsigned long identifier, const WebSocketFrame& frame)
{
- auto frameObject = Inspector::Protocol::Network::WebSocketFrame::create()
- .setOpcode(frame.opCode)
- .setMask(frame.masked)
- .setPayloadData(String::fromUTF8WithLatin1Fallback(frame.payload, frame.payloadLength))
- .setPayloadLength(frame.payloadLength)
- .release();
- m_frontendDispatcher->webSocketFrameSent(IdentifiersFactory::requestId(identifier), timestamp(), WTFMove(frameObject));
+ m_frontendDispatcher->webSocketFrameSent(IdentifiersFactory::requestId(identifier), timestamp(), buildWebSocketMessage(frame));
}
void InspectorNetworkAgent::didReceiveWebSocketFrameError(unsigned long identifier, const String& errorMessage)
Modified: trunk/Source/WebInspectorUI/ChangeLog (256496 => 256497)
--- trunk/Source/WebInspectorUI/ChangeLog 2020-02-13 02:13:12 UTC (rev 256496)
+++ trunk/Source/WebInspectorUI/ChangeLog 2020-02-13 02:18:29 UTC (rev 256497)
@@ -1,3 +1,16 @@
+2020-02-12 Pavel Feldman <[email protected]>
+
+ Web Inspector: encode binary web socket frames using base64
+ https://bugs.webkit.org/show_bug.cgi?id=207448
+
+ Previous representation of binary frames is lossy using fromUTF8WithLatin1Fallback,
+ this patch consistently encodes binary data using base64.
+
+ Reviewed by Timothy Hatcher.
+
+ * UserInterface/Models/WebSocketResource.js:
+ (WI.WebSocketResource.prototype.addFrame):
+
2020-02-11 Nikita Vasilyev <[email protected]>
Web Inspector RTL: Elements closing tag is reversed
Modified: trunk/Source/WebInspectorUI/UserInterface/Models/WebSocketResource.js (256496 => 256497)
--- trunk/Source/WebInspectorUI/UserInterface/Models/WebSocketResource.js 2020-02-13 02:13:12 UTC (rev 256496)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/WebSocketResource.js 2020-02-13 02:18:29 UTC (rev 256497)
@@ -75,6 +75,8 @@
let frame = {data: frameData, isOutgoing, opcode, walltime: this._walltimeForWebSocketTimestamp(timestamp)};
this._frames.push(frame);
+ if (InspectorFrontendHost.isUnderTest())
+ frame.dataForTest = data;
// COMPATIBILITY (iOS 10.3): `payloadLength` did not exist in 10.3 and earlier.
if (payloadLength === undefined)