changeset 1613:5f0660fe06c3

fix
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 30 Oct 2020 11:07:38 +0100
parents 228a41233540
children ad9b425f27ae
files Applications/StoneWebViewer/WebApplication/app.js
diffstat 1 files changed, 15 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/Applications/StoneWebViewer/WebApplication/app.js	Thu Oct 29 18:27:06 2020 +0100
+++ b/Applications/StoneWebViewer/WebApplication/app.js	Fri Oct 30 11:07:38 2020 +0100
@@ -717,21 +717,23 @@
 var expectedOrigin = '';   // TODO - INSECURE - CONFIGURATION
 
 window.addEventListener('message', function(e) {
-  if (expectedOrigin != '' &&
-      e.origin !== expectedOrigin) {
-    alert('Bad origin for the message');
-    return;
-  }
-  
-  if (e.data.type == 'show-osirix-annotations') {
-    var clear = true;  // Whether to clear previous annotations
-    if ('clear' in e.data) {
-      clear = e.data.clear;
+  if ('type' in e.data) {
+    if (expectedOrigin != '' &&
+        e.origin !== expectedOrigin) {
+      alert('Bad origin for the message');
+      return;
     }
     
-    app.LoadOsiriXAnnotations(e.data.xml, clear);
-  } else {
-    alert('Unknown message type: ' + e.data.type);
+    if (e.data.type == 'show-osirix-annotations') {
+      var clear = true;  // Whether to clear previous annotations
+      if ('clear' in e.data) {
+        clear = e.data.clear;
+      }
+      
+      app.LoadOsiriXAnnotations(e.data.xml, clear);
+    } else {
+      alert('Unknown message type: ' + e.data.type);
+    }
   }
 });