From a37e699ba7d8e53e0336fc7caea1f2bda66e0dc0 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Wed, 30 Aug 2006 00:16:07 +0000 Subject: [PATCH] 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() --- .../content/scholar/xpcom/integration.js | 17 ++++++++++------- .../content/scholar/xpcom/scholar.js | 4 ++++ 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/chrome/chromeFiles/content/scholar/xpcom/integration.js b/chrome/chromeFiles/content/scholar/xpcom/integration.js index edffc82d8..79d3922a1 100644 --- a/chrome/chromeFiles/content/scholar/xpcom/integration.js +++ b/chrome/chromeFiles/content/scholar/xpcom/integration.js @@ -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(); \ No newline at end of file +} \ No newline at end of file diff --git a/chrome/chromeFiles/content/scholar/xpcom/scholar.js b/chrome/chromeFiles/content/scholar/xpcom/scholar.js index 793469e80..bb99a0eaa 100644 --- a/chrome/chromeFiles/content/scholar/xpcom/scholar.js +++ b/chrome/chromeFiles/content/scholar/xpcom/scholar.js @@ -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; }