same story tutorial popup: 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:25:52 +01:00
parent 461b2e3e0a
commit ecf001fe06

View File

@ -319,35 +319,40 @@
{
window.scrollTo(0, 1);
}
// Open tutorial popup with an introduction video about egroupware
if (window.framework === window.top.framework && typeof et2_dialog != 'undefined' &&
!egw.preference('egw_tutorial_noautoload', 'common') &&
!parseInt(document.getElementById('egw_script_id').getAttribute('data-framework-reload')) &&
(!egw.config('egw_tutorial_disable', 'phpgwapi') || egw.config('egw_tutorial_disable', 'phpgwapi') == 'sidebox'))
{
// we need to wait until common translations are loaded
egw.langRequireApp(window, 'common', function()
try {
// Open tutorial popup with an introduction video about egroupware
if (window.framework === window.top.framework && typeof et2_dialog != 'undefined' &&
!egw.preference('egw_tutorial_noautoload', 'common') &&
!parseInt(document.getElementById('egw_script_id').getAttribute('data-framework-reload')) &&
(!egw.config('egw_tutorial_disable', 'phpgwapi') || egw.config('egw_tutorial_disable', 'phpgwapi') == 'sidebox'))
{
var buttons = [
{text:egw.lang("Show now"), id:"show", image: "check", default:"true"},
{text:egw.lang("Show next login"), id:"later", image: "right"},
{text:egw.lang("No thanks"), id:"never", image: "cancel"}
];
et2_dialog.show_dialog(function (_button_id)
// we need to wait until common translations are loaded
egw.langRequireApp(window, 'common', function()
{
if (_button_id == "show" )
var buttons = [
{text:egw.lang("Show now"), id:"show", image: "check", default:"true"},
{text:egw.lang("Show next login"), id:"later", image: "right"},
{text:egw.lang("No thanks"), id:"never", image: "cancel"}
];
et2_dialog.show_dialog(function (_button_id)
{
egw.open_link(egw.link('/index.php', 'menuaction=api.EGroupware\\Api\\Framework\\Tutorial.popup&tuid=introduction-'+egw.preference('lang')+'-0-a'),'_blank','960x580');
}
if(_button_id != "later")
{
egw.set_preference('common', 'egw_tutorial_noautoload',true);
}
},
egw.lang('We would like to introduce you to EGroupware by showing a short introduction video.'),
egw.lang('Introduction'),
{}, buttons, et2_dialog.QUESTION_MESSAGE, undefined, egw(window));
}, this);
if (_button_id == "show" )
{
egw.open_link(egw.link('/index.php', 'menuaction=api.EGroupware\\Api\\Framework\\Tutorial.popup&tuid=introduction-'+egw.preference('lang')+'-0-a'),'_blank','960x580');
}
if(_button_id != "later")
{
egw.set_preference('common', 'egw_tutorial_noautoload',true);
}
},
egw.lang('We would like to introduce you to EGroupware by showing a short introduction video.'),
egw.lang('Introduction'),
{}, buttons, et2_dialog.QUESTION_MESSAGE, undefined, egw(window));
}, this);
}
}
catch(e) {
// ignore SecurityError exception if top is different security context / cross-origin
}
});
});