commit 5ddfdec584dae7d9c2e1c3a2a5449b2e7f938558
parent 015b37a85e9324943c839c8c1d4aef602a67fc9d
Author: Dan Stillman <dstillman@zotero.org>
Date: Sun, 2 Mar 2014 05:22:58 -0500
Fix first item drag of session
https://forums.zotero.org/discussion/35206/
Diffstat:
2 files changed, 14 insertions(+), 6 deletions(-)
diff --git 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
@@ -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")) {