Work around strange order of execution bug in Firefox. Fixes #620

pull/622/head
Chad Weider 2012-04-11 02:01:53 -07:00
parent b767192c58
commit e695c716e5
1 changed files with 7 additions and 2 deletions

View File

@ -85,15 +85,20 @@ exports.extractHooks = function (parts, hook_set_name) {
if (exports.isClient) { if (exports.isClient) {
exports.update = function (cb) { exports.update = function (cb) {
// It appears that this response (see #620) may interrupt the current thread
// of execution on Firefox. This schedules the response in the run-loop,
// which appears to fix the issue.
var callback = function () {setTimeout(cb, 0);};
jQuery.getJSON('/pluginfw/plugin-definitions.json', function(data) { jQuery.getJSON('/pluginfw/plugin-definitions.json', function(data) {
exports.plugins = data.plugins; exports.plugins = data.plugins;
exports.parts = data.parts; exports.parts = data.parts;
exports.hooks = exports.extractHooks(exports.parts, "client_hooks"); exports.hooks = exports.extractHooks(exports.parts, "client_hooks");
exports.loaded = true; exports.loaded = true;
cb(); callback();
}).error(function(xhr, s, err){ }).error(function(xhr, s, err){
console.error("Failed to load plugin-definitions: " + err); console.error("Failed to load plugin-definitions: " + err);
cb(); callback();
}); });
}; };
} else { } else {