[JSC] implement spec changes for String#padStart and String#padEnd
authorcaitp@igalia.com <caitp@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 28 Apr 2016 17:05:17 +0000 (17:05 +0000)
committercaitp@igalia.com <caitp@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 28 Apr 2016 17:05:17 +0000 (17:05 +0000)
commit19e9c395b976d5b0eaaacaf104fff0a5f2f288ec
tree4ceda0c35392db3875204c302a874bed223771a7
parentd11d74aed30f4f0ede8c15efdc923e217c347de2
[JSC] implement spec changes for String#padStart and String#padEnd
https://bugs.webkit.org/show_bug.cgi?id=157139

Reviewed by Keith Miller.

Previously, if the fill string was the empty string, it was treated as a
single U+0020 SPACE character. Now, if this occurs, the original string
is returned instead.

Change was discussed at TC39 in March [1], and is reflected in new
test262 tests for the feature.

[1] https://github.com/tc39/tc39-notes/blob/master/es7/2016-03/march-29.md#stringprototypepadstartpadend

* runtime/StringPrototype.cpp:
(JSC::padString):
* tests/es6/String.prototype_methods_String.prototype.padEnd.js:
(TestFillerToString):
(TestFillerEmptyString):
* tests/es6/String.prototype_methods_String.prototype.padStart.js:
(TestFillerToString):
(TestFillerEmptyString):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@200194 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/runtime/StringPrototype.cpp
Source/JavaScriptCore/tests/es6/String.prototype_methods_String.prototype.padEnd.js
Source/JavaScriptCore/tests/es6/String.prototype_methods_String.prototype.padStart.js