19258b6bc66e09368ada54001f619d53b4fc976d5ager@chromium.org// Copyright 2008 the V8 project authors. All rights reserved. 29a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com// Redistribution and use in source and binary forms, with or without 39a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com// modification, are permitted provided that the following conditions are 49a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com// met: 59a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com// 69a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com// * Redistributions of source code must retain the above copyright 79a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com// notice, this list of conditions and the following disclaimer. 89a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com// * Redistributions in binary form must reproduce the above 99a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com// copyright notice, this list of conditions and the following 109a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com// disclaimer in the documentation and/or other materials provided 119a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com// with the distribution. 129a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com// * Neither the name of Google Inc. nor the names of its 139a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com// contributors may be used to endorse or promote products derived 149a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com// from this software without specific prior written permission. 159a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com// 169a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 179a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 189a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 199a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 209a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 219a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 229a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 239a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 249a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 259a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 269a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 279a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com 282b995c4171e67960088466af11110c6f6aeea4fcmachenbach@chromium.org// Flags: --allow-natives-syntax 292b995c4171e67960088466af11110c6f6aeea4fcmachenbach@chromium.org 309a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.comfunction f0() { 319a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com return this; 329a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com} 339a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com 349a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.comfunction f1(a) { 359a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com return a; 369a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com} 379a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com 38160a7b0747492f3f735353d9582521f3314bf4dfdanno@chromium.orgassertSame(this, f0.apply(), "1-0"); 399a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com 40160a7b0747492f3f735353d9582521f3314bf4dfdanno@chromium.orgassertSame(this, f0.apply(this), "2a"); 41160a7b0747492f3f735353d9582521f3314bf4dfdanno@chromium.orgassertSame(this, f0.apply(this, new Array(1)), "2b"); 42160a7b0747492f3f735353d9582521f3314bf4dfdanno@chromium.orgassertSame(this, f0.apply(this, new Array(2)), "2c"); 43160a7b0747492f3f735353d9582521f3314bf4dfdanno@chromium.orgassertSame(this, f0.apply(this, new Array(4242)), "2d"); 449a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com 45160a7b0747492f3f735353d9582521f3314bf4dfdanno@chromium.orgassertSame(this, f0.apply(null), "3a"); 46160a7b0747492f3f735353d9582521f3314bf4dfdanno@chromium.orgassertSame(this, f0.apply(null, new Array(1)), "3b"); 47160a7b0747492f3f735353d9582521f3314bf4dfdanno@chromium.orgassertSame(this, f0.apply(null, new Array(2)), "3c"); 48160a7b0747492f3f735353d9582521f3314bf4dfdanno@chromium.orgassertSame(this, f0.apply(this, new Array(4242)), "3d"); 499a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com 50160a7b0747492f3f735353d9582521f3314bf4dfdanno@chromium.orgassertSame(this, f0.apply(void 0), "4a"); 51160a7b0747492f3f735353d9582521f3314bf4dfdanno@chromium.orgassertSame(this, f0.apply(void 0, new Array(1)), "4b"); 52160a7b0747492f3f735353d9582521f3314bf4dfdanno@chromium.orgassertSame(this, f0.apply(void 0, new Array(2)), "4c"); 539a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com 54160a7b0747492f3f735353d9582521f3314bf4dfdanno@chromium.orgassertEquals(void 0, f1.apply(), "1-1"); 559a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com 56160a7b0747492f3f735353d9582521f3314bf4dfdanno@chromium.orgassertEquals(void 0, f1.apply(this), "5a"); 57160a7b0747492f3f735353d9582521f3314bf4dfdanno@chromium.orgassertEquals(void 0, f1.apply(this, new Array(1)), "5b"); 58160a7b0747492f3f735353d9582521f3314bf4dfdanno@chromium.orgassertEquals(void 0, f1.apply(this, new Array(2)), "5c"); 59160a7b0747492f3f735353d9582521f3314bf4dfdanno@chromium.orgassertEquals(void 0, f1.apply(this, new Array(4242)), "5d"); 60160a7b0747492f3f735353d9582521f3314bf4dfdanno@chromium.orgassertEquals(42, f1.apply(this, new Array(42, 43)), "5e"); 61defbd109bb9bd556bb8ece103c3b340d3552155ekasperl@chromium.orgassertEquals("foo", f1.apply(this, new Array("foo", "bar", "baz", "bo")), "5f"); 62defbd109bb9bd556bb8ece103c3b340d3552155ekasperl@chromium.org 63160a7b0747492f3f735353d9582521f3314bf4dfdanno@chromium.orgassertEquals(void 0, f1.apply(null), "6a"); 64160a7b0747492f3f735353d9582521f3314bf4dfdanno@chromium.orgassertEquals(void 0, f1.apply(null, new Array(1)), "6b"); 65160a7b0747492f3f735353d9582521f3314bf4dfdanno@chromium.orgassertEquals(void 0, f1.apply(null, new Array(2)), "6c"); 66160a7b0747492f3f735353d9582521f3314bf4dfdanno@chromium.orgassertEquals(void 0, f1.apply(null, new Array(4242)), "6d"); 67160a7b0747492f3f735353d9582521f3314bf4dfdanno@chromium.orgassertEquals(42, f1.apply(null, new Array(42, 43)), "6e"); 68defbd109bb9bd556bb8ece103c3b340d3552155ekasperl@chromium.orgassertEquals("foo", f1.apply(null, new Array("foo", "bar", "baz", "bo")), "6f"); 69defbd109bb9bd556bb8ece103c3b340d3552155ekasperl@chromium.org 70160a7b0747492f3f735353d9582521f3314bf4dfdanno@chromium.orgassertEquals(void 0, f1.apply(void 0), "7a"); 71160a7b0747492f3f735353d9582521f3314bf4dfdanno@chromium.orgassertEquals(void 0, f1.apply(void 0, new Array(1)), "7b"); 72160a7b0747492f3f735353d9582521f3314bf4dfdanno@chromium.orgassertEquals(void 0, f1.apply(void 0, new Array(2)), "7c"); 73160a7b0747492f3f735353d9582521f3314bf4dfdanno@chromium.orgassertEquals(void 0, f1.apply(void 0, new Array(4242)), "7d"); 74160a7b0747492f3f735353d9582521f3314bf4dfdanno@chromium.orgassertEquals(42, f1.apply(void 0, new Array(42, 43)), "7e"); 75defbd109bb9bd556bb8ece103c3b340d3552155ekasperl@chromium.orgassertEquals("foo", f1.apply(void 0, new Array("foo", "bar", "ba", "b")), "7f"); 769a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com 779a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.comvar arr = new Array(42, "foo", "fish", "horse"); 789a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.comfunction j(a, b, c, d, e, f, g, h, i, j, k, l) { 799a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com return "" + a + b + c + d + e + f + g + h + i + j + k + l; 809a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com} 819a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com 829a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com 839a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.comvar expect = "42foofishhorse"; 849a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.comfor (var i = 0; i < 8; i++) 859a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com expect += "undefined"; 86defbd109bb9bd556bb8ece103c3b340d3552155ekasperl@chromium.orgassertEquals(expect, j.apply(undefined, arr), "apply to undefined"); 879a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com 889a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.comassertThrows("f0.apply(this, 1);"); 899a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.comassertThrows("f0.apply(this, 1, 2);"); 909a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.comassertThrows("f0.apply(this, 1, new Array(2));"); 919a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com 929a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.comfunction f() { 939a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com var doo = ""; 949a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com for (var i = 0; i < arguments.length; i++) { 959a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com doo += arguments[i]; 969a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com } 979a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com return doo; 989a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com} 996a2b0aa331a1ae1829a9b9637ad18cfc7ec9d840ager@chromium.org 100defbd109bb9bd556bb8ece103c3b340d3552155ekasperl@chromium.orgassertEquals("42foofishhorse", f.apply(this, arr), "apply to this"); 1019a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com 1029a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.comfunction s() { 1039a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com var doo = this; 1049a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com for (var i = 0; i < arguments.length; i++) { 1059a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com doo += arguments[i]; 1069a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com } 1079a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com return doo; 1089a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com} 1099a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com 110defbd109bb9bd556bb8ece103c3b340d3552155ekasperl@chromium.orgassertEquals("bar42foofishhorse", s.apply("bar", arr), "apply to string"); 1119a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com 1129a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.comfunction al() { 113160a7b0747492f3f735353d9582521f3314bf4dfdanno@chromium.org assertEquals(Object(345), this); 1149a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com return arguments.length + arguments[arguments.length - 1]; 1159a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com} 1169a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com 1179a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.comfor (var j = 1; j < 0x40000000; j <<= 1) { 1189a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com try { 1192b995c4171e67960088466af11110c6f6aeea4fcmachenbach@chromium.org var a = %NormalizeElements([]); 1202b995c4171e67960088466af11110c6f6aeea4fcmachenbach@chromium.org a.length = j; 1219a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com a[j - 1] = 42; 1229a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com assertEquals(42 + j, al.apply(345, a)); 1239a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com } catch (e) { 1246a2b0aa331a1ae1829a9b9637ad18cfc7ec9d840ager@chromium.org assertTrue(e.toString().indexOf("Maximum call stack size exceeded") != -1); 1259a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com for (; j < 0x40000000; j <<= 1) { 1269a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com var caught = false; 1279a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com try { 1282b995c4171e67960088466af11110c6f6aeea4fcmachenbach@chromium.org a = %NormalizeElements([]); 1292b995c4171e67960088466af11110c6f6aeea4fcmachenbach@chromium.org a.length = j; 1309a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com a[j - 1] = 42; 1319a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com al.apply(345, a); 1325ad5acef6bd4ebc785f946d8bcc2a88b1e031827ricow@chromium.org assertUnreachable("Apply of array with length " + a.length + 133defbd109bb9bd556bb8ece103c3b340d3552155ekasperl@chromium.org " should have thrown"); 1349a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com } catch (e) { 1356a2b0aa331a1ae1829a9b9637ad18cfc7ec9d840ager@chromium.org assertTrue(e.toString().indexOf("Maximum call stack size exceeded") != -1); 1369a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com caught = true; 1379a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com } 138defbd109bb9bd556bb8ece103c3b340d3552155ekasperl@chromium.org assertTrue(caught, "exception not caught"); 1399a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com } 1409a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com break; 1419a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com } 1429a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com} 1439a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com 1449a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.comvar primes = new Array(0); 1459a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com 1469a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.comfunction isPrime(possible_prime) { 1479a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com for (var d = 0; d < primes.length; d++) { 1489a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com var p = primes[d]; 1499a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com if (possible_prime % p == 0) 1509a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com return false; 1519a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com if (p * p > possible_prime) 1529a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com return true; 1539a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com } 1549a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com return true; 1559a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com} 1569a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com 1579a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.comfor (var i = 2; i < 10000; i++) { 1589a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com if (isPrime(i)) { 1599a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com primes.push(i); 1609a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com } 1619a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com} 1629a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com 1639a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.comassertEquals(1229, primes.length); 1649a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com 1659a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.comvar same_primes = Array.prototype.constructor.apply(Array, primes); 1669a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com 1679a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.comfor (var i = 0; i < primes.length; i++) 168defbd109bb9bd556bb8ece103c3b340d3552155ekasperl@chromium.org assertEquals(primes[i], same_primes[i], "prime" + primes[i]); 169defbd109bb9bd556bb8ece103c3b340d3552155ekasperl@chromium.orgassertEquals(primes.length, same_primes.length, "prime-length"); 1709a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com 1719a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com 1729a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.comArray.prototype["1"] = "sep"; 1739a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com 1749a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.comvar holey = new Array(3); 1759a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.comholey[0] = "mor"; 1769a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.comholey[2] = "er"; 1779a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com 178defbd109bb9bd556bb8ece103c3b340d3552155ekasperl@chromium.orgassertEquals("morseper", String.prototype.concat.apply("", holey), 179defbd109bb9bd556bb8ece103c3b340d3552155ekasperl@chromium.org "moreseper0"); 180defbd109bb9bd556bb8ece103c3b340d3552155ekasperl@chromium.orgassertEquals("morseper", String.prototype.concat.apply("", holey, 1), 181defbd109bb9bd556bb8ece103c3b340d3552155ekasperl@chromium.org "moreseper1"); 182defbd109bb9bd556bb8ece103c3b340d3552155ekasperl@chromium.orgassertEquals("morseper", String.prototype.concat.apply("", holey, 1, 2), 183defbd109bb9bd556bb8ece103c3b340d3552155ekasperl@chromium.org "moreseper2"); 184defbd109bb9bd556bb8ece103c3b340d3552155ekasperl@chromium.orgassertEquals("morseper", String.prototype.concat.apply("", holey, 1, 2, 3), 185defbd109bb9bd556bb8ece103c3b340d3552155ekasperl@chromium.org "morseper3"); 186defbd109bb9bd556bb8ece103c3b340d3552155ekasperl@chromium.orgassertEquals("morseper", String.prototype.concat.apply("", holey, 1, 2, 3, 4), 187defbd109bb9bd556bb8ece103c3b340d3552155ekasperl@chromium.org "morseper4"); 1889a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com 1899a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.comprimes[0] = ""; 1909a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.comprimes[1] = holey; 1919a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.comassertThrows("String.prototype.concat.apply.apply('foo', primes)"); 192defbd109bb9bd556bb8ece103c3b340d3552155ekasperl@chromium.orgassertEquals("morseper", 193160a7b0747492f3f735353d9582521f3314bf4dfdanno@chromium.org String.prototype.concat.apply.apply(String.prototype.concat, primes), 194defbd109bb9bd556bb8ece103c3b340d3552155ekasperl@chromium.org "moreseper-prime"); 1959a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.com 1969a4089a092cad9ff23b6416b92cd5d818dc101d1mads.s.ager@gmail.comdelete(Array.prototype["1"]); 197394dbcf9009cf5203b6d85e8b515fcff072040f3erik.corry@gmail.com 198394dbcf9009cf5203b6d85e8b515fcff072040f3erik.corry@gmail.com// Check correct handling of non-array argument lists. 199394dbcf9009cf5203b6d85e8b515fcff072040f3erik.corry@gmail.comassertSame(this, f0.apply(this, {}), "non-array-1"); 200394dbcf9009cf5203b6d85e8b515fcff072040f3erik.corry@gmail.comassertSame(this, f0.apply(this, { length:1 }), "non-array-2"); 201394dbcf9009cf5203b6d85e8b515fcff072040f3erik.corry@gmail.comassertEquals(void 0, f1.apply(this, { length:1 }), "non-array-3"); 202394dbcf9009cf5203b6d85e8b515fcff072040f3erik.corry@gmail.comassertEquals(void 0, f1.apply(this, { 0:"foo" }), "non-array-4"); 203394dbcf9009cf5203b6d85e8b515fcff072040f3erik.corry@gmail.comassertEquals("foo", f1.apply(this, { length:1, 0:"foo" }), "non-array-5"); 204