commit 7d19e17bb943d6c2d961b43e2271b20a2162b78c
parent f1a3cb35773c4fdcb203a0df6c716d582834cdb9
Author: Simon Kornblith <simon@simonster.com>
Date: Tue, 13 Jan 2015 01:46:55 -0500
Ensure that we pass WebPageDump an XPCNativeWrapper
Fixes some CSS issues in snapshots
Diffstat:
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/chrome/content/zotero/xpcom/translation/translate_item.js b/chrome/content/zotero/xpcom/translation/translate_item.js
@@ -412,9 +412,10 @@ Zotero.Translate.ItemSaver.prototype = {
}
}
+ var doc = undefined;
if(attachment.document) {
- attachment.document = Zotero.Translate.DOMWrapper.unwrap(attachment.document);
- if(!attachment.title) attachment.title = attachment.document.title;
+ doc = new XPCNativeWrapper(Zotero.Translate.DOMWrapper.unwrap(attachment.document));
+ if(!attachment.title) attachment.title = doc.title;
}
var title = attachment.title || null;
if(!title) {
@@ -426,9 +427,9 @@ Zotero.Translate.ItemSaver.prototype = {
// if snapshot is explicitly set to false, attach as link
attachment.linkMode = "linked_url";
let url, mimeType;
- if(attachment.document) {
- url = attachment.document.location.href;
- mimeType = attachment.mimeType ? attachment.mimeType : attachment.document.contentType;
+ if(doc) {
+ url = doc.location.href;
+ mimeType = attachment.mimeType ? attachment.mimeType : doc.contentType;
} else {
url = attachment.url
mimeType = attachment.mimeType ? attachment.mimeType : undefined;
@@ -464,10 +465,10 @@ Zotero.Translate.ItemSaver.prototype = {
return true;
} else {
// if snapshot is not explicitly set to false, retrieve snapshot
- if(attachment.document) {
+ if(doc) {
try {
attachment.linkMode = "imported_url";
- Zotero.Attachments.importFromDocument(attachment.document,
+ Zotero.Attachments.importFromDocument(doc,
parentID, title, null, function(status, err) {
if(status) {
attachmentCallback(attachment, 100);