Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / js / script-tests / dfg-to-string-valueOf-becomes-bad.js
blob594e142f75639dd1217f072a6abfe5b059109f2c
1 description(
2 "Tests that we do ToString conversions correctly when String.prototype.valueOf is initially fine but then gets clobbered."
3 );
5 function foo(a) {
6 for (var i = 0; i < 100; ++i)
7 a = new String(a);
8 return a;
11 var expected = "\"hello\"";
12 for (var i = 0; i < 150; ++i) {
13 if (i == 100) {
14 String.prototype.valueOf = function() { return 42; }
15 expected = "\"42\"";
17 shouldBe("\"\" + foo(\"hello\")", expected);