-
barraclough@apple.com authored
Fix bugs in String.prototype this handling. Reviewed by Oliver Hunt. Source/JavaScriptCore: undefined/null this values should throw TypeErrors, not convert to the global object, and primitive values should not be converted via object types. * runtime/StringPrototype.cpp: (JSC::stringProtoFuncReplace): (JSC::stringProtoFuncCharAt): (JSC::stringProtoFuncCharCodeAt): (JSC::stringProtoFuncIndexOf): (JSC::stringProtoFuncLastIndexOf): (JSC::stringProtoFuncMatch): (JSC::stringProtoFuncSearch): (JSC::stringProtoFuncSlice): (JSC::stringProtoFuncSplit): (JSC::stringProtoFuncSubstr): (JSC::stringProtoFuncSubstring): (JSC::stringProtoFuncToLowerCase): (JSC::stringProtoFuncToUpperCase): (JSC::stringProtoFuncLocaleCompare): (JSC::stringProtoFuncBig): (JSC::stringProtoFuncSmall): (JSC::stringProtoFuncBlink): (JSC::stringProtoFuncBold): (JSC::stringProtoFuncFixed): (JSC::stringProtoFuncItalics): (JSC::stringProtoFuncStrike): (JSC::stringProtoFuncSub): (JSC::stringProtoFuncSup): (JSC::stringProtoFuncFontcolor): (JSC::stringProtoFuncFontsize): (JSC::stringProtoFuncAnchor): (JSC::stringProtoFuncLink): (JSC::trimString): - These methods should throw if this value is undefined, convert ToString directly, not via ToObject. LayoutTests: * fast/js/script-tests/string-prototype-properties.js: Added. * fast/js/string-prototype-properties-expected.txt: Added. * fast/js/string-prototype-properties.html: Added. - Added layout test for string prototype functions with undefined/number as this value. git-svn-id: http://svn.webkit.org/repository/webkit/trunk@91284 268f45cc-cd09-0410-ab3c-d52691b4dbfc
dd4f7ae2