[RN Debugger] Don't try to handle messages without a method

Summary:
Some messages are special and are intended for the devtools, like `{$open: id}` and `{$error: id}`. The main debugger-ui page can't handle these and thinks something is wrong when `object.method` is undefined. This diff handles messages only if they specify a method.

Fixes #2377

Closes https://github.com/facebook/react-native/pull/2405
Github Author: James Ide <ide@jameside.com>
This commit is contained in:
James Ide 2015-08-31 11:18:23 -07:00
parent d080c8dc2b
commit 81c2216d82
1 changed files with 4 additions and 0 deletions

View File

@ -85,6 +85,10 @@ function connectToDebuggerProxy() {
ws.onmessage = function(message) { ws.onmessage = function(message) {
var object = JSON.parse(message.data); var object = JSON.parse(message.data);
if (!object.method) {
return;
}
var sendReply = function(result) { var sendReply = function(result) {
ws.send(JSON.stringify({replyID: object.id, result: result})); ws.send(JSON.stringify({replyID: object.id, result: result}));
}; };