Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > Freed script

Reply
Thread Tools

Freed script

 
 
Thor W Hammer
Guest
Posts: n/a
 
      11-21-2005
Hello all,

Is it possible to find out if a script is freed? This is actual when having
a pointer to a function and should determine if it is freed so we don't call
it and get error..

TWH


 
Reply With Quote
 
 
 
 
VK
Guest
Posts: n/a
 
      11-21-2005

Thor W Hammer wrote:
> Is it possible to find out if a script is freed?


How do you determine the term "freed" for JavaScript?
Any function exists in the scope until you manually removed it (by
setting to null).

> a pointer to a function and should determine if it is freed so we don't call
> it and get error..


if (typeof ptrMyFunction == "undefined") {
// then there is no such function
}

 
Reply With Quote
 
 
 
 
Thor W Hammer
Guest
Posts: n/a
 
      11-21-2005
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.


"VK" <> wrote in message
news: oups.com...
>
> Thor W Hammer wrote:
>> Is it possible to find out if a script is freed?

>
> How do you determine the term "freed" for JavaScript?
> Any function exists in the scope until you manually removed it (by
> setting to null).
>
>> a pointer to a function and should determine if it is freed so we don't
>> call
>> it and get error..

>
> if (typeof ptrMyFunction == "undefined") {
> // then there is no such function
> }
>



 
Reply With Quote
 
VK
Guest
Posts: n/a
 
      11-21-2005

Thor W Hammer wrote:
> 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)) {
// ...
}

 
Reply With Quote
 
Thor W Hammer
Guest
Posts: n/a
 
      11-23-2005
Yep, I've already done that.


"Jasen Betts" <> wrote in message
news:...
> On 2005-11-21, Thor W Hammer <> wrote:
>
>> 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.

>
> $0.02 solution: use try/catch
>
> there may be a better way.
>
>
>
> --
>
> Bye.
> Jasen



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
can't execute code from a freed script.. maya Javascript 2 02-25-2008 06:55 PM
"can't execute code from a freed script" on webpages richjone@gmail.com Computer Support 7 05-08-2007 02:00 PM
prevent "can't execute code from freed script" reformy Javascript 2 06-30-2005 02:31 PM
Can't execute code from freed script Martin Waller ASP General 1 12-03-2004 03:39 PM
Can't execute code from a freed script Dirk Gently Javascript 4 11-16-2004 02:17 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57