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, pareMethod) {
if (!array) {
return;
}
if (!$.isFunction(pareMethod)) {
return;
}
var index = getIndexOfElement(array, pareMethod);
if (index < 0) {
return;
}
array.splice(index, 1);
}
function getIndexOfElement(array, pareMethod) {
if (!array) {
return -1;
}
if (!$.isFunction(pareMethod)) {
return -1;
}
for (var i = 0; i < array.length; i++) {
var element = array[i];
if (pareMethod(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?
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, pareMethod) {
if (!array) {
return;
}
if (!$.isFunction(pareMethod)) {
return;
}
var index = getIndexOfElement(array, pareMethod);
if (index < 0) {
return;
}
array.splice(index, 1);
}
function getIndexOfElement(array, pareMethod) {
if (!array) {
return -1;
}
if (!$.isFunction(pareMethod)) {
return -1;
}
for (var i = 0; i < array.length; i++) {
var element = array[i];
if (pareMethod(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?
Share Improve this question edited May 23, 2017 at 10:25 CommunityBot 11 silver badge asked Apr 5, 2013 at 9:32 user57508user57508 8- 2 Can you reproduce this in a fiddle ? – Denys Séguret Commented Apr 5, 2013 at 9:34
- @dystroy good point! will try to! – user57508 Commented Apr 5, 2013 at 9:37
- Are you sure none of your code change the splice function ? Is array a real array or an array-like object ? – Denys Séguret Commented Apr 5, 2013 at 9:38
-
@dystroy it's a real array, created with
new Array();
and when I hover thesplice
prototype in the inspector, I getnative code
... – user57508 Commented Apr 5, 2013 at 9:47 - 1 Then you definetely should take a look at this stackoverflow./questions/83132/… – Tommi Commented Apr 5, 2013 at 9:58
1 Answer
Reset to default 2This question contains a good answers about iframes relationship. (Added as answer by OP suggestion).