use iframe url if no script

# Conflicts:
#	front/src/Api/IframeListener.ts
This commit is contained in:
jonny 2021-05-05 19:11:48 +02:00
parent 0a5dffd034
commit a24ca078e6

View File

@ -60,14 +60,14 @@ class IframeListener {
// Do we trust the sender of this message? // Do we trust the sender of this message?
// Let's only accept messages from the iframe that are allowed. // Let's only accept messages from the iframe that are allowed.
// Note: maybe we could restrict on the domain too for additional security (in case the iframe goes to another domain). // Note: maybe we could restrict on the domain too for additional security (in case the iframe goes to another domain).
let found = false; let foundSrc: string | null = null;
for (const iframe of this.iframes) { for (const iframe of this.iframes) {
if (iframe.contentWindow === message.source) { if (iframe.contentWindow === message.source) {
found = true; foundSrc = iframe.src;
break; break;
} }
} }
if (!found) { if (!foundSrc) {
return; return;
} }
@ -91,7 +91,7 @@ class IframeListener {
return this.scripts.get(key)?.contentWindow == message.source return this.scripts.get(key)?.contentWindow == message.source
}) })
scriptUtils.openCoWebsite(payload.data.url, scriptUrl || payload.data.url); scriptUtils.openCoWebsite(payload.data.url, scriptUrl || foundSrc);
} }
else if(payload.type === 'closeCoWebSite') { else if(payload.type === 'closeCoWebSite') {
scriptUtils.closeCoWebSite(); scriptUtils.closeCoWebSite();