2015-06-03 00:55:12 +02:00
|
|
|
// Copyright (C) 2015 the V8 project authors. All rights reserved.
|
|
|
|
// This code is governed by the BSD license found in the LICENSE file.
|
|
|
|
/*---
|
|
|
|
es6id: 9.5.5
|
|
|
|
description: >
|
|
|
|
Throws a TypeError exception if trap result and target property descriptors
|
|
|
|
are not compatible.
|
2018-01-05 18:26:51 +01:00
|
|
|
info: |
|
2015-06-03 00:55:12 +02:00
|
|
|
[[GetOwnProperty]] (P)
|
|
|
|
|
|
|
|
...
|
|
|
|
20. Let valid be IsCompatiblePropertyDescriptor (extensibleTarget,
|
|
|
|
resultDesc, targetDesc).
|
|
|
|
21. If valid is false, throw a TypeError exception.
|
2018-07-21 00:42:39 +02:00
|
|
|
features: [Proxy]
|
2015-06-03 00:55:12 +02:00
|
|
|
---*/
|
|
|
|
|
|
|
|
var target = {};
|
|
|
|
|
|
|
|
var p = new Proxy(target, {
|
2018-02-15 21:11:36 +01:00
|
|
|
getOwnPropertyDescriptor: function(t, prop) {
|
|
|
|
var foo = {
|
|
|
|
bar: 1
|
|
|
|
};
|
2015-06-03 00:55:12 +02:00
|
|
|
|
2018-02-15 21:11:36 +01:00
|
|
|
return Object.getOwnPropertyDescriptor(foo, "bar");
|
|
|
|
}
|
2015-06-03 00:55:12 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
Object.preventExtensions(target);
|
|
|
|
|
|
|
|
assert.throws(TypeError, function() {
|
2018-02-15 21:11:36 +01:00
|
|
|
Object.getOwnPropertyDescriptor(p, "bar");
|
2015-06-03 00:55:12 +02:00
|
|
|
});
|