Why do I get "Can't execute code from a freed script"

javascript

Solution

This question contains a good answers about iframes relationship. (Added as answer by OP suggestion).

Problem

First of all: Yes, I've read this answer... And, Yes, there's no meta after script (as I do not have any meta on my page), and, No, there's no timeout or ajax-request I have following helper-method (Yes, I could have made a 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; } for (var i = 0; i < array.length; i++) { var element = array[i]; if (compareMethod(element)) { return i; } } return -1; } ``` I am calling this with: ``` $foo.on('click', function () { removeElementFromArray(window.myArray, function (element) { return // some condition }); }); ``` I am getting the exception "SCRIPT5011: Can't execute code from a freed script" (only in IE render-mode < 10) in following line: ``` array.splice(index, 1); ``` But not on the first call, but on any subsequent ones (for the same array) ... But I can't think of a single reason why this exception occurs, as I am accessing the array in other lines as well in the callstack (as you can see, eg getIndexOfElement, where I iterate over the array). Can anybody help me out?

Original source

Related problems