Fix WPD leak by loading into a local scope
This commit is contained in:
parent
39c86a791e
commit
a78cd2cf18
2 changed files with 11 additions and 11 deletions
|
@ -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
|
||||
|
|
|
@ -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<xpcomFilesAll.length; i++) {
|
||||
try {
|
||||
|
|
Loading…
Reference in a new issue