Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(618)

Unified Diff: runtime/bin/vmservice/server.dart

Issue 1255003003: Make VM service id handling JSON-RPC 2 compliant. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: cr Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « CHANGELOG.md ('k') | runtime/vm/json_stream.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/vmservice/server.dart
diff --git a/runtime/bin/vmservice/server.dart b/runtime/bin/vmservice/server.dart
index 4723ca507fc9ce03c863f55ef05f74b8801f0a6f..2c6aa6639b225e5d639b2e96a2217b5da1f67867 100644
--- a/runtime/bin/vmservice/server.dart
+++ b/runtime/bin/vmservice/server.dart
@@ -8,6 +8,7 @@ class WebSocketClient extends Client {
static const int PARSE_ERROR_CODE = 4000;
static const int BINARY_MESSAGE_ERROR_CODE = 4001;
static const int NOT_MAP_ERROR_CODE = 4002;
+ static const int ID_ERROR_CODE = 4003;
final WebSocket socket;
WebSocketClient(this.socket, VMService service) : super(service) {
@@ -29,6 +30,9 @@ class WebSocketClient extends Client {
return;
}
var serial = map['id'];
+ if (serial != null && serial is! num && serial is! String) {
+ socket.close(ID_ERROR_CODE, '"id" must be a number, string, or null.');
+ }
onMessage(serial, new Message.fromJsonRpc(this, map));
} else {
socket.close(BINARY_MESSAGE_ERROR_CODE, 'Message must be a string.');
« no previous file with comments | « CHANGELOG.md ('k') | runtime/vm/json_stream.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698