JavaScript 'new String' - "JavaScript objects may not be passed to external

Finally got 4.0.2 going with Plesk and Red Hat, having previously used Chili!Soft on a RAQ4+

but there seems to be some odd changes...

I use the "new String()" function in various programs, and now, when you try to 'imbed' a variable/Object created this way an error comes up - I'm sure it can be re-coded, but any idea why this was done, and if it is documented ?

A snip from a test program:

<%

var h=new String("HOLIDAY_NAME");;

%>

<h1>ASP Test h=<% =h%></h1>

Gives error:

Sun ONE ASP JavaScript runtime (0x800A0FA1)

JavaScript objects may not be passed to external objects

Any help appreciated !

Nigel

[711 byte] By [nigelbrooks] at [2007-11-14]
# 1
If I add:h = h.toUpperCase();then it is fine - this is a bug, SURELY ?Nigel
nigelbrooks at 2007-7-7 > top of java,Web & Directory Servers,Web Servers...
# 2

from a previous posting.....

Sounds like you could be running into either of these known issues listed in the Release Notes.

4.8.2 FUNCTION BODY NOT RETURNED

Under Sun ONE ASP JavaScript, when printing out a function,

the function body will not be returned. This functionality

differs from MS-JScript. (#4072)

4.8.3 JAVASCRIPT OBJECTS

JavaScript objects cannot be passed across COM, which means

that JavaScript objects cannot be:

1. Stored in the ASP Application and Session objects.

2. Passed to ASP objects.

3. Passed to VBScript.

The workaround is to pass the result of calling the

toString() or valueOf() method of the JavaScript object.

(#5542, #5021)

Duncan

Duncan_Berriman at 2007-7-7 > top of java,Web & Directory Servers,Web Servers...
# 3

Thanks Duncan, it may be that,

I've also found some other issues:

Response.WriteLine no longer exists - obviousl I can use Response.Write instead - but why remove it and break old code ?

fs.CreateTextFile now fails if the file exists - before it just zeroed the old file - I know this is now 'safer', but again, it's breaking my code !

Cheers

Nigel

nigelbrooks at 2007-7-7 > top of java,Web & Directory Servers,Web Servers...
# 4

It clearly is as you said casting it with uppercase fixes the code.

I suggest you read the release notes, may save you time discovering things.

Can't say why sun did it. Guess they must have their reasons. Fortunately I did not have many problems porting my code when I upgraded except for the odd couple of bugs which I could easily work round.

Duncan

Duncan_Berriman at 2007-7-7 > top of java,Web & Directory Servers,Web Servers...
# 5

Where abouts are all these things listed ?

I've come across something more serious, I use various log files, and one in particular is now 21MB and another is 4MB. I have a short function to open the 4MB file in append mode and add a line, it takes nearly 1 minute just to execute the line:

var file=fs.OpenTextFile(Server.MapPath(filename),8,true); // append to log

That is absurd, and I can't think of a quick way around it. The 21MB file I've never left running to completetion, caspeng grabs too much CPU, and I just kill the process.

G*d know what it's doing - must be stepping thru 1 byte at a time ! I've a shell script that scans the file for a text pattern, and that only takes about 30 secs to scan the file. What are Sun playing at ?

A very frustrated

Nigel

nigelbrooks at 2007-7-7 > top of java,Web & Directory Servers,Web Servers...