Skip to content
  • zandobersek@gmail.com's avatar
    [JSC] Test262 15.5.4.9_3 test is failing · 5dea8eb9
    zandobersek@gmail.com authored
    https://bugs.webkit.org/show_bug.cgi?id=116789
    
    Reviewed by Geoffrey Garen.
    
    Source/JavaScriptCore: 
    
    Bring the String.prototype.localeCompare behavior in line wit ES5 15.9.4.9.
    If method is not given enough arguments, the minimal amount of arguments must be assumed, with their value being undefined.
    The first argument to localeCompare, in its string form, is used as the 'that' string that's used in the comparison.
    Therefor, when calling str.localeCompare() or str.localeCompare(undefined), the first argument is `undefined` and the
    string "undefined" is used as the string to which value of str is compared.
    
    * runtime/StringPrototype.cpp:
    (JSC::stringProtoFuncLocaleCompare): Remove the early return in case of no given arguments to achieve the desired behavior.
    
    LayoutTests: 
    
    Add the 15.5.4.9_3 test from the test262 test suite to cover proper behavior of String.prototype.localeCompare
    when no arguments are passed to it. The test tests that str.localeCompare() and str.localeCompare(undefined) work
    the same way, i.e. using the string 'undefined' as the string with which str is compared (meaning that the first argument
    defaults to 'undefined' when not given).
    
    The test and the rationale behind it originates from bug #1245 in ECMAScript Bugzilla.
    https://bugs.ecmascript.org/show_bug.cgi?id=1245
    
    * fast/js/kde/StringObject-expected.txt: Update the baseline.
    * fast/js/kde/script-tests/StringObject.js: Update the expected return of the localeCompare test case with no arguments. -1 is
    expected as the missing argument defaults to 'undefined' and is then compared to the string on which localeCompare is called.
    * sputnik/Conformance/15_Native_Objects/15.5_String/15.5.4/15.5.4.9_String.prototype.localeCompare/S15.5.4.9_3-expected.txt: Added.
    * sputnik/Conformance/15_Native_Objects/15.5_String/15.5.4/15.5.4.9_String.prototype.localeCompare/S15.5.4.9_3.html: Added.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@151159 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    5dea8eb9