KDE JS tests where Firefox disagrees

Maciej Stachowiak mjs at apple.com
Wed Dec 28 03:00:52 GMT 2005


I recently incorporated the KDE JS test suite into the WebKit layout  
tests. As part of the KJS/JSC merger work, we are trying to make  
JavaScriptCore pass all these.

To double-check the tests, I tried them in Firefox and took a look at  
the spec where there was disagreement. Here are the discrepencies I  
found:

parse.js
---------
Firefox fails to parse this. So does Mac IE. What is the evidence  
that it should parse?

math.js
------------
FAIL String()+Math.LOG10E should be 0.43429448190325176. Was  
0.4342944819032518
(possibly slight difference in numeric output? can't tell if the spec  
has an opinion on this)

inbuilt_function_tostring.js
---------------------------------
FAIL StripSpaces(kjsprint.toString()) should be functionkjsprint() 
{[nativecode]}. Threw exception ReferenceError: kjsprint is not defined
(perhaps we should skip testing this, in Safari it is only defined in  
debug builds)
FAIL StripSpaces(Date.prototype.toGMTString.toString()) should be  
functiontoGMTString(){[nativecode]}. Was functiontoUTCString() 
{[nativecode]}
(bug in moz? don't think we should change this)

function_length.js
--------------------
FAIL Array.prototype.slice.length should be 2. Was 0
FAIL Array.prototype.splice.length should be 2. Was 1
FAIL Array.prototype.concat.length should be 1. Was 0
FAIL String.prototype.concat.length should be 1. Was 0
FAIL String.prototype.slice.length should be 2. Was 0
FAIL Number.prototype.toString.length should be 1. Was 0
(Firefox is wrong per the spec in all cases - we should probably file  
bugs in moz bugzilla)

StringObject.js
-----------------
FAIL 'abc'[-1] should be undefined. Was 3
(Firefox appears to always give the length of a string as property  
-1, MacIE does not have this quirk, but it also does not allow  
numeric indexing of string objects, nor does the spec call for  
numeric indexing of string objects. If we copy the quirk, we may as  
well copy it all the way.)

exception_propagation.js
-----------------------------
fails to parse
(MacIE parses it and gets up to checkOperator(">>>","OpURShift");,  
then bombs; needs further investigation)

evil-n.js
---------
parses successfully, desipte the -n.js ending
FAIL (new Error()).message should be undefined. Was
(I think this test is just plain wrong and should be removed)

encode_decode_uri.js
-------------------------
FAIL checkWithFunctions(encodeURI,decodeURI) should be true. Was false
FAIL checkWithFunctions(encodeURIComponent,decodeURIComponent) should  
be true. Was false
(is this test case actually correct? can't tell - it also fails in  
Mac IE)

constructor_length.js
------------------------
FAIL RegExp.length should be 2. Was 1
FAIL Error.length should be 1. Was 3
FAIL EvalError.length should be 1. Was 3
FAIL RangeError.length should be 1. Was 3
FAIL ReferenceError.length should be 1. Was 3
FAIL SyntaxError.length should be 1. Was 3
FAIL TypeError.length should be 1. Was 3
FAIL URIError.length should be 1. Was 3
(in all cases firefox is contrary to the ECMA spec, I think we should  
maintain this behavior and file bugs against them)

RegExp.js
-----------
FAIL RegExp.$1 should be . Was 100
FAIL RegExp.$3 should be . Was 200
FAIL RegExp.$5 should be . Was 150
FAIL RegExp.$7 should be . Was 15
(It's weird for failing matches not to overwrite the $ values, but  
since these are a Firefox extension it seems like a bad idea to be  
inconsistent on this. JSC matches the firefox behavior. I recommend  
leaving it that way.)

Number.js
------------
FAIL toFixedOrException(2,-1).indexOf('Range') >= 0 should be true.  
Was false
FAIL toFixedOrException(2,21).indexOf('Range') >= 0 should be true.  
Was false
FAIL Number(123.456).toExponential(17) should be 1.23456000000000000e 
+2. Was 1.23456000000000003e+2
FAIL Number(123.456).toExponential(18) should be 1.234560000000000000e 
+2. Was 1.234560000000000031e+2
FAIL Number(123.456).toExponential(19) should be  
1.2345600000000000000e+2. Was 1.2345600000000000307e+2
FAIL Number(123.456).toExponential(20) should be  
1.23456000000000000000e+2. Was 1.23456000000000003070e+2
FAIL try { Number(123.456).toExponential(21) } catch (e) { String 
(e).indexOf('Range') >= 0; } should be true. Was  
1.234560000000000030695e+2
FAIL Number(.000123456).toExponential(16) should be  
1.2345600000000000e-4. Was 1.2345600000000001e-4
FAIL Number(.000123456).toExponential(17) should be  
1.23456000000000000e-4. Was 1.23456000000000005e-4
FAIL Number(.000123456).toExponential(18) should be  
1.234560000000000000e-4. Was 1.234560000000000052e-4
FAIL Number(.000123456).toExponential(19) should be  
1.2345600000000000000e-4. Was 1.2345600000000000519e-4
FAIL Number(.000123456).toExponential(20) should be  
1.23456000000000000000e-4. Was 1.23456000000000005188e-4
FAIL try { Number(.000123456).toExponential(21) } catch (e) { String 
(e).indexOf('Range') >= 0; } should be true. Was  
1.234560000000000051876e-4
FAIL Number(123.4567890123456789012).toExponential(16) should be  
1.2345678901234570e+2. Was 1.2345678901234568e+2
FAIL Number(123.4567890123456789012).toExponential(17) should be  
1.23456789012345700e+2. Was 1.23456789012345681e+2
FAIL Number(123.4567890123456789012).toExponential(18) should be  
1.234567890123457100e+2. Was 1.234567890123456806e+2
FAIL Number(123.4567890123456789012).toExponential(19) should be  
1.2345678901234570000e+2. Was 1.2345678901234568059e+2
FAIL Number(123.4567890123456789012).toExponential(20) should be  
1.23456789012345700000e+2. Was 1.23456789012345680590e+2
FAIL try { Number(123.4567890123456789012).toExponential(21) } catch  
(e) { String(e).indexOf('Range') >= 0; } should be true. Was  
1.234567890123456805895e+2
FAIL try { Number(1).toPrecision(22); } catch (e) { String(e).indexOf 
('Range') >= 0; } should be true. Was 1.000000000000000000000
FAIL Number(0.0001234567890123456789012345).toPrecision(17) should be  
0.00012345678901234568. Was 0.00012345678901234567
FAIL Number(0.0001234567890123456789012345).toPrecision(18) should be  
0.000123456789012345680. Was 0.000123456789012345671
FAIL Number(0.0001234567890123456789012345).toPrecision(19) should be  
0.0001234567890123456800. Was 0.0001234567890123456713
FAIL Number(0.0001234567890123456789012345).toPrecision(20) should be  
0.00012345678901234567000. Was 0.00012345678901234567130
FAIL Number(0.0001234567890123456789012345).toPrecision(21) should be  
0.000123456789012345680000. Was 0.000123456789012345671298
FAIL Number(12345.67890123456789012345).toPrecision(17) should be  
12345.678901234568. Was 12345.678901234567
FAIL Number(12345.67890123456789012345).toPrecision(18) should be  
12345.6789012345660. Was 12345.6789012345671
FAIL Number(12345.67890123456789012345).toPrecision(19) should be  
12345.67890123456800. Was 12345.67890123456709
FAIL Number(12345.67890123456789012345).toPrecision(20) should be  
12345.678901234565000. Was 12345.678901234567093
FAIL Number(12345.67890123456789012345).toPrecision(21) should be  
12345.6789012345670000. Was 12345.6789012345670926

(Firefox does not appear to enforce limitations on toFixed or  
toExponential, it also gets somewhat different numeric results in  
some cases. I didn't examine the spec in enough detail to see if any  
of the  ffx results are bugs or any of ours are.)





More information about the kfm-devel mailing list