Chromium Code Reviews| Index: runtime/vm/json_stream.cc |
| diff --git a/runtime/vm/json_stream.cc b/runtime/vm/json_stream.cc |
| index f098998dd1642b3e05d87986cef481144d79e2c0..fd2b00d9514c1e40fa737cf47ec3482eb20e155d 100644 |
| --- a/runtime/vm/json_stream.cc |
| +++ b/runtime/vm/json_stream.cc |
| @@ -210,10 +210,9 @@ static void Finalizer(void* isolate_callback_data, |
| void JSONStream::PostReply() { |
| + ASSERT(seq_ != NULL); |
| Dart_Port port = reply_port(); |
| - ASSERT(port != ILLEGAL_PORT); |
| set_reply_port(ILLEGAL_PORT); // Prevent double replies. |
| - ASSERT(seq_ != NULL); |
| if (seq_->IsString()) { |
| const String& str = String::Cast(*seq_); |
| PrintProperty("id", str.ToCString()); |
| @@ -224,12 +223,22 @@ void JSONStream::PostReply() { |
| const Double& dbl = Double::Cast(*seq_); |
| PrintProperty("id", dbl.value()); |
| } else if (seq_->IsNull()) { |
| + if (port == ILLEGAL_PORT) { |
| + // This path is only used in tests. |
| + buffer_.AddChar('}'); // Finish our message. |
| + char* cstr; |
| + intptr_t length; |
| + Steal(&cstr, &length); |
| + fprintf(stderr, "-----\nDropping reply:\n%s\n-----\n", cstr); |
|
rmacnak
2017/01/31 19:21:00
OS::PrintErr
turnidge
2017/01/31 19:35:46
Done.
|
| + free(cstr); |
| + } |
| // JSON-RPC 2.0 says that a request with a null ID shouldn't get a reply. |
| PostNullReply(port); |
| return; |
| } |
| - buffer_.AddChar('}'); |
| + ASSERT(port != ILLEGAL_PORT); |
| + buffer_.AddChar('}'); // Finish our message. |
| char* cstr; |
| intptr_t length; |
| Steal(&cstr, &length); |