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

Side by Side Diff: src/string.js

Issue 1199933005: Fix HTML string methods to not depend on replace method (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix syntax error after git rebase Created 5 years, 6 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/es6/string-html.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 828 matching lines...) Expand 10 before | Expand all | Expand 10 after
839 var code = %_Arguments(i); 839 var code = %_Arguments(i);
840 if (!%_IsSmi(code)) code = $toNumber(code) & 0xffff; 840 if (!%_IsSmi(code)) code = $toNumber(code) & 0xffff;
841 %_TwoByteSeqStringSetChar(j, code, two_byte); 841 %_TwoByteSeqStringSetChar(j, code, two_byte);
842 } 842 }
843 return one_byte + two_byte; 843 return one_byte + two_byte;
844 } 844 }
845 845
846 846
847 // ES6 draft, revision 26 (2014-07-18), section B.2.3.2.1 847 // ES6 draft, revision 26 (2014-07-18), section B.2.3.2.1
848 function HtmlEscape(str) { 848 function HtmlEscape(str) {
849 return TO_STRING_INLINE(str).replace(/"/g, """); 849 return %_CallFunction(TO_STRING_INLINE(str), /"/g, """, StringReplace);
850 } 850 }
851 851
852 852
853 // ES6 draft, revision 26 (2014-07-18), section B.2.3.2 853 // ES6 draft, revision 26 (2014-07-18), section B.2.3.2
854 function StringAnchor(name) { 854 function StringAnchor(name) {
855 CHECK_OBJECT_COERCIBLE(this, "String.prototype.anchor"); 855 CHECK_OBJECT_COERCIBLE(this, "String.prototype.anchor");
856 return "<a name=\"" + HtmlEscape(name) + "\">" + TO_STRING_INLINE(this) + 856 return "<a name=\"" + HtmlEscape(name) + "\">" + TO_STRING_INLINE(this) +
857 "</a>"; 857 "</a>";
858 } 858 }
859 859
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
1188 // ------------------------------------------------------------------- 1188 // -------------------------------------------------------------------
1189 // Exports 1189 // Exports
1190 1190
1191 utils.Export(function(to) { 1191 utils.Export(function(to) {
1192 to.StringCharAt = StringCharAtJS; 1192 to.StringCharAt = StringCharAtJS;
1193 to.StringIndexOf = StringIndexOfJS; 1193 to.StringIndexOf = StringIndexOfJS;
1194 to.StringSubstring = StringSubstring; 1194 to.StringSubstring = StringSubstring;
1195 }); 1195 });
1196 1196
1197 }) 1197 })
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/es6/string-html.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698