Changeset 252753 in webkit for trunk/Source/JavaScriptCore/builtins
- Timestamp:
- Nov 21, 2019, 3:18:48 PM (6 years ago)
- Location:
- trunk/Source/JavaScriptCore/builtins
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/builtins/BuiltinNames.h
r252683 r252753 133 133 macro(replaceUsingRegExp) \ 134 134 macro(replaceUsingStringSearch) \ 135 macro(replaceAllUsingStringSearch) \136 135 macro(makeTypeError) \ 137 136 macro(mapBucket) \ -
trunk/Source/JavaScriptCore/builtins/StringPrototype.js
r252683 r252753 260 260 } 261 261 262 function replaceAll(search, replace)263 {264 "use strict";265 266 if (@isUndefinedOrNull(this))267 @throwTypeError("String.prototype.replaceAll requires |this| not to be null nor undefined");268 269 if (search != null) {270 if (@isRegExp(search) && !@stringIncludesInternal.@call(@toString(search.flags), "g"))271 @throwTypeError("String.prototype.replaceAll argument must not be a non-global regular expression");272 273 var replacer = search.@replaceSymbol;274 if (replacer !== @undefined) {275 if (!@hasObservableSideEffectsForStringReplace(search, replacer))276 return @toString(this).@replaceUsingRegExp(search, replace);277 return replacer.@call(search, this, replace);278 }279 }280 281 var thisString = @toString(this);282 var searchString = @toString(search);283 return thisString.@replaceAllUsingStringSearch(searchString, replace);284 }285 286 262 function search(regexp) 287 263 {
Note:
See TracChangeset
for help on using the changeset viewer.