Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(145)

Side by Side Diff: src/js/string.js

Issue 2628963005: String.prototype.anchor and others should not cause side effects. (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-5836.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 (function(global, utils) { 5 (function(global, utils) {
6 6
7 %CheckIsBootstrapping(); 7 %CheckIsBootstrapping();
8 8
9 // ------------------------------------------------------------------- 9 // -------------------------------------------------------------------
10 // Imports 10 // Imports
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 // ECMA-262, 15.5.4.19 326 // ECMA-262, 15.5.4.19
327 function StringToLocaleUpperCase() { 327 function StringToLocaleUpperCase() {
328 CHECK_OBJECT_COERCIBLE(this, "String.prototype.toLocaleUpperCase"); 328 CHECK_OBJECT_COERCIBLE(this, "String.prototype.toLocaleUpperCase");
329 329
330 return %StringToUpperCase(TO_STRING(this)); 330 return %StringToUpperCase(TO_STRING(this));
331 } 331 }
332 332
333 333
334 // ES6 draft, revision 26 (2014-07-18), section B.2.3.2.1 334 // ES6 draft, revision 26 (2014-07-18), section B.2.3.2.1
335 function HtmlEscape(str) { 335 function HtmlEscape(str) {
336 return %_Call(StringReplace, TO_STRING(str), /"/g, """); 336 return %RegExpInternalReplace(/"/g, TO_STRING(str), """);
337 } 337 }
338 338
339 339
340 // ES6 draft, revision 26 (2014-07-18), section B.2.3.2 340 // ES6 draft, revision 26 (2014-07-18), section B.2.3.2
341 function StringAnchor(name) { 341 function StringAnchor(name) {
342 CHECK_OBJECT_COERCIBLE(this, "String.prototype.anchor"); 342 CHECK_OBJECT_COERCIBLE(this, "String.prototype.anchor");
343 return "<a name=\"" + HtmlEscape(name) + "\">" + TO_STRING(this) + 343 return "<a name=\"" + HtmlEscape(name) + "\">" + TO_STRING(this) +
344 "</a>"; 344 "</a>";
345 } 345 }
346 346
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
543 // Exports 543 // Exports
544 544
545 utils.Export(function(to) { 545 utils.Export(function(to) {
546 to.StringMatch = StringMatchJS; 546 to.StringMatch = StringMatchJS;
547 to.StringReplace = StringReplace; 547 to.StringReplace = StringReplace;
548 to.StringSlice = StringSlice; 548 to.StringSlice = StringSlice;
549 to.StringSplit = StringSplitJS; 549 to.StringSplit = StringSplitJS;
550 }); 550 });
551 551
552 }) 552 })
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-5836.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698