keep parent and iframe from sending init messages indefinitely

This commit is contained in:
rlx 2014-09-26 11:29:14 +02:00
parent 4b84424869
commit 5424023903
2 changed files with 11 additions and 5 deletions

View file

@ -133,9 +133,12 @@
if (that.attr('src')) { if (that.attr('src')) {
// send oxid to iframe // send oxid to iframe
that.postMessage({init: {oxid: that.oxid}}); that.postMessage({init: {oxid: that.oxid}});
self.initTime = self.initTime || new Date();
if (new Date() < self.initTime + 60000) {
self.initTimeout = setTimeout(init, 250); self.initTimeout = setTimeout(init, 250);
} }
} }
}
}).bindEvent({ }).bindEvent({
init: function() { init: function() {
// iframe has received oxid // iframe has received oxid

View file

@ -222,9 +222,12 @@
// There actually is an outer window // There actually is an outer window
if (!Ox.oxid) { if (!Ox.oxid) {
// Inner window has not received init message yet // Inner window has not received init message yet
self.initTime = self.initTime || new Date();
if (new Date() < self.initTime + 60000) {
setTimeout(function() { setTimeout(function() {
that.postMessage.apply(that, arguments); that.postMessage.apply(that, arguments);
}, 250); }, 250);
}
} else { } else {
return Ox.Message.post.apply(this, arguments); return Ox.Message.post.apply(this, arguments);
} }