summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2013-03-08 08:49:57 +0100
committerAleksander Machniak <alec@alec.pl>2013-03-08 08:51:03 +0100
commit527e7d45092a1efb9f72664210a591be0a6b2c2d (patch)
treeeb49897cb3a85c83bff10d83b9bbd73d24227009
parent91deac7c91e18bfa0e94715cd2966699588fad35 (diff)
Fix javascript errors when working in a page opened with taget="_blank"
-rw-r--r--CHANGELOG1
-rw-r--r--program/js/app.js20
-rw-r--r--skins/larry/ui.js3
3 files changed, 19 insertions, 5 deletions
diff --git a/CHANGELOG b/CHANGELOG
index 842a89acf..c34aca358 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,7 @@
CHANGELOG Roundcube Webmail
===========================
+- Fix javascript errors when working in a page opened with taget="_blank"
- Mention SQLite database format change in UPGRADING file (#1488983)
- Increase maxlength to 254 chars for email input fields in addressbook (#1488987)
- Fix thumbnail size when GD extension is used for image resize (#1488985)
diff --git a/program/js/app.js b/program/js/app.js
index ab8eb2369..41781b9e2 100644
--- a/program/js/app.js
+++ b/program/js/app.js
@@ -3038,10 +3038,10 @@ function rcube_webmail()
input_message = $("[name='_message']").get(0),
html_mode = $("input[name='_is_html']").val() == '1',
ac_fields = ['cc', 'bcc', 'replyto', 'followupto'],
- ac_props;
+ ac_props, opener_rc = this.opener();
// close compose step in opener
- if (window.opener && !window.opener.closed && opener.rcmail && opener.rcmail.env.action == 'compose') {
+ if (opener_rc && opener_rc.env.action == 'compose') {
setTimeout(function(){ opener.history.back(); }, 100);
this.env.opened_extwin = true;
}
@@ -3720,9 +3720,10 @@ function rcube_webmail()
this.display_message(msg, type);
if (this.env.extwin) {
+ var opener_rc = this.opener();
this.lock_form(this.gui_objects.messageform);
- if (window.opener && !window.opener.closed && opener.rcmail)
- opener.rcmail.display_message(msg, type);
+ if (opener_rc)
+ opener_rc.display_message(msg, type);
setTimeout(function(){ window.close() }, 1000);
}
else {
@@ -6601,6 +6602,17 @@ function rcube_webmail()
/********* helper methods *********/
/********************************************************/
+ // get window.opener.rcmail if available
+ this.opener = function()
+ {
+ // catch Error: Permission denied to access property rcmail
+ try {
+ if (window.opener && !opener.closed && opener.rcmail)
+ return opener.rcmail;
+ }
+ catch (e) {}
+ };
+
// check if we're in show mode or if we have a unique selection
// and return the message uid
this.get_single_uid = function()
diff --git a/skins/larry/ui.js b/skins/larry/ui.js
index d2638bbca..76485c11e 100644
--- a/skins/larry/ui.js
+++ b/skins/larry/ui.js
@@ -117,7 +117,8 @@ function rcube_mail_ui()
}).css('cursor', 'pointer');
// toggle compose options if opened in new window and they were visible before
- if (window.opener && opener.rcmail && opener.rcmail.env.action == 'compose' && $('#composeoptionstoggle', opener.document).hasClass('remove'))
+ var opener_rc = rcmail.opener();
+ if (opener_rc && opener_rc.env.action == 'compose' && $('#composeoptionstoggle', opener.document).hasClass('remove'))
$('#composeoptionstoggle').click();
new rcube_splitter({ id:'composesplitterv', p1:'#composeview-left', p2:'#composeview-right',