changeset 5046:f558eeffa8b3

Merge
author Oldrich Maticka <oldrich.maticka@oracle.com>
date Wed, 11 Sep 2013 16:15:59 +0200
parents f35948041d8c 5bfcbb5471e5
children 196cc888c3ee
files
diffstat 1 files changed, 11 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/modules/web/src/ios/resources/javafx/scene/web/init.js	Wed Sep 11 17:49:20 2013 +0400
+++ b/modules/web/src/ios/resources/javafx/scene/web/init.js	Wed Sep 11 16:15:59 2013 +0200
@@ -37,7 +37,6 @@
                 alert(e);
             }
         },
-        callFrame: null,
         call: function(method, args) {
             var cbId = cbId = ++JavaBridge.callbackCnt;
             JavaBridge.callbacks[cbId] = {'success': false, 'result': null};
@@ -47,30 +46,25 @@
                     args[i] = JavaBridge.encodeObject(args[i]);
                 }
             }
-            if ((JavaBridge.callFrame === null) || 
-                (JavaBridge.callFrame.ownerDocument !== document)) {
-                
-                JavaBridge.callFrame = document.createElement('iframe');
-                
-                JavaBridge.callFrame.setAttribute("width","1");
-                JavaBridge.callFrame.setAttribute("height","1");
-                JavaBridge.callFrame.setAttribute("frameborder",0);
-                JavaBridge.callFrame.setAttribute("style","display:none");
-            }
-            
-            JavaBridge.callFrame.setAttribute('src', 'javacall:' + key + ':' + cbId + ':' + method + ':' + encodeURIComponent(JSON.stringify(args)));
-            document.documentElement.appendChild(JavaBridge.callFrame);
-            JavaBridge.callFrame.parentNode.removeChild(JavaBridge.callFrame);
+            var iframe = document.createElement('iframe');
+            iframe.setAttribute("width","1");
+            iframe.setAttribute("height","1");
+            iframe.setAttribute("frameborder",0);
+            iframe.setAttribute("style","display:none");
+            iframe.setAttribute('src', 'javacall:' + key + ':' + cbId + ':' + method + ':' + encodeURIComponent(JSON.stringify(args)));
+            document.documentElement.appendChild(iframe);
+            iframe.parentNode.removeChild(iframe);
+            iframe = null;
 
             var success = JavaBridge.callbacks[cbId]['success'];
-            var result = JavaBridge.callbacks[cbId]['result'];
+            var result = JavaBridge.callbacks[cbId]['result']
             delete JavaBridge.callbacks[cbId];
 
             if (success) {
                 return result;
             }
             // on failure result should contain error (exception) message
-            if (result === null) {
+            if (result == null) {
                 // Java didn't set error message. it means something went wrong
                 throw new Error("Internal java call error");
             }