add check on list size

This commit is contained in:
sebastien blanc 2016-10-18 11:50:51 +02:00 committed by Stian Thorgersen
parent 116f5f5795
commit 32df5225cf

View file

@ -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();
}