mirror of
https://github.com/tc39/test262.git
synced 2025-09-25 11:08:49 +02:00
parent
e764feb1fe
commit
99867ff618
@ -209,11 +209,15 @@ function isWritable(obj, name, verifyProp, value) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Verify that there is a function of specified name, length, and containing
|
||||||
|
* descriptor associated with `obj[name]` and following the conventions for
|
||||||
|
* built-in objects.
|
||||||
|
*
|
||||||
* @param {object} obj
|
* @param {object} obj
|
||||||
* @param {string|symbol} name
|
* @param {string|symbol} name
|
||||||
* @param {string} [functionName] defaults to name for strings, `[${name.description}]` for symbols
|
* @param {string} [functionName] defaults to name for strings, `[${name.description}]` for symbols
|
||||||
* @param {number} functionLength
|
* @param {number} functionLength
|
||||||
* @param {PropertyDescriptor} desc
|
* @param {PropertyDescriptor} [desc] defaults to data property conventions (writable, non-enumerable, configurable)
|
||||||
* @param {object} [options]
|
* @param {object} [options]
|
||||||
* @param {boolean} [options.restore] revert mutations from verifying writable/configurable
|
* @param {boolean} [options.restore] revert mutations from verifying writable/configurable
|
||||||
*/
|
*/
|
||||||
@ -223,7 +227,21 @@ function verifyCallableProperty(obj, name, functionName, functionLength, desc, o
|
|||||||
assert.sameValue(typeof value, "function",
|
assert.sameValue(typeof value, "function",
|
||||||
"obj['" + String(name) + "'] descriptor should be a function");
|
"obj['" + String(name) + "'] descriptor should be a function");
|
||||||
|
|
||||||
if (!__hasOwnProperty(desc, "value")) desc.value = value;
|
// Every other data property described in clauses 19 through 28 and in
|
||||||
|
// Annex B.2 has the attributes { [[Writable]]: true, [[Enumerable]]: false,
|
||||||
|
// [[Configurable]]: true } unless otherwise specified.
|
||||||
|
// https://tc39.es/ecma262/multipage/ecmascript-standard-built-in-objects.html
|
||||||
|
if (desc === undefined) {
|
||||||
|
desc = {
|
||||||
|
writable: true,
|
||||||
|
enumerable: false,
|
||||||
|
configurable: true,
|
||||||
|
value: value
|
||||||
|
};
|
||||||
|
} else if (!__hasOwnProperty(desc, "value") && !__hasOwnProperty(desc, "get")) {
|
||||||
|
desc.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
verifyProperty(obj, name, desc, options);
|
verifyProperty(obj, name, desc, options);
|
||||||
|
|
||||||
if (functionName === undefined) {
|
if (functionName === undefined) {
|
||||||
|
@ -8,8 +8,4 @@ description: >
|
|||||||
includes: [propertyHelper.js]
|
includes: [propertyHelper.js]
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
verifyPrimordialCallableProperty(this, "isFinite", "isFinite", 1, {
|
verifyPrimordialCallableProperty(this, "isFinite", "isFinite", 1);
|
||||||
writable: true,
|
|
||||||
enumerable: false,
|
|
||||||
configurable: true
|
|
||||||
});
|
|
||||||
|
@ -8,8 +8,4 @@ description: >
|
|||||||
includes: [propertyHelper.js]
|
includes: [propertyHelper.js]
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
verifyPrimordialCallableProperty(this, "isNaN", "isNaN", 1, {
|
verifyPrimordialCallableProperty(this, "isNaN", "isNaN", 1);
|
||||||
writable: true,
|
|
||||||
enumerable: false,
|
|
||||||
configurable: true
|
|
||||||
});
|
|
||||||
|
@ -12,8 +12,4 @@ info: |
|
|||||||
includes: [propertyHelper.js]
|
includes: [propertyHelper.js]
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
verifyPrimordialCallableProperty(this, "parseFloat", "parseFloat", 1, {
|
verifyPrimordialCallableProperty(this, "parseFloat", "parseFloat", 1);
|
||||||
writable: true,
|
|
||||||
enumerable: false,
|
|
||||||
configurable: true
|
|
||||||
});
|
|
||||||
|
@ -11,8 +11,4 @@ info: |
|
|||||||
includes: [propertyHelper.js]
|
includes: [propertyHelper.js]
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
verifyPrimordialCallableProperty(this, "parseInt", "parseInt", 2, {
|
verifyPrimordialCallableProperty(this, "parseInt", "parseInt", 2);
|
||||||
writable: true,
|
|
||||||
enumerable: false,
|
|
||||||
configurable: true
|
|
||||||
});
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user