19ee27ae43ab88e9bb6417ff9e27af64e0cf13729ager@chromium.org// Copyright 2011 the V8 project authors. All rights reserved.
29ee27ae43ab88e9bb6417ff9e27af64e0cf13729ager@chromium.org// Redistribution and use in source and binary forms, with or without
39ee27ae43ab88e9bb6417ff9e27af64e0cf13729ager@chromium.org// modification, are permitted provided that the following conditions are
49ee27ae43ab88e9bb6417ff9e27af64e0cf13729ager@chromium.org// met:
59ee27ae43ab88e9bb6417ff9e27af64e0cf13729ager@chromium.org//
69ee27ae43ab88e9bb6417ff9e27af64e0cf13729ager@chromium.org//     * Redistributions of source code must retain the above copyright
79ee27ae43ab88e9bb6417ff9e27af64e0cf13729ager@chromium.org//       notice, this list of conditions and the following disclaimer.
89ee27ae43ab88e9bb6417ff9e27af64e0cf13729ager@chromium.org//     * Redistributions in binary form must reproduce the above
99ee27ae43ab88e9bb6417ff9e27af64e0cf13729ager@chromium.org//       copyright notice, this list of conditions and the following
109ee27ae43ab88e9bb6417ff9e27af64e0cf13729ager@chromium.org//       disclaimer in the documentation and/or other materials provided
119ee27ae43ab88e9bb6417ff9e27af64e0cf13729ager@chromium.org//       with the distribution.
129ee27ae43ab88e9bb6417ff9e27af64e0cf13729ager@chromium.org//     * Neither the name of Google Inc. nor the names of its
139ee27ae43ab88e9bb6417ff9e27af64e0cf13729ager@chromium.org//       contributors may be used to endorse or promote products derived
149ee27ae43ab88e9bb6417ff9e27af64e0cf13729ager@chromium.org//       from this software without specific prior written permission.
159ee27ae43ab88e9bb6417ff9e27af64e0cf13729ager@chromium.org//
169ee27ae43ab88e9bb6417ff9e27af64e0cf13729ager@chromium.org// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
179ee27ae43ab88e9bb6417ff9e27af64e0cf13729ager@chromium.org// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
189ee27ae43ab88e9bb6417ff9e27af64e0cf13729ager@chromium.org// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
199ee27ae43ab88e9bb6417ff9e27af64e0cf13729ager@chromium.org// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
209ee27ae43ab88e9bb6417ff9e27af64e0cf13729ager@chromium.org// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
219ee27ae43ab88e9bb6417ff9e27af64e0cf13729ager@chromium.org// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
229ee27ae43ab88e9bb6417ff9e27af64e0cf13729ager@chromium.org// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
239ee27ae43ab88e9bb6417ff9e27af64e0cf13729ager@chromium.org// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
249ee27ae43ab88e9bb6417ff9e27af64e0cf13729ager@chromium.org// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
259ee27ae43ab88e9bb6417ff9e27af64e0cf13729ager@chromium.org// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
269ee27ae43ab88e9bb6417ff9e27af64e0cf13729ager@chromium.org// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
279ee27ae43ab88e9bb6417ff9e27af64e0cf13729ager@chromium.org
28c54d36599f1e72bddd09d5b7a980304c7b638048ricow@chromium.org// Test that an exception is not thrown when trying to set a value for
29c54d36599f1e72bddd09d5b7a980304c7b638048ricow@chromium.org// a property that has only a defined getter, except when in strict mode.
309ee27ae43ab88e9bb6417ff9e27af64e0cf13729ager@chromium.org
31c54d36599f1e72bddd09d5b7a980304c7b638048ricow@chromium.orgvar foo = Object.defineProperty({}, "bar", {
32c54d36599f1e72bddd09d5b7a980304c7b638048ricow@chromium.org get: function () {
33c54d36599f1e72bddd09d5b7a980304c7b638048ricow@chromium.org      return 10;
34c54d36599f1e72bddd09d5b7a980304c7b638048ricow@chromium.org    }
35c54d36599f1e72bddd09d5b7a980304c7b638048ricow@chromium.org  });
36c54d36599f1e72bddd09d5b7a980304c7b638048ricow@chromium.org
37c54d36599f1e72bddd09d5b7a980304c7b638048ricow@chromium.orgassertDoesNotThrow("foo.bar = 20");
38c54d36599f1e72bddd09d5b7a980304c7b638048ricow@chromium.org
39c54d36599f1e72bddd09d5b7a980304c7b638048ricow@chromium.orgfunction shouldThrow() {
40c54d36599f1e72bddd09d5b7a980304c7b638048ricow@chromium.org  'use strict';
41c54d36599f1e72bddd09d5b7a980304c7b638048ricow@chromium.org  foo.bar = 20;
429ee27ae43ab88e9bb6417ff9e27af64e0cf13729ager@chromium.org}
439ee27ae43ab88e9bb6417ff9e27af64e0cf13729ager@chromium.org
44c54d36599f1e72bddd09d5b7a980304c7b638048ricow@chromium.orgassertThrows("shouldThrow()");
45