Skip to content
Snippets Groups Projects
Commit 3ce00cf5 authored by André Bargull's avatar André Bargull Committed by Rick Waldron
Browse files

Add tests for uninitialized bindings when accessed through Object methods and for-in

parent 9f39d988
No related branches found
No related tags found
No related merge requests found
// Copyright (C) 2017 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
id: sec-enumerate-object-properties
info: >
Test for-in enumeration with uninitialized binding.
description: |
13.7.5.15 EnumerateObjectProperties (O)
...
EnumerateObjectProperties must obtain the own property keys of the
target object by calling its [[OwnPropertyKeys]] internal method.
Property attributes of the target object must be obtained by
calling its [[GetOwnProperty]] internal method.
9.4.6.4 [[GetOwnProperty]] (P)
...
4. Let value be ? O.[[Get]](P, O).
...
9.4.6.7 [[Get]] (P, Receiver)
...
12. Let targetEnvRec be targetEnv's EnvironmentRecord.
13. Return ? targetEnvRec.GetBindingValue(binding.[[BindingName]], true).
8.1.1.1.6 GetBindingValue ( N, S )
...
If the binding for N in envRec is an uninitialized binding, throw a ReferenceError exception.
...
flags: [module]
---*/
import* as self from "./enumerate-binding-uninit.js";
assert.throws(ReferenceError, function() {
for (var key in self) {
throw new Test262Error();
}
});
export default 0;
// Copyright (C) 2017 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
id: sec-object.prototype.hasownproperty
info: >
Test Object.prototype.hasOwnProperty() with uninitialized binding.
description: |
19.1.3.2 Object.prototype.hasOwnProperty ( V )
...
3. Return ? HasOwnProperty(O, P).
7.3.11 HasOwnProperty ( O, P )
...
3. Let desc be ? O.[[GetOwnProperty]](P).
...
9.4.6.4 [[GetOwnProperty]] (P)
...
4. Let value be ? O.[[Get]](P, O).
...
9.4.6.7 [[Get]] (P, Receiver)
...
12. Let targetEnvRec be targetEnv's EnvironmentRecord.
13. Return ? targetEnvRec.GetBindingValue(binding.[[BindingName]], true).
8.1.1.1.6 GetBindingValue ( N, S )
...
If the binding for N in envRec is an uninitialized binding, throw a ReferenceError exception.
...
flags: [module]
---*/
import* as self from "./object-hasOwnProperty-binding-uninit.js";
assert.throws(ReferenceError, function() {
Object.prototype.hasOwnProperty.call(self, "default");
});
export default 0;
// Copyright (C) 2017 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
id: sec-object.keys
info: >
Test Object.keys() with uninitialized binding.
description: |
19.1.2.16 Object.keys ( O )
...
2. Let nameList be ? EnumerableOwnProperties(obj, "key").
...
7.3.21 EnumerableOwnProperties ( O, kind )
...
4. For each element key of ownKeys in List order, do
a. If Type(key) is String, then
i. Let desc be ? O.[[GetOwnProperty]](key).
...
9.4.6.4 [[GetOwnProperty]] (P)
...
4. Let value be ? O.[[Get]](P, O).
...
9.4.6.7 [[Get]] (P, Receiver)
...
12. Let targetEnvRec be targetEnv's EnvironmentRecord.
13. Return ? targetEnvRec.GetBindingValue(binding.[[BindingName]], true).
8.1.1.1.6 GetBindingValue ( N, S )
...
If the binding for N in envRec is an uninitialized binding, throw a ReferenceError exception.
...
flags: [module]
---*/
import* as self from "./object-keys-binding-uninit.js";
assert.throws(ReferenceError, function() {
Object.keys(self);
});
export default 0;
// Copyright (C) 2017 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
id: sec-object.prototype.propertyisenumerable
info: >
Test Object.prototype.propertyIsEnumerable() with uninitialized binding.
description: |
19.1.3.4 Object.prototype.propertyIsEnumerable ( V )
...
3. Let desc be ? O.[[GetOwnProperty]](P).
...
9.4.6.4 [[GetOwnProperty]] (P)
...
4. Let value be ? O.[[Get]](P, O).
...
9.4.6.7 [[Get]] (P, Receiver)
...
12. Let targetEnvRec be targetEnv's EnvironmentRecord.
13. Return ? targetEnvRec.GetBindingValue(binding.[[BindingName]], true).
8.1.1.1.6 GetBindingValue ( N, S )
...
If the binding for N in envRec is an uninitialized binding, throw a ReferenceError exception.
...
flags: [module]
---*/
import* as self from "./object-propertyIsEnumerable-binding-uninit.js";
assert.throws(ReferenceError, function() {
Object.prototype.propertyIsEnumerable.call(self, "default");
});
export default 0;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment