(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 #3900pull/228/head
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)
|
||||
------------------
|
||||
|
||||
|
|
|
@ -93,25 +93,31 @@
|
|||
*/
|
||||
function $parentControllers() {
|
||||
var originMessage, ctrls = {};
|
||||
if ($window.opener) {
|
||||
if ($window.opener.$mailboxController) {
|
||||
if ($window.opener.$mailboxController.selectedFolder.type == 'draft') {
|
||||
ctrls.draftMailboxCtrl = $window.opener.$mailboxController;
|
||||
if ($window.opener.$messageController &&
|
||||
$window.opener.$messageController.message.uid == stateMessage.uid) {
|
||||
// The draft is opened in the parent window
|
||||
ctrls.draftMessageCtrl = $window.opener.$messageController;
|
||||
|
||||
try {
|
||||
if ($window.opener) {
|
||||
if ('$mailboxController' in $window.opener &&
|
||||
'selectedFolder' in $window.opener.$mailboxController) {
|
||||
if ($window.opener.$mailboxController.selectedFolder.type == 'draft') {
|
||||
ctrls.draftMailboxCtrl = $window.opener.$mailboxController;
|
||||
if ('$messageController' in $window.opener &&
|
||||
$window.opener.$messageController.message.uid == stateMessage.uid) {
|
||||
// The draft is opened in the parent window
|
||||
ctrls.draftMessageCtrl = $window.opener.$messageController;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (stateMessage.origin) {
|
||||
originMessage = stateMessage.origin.message;
|
||||
if ($window.opener.$mailboxController.selectedFolder.$id() == originMessage.$mailbox.$id()) {
|
||||
// The message mailbox is opened in the parent window
|
||||
ctrls.originMailboxCtrl = $window.opener.$mailboxController;
|
||||
else if (stateMessage.origin) {
|
||||
originMessage = stateMessage.origin.message;
|
||||
if ($window.opener.$mailboxController.selectedFolder.$id() == originMessage.$mailbox.$id()) {
|
||||
// The message mailbox is opened in the parent window
|
||||
ctrls.originMailboxCtrl = $window.opener.$mailboxController;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (e) {}
|
||||
|
||||
return ctrls;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue