From 911e7d2955dc289db7a20a070c664a0e4a806dff Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Wed, 8 Jan 2014 15:14:10 +0000 Subject: [PATCH] ignore SecurityError exception if opener is different security context / cross-origin --- phpgwapi/js/jsapi/egw.js | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/phpgwapi/js/jsapi/egw.js b/phpgwapi/js/jsapi/egw.js index c7b8dc1ce1..47c1bb5543 100644 --- a/phpgwapi/js/jsapi/egw.js +++ b/phpgwapi/js/jsapi/egw.js @@ -49,13 +49,22 @@ // check if egw object was injected by window open if (typeof window.egw == 'undefined') { - // try finding it in top or opener's top - if (window.opener && typeof window.opener.top.egw != 'undefined') + try { + // try finding it in top or opener's top + if (window.opener && typeof window.opener.top.egw != 'undefined') + { + window.egw = window.opener.top.egw; + if (typeof window.opener.top.framework != 'undefined') window.framework = window.opener.top.framework; + popup = true; + if (debug) console.log('found egw object in opener'); + } + } + catch(e) { + // ignore SecurityError exception if opener is different security context / cross-origin + } + if (typeof window.egw != 'undefined') { - window.egw = window.opener.top.egw; - if (typeof window.opener.top.framework != 'undefined') window.framework = window.opener.top.framework; - popup = true; - if (debug) console.log('found egw object in opener'); + // set in above try block } else if (window.top && typeof window.top.egw != 'undefined') {