From de36a6e83324700eacd44266ba374b5f61b2c07a Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Thu, 17 Aug 2017 02:16:39 +0200 Subject: [PATCH] Make sure rootDocument is set in Zotero.Translate.Web.setDocument() For non-browser documents that we wrap, defaultView.top.document can be undefined without being inaccessible. Fixes regression from dae0986b9be --- chrome/content/zotero/xpcom/translation/translate.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/chrome/content/zotero/xpcom/translation/translate.js b/chrome/content/zotero/xpcom/translation/translate.js index 11e051bab..fd785c2fe 100644 --- a/chrome/content/zotero/xpcom/translation/translate.js +++ b/chrome/content/zotero/xpcom/translation/translate.js @@ -1960,6 +1960,8 @@ Zotero.Translate.Web.prototype.setDocument = function(doc) { this.rootDocument = doc.defaultView.top.document; } catch (e) { // Cross-origin frames won't be able to access top.document and will throw an error + } + if (!this.rootDocument) { this.rootDocument = doc; } this.setLocation(doc.location.href, this.rootDocument.location.href);