Author: jsdelfino
Date: Thu Jul 31 01:32:58 2008
New Revision: 681299

URL: http://svn.apache.org/viewvc?rev=681299&view=rev
Log:
Handle javascript security exception when a widget is included in a page from a 
different domain, and therefore cannot access the parent window.

Modified:
    tuscany/java/sca/modules/domain-manager/src/main/resources/utils.js

Modified: tuscany/java/sca/modules/domain-manager/src/main/resources/utils.js
URL: 
http://svn.apache.org/viewvc/tuscany/java/sca/modules/domain-manager/src/main/resources/utils.js?rev=681299&r1=681298&r2=681299&view=diff
==============================================================================
--- tuscany/java/sca/modules/domain-manager/src/main/resources/utils.js 
(original)
+++ tuscany/java/sca/modules/domain-manager/src/main/resources/utils.js Thu Jul 
31 01:32:58 2008
@@ -167,7 +167,7 @@
 }
 
 /**
- * Utility function returning an non-sparse array from an array or an object. 
+ * Return an non-sparse array from an array or an object. 
  */ 
 function array(obj) {
     if (obj.length == undefined) {
@@ -186,7 +186,7 @@
 }
 
 /**
- * Utility function thats dumps a Javascript object to the console
+ * Dump a Javascript object to the console
  */
 function dump(o) {
        for (f in o) {
@@ -196,6 +196,9 @@
        }
 }
 
+/**
+ * Return the content document of the given window.
+ */
 function content(win) {
        if (win.document != 'undefined' && win.document != null) {
                return win.document;
@@ -206,11 +209,20 @@
        }
 }
 
+/**
+ * Install a gadget
+ */
 function gadget(win, doc) {
-       if (win.parent.ongadget != null && win.parent.ongadget != 'undefined') {
-               return win.parent.ongadget(win, doc);
+       var ongadget = null;
+       try {
+               if (win.parent.ongadget != null && win.parent.ongadget != 
'undefined') {
+                       ongadget = win.parent.ongadget;
+               }
+       } catch (e) {
+       }
+       if (ongadget != null) {
+               return ongadget(win, doc);
        } else {
                return doc;
        }
 }
- 
\ No newline at end of file


Reply via email to