same story for framework: ignore security exception if window.top is in a different security context

eg. because SiteMgr contact-form is running in an iframe
This commit is contained in:
Ralf Becker 2017-03-08 14:21:29 +01:00
parent d1b963c98b
commit f0925ef32c

View File

@ -118,17 +118,19 @@
catch(e) { catch(e) {
// ignore SecurityError exception if opener is different security context / cross-origin // ignore SecurityError exception if opener is different security context / cross-origin
} }
if (typeof window.framework != 'undefined') try {
{ if (typeof window.framework == 'undefined' && window.top && typeof window.top.framework != 'undefined')
// set in above try block {
window.framework = window.top.framework;
if (debug) console.log('found framework object in top');
}
} }
else if (window.top && typeof window.top.framework != 'undefined') catch(e) {
{ // ignore SecurityError exception if top is different security context / cross-origin
window.framework = window.top.framework;
if (debug) console.log('found framework object in top');
} }
// if framework not found, but requested to check for it, redirect to cd=yes to create it // if framework not found, but requested to check for it, redirect to cd=yes to create it
else if (egw_script.getAttribute('data-check-framework') && !window.location.search.match(/[&?]cd=/)) if (typeof window.framework == 'undefined' && egw_script.getAttribute('data-check-framework') &&
!window.location.search.match(/[&?]cd=/))
{ {
window.location.search += window.location.search ? "&cd=yes" : "?cd=yes"; window.location.search += window.location.search ? "&cd=yes" : "?cd=yes";
} }