diff options
Diffstat (limited to 'deps/v8/test/mjsunit/object-literal-modified-object-prototype.js')
-rw-r--r-- | deps/v8/test/mjsunit/object-literal-modified-object-prototype.js | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/deps/v8/test/mjsunit/object-literal-modified-object-prototype.js b/deps/v8/test/mjsunit/object-literal-modified-object-prototype.js new file mode 100644 index 0000000000..1bf7d3d36c --- /dev/null +++ b/deps/v8/test/mjsunit/object-literal-modified-object-prototype.js @@ -0,0 +1,25 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +(function TestModifedPrototypeInObjectLiteral() { + // The prototype chain should not be used if the definition + // happens in the object literal. + + Object.defineProperty(Object.prototype, 'c', { + get: function () { + return 21; + }, + set: function () { + } + }); + + var o = {}; + o.c = 7; + assertEquals(21, o.c); + + var l = {c: 7}; + assertEquals(7, l.c); + + delete Object.prototype.c; +})(); |