10a4e901cdfb5505a896d30aa8c2e04fce0fbe069vegorov@chromium.org// Copyright 2011 the V8 project authors. All rights reserved.
20a4e901cdfb5505a896d30aa8c2e04fce0fbe069vegorov@chromium.org// Redistribution and use in source and binary forms, with or without
30a4e901cdfb5505a896d30aa8c2e04fce0fbe069vegorov@chromium.org// modification, are permitted provided that the following conditions are
40a4e901cdfb5505a896d30aa8c2e04fce0fbe069vegorov@chromium.org// met:
50a4e901cdfb5505a896d30aa8c2e04fce0fbe069vegorov@chromium.org//
60a4e901cdfb5505a896d30aa8c2e04fce0fbe069vegorov@chromium.org//     * Redistributions of source code must retain the above copyright
70a4e901cdfb5505a896d30aa8c2e04fce0fbe069vegorov@chromium.org//       notice, this list of conditions and the following disclaimer.
80a4e901cdfb5505a896d30aa8c2e04fce0fbe069vegorov@chromium.org//     * Redistributions in binary form must reproduce the above
90a4e901cdfb5505a896d30aa8c2e04fce0fbe069vegorov@chromium.org//       copyright notice, this list of conditions and the following
100a4e901cdfb5505a896d30aa8c2e04fce0fbe069vegorov@chromium.org//       disclaimer in the documentation and/or other materials provided
110a4e901cdfb5505a896d30aa8c2e04fce0fbe069vegorov@chromium.org//       with the distribution.
120a4e901cdfb5505a896d30aa8c2e04fce0fbe069vegorov@chromium.org//     * Neither the name of Google Inc. nor the names of its
130a4e901cdfb5505a896d30aa8c2e04fce0fbe069vegorov@chromium.org//       contributors may be used to endorse or promote products derived
140a4e901cdfb5505a896d30aa8c2e04fce0fbe069vegorov@chromium.org//       from this software without specific prior written permission.
150a4e901cdfb5505a896d30aa8c2e04fce0fbe069vegorov@chromium.org//
160a4e901cdfb5505a896d30aa8c2e04fce0fbe069vegorov@chromium.org// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
170a4e901cdfb5505a896d30aa8c2e04fce0fbe069vegorov@chromium.org// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
180a4e901cdfb5505a896d30aa8c2e04fce0fbe069vegorov@chromium.org// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
190a4e901cdfb5505a896d30aa8c2e04fce0fbe069vegorov@chromium.org// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
200a4e901cdfb5505a896d30aa8c2e04fce0fbe069vegorov@chromium.org// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
210a4e901cdfb5505a896d30aa8c2e04fce0fbe069vegorov@chromium.org// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
220a4e901cdfb5505a896d30aa8c2e04fce0fbe069vegorov@chromium.org// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
230a4e901cdfb5505a896d30aa8c2e04fce0fbe069vegorov@chromium.org// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
240a4e901cdfb5505a896d30aa8c2e04fce0fbe069vegorov@chromium.org// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
250a4e901cdfb5505a896d30aa8c2e04fce0fbe069vegorov@chromium.org// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
260a4e901cdfb5505a896d30aa8c2e04fce0fbe069vegorov@chromium.org// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
270a4e901cdfb5505a896d30aa8c2e04fce0fbe069vegorov@chromium.org
28394dbcf9009cf5203b6d85e8b515fcff072040f3erik.corry@gmail.com// Regression test for correct handling of non-object receiver values
29394dbcf9009cf5203b6d85e8b515fcff072040f3erik.corry@gmail.com// passed to built-in array functions.
300a4e901cdfb5505a896d30aa8c2e04fce0fbe069vegorov@chromium.org
31394dbcf9009cf5203b6d85e8b515fcff072040f3erik.corry@gmail.comString.prototype.isThatMe = function () {
32394dbcf9009cf5203b6d85e8b515fcff072040f3erik.corry@gmail.com  assertFalse(this === str);
33394dbcf9009cf5203b6d85e8b515fcff072040f3erik.corry@gmail.com};
340a4e901cdfb5505a896d30aa8c2e04fce0fbe069vegorov@chromium.org
35394dbcf9009cf5203b6d85e8b515fcff072040f3erik.corry@gmail.comvar str = "abc";
36394dbcf9009cf5203b6d85e8b515fcff072040f3erik.corry@gmail.comstr.isThatMe();
37394dbcf9009cf5203b6d85e8b515fcff072040f3erik.corry@gmail.comstr.isThatMe.call(str);
380a4e901cdfb5505a896d30aa8c2e04fce0fbe069vegorov@chromium.org
39394dbcf9009cf5203b6d85e8b515fcff072040f3erik.corry@gmail.comvar arr = [1];
40394dbcf9009cf5203b6d85e8b515fcff072040f3erik.corry@gmail.comarr.forEach("".isThatMe, str);
41394dbcf9009cf5203b6d85e8b515fcff072040f3erik.corry@gmail.comarr.filter("".isThatMe, str);
42394dbcf9009cf5203b6d85e8b515fcff072040f3erik.corry@gmail.comarr.some("".isThatMe, str);
43394dbcf9009cf5203b6d85e8b515fcff072040f3erik.corry@gmail.comarr.every("".isThatMe, str);
44394dbcf9009cf5203b6d85e8b515fcff072040f3erik.corry@gmail.comarr.map("".isThatMe, str);
45