Bug 126482 - Konqueror does not pass mochikit tests
Summary: Konqueror does not pass mochikit tests
Status: RESOLVED FIXED
Alias: None
Product: konqueror
Classification: Applications
Component: khtml (show other bugs)
Version: unspecified
Platform: Ubuntu Linux
: NOR normal
Target Milestone: ---
Assignee: Konqueror Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-04-29 20:17 UTC by Daniel Hahler
Modified: 2006-08-14 15:05 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Hahler 2006-04-29 20:17:40 UTC
Version:            (using KDE KDE 3.5.2)
Installed from:    Ubuntu Packages

There are javascript tests at http://mochikit.com/tests/index.html, which Konqueror does not pass all.

MochiKit is "a leightweight javascript framework" and I've added a bug in their tracker, but it seems to be with Konqueror.
See http://trac.mochikit.com/ticket/93
Comment 1 Maksim Orlovich 2006-04-29 21:25:45 UTC
Can't confirm the problem
Comment 2 Daniel Hahler 2006-04-29 22:22:21 UTC
Just tried it again, after disabling Privoxy, which I use as a proxy, but the same number of test fails.

I assume you're using the same Konqueror version?

Should I take the bug over to Kubuntu?
Comment 3 Maksim Orlovich 2006-04-29 22:36:17 UTC
I am using post-3.5.2 3.5 branch, so not quite the same version...
Comment 4 Ismail Donmez 2006-04-30 00:10:58 UTC
Passes all tests here too. KDE 3.5 SVN.
Comment 5 Daniel Hahler 2006-04-30 02:56:42 UTC
Could not get verified on #kubuntu with x86 on amd64 (like my system), too (though with Dapper beta 2 and I'm using the current one).

Someone on x86 also experienced the same problem.


Nearly all tests are "decimal related":
not ok - 1.23 JSON got "1", expected "1.23"
not ok - array JSON got "[1, \"2\", 3]", expected "[1, \"2\", 3.3]"
not ok - truncToFixed truncate got "0.000", expected "0.123"
not ok - truncToFixed trailing zeros got "0.000", expected "0.120"
not ok - truncToFixed no round got "0.0", expected "0.1"
[...]
not ok - custom locale got "2 apples and 300 bagels at 0am for breakfast", expected "2 apples and 345 bagels at 8am for breakfast"
not ok - fromRGB < 16 works got "#e20fb6", expected "#e210b6"
Comment 6 Daniel Hahler 2006-04-30 03:14:21 UTC
It's related to LANG.

When I start Konqueror with:
LANG=C konqueror
all tests pass.

LANG is set to de_DE.UTF8 normally (and with the other person where the tests have failed).
Comment 7 Maksim Orlovich 2006-04-30 03:17:48 UTC
Great detective work, thanks!
Comment 8 Daniel Hahler 2006-04-30 03:43:23 UTC
You're welcome.

More strange: "LANG=C konqueror" does not fix it with the other person's setup, where it fails. But the failing tests are the same. At least that's what he said.
Comment 9 Maksim Orlovich 2006-04-30 04:20:49 UTC
And trying to force your locale here doesn't trigger it :-(, nor can I see anything locale-specific happening on the path..
Could you perhaps do this experiment: enable the javascript debugger, run the tests. Pull up the debbugger window (View -> JavaScript debugger), click on the right-most icon in the toolbar. Then go to webpage, and click one of the report lines, so some JS runs and makes the debugger attach. At the bottom of the debugger window, there is a console.
Type in:
serializeJSON(1.23)
and please paste the output here..
Also, typeof serializeJSON(1.23) may be interesting...
Comment 10 Daniel Hahler 2006-04-30 04:25:18 UTC
serializeJSON(1.23)
1
typeof serializeJSON(1.23)
string

btw: I had the debugger already enabled, but should not make any difference.
Comment 11 Maksim Orlovich 2006-04-30 04:33:08 UTC
Wow. and what happens with:
1.23 + ""
and String(1.23)?
Comment 12 Maksim Orlovich 2006-04-30 04:53:46 UTC
.. and I just realized I may be looking at it from the wrong direction. Could you perhaps also test:
1.23 + 2
Number("1.23")
Number("1.29")?

thanks...
Comment 13 Daniel Hahler 2006-04-30 05:00:02 UTC
1.23 + ""
1
String(1.23)
1
1.23 + 2
3
Number("1.23")
1.23
Number("1.29")
1.29
Comment 14 Ismail Donmez 2006-04-30 09:22:43 UTC
FWIW I am testing with tr_TR.UTF-8 here and all test passes.
Comment 15 Maksim Orlovich 2006-08-12 19:01:58 UTC
Aha, this came up again in a private conversation, and I see that the lexer is using strtod, which is locale-sensitive. The relevant setting is LC_NUMERIC....

Comment 16 Maksim Orlovich 2006-08-14 15:05:06 UTC
SVN commit 572947 by orlovich:

Fix locale-dependence in the parser. Thanks to Fredrik Johansson 
for reminding me of it and testing the fix.
BUG:126482


 M  +2 -1      lexer.cpp  


--- branches/KDE/3.5/kdelibs/kjs/lexer.cpp #572946:572947
@@ -39,6 +39,7 @@
 #include "identifier.h"
 #include "lookup.h"
 #include "internal.h"
+#include "dtoa.h"
 
 // we can't specify the namespace in yacc's C output, so do it here
 using namespace KJS;
@@ -453,7 +454,7 @@
 
   long double dval = 0;
   if (state == Number) {
-    dval = strtod(buffer8, 0L);
+    dval = kjs_strtod(buffer8, 0L);
   } else if (state == Hex) { // scan hex numbers
     dval = 0;
     if (buffer8[0] == '0' && (buffer8[1] == 'x' || buffer8[1] == 'X')) {