Skip to content
Permalink
Browse files
[PlayStation] Specify byte order clearly on Remote Inspector Protocol
https://bugs.webkit.org/show_bug.cgi?id=196790

Reviewed by Ross Kirsling.

Original implementation lacks byte order specification. Network byte order is the
good candidate if there's no strong reason to choose other.
Currently no client exists for PlayStation remote inspector protocol, so we can
change the byte order without care.

* inspector/remote/playstation/RemoteInspectorMessageParserPlayStation.cpp:
(Inspector::MessageParser::createMessage):
(Inspector::MessageParser::parse):


Canonical link: https://commits.webkit.org/211087@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@244176 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
basuke committed Apr 11, 2019
1 parent c5f18ad commit 8845216fc96bbe0fde73856eeb03536ac1e0c0d7
Showing 2 changed files with 22 additions and 2 deletions.
@@ -1,3 +1,19 @@
2019-04-10 Basuke Suzuki <basuke.suzuki@sony.com>

[PlayStation] Specify byte order clearly on Remote Inspector Protocol
https://bugs.webkit.org/show_bug.cgi?id=196790

Reviewed by Ross Kirsling.

Original implementation lacks byte order specification. Network byte order is the
good candidate if there's no strong reason to choose other.
Currently no client exists for PlayStation remote inspector protocol, so we can
change the byte order without care.

* inspector/remote/playstation/RemoteInspectorMessageParserPlayStation.cpp:
(Inspector::MessageParser::createMessage):
(Inspector::MessageParser::parse):

2019-04-10 Devin Rousso <drousso@apple.com>

Web Inspector: Inspector: lazily create the agent
@@ -26,6 +26,8 @@
#include "config.h"
#include "RemoteInspectorMessageParser.h"

#include <netinet/in.h>

#if ENABLE(REMOTE_INSPECTOR)

namespace Inspector {
@@ -34,7 +36,7 @@ namespace Inspector {
| <--- one message for send / didReceiveData ---> |
+--------------+----------------------------------+--------------
| size | data | (next message)
| 4byte | variable length |
| 4byte (NBO) | variable length |
+--------------+----------------------------------+--------------
| <------------ size ------------> |
*/
@@ -52,7 +54,8 @@ Vector<uint8_t> MessageParser::createMessage(const uint8_t* data, size_t size)

auto messageBuffer = Vector<uint8_t>(size + sizeof(uint32_t));
uint32_t uintSize = static_cast<uint32_t>(size);
memcpy(&messageBuffer[0], &uintSize, sizeof(uint32_t));
uint32_t nboSize = htonl(uintSize);
memcpy(&messageBuffer[0], &nboSize, sizeof(uint32_t));
memcpy(&messageBuffer[sizeof(uint32_t)], data, uintSize);
return messageBuffer;
}
@@ -84,6 +87,7 @@ bool MessageParser::parse()

uint32_t dataSize = 0;
memcpy(&dataSize, &m_buffer[0], sizeof(uint32_t));
dataSize = ntohl(dataSize);
if (!dataSize) {
LOG_ERROR("Message Parser received an invalid message size");
return false;

0 comments on commit 8845216

Please sign in to comment.