1496c03a64f12710e837204e261ef155601247895sgjesse@chromium.org// Copyright 2011 the V8 project authors. All rights reserved.
2496c03a64f12710e837204e261ef155601247895sgjesse@chromium.org// Redistribution and use in source and binary forms, with or without
3496c03a64f12710e837204e261ef155601247895sgjesse@chromium.org// modification, are permitted provided that the following conditions are
4496c03a64f12710e837204e261ef155601247895sgjesse@chromium.org// met:
5496c03a64f12710e837204e261ef155601247895sgjesse@chromium.org//
6496c03a64f12710e837204e261ef155601247895sgjesse@chromium.org//     * Redistributions of source code must retain the above copyright
7496c03a64f12710e837204e261ef155601247895sgjesse@chromium.org//       notice, this list of conditions and the following disclaimer.
8496c03a64f12710e837204e261ef155601247895sgjesse@chromium.org//     * Redistributions in binary form must reproduce the above
9496c03a64f12710e837204e261ef155601247895sgjesse@chromium.org//       copyright notice, this list of conditions and the following
10496c03a64f12710e837204e261ef155601247895sgjesse@chromium.org//       disclaimer in the documentation and/or other materials provided
11496c03a64f12710e837204e261ef155601247895sgjesse@chromium.org//       with the distribution.
12496c03a64f12710e837204e261ef155601247895sgjesse@chromium.org//     * Neither the name of Google Inc. nor the names of its
13496c03a64f12710e837204e261ef155601247895sgjesse@chromium.org//       contributors may be used to endorse or promote products derived
14496c03a64f12710e837204e261ef155601247895sgjesse@chromium.org//       from this software without specific prior written permission.
15496c03a64f12710e837204e261ef155601247895sgjesse@chromium.org//
16496c03a64f12710e837204e261ef155601247895sgjesse@chromium.org// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17496c03a64f12710e837204e261ef155601247895sgjesse@chromium.org// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18496c03a64f12710e837204e261ef155601247895sgjesse@chromium.org// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19496c03a64f12710e837204e261ef155601247895sgjesse@chromium.org// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20496c03a64f12710e837204e261ef155601247895sgjesse@chromium.org// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21496c03a64f12710e837204e261ef155601247895sgjesse@chromium.org// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22496c03a64f12710e837204e261ef155601247895sgjesse@chromium.org// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23496c03a64f12710e837204e261ef155601247895sgjesse@chromium.org// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24496c03a64f12710e837204e261ef155601247895sgjesse@chromium.org// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25496c03a64f12710e837204e261ef155601247895sgjesse@chromium.org// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26496c03a64f12710e837204e261ef155601247895sgjesse@chromium.org// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27496c03a64f12710e837204e261ef155601247895sgjesse@chromium.org
28496c03a64f12710e837204e261ef155601247895sgjesse@chromium.org// Test that parser errors can be build up correctly even in the presence
29496c03a64f12710e837204e261ef155601247895sgjesse@chromium.org// of JS accessors on Object's prototype elements.
30496c03a64f12710e837204e261ef155601247895sgjesse@chromium.org
31496c03a64f12710e837204e261ef155601247895sgjesse@chromium.orgObject.prototype.__defineGetter__(0, function() { throw 42; } );
32496c03a64f12710e837204e261ef155601247895sgjesse@chromium.org
33d2be901879306d8ff27e78e37783028d581d46fcricow@chromium.orgvar exception = false;
34496c03a64f12710e837204e261ef155601247895sgjesse@chromium.orgtry {
35496c03a64f12710e837204e261ef155601247895sgjesse@chromium.org  eval("(function() { const x; var x })")();
36496c03a64f12710e837204e261ef155601247895sgjesse@chromium.org} catch (e) {
37d2be901879306d8ff27e78e37783028d581d46fcricow@chromium.org  exception = true;
38496c03a64f12710e837204e261ef155601247895sgjesse@chromium.org  assertTrue(e instanceof TypeError);
39496c03a64f12710e837204e261ef155601247895sgjesse@chromium.org}
40d2be901879306d8ff27e78e37783028d581d46fcricow@chromium.orgassertTrue(exception);
41