Author jbms
Recipients retroj
Date 2014-05-20.06:30:38
I can reproduce this, and I think I know what is happening.  It is the call to String(result), for
generating a string representation of a function, in commands.js that produces the exception.  Mozilla
doesn't store the source code of the function in memory when it first evaluates the function; it just
stores the filename and offset where the function is defined.  The first time the string representation
of the function is needed, it opens the file again and reads the function definition.  Subsequently, it
just uses the cached value and doesn't need to open the file.

The temporary file used by evaluate is deleted before the call to String(result), hence the error. 
However, the same temporary file name tends to be reused repeatedly.  If the file exists but has the
wrong contents, you end up with a garbled result.  For instance:

M-: function foobar () { return 1; }
M-: String(foobar)

<prints garbled output but doesn't throw an exception>


M-: function returns1 () { return 1; }
M-: function returns2 () { return 2; } String(returns1)

function returns1() { return 2; }

Do you know why we use a temporary file for evaluate instead of just using eval?  If there aren't any
problems with using eval that might be the easiest solution.
Date User Action Args
2014-05-20 06:30:39jbmssetmessageid: <>
2014-05-20 06:30:39jbmssetrecipients: + retroj
2014-05-20 06:30:39jbmslinkissue467 messages
2014-05-20 06:30:38jbmscreate