mirror of https://github.com/tc39/test262.git
Correct bug in property helper (#2364)
Allow the property helper to be used to verify the configurability of the global "Object" property.
This commit is contained in:
parent
38ffce541d
commit
ce2dfd49d1
|
@ -92,6 +92,7 @@ function verifyProperty(obj, name, desc, options) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function isConfigurable(obj, name) {
|
function isConfigurable(obj, name) {
|
||||||
|
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
||||||
try {
|
try {
|
||||||
delete obj[name];
|
delete obj[name];
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
@ -99,7 +100,7 @@ function isConfigurable(obj, name) {
|
||||||
$ERROR("Expected TypeError, got " + e);
|
$ERROR("Expected TypeError, got " + e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return !Object.prototype.hasOwnProperty.call(obj, name);
|
return !hasOwnProperty.call(obj, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
function isEnumerable(obj, name) {
|
function isEnumerable(obj, name) {
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
// Copyright (C) 2019 Bocoup. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
description: >
|
||||||
|
Objects whose specified property is configurable satisfy the assertion.
|
||||||
|
includes: [propertyHelper.js]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
Object.defineProperty(this, 'Object', {
|
||||||
|
configurable: true,
|
||||||
|
value: Object
|
||||||
|
});
|
||||||
|
|
||||||
|
verifyConfigurable(this, 'Object');
|
|
@ -0,0 +1,17 @@
|
||||||
|
// Copyright (C) 2019 Bocoup. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
description: >
|
||||||
|
Objects whose specified property is configurable satisfy the assertion.
|
||||||
|
includes: [propertyHelper.js]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
Object.defineProperty(this, 'Object', {
|
||||||
|
configurable: true,
|
||||||
|
value: Object
|
||||||
|
});
|
||||||
|
|
||||||
|
verifyProperty(this, 'Object', {
|
||||||
|
configurable: true
|
||||||
|
});
|
Loading…
Reference in New Issue