(js) Fix possible cross-origin exception
When SOGo is launched from an external link, either using a different "target" or using window.open(), the Mail composer could throw a JavaScript exception when trying to save or send a message that would completely stop the operation. Fixes #3900
This commit is contained in:
parent
e253f5735d
commit
e059a6043e
6
NEWS
6
NEWS
|
@ -1,3 +1,9 @@
|
||||||
|
3.2.4 (2016-12-DD)
|
||||||
|
------------------
|
||||||
|
|
||||||
|
Bug fixes
|
||||||
|
- [web] fixed JavaScript exception when SOGo is launched from an external link (#3900)
|
||||||
|
|
||||||
3.2.3 (2016-11-25)
|
3.2.3 (2016-11-25)
|
||||||
------------------
|
------------------
|
||||||
|
|
||||||
|
|
|
@ -93,11 +93,14 @@
|
||||||
*/
|
*/
|
||||||
function $parentControllers() {
|
function $parentControllers() {
|
||||||
var originMessage, ctrls = {};
|
var originMessage, ctrls = {};
|
||||||
|
|
||||||
|
try {
|
||||||
if ($window.opener) {
|
if ($window.opener) {
|
||||||
if ($window.opener.$mailboxController) {
|
if ('$mailboxController' in $window.opener &&
|
||||||
|
'selectedFolder' in $window.opener.$mailboxController) {
|
||||||
if ($window.opener.$mailboxController.selectedFolder.type == 'draft') {
|
if ($window.opener.$mailboxController.selectedFolder.type == 'draft') {
|
||||||
ctrls.draftMailboxCtrl = $window.opener.$mailboxController;
|
ctrls.draftMailboxCtrl = $window.opener.$mailboxController;
|
||||||
if ($window.opener.$messageController &&
|
if ('$messageController' in $window.opener &&
|
||||||
$window.opener.$messageController.message.uid == stateMessage.uid) {
|
$window.opener.$messageController.message.uid == stateMessage.uid) {
|
||||||
// The draft is opened in the parent window
|
// The draft is opened in the parent window
|
||||||
ctrls.draftMessageCtrl = $window.opener.$messageController;
|
ctrls.draftMessageCtrl = $window.opener.$messageController;
|
||||||
|
@ -112,6 +115,9 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
catch (e) {}
|
||||||
|
|
||||||
return ctrls;
|
return ctrls;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue