XPCOM calls can't be made in top-level code, as the XPCOM components may not be available yet -- breakage can (and did, on my system) ensue via a race condition

Moved integration init()'s to Scholar.init()
This commit is contained in:
Dan Stillman 2006-08-30 00:16:07 +00:00
parent 73b5634f62
commit a37e699ba7
2 changed files with 14 additions and 7 deletions

View file

@ -293,14 +293,19 @@ Scholar.Integration.DataListener.prototype._requestFinished = function(response)
}
Scholar.Integration.SOAP = new function() {
var window = Components.classes["@mozilla.org/appshell/appShellService;1"]
.getService(Components.interfaces.nsIAppShellService)
.hiddenDOMWindow;
this.init = init;
this.getCitation = getCitation;
this.getBibliography = getBibliography;
this.setDocPrefs = setDocPrefs;
var window;
function init() {
window = Components.classes["@mozilla.org/appshell/appShellService;1"]
.getService(Components.interfaces.nsIAppShellService)
.hiddenDOMWindow;
}
/*
* generates a new citation for a given item
* ACCEPTS: style[, itemString, newItemIndex]
@ -375,6 +380,4 @@ Scholar.Integration.SOAP = new function() {
var styleClass = Scholar.Cite.getStyleClass(io.style);
return [io.style, styleClass];
}
}
Scholar.Integration.init();
}

View file

@ -84,6 +84,10 @@ var Scholar = new function(){
Scholar.Schema.updateSchema();
Scholar.Schema.updateScrapersRemote();
// Initialize integration web server
Scholar.Integration.SOAP.init();
Scholar.Integration.init();
_initialized = true;
return true;
}