diff --git a/chrome/content/zotero/xpcom/translation/translate.js b/chrome/content/zotero/xpcom/translation/translate.js index 31c39a5165..11e051bab7 100644 --- 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); }