diff --git a/chrome/content/zotero/xpcom/attachments.js b/chrome/content/zotero/xpcom/attachments.js index 125dc4dc8..0b0796cc2 100644 --- a/chrome/content/zotero/xpcom/attachments.js +++ b/chrome/content/zotero/xpcom/attachments.js @@ -567,8 +567,17 @@ Zotero.Attachments = new function(){ if (mimeType === 'text/html' || mimeType === 'application/xhtml+xml') { var sync = true; - Zotero.WebPageDump.wpdDOMSaver.init(file.path, document); - Zotero.WebPageDump.wpdDOMSaver.saveHTMLDocument(); + // Load WebPageDump code + var wpd = {"Zotero":Zotero}; + Components.classes["@mozilla.org/moz/jssubscript-loader;1"] + .getService(Components.interfaces.mozIJSSubScriptLoader) + .loadSubScript("chrome://zotero/content/webpagedump/common.js", wpd); + Components.classes["@mozilla.org/moz/jssubscript-loader;1"] + .getService(Components.interfaces.mozIJSSubScriptLoader) + .loadSubScript("chrome://zotero/content/webpagedump/domsaver.js", wpd); + + wpd.wpdDOMSaver.init(file.path, document); + wpd.wpdDOMSaver.saveHTMLDocument(); attachmentItem.attachmentPath = this.getPath( file, Zotero.Attachments.LINK_MODE_IMPORTED_URL diff --git a/components/zotero-service.js b/components/zotero-service.js index 71d2993a8..070c06273 100644 --- a/components/zotero-service.js +++ b/components/zotero-service.js @@ -206,15 +206,6 @@ function makeZoteroContext(isConnector) { .getService(Ci.mozIJSSubScriptLoader) .loadSubScript("chrome://zotero/content/xpcom/citeproc.js", zContext.Zotero.CiteProc); - // Load WPD into Zotero.WebPageDump namespace - zContext.Zotero.WebPageDump = {"Zotero":zContext.Zotero}; - Components.classes["@mozilla.org/moz/jssubscript-loader;1"] - .getService(Components.interfaces.mozIJSSubScriptLoader) - .loadSubScript("chrome://zotero/content/webpagedump/common.js", zContext.Zotero.WebPageDump); - Components.classes["@mozilla.org/moz/jssubscript-loader;1"] - .getService(Components.interfaces.mozIJSSubScriptLoader) - .loadSubScript("chrome://zotero/content/webpagedump/domsaver.js", zContext.Zotero.WebPageDump); - // Load remaining xpcomFiles for (var i=1; i