ensure postmessage data is a string #1143

This commit is contained in:
Hakim El Hattab 2015-02-25 13:26:45 +01:00
parent 4c0a033dfa
commit ea735f0a2f
1 changed files with 1 additions and 1 deletions

View File

@ -795,7 +795,7 @@
var data = event.data; var data = event.data;
// Make sure we're dealing with JSON // Make sure we're dealing with JSON
if( data.charAt( 0 ) === '{' && data.charAt( data.length - 1 ) === '}' ) { if( typeof data === 'string' && data.charAt( 0 ) === '{' && data.charAt( data.length - 1 ) === '}' ) {
data = JSON.parse( data ); data = JSON.parse( data );
// Check if the requested method can be found // Check if the requested method can be found