test262/test/built-ins/Function/internals/Construct/base-ctor-revoked-proxy.js
jugglinmike 71e573f7da Add tests for realm interactions (#688)
* Add tests for prototype realm inference

* Add tests for miscellaneous realm concerns

* Add tests for realm of spec-created Errors

In some cases, Error objects produced by the specification are
observable from ECMAScript code. Among these cases, some are further
differentiated in that they occur outside of any built-in function and
may be triggered through syntactic production directly. The current
realm record is commonly interpreted incorrectly under these
circumstances.

Add tests asserting that the expected realm record is used when
constructing such Error objects.

* Add tests for realm use in ArraySpeciesCreate

* Add tests for function realm retrieval

* Add tests for cross-realm behaviors of Symbols

* Add tests for GetValue and PutValue

* Add tests for realm of spec-created Arrays

In some cases, Arrays produced by CreateArrayFromList are observable
from ECMAScript code. Among these cases, two occur outside of any
built-in function and may be triggered through syntactic production
directly. The current realm record is commonly interpreted incorrectly
under these circumstances.

Add tests asserting that the expected realm record is used when
constructing arrays.

* Add test for spec-created object

* fixup! Add tests for realm of spec-created Errors

* fixup! Add tests for realm of spec-created Errors

* fixup! Add tests for prototype realm inference

* fixup! Add tests for miscellaneous realm concerns
2016-10-24 10:43:17 -07:00

56 lines
1.4 KiB
JavaScript

// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-ecmascript-function-objects-construct-argumentslist-newtarget
es6id: 9.2.2
description: Error retrieving function realm from revoked Proxy exotic object
info: |
[...]
5. If kind is "base", then
a. Let thisArgument be ? OrdinaryCreateFromConstructor(newTarget,
"%ObjectPrototype%").
[...]
9.1.13 OrdinaryCreateFromConstructor
[...]
2. Let proto be ? GetPrototypeFromConstructor(constructor,
intrinsicDefaultProto).
[...]
9.1.14 GetPrototypeFromConstructor
[...]
3. Let proto be ? Get(constructor, "prototype").
4. If Type(proto) is not Object, then
a. Let realm be ? GetFunctionRealm(constructor).
7.3.22 GetFunctionRealm
[...]
2. If obj has a [[Realm]] internal slot, then
[...]
3. If obj is a Bound Function exotic object, then
[...]
4. If obj is a Proxy exotic object, then
a. If the value of the [[ProxyHandler]] internal slot of obj is null,
throw a TypeError exception.
features: [Proxy]
---*/
// Defer proxy revocation until after the `constructor` property has been
// accessed
var handlers = {
get: function() {
handle.revoke();
}
};
var handle = Proxy.revocable(function() {}, handlers);
var f = handle.proxy;
assert.sameValue(typeof f, 'function');
assert.throws(TypeError, function() {
new f();
});