commit de36a6e83324700eacd44266ba374b5f61b2c07a
parent 871cbae499bd367950e3d0fbc5f84913b1aeb7cf
Author: Dan Stillman <dstillman@zotero.org>
Date: Thu, 17 Aug 2017 02:16:39 +0200
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
Diffstat:
1 file changed, 2 insertions(+), 0 deletions(-)
diff --git 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);