Fixed iframe postmessage breaking non-string messages

See issue: https://github.com/silverstripe/silverstripe-framework/issues/6562

This is a fix for that, which was already implemented in the code for version 4.0.
This commit is contained in:
Ruud Arentsen 2017-01-24 14:15:34 +01:00 committed by GitHub
parent e7e5d42865
commit c640ade911

View File

@ -73,7 +73,7 @@ jQuery.noConflict();
$(window).on("message", function(e) {
var target,
event = e.originalEvent,
data = JSON.parse(event.data);
data = typeof event.data === 'object' ? event.data : JSON.parse(event.data);
// Reject messages outside of the same origin
if($.path.parseUrl(window.location.href).domain !== $.path.parseUrl(event.origin).domain) return;