Changeset 252754 in webkit for trunk/Source/JavaScriptCore/builtins
- Timestamp:
- Nov 21, 2019, 3:35:21 PM (5 years ago)
- Location:
- trunk/Source/JavaScriptCore/builtins
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/builtins/BuiltinNames.h
r252753 r252754 133 133 macro(replaceUsingRegExp) \ 134 134 macro(replaceUsingStringSearch) \ 135 macro(replaceAllUsingStringSearch) \ 135 136 macro(makeTypeError) \ 136 137 macro(mapBucket) \ -
trunk/Source/JavaScriptCore/builtins/StringPrototype.js
r252753 r252754 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 262 286 function search(regexp) 263 287 {
Note:
See TracChangeset
for help on using the changeset viewer.