Permalink
Browse files

fix added that prevents runtime error caused by collision of callback…

… ids
  • Loading branch information...
1 parent 6c0baaf commit 25a82890e265150946898433ce00ee9445d6d524 @alexbeletsky alexbeletsky committed Jul 12, 2010
Showing with 9 additions and 0 deletions.
  1. +3 −0 .gitignore
  2. +6 −0 github.js
View
@@ -0,0 +1,3 @@
+*.htm
+*.html
+*.config
View
@@ -29,6 +29,12 @@
var id = +new Date,
script = document.createElement("script");
+ // prevention error fix
+ // if gh object calls are to frequent, there is a change of collision in id
+ // it has been reproduced with my tests, giving a runtime error, because the callback with same id have already been destroyed
+ if(gh.__jsonp_callbacks[id]!=null)
+ id+= +Math.random();
+
gh.__jsonp_callbacks[id] = function () {
delete gh.__jsonp_callbacks[id];
callback.apply(context, arguments);

0 comments on commit 25a8289

Please sign in to comment.