You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First, congrats on creating BLeak, this is such a wonderful and helpful software :)
I ran into an issue when using recursive function calls in the instrumented JavaScript code.
The issue is with an old version of the jQuery (haven't checked a newer version).
The original code causing the issue is:
add: function(){if(list){// If we have memory from a past run, we should fire after addingif(memory&&!firing){firingIndex=list.length-1;queue.push(memory);}(functionadd(args){jQuery.each(args,function(_,arg){if(jQuery.isFunction(arg)){if(!options.unique||!self.has(arg)){list.push(arg);}}elseif(arg&&arg.length&&jQuery.type(arg)!=="string"){// Inspect recursively// !!! This is where the error happens !!! add(arg);}});})(arguments);if(memory&&!firing){fire();}}returnthis;},
The instrumented code is as follows:
s31.self={add: $$$FUNCTION_EXPRESSION$$$(function(){if(s31.list){if(s31.memory&&!s31.firing){s31.firingIndex=s31.list.length-1;s31.queue.push(s31.memory);}$$$FUNCTION_EXPRESSION$$$(functionadd(args){vars32=$$$CREATE_SCOPE_OBJECT$$$(s31,["add"],{},[],[]);s1.jQuery.each(args,$$$FUNCTION_EXPRESSION$$$(function(_,arg){if(s1.jQuery.isFunction(arg)){if(!s31.options.unique||!s31.self.has(arg)){s31.list.push(arg);}}elseif(arg&&arg.length&&!$$$SEQ$$$(s1.jQuery.type(arg),"string")){// !!! This is where the error happens !!!(s32.add||s32.add)(arg);}},s32));},s31)(arguments);if(s31.memory&&!s31.firing){(s31.fire||s31.fire)();}}returnthis;},s31),
I was able to work around the issue by rewriting the function so that the instrumented code becomes:
varlist=[];functionisWindow(obj){returnobj!=null&&obj===obj.window;}functionisArrayLike(obj){// Support: iOS 8.2 (not reproducible in simulator)// `in` check used to prevent JIT error (gh-2145)// hasOwn isn't used here due to false negatives// regarding Nodelist length in IEvarlength=!!obj&&"length"inobj&&obj.length,type=typeofobj;if(type==="function"||isWindow(obj)){returnfalse;}returntype==="array"||length===0||typeoflength==="number"&&length>0&&(length-1)inobj;}varjQueryEach=function(obj,callback){varlength,i=0;if(isArrayLike(obj)){length=obj.length;for(;i<length;i++){if(callback.call(obj[i],i,obj[i])===false){break;}}}else{for(iinobj){if(callback.call(obj[i],i,obj[i])===false){break;}}}returnobj;}varadd=function(){(functioninnerAdd(args){jQueryEach(args,function(_,arg){if(typeofarg==="function"){list.push(arg);}elseif(arg&&arg.length&&typeofarg!=="string"){// Inspect recursivelyinnerAdd(arg);}});})(arguments);};functionaddToList(){// Please don't ask why I'm doing this, it's coming from another library initialising...varcrazyArgs={0: undefined,1: {0: undefined,length: 1},length: 2}add(crazyArgs);console.log("list: ",list);}document.getElementById('addToList').addEventListener('click',addToList);
First, congrats on creating BLeak, this is such a wonderful and helpful software :)
I ran into an issue when using recursive function calls in the instrumented JavaScript code.
The issue is with an old version of the jQuery (haven't checked a newer version).
The original code causing the issue is:
The instrumented code is as follows:
I was able to work around the issue by rewriting the function so that the instrumented code becomes:
This is not blocking me anymore, but other people may run into similar issues.
Please let me know if I can provide anything else to help solve this issue.
The text was updated successfully, but these errors were encountered: