www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | Submodules | README | LICENSE

commit dae0986b9bec5a2e1008fa3b38fba8d0fe57551c
parent a5a7df328ac08de888a495677fe9e8735ad8b35d
Author: Adomas VenĨkauskas <adomas.ven@gmail.com>
Date:   Tue, 15 Aug 2017 15:36:26 +0300

Fix a cross-origin frame access error in Translate.Web.setDocument

Diffstat:
Mchrome/content/zotero/xpcom/translation/translate.js | 7++++++-
1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/chrome/content/zotero/xpcom/translation/translate.js b/chrome/content/zotero/xpcom/translation/translate.js @@ -1956,7 +1956,12 @@ Zotero.Translate.Web.prototype.Sandbox = Zotero.Translate.Sandbox._inheritFromBa */ Zotero.Translate.Web.prototype.setDocument = function(doc) { this.document = doc; - this.rootDocument = doc.defaultView.top.document || doc; + try { + this.rootDocument = doc.defaultView.top.document; + } catch (e) { + // Cross-origin frames won't be able to access top.document and will throw an error + this.rootDocument = doc; + } this.setLocation(doc.location.href, this.rootDocument.location.href); }