mirror of
https://github.com/tc39/test262.git
synced 2025-07-15 10:04:39 +02:00
Bring back verifyProp
param to isWritable
This commit is contained in:
parent
3bf630cdda
commit
79146e5cf4
@ -139,7 +139,7 @@ function isSameValue(a, b) {
|
|||||||
return a === b;
|
return a === b;
|
||||||
}
|
}
|
||||||
|
|
||||||
function isWritable(obj, name, value) {
|
function isWritable(obj, name, verifyProp, value) {
|
||||||
var unlikelyValue = Array.isArray(obj) && name === "length" ?
|
var unlikelyValue = Array.isArray(obj) && name === "length" ?
|
||||||
Math.pow(2, 32) - 1 :
|
Math.pow(2, 32) - 1 :
|
||||||
"unlikelyValue";
|
"unlikelyValue";
|
||||||
@ -156,7 +156,7 @@ function isWritable(obj, name, value) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
writeSucceeded = isSameValue(obj[name], newValue);
|
writeSucceeded = isSameValue(obj[verifyProp || name], newValue);
|
||||||
|
|
||||||
// Revert the change only if it was successful (in other cases, reverting
|
// Revert the change only if it was successful (in other cases, reverting
|
||||||
// is unnecessary and may trigger exceptions for certain property
|
// is unnecessary and may trigger exceptions for certain property
|
||||||
@ -184,7 +184,7 @@ function verifyWritable(obj, name, verifyProp, value) {
|
|||||||
assert(Object.getOwnPropertyDescriptor(obj, name).writable,
|
assert(Object.getOwnPropertyDescriptor(obj, name).writable,
|
||||||
"Expected obj[" + String(name) + "] to have writable:true.");
|
"Expected obj[" + String(name) + "] to have writable:true.");
|
||||||
}
|
}
|
||||||
if (!isWritable(obj, name, value)) {
|
if (!isWritable(obj, name, verifyProp, value)) {
|
||||||
$ERROR("Expected obj[" + String(name) + "] to be writable, but was not.");
|
$ERROR("Expected obj[" + String(name) + "] to be writable, but was not.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -194,7 +194,7 @@ function verifyNotWritable(obj, name, verifyProp, value) {
|
|||||||
assert(!Object.getOwnPropertyDescriptor(obj, name).writable,
|
assert(!Object.getOwnPropertyDescriptor(obj, name).writable,
|
||||||
"Expected obj[" + String(name) + "] to have writable:false.");
|
"Expected obj[" + String(name) + "] to have writable:false.");
|
||||||
}
|
}
|
||||||
if (isWritable(obj, name, value)) {
|
if (isWritable(obj, name, verifyProp)) {
|
||||||
$ERROR("Expected obj[" + String(name) + "] NOT to be writable, but was.");
|
$ERROR("Expected obj[" + String(name) + "] NOT to be writable, but was.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user