Skip to content

Commit

Permalink
Item13373: fix issues with loader when using same brush multiple times
Browse files Browse the repository at this point in the history
The previous loader called its callback immediately when another request
for the same brush was in progress, even if the request was not finished
yet. This would break all code blocks in the page.
  • Loading branch information
jast committed Jul 30, 2015
1 parent 6be42c3 commit ba6a09f
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions pub/System/DpSyntaxHighlighterPlugin/shInit.uncompressed.js
Expand Up @@ -150,11 +150,12 @@
throw("no brush found for language '"+id+"'");
}

if (brush.loaded) {
callback();
if (brush.def) {
def.then(callback);
} else {
brush.loaded = true;
$.getScript(brush.url, callback);
brush.def = jQuery.Deferred();
brush.def.then(callback);
$.getScript(brush.url, function() { def.resolve(); });
}

}
Expand Down

0 comments on commit ba6a09f

Please sign in to comment.