Commit 81f2c440 authored by arv's avatar arv Committed by Commit bot

Fix HTML string methods to not depend on replace method

Before this we were using String.prototype.replace. Now
we call the internal StringReplace instead.

BUG=v8:4221
LOG=N
R=adamk, littledan
CQ_INCLUDE_TRYBOTS=tryserver.chromium.linux:linux_chromium_rel_ng;tryserver.blink:linux_blink_rel

Review URL: https://codereview.chromium.org/1199933005

Cr-Commit-Position: refs/heads/master@{#29206}
parent 1c575e91
......@@ -846,7 +846,7 @@ function StringFromCharCode(code) {
// ES6 draft, revision 26 (2014-07-18), section B.2.3.2.1
function HtmlEscape(str) {
return TO_STRING_INLINE(str).replace(/"/g, """);
return %_CallFunction(TO_STRING_INLINE(str), /"/g, """, StringReplace);
}
......
......@@ -192,3 +192,10 @@ assertEquals(String.prototype.sup.length, 0);
assertEquals(1, calls);
}
})();
(function TestDeleteStringRelace() {
assertEquals('<a name="n">s</a>', 's'.anchor('n'));
assertTrue(delete String.prototype.replace);
assertEquals('<a name="n">s</a>', 's'.anchor('n'));
})();
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment