Remove dependency on zoteroIntegration.idl
This commit is contained in:
parent
0de22b132e
commit
49001572fd
|
@ -228,8 +228,13 @@ Zotero.Integration = new function() {
|
||||||
try {
|
try {
|
||||||
var componentClass = "@zotero.org/Zotero/integration/application?agent="+agent+";1";
|
var componentClass = "@zotero.org/Zotero/integration/application?agent="+agent+";1";
|
||||||
Zotero.debug("Integration: Instantiating "+componentClass+" for command "+command+(docId ? " with doc "+docId : ""));
|
Zotero.debug("Integration: Instantiating "+componentClass+" for command "+command+(docId ? " with doc "+docId : ""));
|
||||||
|
try {
|
||||||
return Components.classes[componentClass]
|
return Components.classes[componentClass]
|
||||||
.getService(Components.interfaces.zoteroIntegrationApplication);
|
.getService(Components.interfaces.zoteroIntegrationApplication);
|
||||||
|
} catch (e) {
|
||||||
|
return Components.classes[componentClass]
|
||||||
|
.getService(Components.interfaces.nsISupports).wrappedJSObject;
|
||||||
|
}
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
throw new Zotero.Exception.Alert("integration.error.notInstalled",
|
throw new Zotero.Exception.Alert("integration.error.notInstalled",
|
||||||
[], "integration.error.title");
|
[], "integration.error.title");
|
||||||
|
@ -311,6 +316,8 @@ Zotero.Integration = new function() {
|
||||||
// Call complete function if one exists
|
// Call complete function if one exists
|
||||||
if (document.wrappedJSObject && document.wrappedJSObject.complete) {
|
if (document.wrappedJSObject && document.wrappedJSObject.complete) {
|
||||||
document.wrappedJSObject.complete();
|
document.wrappedJSObject.complete();
|
||||||
|
} else if (document.complete) {
|
||||||
|
document.complete();
|
||||||
}
|
}
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
Zotero.logError(e);
|
Zotero.logError(e);
|
||||||
|
@ -1434,7 +1441,12 @@ Zotero.Integration.Fields.prototype.get = function get() {
|
||||||
var fieldsEnumerator = subject.QueryInterface(Components.interfaces.nsISimpleEnumerator);
|
var fieldsEnumerator = subject.QueryInterface(Components.interfaces.nsISimpleEnumerator);
|
||||||
var fields = me._fields = [];
|
var fields = me._fields = [];
|
||||||
while(fieldsEnumerator.hasMoreElements()) {
|
while(fieldsEnumerator.hasMoreElements()) {
|
||||||
fields.push(fieldsEnumerator.getNext().QueryInterface(Components.interfaces.zoteroIntegrationField));
|
let field = fieldsEnumerator.getNext();
|
||||||
|
try {
|
||||||
|
fields.push(field.QueryInterface(Components.interfaces.zoteroIntegrationField));
|
||||||
|
} catch (e) {
|
||||||
|
fields.push(field);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(Zotero.Debug.enabled) {
|
if(Zotero.Debug.enabled) {
|
||||||
|
|
|
@ -120,7 +120,6 @@ describe("Zotero.Integration", function () {
|
||||||
* Informs the document processor that the operation is complete
|
* Informs the document processor that the operation is complete
|
||||||
*/
|
*/
|
||||||
complete: () => 0,
|
complete: () => 0,
|
||||||
QueryInterface: function() {return this},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
DocumentPluginDummy.FieldEnumerator = function(doc) {this.doc = doc; this.idx = 0};
|
DocumentPluginDummy.FieldEnumerator = function(doc) {this.doc = doc; this.idx = 0};
|
||||||
|
@ -190,7 +189,6 @@ describe("Zotero.Integration", function () {
|
||||||
* @returns {Number}
|
* @returns {Number}
|
||||||
*/
|
*/
|
||||||
getNoteIndex: () => 0,
|
getNoteIndex: () => 0,
|
||||||
QueryInterface: function() {return this},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
for (let cls of ['Application', 'Document', 'FieldEnumerator', 'Field']) {
|
for (let cls of ['Application', 'Document', 'FieldEnumerator', 'Field']) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user