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:
jugglinmike 2019-09-24 16:05:30 -04:00 committed by Leo Balter
parent 38ffce541d
commit ce2dfd49d1
3 changed files with 34 additions and 1 deletions

View File

@ -92,6 +92,7 @@ function verifyProperty(obj, name, desc, options) {
}
function isConfigurable(obj, name) {
var hasOwnProperty = Object.prototype.hasOwnProperty;
try {
delete obj[name];
} catch (e) {
@ -99,7 +100,7 @@ function isConfigurable(obj, name) {
$ERROR("Expected TypeError, got " + e);
}
}
return !Object.prototype.hasOwnProperty.call(obj, name);
return !hasOwnProperty.call(obj, name);
}
function isEnumerable(obj, name) {

View File

@ -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');

View File

@ -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
});