Revision: 22955
Author: [email protected]
Date: Thu Aug 7 07:45:33 2014 UTC
Log: Only escape U+0022 in argument values of `String.prototype` HTML
methods
Contributed by Mathias Bynens <[email protected]>.
TEST=mjsunit/es6/string-html
BUG=v8:2217
LOG=Y
[email protected], [email protected]
Review URL: https://codereview.chromium.org/446973004
http://code.google.com/p/v8/source/detail?r=22955
Modified:
/branches/bleeding_edge/src/string.js
/branches/bleeding_edge/test/mjsunit/es6/string-html.js
=======================================
--- /branches/bleeding_edge/src/string.js Wed Aug 6 14:58:46 2014 UTC
+++ /branches/bleeding_edge/src/string.js Thu Aug 7 07:45:33 2014 UTC
@@ -829,10 +829,7 @@
// ES6 draft, revision 26 (2014-07-18), section B.2.3.2.1
function HtmlEscape(str) {
- return TO_STRING_INLINE(str).replace(/</g, "<")
- .replace(/>/g, ">")
- .replace(/"/g, """)
- .replace(/'/g, "'");
+ return TO_STRING_INLINE(str).replace(/"/g, """);
}
=======================================
--- /branches/bleeding_edge/test/mjsunit/es6/string-html.js Wed Aug 6
14:58:46 2014 UTC
+++ /branches/bleeding_edge/test/mjsunit/es6/string-html.js Thu Aug 7
07:45:33 2014 UTC
@@ -6,7 +6,7 @@
// http://mathias.html5.org/tests/javascript/string/
assertEquals('_'.anchor('b'), '<a name="b">_</a>');
-//assertEquals('<'.anchor('<'), '<a name="<"><</a>'); // #2217
+assertEquals('<'.anchor('<'), '<a name="<"><</a>');
assertEquals('_'.anchor(0x2A), '<a name="42">_</a>');
assertEquals('_'.anchor('\x22'), '<a name=""">_</a>');
assertEquals(String.prototype.anchor.call(0x2A, 0x2A), '<a
name="42">42</a>');
@@ -63,7 +63,7 @@
assertEquals(String.prototype.fixed.length, 0);
assertEquals('_'.fontcolor('b'), '<font color="b">_</font>');
-//assertEquals('<'.fontcolor('<'), '<font color="<"><</font>'); // #2217
+assertEquals('<'.fontcolor('<'), '<font color="<"><</font>');
assertEquals('_'.fontcolor(0x2A), '<font color="42">_</font>');
assertEquals('_'.fontcolor('\x22'), '<font color=""">_</font>');
assertEquals(String.prototype.fontcolor.call(0x2A, 0x2A),
@@ -77,7 +77,7 @@
assertEquals(String.prototype.fontcolor.length, 1);
assertEquals('_'.fontsize('b'), '<font size="b">_</font>');
-//assertEquals('<'.fontsize('<'), '<font size="<"><</font>'); // #2217
+assertEquals('<'.fontsize('<'), '<font size="<"><</font>');
assertEquals('_'.fontsize(0x2A), '<font size="42">_</font>');
assertEquals('_'.fontsize('\x22'), '<font size=""">_</font>');
assertEquals(String.prototype.fontsize.call(0x2A, 0x2A),
@@ -102,7 +102,7 @@
assertEquals(String.prototype.italics.length, 0);
assertEquals('_'.link('b'), '<a href="b">_</a>');
-//assertEquals('<'.link('<'), '<a href="<"><</a>'); // #2217
+assertEquals('<'.link('<'), '<a href="<"><</a>');
assertEquals('_'.link(0x2A), '<a href="42">_</a>');
assertEquals('_'.link('\x22'), '<a href=""">_</a>');
assertEquals(String.prototype.link.call(0x2A, 0x2A), '<a
href="42">42</a>');
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.