diff --git a/chrome/content/zotero/xpcom/style.js b/chrome/content/zotero/xpcom/style.js index e3ade24a67..2568a4ba6e 100644 --- a/chrome/content/zotero/xpcom/style.js +++ b/chrome/content/zotero/xpcom/style.js @@ -45,6 +45,18 @@ Zotero.Styles = new function() { "csl":"http://purl.org/net/xbiblio/csl" }; + // TEMP + // Until we get asynchronous style loading, load renamed styles at startup, since the + // synchronous call we were using breaks the first drag of the session (on OS X, at least) + this.preinit = function () { + _renamedStyles = {}; + Zotero.HTTP.promise("GET", "resource://zotero/schema/renamed-styles.json") + .then(function (xmlhttp) { + // Map some obsolete styles to current ones + _renamedStyles = JSON.parse(xmlhttp.responseText); + }) + .done(); + } /** * Initializes styles cache, loading metadata for styles into memory @@ -123,12 +135,7 @@ Zotero.Styles = new function() { this.get = function(id, skipMappings) { if(!_initialized) this.init(); - // Map some obsolete styles to current ones - if(!_renamedStyles) { - _renamedStyles = JSON.parse(Zotero.File.getContentsFromURL( - "resource://zotero/schema/renamed-styles.json" - )); - } + // TODO: With asynchronous style loading, move renamedStyles call back here if(!skipMappings) { var prefix = "http://www.zotero.org/styles/"; diff --git a/chrome/content/zotero/xpcom/zotero.js b/chrome/content/zotero/xpcom/zotero.js index 49c72a327d..d8d2fc031f 100644 --- a/chrome/content/zotero/xpcom/zotero.js +++ b/chrome/content/zotero/xpcom/zotero.js @@ -725,6 +725,7 @@ Components.utils.import("resource://gre/modules/Services.jsm"); } // Initialize various services + Zotero.Styles.preinit(); Zotero.Integration.init(); if(Zotero.Prefs.get("httpServer.enabled")) {