add check on list size

This commit is contained in:
sebastien blanc authored and Stian Thorgersen committed 2016-10-19 14:21:41 +02:00
1 parent 116f5f5795
commit 32df5225cf
1 file changed
+4 -2
@@ -865,13 +865,15 @@
function checkLoginIframe() {
var promise = createPromise();
if (loginIframe.iframe && loginIframe.iframeOrigin && loginIframe.callbackList.length !== 0) {
if (loginIframe.iframe && loginIframe.iframeOrigin ) {
var msg = {};
msg.callbackId = createCallbackId();
msg.sessionId = kc.sessionId;
loginIframe.callbackList.push(promise);
var origin = loginIframe.iframeOrigin;
loginIframe.iframe.contentWindow.postMessage(JSON.stringify(msg), origin);
if(loginIframe.callbackList.length == 1) {
loginIframe.iframe.contentWindow.postMessage(JSON.stringify(msg), origin);
}
} else {
promise.setSuccess();
}