Thor said:
No, if I have a pointer to a function that exists inside a frame (iframe)
and the the frame is unloaded or navigated to another place, then function
is still in memory but it is freed so that we get the error message "Can't
execute code from a freed script". What I want to do is to determine if the
script is freed so that I don't call it.
Oh, orphan script problem... It's even more interesting than freed/not
freed and never was really explored. In some circumstances you even
able to execute a function left from the previous page - as long as it
doesn't address to the DOM of the previous page (imaginary objects).
The latter simply crash Internet Explorer for example.
Well, I guess you still have a reliable checkpoint:
parent.frames['otherFrame'].document.location
and match it against some variable.
Also standard JavaScript doesn't have package scope visibility but you
can emulate it:
function myFunction() {
arguments.callee.packageName = 'package 1';
// the rest of the function
}
and from your script later:
if ((typeof myFunction == 'object') &&
(myFunction.packageName == currentPackage)) {
// ...
}