From baeeff366e8988a127e688bd40c7f0634ac6fcf8 Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Wed, 24 Sep 2014 00:00:00 +0200 Subject: [PATCH] dont send messages if not an iframe --- source/Ox.UI/js/Core/Event.js | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/source/Ox.UI/js/Core/Event.js b/source/Ox.UI/js/Core/Event.js index 3f89225a..70ad2625 100644 --- a/source/Ox.UI/js/Core/Event.js +++ b/source/Ox.UI/js/Core/Event.js @@ -185,7 +185,9 @@ }; that.postMessage = function() { - return Ox.Message.post.apply(this, Ox.slice(arguments)); + if (window !== window.top) { + return Ox.Message.post.apply(this, arguments); + } }; that.triggerMessage = function() { @@ -272,18 +274,19 @@ // posting to parent, but not yet initialized setTimeout(function() { that.post.apply(Ox.parent, args); - }, 25); + }, 250); + } else { + Ox.forEach( + Ox.makeObject(Ox.slice(args)), + function(data, event) { + target.postMessage(JSON.stringify({ + data: data, + event: event, + target: isParent ? Ox.oxid : null + }), '*'); + } + ); } - Ox.forEach( - Ox.makeObject(Ox.slice(args)), - function(data, event) { - target.postMessage(JSON.stringify({ - data: data, - event: event, - target: isParent ? Ox.oxid : null - }), '*'); - } - ); }; that.trigger = function(self) {