Skip to content

Commit 210c846

Browse files
committed
message listener ignores non-string data
1 parent 021d54d commit 210c846

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

lib/client.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -266,10 +266,12 @@
266266
this._listener = function(message) {
267267
var i, error, response;
268268

269-
if (client._closed) return;
270-
271-
// Ignore messages not from our hub
272-
if (message.origin !== client._origin) return;
269+
// Ignore invalid messages, those not from the correct hub, or when
270+
// the client has closed
271+
if (client._closed || !message.data || !message.data.indexOf ||
272+
message.origin !== client._origin) {
273+
return;
274+
}
273275

274276
// LocalStorage isn't available in the hub
275277
if (message.data === 'cross-storage:unavailable') {

0 commit comments

Comments
 (0)