Merge pull request #891 from nilspreusker/ie9-compatibility

IE9 Compatibility
This commit is contained in:
Stian Thorgersen 2014-12-17 10:56:14 +01:00
commit ee62f5b1a1
2 changed files with 7 additions and 6 deletions

View file

@ -619,7 +619,7 @@
if (event.origin !== loginIframe.iframeOrigin) { if (event.origin !== loginIframe.iframeOrigin) {
return; return;
} }
var data = event.data; var data = JSON.parse(event.data);
var promise = loginIframe.callbackMap[data.callbackId]; var promise = loginIframe.callbackMap[data.callbackId];
delete loginIframe.callbackMap[data.callbackId]; delete loginIframe.callbackMap[data.callbackId];
@ -652,7 +652,7 @@
msg.callbackId = createCallbackId(); msg.callbackId = createCallbackId();
loginIframe.callbackMap[msg.callbackId] = promise; loginIframe.callbackMap[msg.callbackId] = promise;
var origin = loginIframe.iframeOrigin; var origin = loginIframe.iframeOrigin;
loginIframe.iframe.contentWindow.postMessage(msg, origin); loginIframe.iframe.contentWindow.postMessage(JSON.stringify(msg), origin);
} else { } else {
promise.setSuccess(); promise.setSuccess();
} }

View file

@ -17,14 +17,15 @@
return; return;
} }
event.data.loggedIn = false; var data = JSON.parse(event.data);
data.loggedIn = false;
var cookie = getCookie('KEYCLOAK_SESSION'); var cookie = getCookie('KEYCLOAK_SESSION');
if (cookie) { if (cookie) {
event.data.loggedIn = true; data.loggedIn = true;
event.data.session = cookie; data.session = cookie;
} }
event.source.postMessage(event.data, event.source.postMessage(JSON.stringify(data),
event.origin); event.origin);
} }
window.addEventListener("message", receiveMessage, false); window.addEventListener("message", receiveMessage, false);