Bug 182545

Summary: Web Inspector: Rename String.prototype.trimEnd to avoid conflicts with native trimEnd
Product: WebKit Reporter: Nikita Vasilyev <nvasilyev>
Component: Web InspectorAssignee: Nikita Vasilyev <nvasilyev>
Status: RESOLVED FIXED    
Severity: Normal CC: bburg, commit-queue, inspector-bugzilla-changes, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: All   
OS: All   
Attachments:
Description Flags
Patch none

Description Nikita Vasilyev 2018-02-06 11:53:06 PST
trimEnd just landed in JSC (bug 182233). Just like `trim` removes whitespace at the beginning and the end of a string,
trimEnd removes whitespace only at the end.

In Utilities.js we have:

String.prototype.trimEnd(maxLength)
String.prototype.trimMiddle(maxLength)
String.prototype.truncate(maxLength)

Our trimEnd truncates a string to a specified maxLength.

I suggest to rename:
1. trimEnd to truncateEnd
2. trimMiddle to truncateMiddle
Comment 1 BJ Burg 2018-02-06 14:43:39 PST
(In reply to Nikita Vasilyev from comment #0)
> trimEnd just landed in JSC (bug 182233). Just like `trim` removes whitespace
> at the beginning and the end of a string,
> trimEnd removes whitespace only at the end.
> 
> In Utilities.js we have:
> 
> String.prototype.trimEnd(maxLength)
> String.prototype.trimMiddle(maxLength)
> String.prototype.truncate(maxLength)
> 
> Our trimEnd truncates a string to a specified maxLength.
> 
> I suggest to rename:
> 1. trimEnd to truncateEnd
> 2. trimMiddle to truncateMiddle

Sounds okay to me.
Comment 2 Nikita Vasilyev 2018-02-06 16:38:42 PST
Created attachment 333235 [details]
Patch
Comment 3 BJ Burg 2018-02-06 16:59:18 PST
Comment on attachment 333235 [details]
Patch

r=me with EWS
Comment 4 WebKit Commit Bot 2018-02-06 19:05:59 PST
Comment on attachment 333235 [details]
Patch

Clearing flags on attachment: 333235

Committed r228214: <https://trac.webkit.org/changeset/228214>
Comment 5 WebKit Commit Bot 2018-02-06 19:06:00 PST
All reviewed patches have been landed.  Closing bug.
Comment 6 Radar WebKit Bug Importer 2018-02-06 19:08:23 PST
<rdar://problem/37298532>