From 4e37892f620294668ab3a066cb25ea2c2ef4822b Mon Sep 17 00:00:00 2001 From: Mike Hamburg Date: Sun, 7 Nov 2010 15:01:10 -0800 Subject: [PATCH] fix an issue reported by ctemplin that prevents event handlers from being removed --- sjcl.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sjcl.js b/sjcl.js index 7bbb02b..e2f7535 100644 --- a/sjcl.js +++ b/sjcl.js @@ -30,7 +30,7 @@ sjcl.random={randomWords:function(a,b){var c=[];b=this.isReady(b);var d;if(b===0 this.w[c]=(this.w[c]+1)%this.f.length;switch(typeof a){case "number":break;case "object":if(b===undefined)for(c=b=0;c0;){b++;e>>>=1}this.f[g].update([d,this.R++,2,b,f,a.length].concat(a));break;case "string":if(b===undefined)b=a.length;this.f[g].update([d,this.R++,3,b,f,a.length]);this.f[g].update(a);break;default:throw new sjcl.exception.bug("random: addEntropy only supports number, array or string");}this.o[g]+=b;this.k+=b;if(h===0){this.isReady()!==0&&this.T("seeded", Math.max(this.l,this.k));this.T("progress",this.getProgress())}},isReady:function(a){a=this.J[a!==undefined?a:this.C];return this.l&&this.l>=a?this.o[0]>80&&(new Date).valueOf()>this.Y?3:1:this.k>=a?2:0},getProgress:function(a){a=this.J[a?a:this.C];return this.l>=a?1["0"]:this.k>a?1["0"]:this.k/a},startCollectors:function(){if(!this.q){if(window.addEventListener){window.addEventListener("load",this.t,false);window.addEventListener("mousemove",this.u,false)}else if(document.attachEvent){document.attachEvent("onload", this.t);document.attachEvent("onmousemove",this.u)}else throw new sjcl.exception.bug("can't attach event");this.q=true}},stopCollectors:function(){if(this.q){if(window.removeEventListener){window.removeEventListener("load",this.t);window.removeEventListener("mousemove",this.u)}else if(window.detachEvent){window.detachEvent("onload",this.t);window.detachEvent("onmousemove",this.u)}this.q=false}},addEventListener:function(a,b){this.A[a][this.ba++]=b},removeEventListener:function(a,b){var c;a=this.A[a]; -var d=[];for(c in a)a.hasOwnProperty[c]&&a[c]===b&&d.push(c);for(b=0;b=1<this.l)this.l=c;this.H++;this.ea(b)},u:function(a){sjcl.random.addEntropy([a.x|| a.clientX||a.offsetX,a.y||a.clientY||a.offsetY],2,"mouse")},t:function(){sjcl.random.addEntropy(new Date,2,"loadtime")},T:function(a,b){var c;a=sjcl.random.A[a];var d=[];for(c in a)a.hasOwnProperty(c)&&d.push(a[c]);for(c=0;c