Skip to content
This repository has been archived by the owner on Apr 20, 2023. It is now read-only.

Commit

Permalink
Fix the problem with exception after receiving msg from another source.
Browse files Browse the repository at this point in the history
The exception is thrown when `event.data` is another type than string.
This is a case when using easyXDM and XDomain at the same time.
  • Loading branch information
methyl committed Oct 2, 2014
1 parent ad2f356 commit 23d0a23
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/stack/PostMessageTransport.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ easyXDM.stack.PostMessageTransport = function(config){
// #ifdef debug
trace("received message '" + event.data + "' from " + origin);
// #endif
if (origin == targetOrigin && event.data.substring(0, config.channel.length + 1) == config.channel + " ") {
if (origin == targetOrigin && typeof event.data === 'string' && event.data.substring(0, config.channel.length + 1) == config.channel + " ") {
pub.up.incoming(event.data.substring(config.channel.length + 1), origin);
}
}
Expand Down

0 comments on commit 23d0a23

Please sign in to comment.