added sanity check

This commit is contained in:
David Meincke
2023-06-02 10:43:19 +02:00
parent 65a6312b8e
commit 221183962c
7 changed files with 28 additions and 23 deletions
@@ -29,7 +29,6 @@ export class OutputFrame extends BaseElement {
if (this.Iframe && this.hasChild(this.Iframe)) {
this.Iframe.setAttribute("sandbox", "allow-pointer-lock allow-same-origin");
console.log("REMOVING IFRAME!");
this.removeChild(this.Iframe);
}
@@ -38,28 +37,21 @@ export class OutputFrame extends BaseElement {
this.Iframe.setAttribute("sandbox", "allow-pointer-lock allow-same-origin allow-scripts");
if (onload) {
this.Iframe.onload = ((ev) => {
console.log("IFRAME LOADED");
onload(ev);
if (this.Iframe)
this.Iframe.onload = () => { };
});
}
console.log("IF SOURCE BEFORE", this.Iframe.src);
if (source != null) {
console.log("CUSOMSRC S:"+source, source);
this.Iframe.src = source;
}
else {
this.Iframe.src = GetOutputFrameUrl();
}
console.log("IF SOURCE AFTER", this.Iframe.src);
if (source !== "") {
this.appendChild(this.Iframe);
}
else {
console.log("SPPCHD");
}
if (resetNotificationBubbles) {
var bubbles = GetNotificationBubbles();
@@ -70,18 +62,16 @@ export class OutputFrame extends BaseElement {
}
setError() {
console.log("RCALLED");
this.reset(() => {
console.log("ERROR RESET");
if (this.Iframe) {
// this.Iframe.contentWindow?.location.reload();
console.log("RESET AFTER", this.Iframe.src);
// this.Iframe.contentWindow?.location.reload();
}
}, true, "");//GetOutputFrameUrl("execution-time-error.html"));
}, true, "");
}
setContent(language: string, value: string) {
console.log("setting content", language, value);
this.contents[language] = value;
this.reset(() => {
for (const lang in this.contents) {
@@ -97,7 +87,6 @@ export class OutputFrame extends BaseElement {
doPostMessage(language: string, value: string) {
this.CurrentIframeScriptRemoveResponseListener = postMessage(this.Iframe?.contentWindow, language, this.contents[language], language == 'javascript' ?
(executeTimeInMs, exceedTimeInMs) => {
console.log("onresponse", executeTimeInMs + " " + exceedTimeInMs);
if (executeTimeInMs === -1) {
this.setError();
}