Skip to content
  • barraclough@apple.com's avatar
    Bug 55994 - Functions on Array.prototype should check length first. · 441a123a
    barraclough@apple.com authored
    These methods are designed to work on generic objects too, and if 'length'
    is a getter that throws an exception, ensure this is correctly thrown
    (even if other exceptions would be thrown, too).
    
    Reviewed by Sam Weinig
    
    Source/JavaScriptCore: 
    
    Make the length check the first thing we do.
    This change shows a progression on SunSpider on my machine, but this is likely bogus.
    
    * runtime/ArrayPrototype.cpp:
    (JSC::arrayProtoFuncToString):
    (JSC::arrayProtoFuncToLocaleString):
    (JSC::arrayProtoFuncJoin):
    (JSC::arrayProtoFuncPop):
    (JSC::arrayProtoFuncPush):
    (JSC::arrayProtoFuncReverse):
    (JSC::arrayProtoFuncShift):
    (JSC::arrayProtoFuncSlice):
    (JSC::arrayProtoFuncSort):
    (JSC::arrayProtoFuncSplice):
    (JSC::arrayProtoFuncUnShift):
    (JSC::arrayProtoFuncFilter):
    (JSC::arrayProtoFuncMap):
    (JSC::arrayProtoFuncEvery):
    (JSC::arrayProtoFuncForEach):
    (JSC::arrayProtoFuncSome):
    (JSC::arrayProtoFuncReduce):
    (JSC::arrayProtoFuncReduceRight):
    (JSC::arrayProtoFuncIndexOf):
    (JSC::arrayProtoFuncLastIndexOf):
    
    LayoutTests: 
    
    Added test cases.
    
    * fast/js/array-proto-func-length-getter-except-expected.txt: Added.
    * fast/js/array-proto-func-length-getter-except.html: Added.
    * fast/js/script-tests/array-proto-func-length-getter-except.js: Added.
    (lengthGetter):
    (test):
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@80621 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    441a123a