javascript - Why do I get "Can't execute code from a freed script" -
first of all: yes, i've read this answer... and, yes, there's no meta after script (as not have meta on page), and, no, there's no timeout or ajax-request
i have following helper-method (yes, have made prototype-method ...):
function removeelementfromarray(array, comparemethod) { if (!array) { return; } if (!$.isfunction(comparemethod)) { return; } var index = getindexofelement(array, comparemethod); if (index < 0) { return; } array.splice(index, 1); } function getindexofelement(array, comparemethod) { if (!array) { return -1; } if (!$.isfunction(comparemethod)) { return -1; } (var = 0; < array.length; i++) { var element = array[i]; if (comparemethod(element)) { return i; } } return -1; }
i calling with:
$foo.on('click', function () { removeelementfromarray(window.myarray, function (element) { return // condition }); });
i getting exception "script5011: can't execute code freed script" (only in ie render-mode < 10) in following line:
array.splice(index, 1);
but not on first call, on subsequent ones (for same array) ...
but can't think of single reason why exception occurs, accessing array in other lines in callstack (as can see, eg getindexofelement, iterate on array).
can me out?
this question contains answers iframes relationship. (added answer op suggestion).
Comments
Post a Comment