Closed Bug 383721 Opened 17 years ago Closed 17 years ago

Tabs not escaped (to "\t") on some platforms due to isprint() differences

Categories

(Core :: JavaScript Engine, defect)

x86
Windows XP
defect
Not set
minor

Tracking

()

VERIFIED FIXED

People

(Reporter: timeless, Assigned: crowderbt)

References

Details

Attachments

(1 file)

I'm playing with jsshell and friends and using a very "dumb" command shell which doesn't understand tabs (well, it thinks of them as "get me to the next tab stop"). 

This means that:
js> function a() {return "\t"}
js> a
function a() {
    return "    ";
}
js> print(uneval(a))
function a() {return "  ";}

When I start copying function a() around, I eventually end up with various random results.

Would we break many sites or any standard rules if Function.prototype.toString was changed to return "\t" instead of "	"? (I pasted this with IE, not sure if that will survive).
WFM, Mac debug jsshell.

js> function a() {return "\t"}
js> a
function a() {
    return "\t";
}
js> print(uneval(a))
function a() {return "\t";}
Weird, I get Jesse's results in both trunk and 1.8 builds, as well.  timeless, what shell build are you using?  Have you possibly shadowed Function.toSource somewhere?
Gonna resolve this as WFM for now.  timeless please re-open if you have more info later.
Status: UNCONFIRMED → RESOLVED
Closed: 17 years ago
Resolution: --- → WORKSFORME
I'm getting the same result as timeless under Windows, in both Firefox 2.0.0.4 and the latest trunk shell. Seems like Microsoft's CRT returns true for isprint('\t') if you call setlocale(LC_ALL, "") before.
Status: RESOLVED → UNCONFIRMED
Resolution: WORKSFORME → ---
Summary: could spidermonkey please return tabs as escaped elements in Function.toString → Tabs not escaped (to "\t") on some platforms due to isprint() differences
Ok, I can repro this on my Windows machine.
Assignee: general → crowder
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Attachment #267769 - Flags: review?(mrbkap)
Attachment #267769 - Flags: review?(mrbkap) → review+
jsopcode.c: 3.250
Status: ASSIGNED → RESOLVED
Closed: 17 years ago17 years ago
Resolution: --- → FIXED
/cvsroot/mozilla/js/tests/js1_5/decompilation/regress-383721.js,v  <--  regress-383721.js
initial revision: 1.1
done
Flags: in-testsuite+
verified fixed 1.9.0 windows.
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: