Don't try to run cleanup on old documents
This commit is contained in:
parent
3c61a4eae8
commit
80c85c7e74
|
@ -402,7 +402,10 @@ Zotero.Integration = new function() {
|
|||
}
|
||||
|
||||
if(Zotero.Integration.currentWindow && !Zotero.Integration.currentWindow.closed) {
|
||||
Zotero.Integration.currentWindow.close();
|
||||
var oldWindow = Zotero.Integration.currentWindow;
|
||||
Zotero.setTimeout(function() {
|
||||
oldWindow.close();
|
||||
}, 100, true);
|
||||
}
|
||||
_inProgress = Zotero.Integration.currentWindow = false;
|
||||
}
|
||||
|
@ -534,7 +537,7 @@ Zotero.Integration.Document.prototype._getSession = function(require, dontRunSet
|
|||
return;
|
||||
}
|
||||
|
||||
this._session.setDocPrefs(this._app.primaryFieldType, this._app.secondaryFieldType, function(status) {
|
||||
this._session.setDocPrefs(this._doc, this._app.primaryFieldType, this._app.secondaryFieldType, function(status) {
|
||||
if(status === false) {
|
||||
throw new Zotero.Integration.UserCancelledException();
|
||||
}
|
||||
|
@ -579,7 +582,7 @@ Zotero.Integration.Document.prototype._getSession = function(require, dontRunSet
|
|||
} catch(e) {
|
||||
// make sure style is defined
|
||||
if(e instanceof Zotero.Integration.DisplayException && e.name === "invalidStyle") {
|
||||
this._session.setDocPrefs(this._app.primaryFieldType, this._app.secondaryFieldType, function() {
|
||||
this._session.setDocPrefs(this._doc, this._app.primaryFieldType, this._app.secondaryFieldType, function() {
|
||||
me._doc.setDocumentData(me._session.data.serializeXML());
|
||||
me._session.reload = true;
|
||||
callback(true);
|
||||
|
@ -674,7 +677,7 @@ Zotero.Integration.Document.prototype.editBibliography = function(callback) {
|
|||
}
|
||||
|
||||
fieldGetter.updateSession(function() {
|
||||
me._session.editBibliography(function() {
|
||||
me._session.editBibliography(this._doc, function() {
|
||||
me._doc.activate();
|
||||
fieldGetter.updateDocument(false, true, false, function() {
|
||||
Zotero.Integration.complete(me._doc);
|
||||
|
@ -1086,7 +1089,7 @@ Zotero.Integration.Fields.prototype._processFields = function(fields, callback,
|
|||
} else { // Yes
|
||||
// Display reselect item dialog
|
||||
var me = this;
|
||||
this._session.reselectItem(e, function() {
|
||||
this._session.reselectItem(this._doc, e, function() {
|
||||
// Now try again
|
||||
me._doc.activate();
|
||||
me._processFields(fields, callback, i);
|
||||
|
@ -1332,11 +1335,11 @@ Zotero.Integration.Fields.prototype.addEditCitation = function(field, callback)
|
|||
var io = new Zotero.Integration.CitationEditInterface(citation, field, this, session, newField, callback);
|
||||
|
||||
if(Zotero.Prefs.get("integration.useClassicAddCitationDialog")) {
|
||||
session.displayDialog('chrome://zotero/content/integration/addCitationDialog.xul', 'alwaysRaised,resizable', io, true);
|
||||
session.displayDialog(this._doc, 'chrome://zotero/content/integration/addCitationDialog.xul', 'alwaysRaised,resizable', io, true);
|
||||
} else {
|
||||
var mode = (!Zotero.isMac && Zotero.Prefs.get('integration.keepAddCitationDialogRaised')
|
||||
? 'popup' : 'alwaysRaised')
|
||||
session.displayDialog('chrome://zotero/content/integration/quickFormat.xul', mode, io, true);
|
||||
session.displayDialog(this._doc, 'chrome://zotero/content/integration/quickFormat.xul', mode, io, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1580,8 +1583,8 @@ Zotero.Integration.Session.prototype.setData = function(data) {
|
|||
* function waits to return until the window has been closed. If "true", the function returns
|
||||
* immediately.
|
||||
*/
|
||||
Zotero.Integration.Session.prototype.displayDialog = function(url, options, io, async) {
|
||||
if(this.doc) this.doc.cleanup();
|
||||
Zotero.Integration.Session.prototype.displayDialog = function(doc, url, options, io, async) {
|
||||
doc.cleanup();
|
||||
|
||||
var allOptions = 'chrome,centerscreen';
|
||||
// without this, Firefox gets raised with our windows under Compiz
|
||||
|
@ -1610,7 +1613,7 @@ Zotero.Integration.Session.prototype.displayDialog = function(url, options, io,
|
|||
try {
|
||||
async();
|
||||
} catch(e) {
|
||||
Zotero.Integration.handleError(e, this.doc);
|
||||
Zotero.Integration.handleError(e, doc);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1621,7 +1624,7 @@ Zotero.Integration.Session.prototype.displayDialog = function(url, options, io,
|
|||
* Displays a dialog to set document preferences
|
||||
* @return {oldData|null|false} Old document data, if there was any; null, if there wasn't; false if cancelled
|
||||
*/
|
||||
Zotero.Integration.Session.prototype.setDocPrefs = function(primaryFieldType, secondaryFieldType, callback) {
|
||||
Zotero.Integration.Session.prototype.setDocPrefs = function(doc, primaryFieldType, secondaryFieldType, callback) {
|
||||
var io = new function() {
|
||||
this.wrappedJSObject = this;
|
||||
};
|
||||
|
@ -1637,7 +1640,7 @@ Zotero.Integration.Session.prototype.setDocPrefs = function(primaryFieldType, se
|
|||
}
|
||||
|
||||
var me = this;
|
||||
this.displayDialog('chrome://zotero/content/integration/integrationDocPrefs.xul', '', io, function() {
|
||||
this.displayDialog(doc, 'chrome://zotero/content/integration/integrationDocPrefs.xul', '', io, function() {
|
||||
if(!io.style) {
|
||||
callback(false);
|
||||
return;
|
||||
|
@ -1668,7 +1671,7 @@ Zotero.Integration.Session.prototype.setDocPrefs = function(primaryFieldType, se
|
|||
* Reselects an item to replace a deleted item
|
||||
* @param exception {Zotero.Integration.MissingItemException}
|
||||
*/
|
||||
Zotero.Integration.Session.prototype.reselectItem = function(exception, callback) {
|
||||
Zotero.Integration.Session.prototype.reselectItem = function(doc, exception, callback) {
|
||||
var io = new function() {
|
||||
this.wrappedJSObject = this;
|
||||
},
|
||||
|
@ -1676,7 +1679,7 @@ Zotero.Integration.Session.prototype.reselectItem = function(exception, callback
|
|||
io.addBorder = Zotero.isWin;
|
||||
io.singleSelection = true;
|
||||
|
||||
this.displayDialog('chrome://zotero/content/selectItemsDialog.xul', 'resizable', io, function() {
|
||||
this.displayDialog(doc, 'chrome://zotero/content/selectItemsDialog.xul', 'resizable', io, function() {
|
||||
if(io.dataOut && io.dataOut.length) {
|
||||
var itemID = io.dataOut[0];
|
||||
|
||||
|
@ -2391,13 +2394,13 @@ Zotero.Integration.Session.prototype.previewCitation = function(citation) {
|
|||
/**
|
||||
* Edits integration bibliography
|
||||
*/
|
||||
Zotero.Integration.Session.prototype.editBibliography = function(callback) {
|
||||
Zotero.Integration.Session.prototype.editBibliography = function(doc, callback) {
|
||||
var bibliographyEditor = new Zotero.Integration.Session.BibliographyEditInterface(this);
|
||||
var io = new function() { this.wrappedJSObject = bibliographyEditor; }
|
||||
|
||||
this.bibliographyDataHasChanged = this.bibliographyHasChanged = true;
|
||||
|
||||
this.displayDialog('chrome://zotero/content/integration/editBibliographyDialog.xul', 'resizable', io, callback);
|
||||
this.displayDialog(doc, 'chrome://zotero/content/integration/editBibliographyDialog.xul', 'resizable', io, callback);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2724,8 +2727,4 @@ Zotero.Integration.URIMap.prototype.getZoteroItemForURIs = function(uris) {
|
|||
}
|
||||
|
||||
return [zoteroItem, needUpdate];
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
}
|
Loading…
Reference in New Issue
Block a user