diff options
author | jsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68> | 2008-07-31 08:32:58 +0000 |
---|---|---|
committer | jsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68> | 2008-07-31 08:32:58 +0000 |
commit | fb66ee7383cd82980d3b4a9c3c2d63f0af6db0fa (patch) | |
tree | 604aced5796a029474b5ffdf15681f79c70d0a29 /java | |
parent | 34f92700da268b74b52aa3f2b6c9e1e2da6ad591 (diff) |
Handle javascript security exception when a widget is included in a page from a different domain, and therefore cannot access the parent window.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@681299 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java')
-rw-r--r-- | java/sca/modules/domain-manager/src/main/resources/utils.js | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/java/sca/modules/domain-manager/src/main/resources/utils.js b/java/sca/modules/domain-manager/src/main/resources/utils.js index 611aaceadc..20f0148954 100644 --- a/java/sca/modules/domain-manager/src/main/resources/utils.js +++ b/java/sca/modules/domain-manager/src/main/resources/utils.js @@ -167,7 +167,7 @@ function toolbar(home, tools) { } /** - * 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 @@ function array(obj) { } /** - * 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 @@ function dump(o) { } } +/** + * 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 @@ function content(win) { } } +/** + * 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 |