RESOLVED FIXED176074
Web Inspector: Use strict mode for String.prototype.* methods
https://bugs.webkit.org/show_bug.cgi?id=176074
Summary Web Inspector: Use strict mode for String.prototype.* methods
Nikita Vasilyev
Reported 2017-08-29 15:19:03 PDT
For ECMAScript classes, strict mode is implicit. In Utilities.js, we don't use classes. Currently, strict mode is only used for "truncate" method: https://bugs.webkit.org/show_bug.cgi?id=149708#c8. We should use it for other. When strict mode isn't used, `this` is always an object. > "abc".trimEnd(5) < String {0: "a", 1: "b", 2: "c", length: 3} This may lead to unexpected behavior: > "abc".trimEnd(5) === "abc" < false It also makes String.prototype.* operations slower.
Attachments
WIP (8.88 KB, patch)
2017-08-29 16:39 PDT, Nikita Vasilyev
no flags
Nikita Vasilyev
Comment 1 2017-08-29 16:06:36 PDT
All String.prototype.* methods except String.prototype.extendedLocaleCompare are untested 😱
Nikita Vasilyev
Comment 2 2017-08-29 16:39:32 PDT
Created attachment 319304 [details] WIP This requires more work than I anticipated. Tabling this until the week of tests.
Radar WebKit Bug Importer
Comment 3 2025-12-14 10:27:18 PST
Brandon
Comment 4 2025-12-14 10:28:53 PST
EWS
Comment 5 2025-12-16 12:26:03 PST
Committed 304532@main (7983d6668967): <https://commits.webkit.org/304532@main> Reviewed commits have been landed. Closing PR #55378 and removing active labels.
Note You need to log in before you can comment on or make changes to this bug.