183aa54905e559090bea7771b83f188762cfcf082ricow@chromium.org// Copyright 2011 the V8 project authors. All rights reserved.
283aa54905e559090bea7771b83f188762cfcf082ricow@chromium.org// Redistribution and use in source and binary forms, with or without
383aa54905e559090bea7771b83f188762cfcf082ricow@chromium.org// modification, are permitted provided that the following conditions are
483aa54905e559090bea7771b83f188762cfcf082ricow@chromium.org// met:
583aa54905e559090bea7771b83f188762cfcf082ricow@chromium.org//
683aa54905e559090bea7771b83f188762cfcf082ricow@chromium.org//     * Redistributions of source code must retain the above copyright
783aa54905e559090bea7771b83f188762cfcf082ricow@chromium.org//       notice, this list of conditions and the following disclaimer.
883aa54905e559090bea7771b83f188762cfcf082ricow@chromium.org//     * Redistributions in binary form must reproduce the above
983aa54905e559090bea7771b83f188762cfcf082ricow@chromium.org//       copyright notice, this list of conditions and the following
1083aa54905e559090bea7771b83f188762cfcf082ricow@chromium.org//       disclaimer in the documentation and/or other materials provided
1183aa54905e559090bea7771b83f188762cfcf082ricow@chromium.org//       with the distribution.
1283aa54905e559090bea7771b83f188762cfcf082ricow@chromium.org//     * Neither the name of Google Inc. nor the names of its
1383aa54905e559090bea7771b83f188762cfcf082ricow@chromium.org//       contributors may be used to endorse or promote products derived
1483aa54905e559090bea7771b83f188762cfcf082ricow@chromium.org//       from this software without specific prior written permission.
1583aa54905e559090bea7771b83f188762cfcf082ricow@chromium.org//
1683aa54905e559090bea7771b83f188762cfcf082ricow@chromium.org// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
1783aa54905e559090bea7771b83f188762cfcf082ricow@chromium.org// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
1883aa54905e559090bea7771b83f188762cfcf082ricow@chromium.org// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
1983aa54905e559090bea7771b83f188762cfcf082ricow@chromium.org// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
2083aa54905e559090bea7771b83f188762cfcf082ricow@chromium.org// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
2183aa54905e559090bea7771b83f188762cfcf082ricow@chromium.org// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
2283aa54905e559090bea7771b83f188762cfcf082ricow@chromium.org// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2383aa54905e559090bea7771b83f188762cfcf082ricow@chromium.org// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2483aa54905e559090bea7771b83f188762cfcf082ricow@chromium.org// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2583aa54905e559090bea7771b83f188762cfcf082ricow@chromium.org// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2683aa54905e559090bea7771b83f188762cfcf082ricow@chromium.org// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2783aa54905e559090bea7771b83f188762cfcf082ricow@chromium.org
2883aa54905e559090bea7771b83f188762cfcf082ricow@chromium.org// Object.defineProperty with generic desc on existing property
2983aa54905e559090bea7771b83f188762cfcf082ricow@chromium.org// should just update enumerable/configurable flags.
3083aa54905e559090bea7771b83f188762cfcf082ricow@chromium.org
3183aa54905e559090bea7771b83f188762cfcf082ricow@chromium.orgvar obj =  { get p() { return 42; }  };
3283aa54905e559090bea7771b83f188762cfcf082ricow@chromium.orgvar desc = Object.getOwnPropertyDescriptor(obj, 'p');
3383aa54905e559090bea7771b83f188762cfcf082ricow@chromium.orgvar getter = desc.get;
3483aa54905e559090bea7771b83f188762cfcf082ricow@chromium.org
3583aa54905e559090bea7771b83f188762cfcf082ricow@chromium.orgObject.defineProperty(obj, 'p', {enumerable: false });
3683aa54905e559090bea7771b83f188762cfcf082ricow@chromium.orgassertEquals(obj.p, 42);
3783aa54905e559090bea7771b83f188762cfcf082ricow@chromium.orgdesc = Object.getOwnPropertyDescriptor(obj, 'p');
3883aa54905e559090bea7771b83f188762cfcf082ricow@chromium.orgassertFalse(desc.enumerable);
3983aa54905e559090bea7771b83f188762cfcf082ricow@chromium.orgassertTrue(desc.configurable);
4083aa54905e559090bea7771b83f188762cfcf082ricow@chromium.orgassertEquals(desc.get, getter);
4183aa54905e559090bea7771b83f188762cfcf082ricow@chromium.orgassertEquals(desc.set, undefined);
4283aa54905e559090bea7771b83f188762cfcf082ricow@chromium.orgassertFalse(desc.hasOwnProperty('value'));
4383aa54905e559090bea7771b83f188762cfcf082ricow@chromium.orgassertFalse(desc.hasOwnProperty('writable'));
44