make Zotero.Integration.execCommand() synchronous on Fx 4
This commit is contained in:
parent
3c1bb02c9f
commit
2e0d6aa4ec
|
@ -130,9 +130,20 @@ Zotero.Integration = new function() {
|
||||||
* Executes an integration command, first checking to make sure that versions are compatible
|
* Executes an integration command, first checking to make sure that versions are compatible
|
||||||
*/
|
*/
|
||||||
this.execCommand = function execCommand(agent, command, docId) {
|
this.execCommand = function execCommand(agent, command, docId) {
|
||||||
|
if(_inProgress) {
|
||||||
|
Zotero.Integration.activate();
|
||||||
|
Zotero.debug("Integration: Request already in progress; not executing "+agent+" "+command);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
_inProgress = true;
|
||||||
|
|
||||||
|
// Check integration component versions
|
||||||
|
if(!_integrationVersionsOK) {
|
||||||
var verComp = Components.classes["@mozilla.org/xpcom/version-comparator;1"]
|
var verComp = Components.classes["@mozilla.org/xpcom/version-comparator;1"]
|
||||||
.getService(Components.interfaces.nsIVersionComparator);
|
.getService(Components.interfaces.nsIVersionComparator);
|
||||||
|
var addonsChecked = false;
|
||||||
function _checkAddons(addons) {
|
function _checkAddons(addons) {
|
||||||
|
addonsChecked = true;
|
||||||
for each(var addon in addons) {
|
for each(var addon in addons) {
|
||||||
if(!addon) continue;
|
if(!addon) continue;
|
||||||
|
|
||||||
|
@ -154,18 +165,10 @@ Zotero.Integration = new function() {
|
||||||
_callIntegration(agent, command, docId);
|
_callIntegration(agent, command, docId);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(_inProgress) {
|
|
||||||
Zotero.Integration.activate();
|
|
||||||
Zotero.debug("Integration: Request already in progress; not executing "+agent+" "+command);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
_inProgress = true;
|
|
||||||
|
|
||||||
// Check integration component versions
|
|
||||||
if(!_integrationVersionsOK) {
|
|
||||||
if(Zotero.isFx4) {
|
if(Zotero.isFx4) {
|
||||||
Components.utils.import("resource://gre/modules/AddonManager.jsm");
|
Components.utils.import("resource://gre/modules/AddonManager.jsm");
|
||||||
AddonManager.getAddonsByIDs(INTEGRATION_PLUGINS, _checkAddons);
|
AddonManager.getAddonsByIDs(INTEGRATION_PLUGINS, _checkAddons);
|
||||||
|
while(!addonsChecked) Zotero.mainThread.processNextEvent(true);
|
||||||
} else {
|
} else {
|
||||||
var extMan = Components.classes['@mozilla.org/extensions/manager;1'].
|
var extMan = Components.classes['@mozilla.org/extensions/manager;1'].
|
||||||
getService(Components.interfaces.nsIExtensionManager);
|
getService(Components.interfaces.nsIExtensionManager);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user