Hello,
I am having trouble understanding where testcase 15.2.3.6-4-123 should fail
according to the ecma262 5.1 Document.
I get why it should fails, but not in which step exactly.
I really think I am just getting something wrong so I will write down
everything what I think happens.
If you spot the error please correct me :)
++The Testcase:
/// Copyright (c) 2012 Ecma International. All rights reserved.
/**
* @path ch15/15.2/15.2.3/15.2.3.6/15.2.3.6-4-123.js
* @description Object.defineProperty - 'O' is an Array, 'name' is the length
property of 'O', the [[Value]] field of 'desc' is absent, test TypeError is
thrown when updating the [[Writable]] attribute of the length property from
false to true (15.4.5.1 step 3.a.i)
*/
var arrObj = [];
try {
//1. call
Object.defineProperty(arrObj, "length", {
writable: false
});
//2. call
Object.defineProperty(arrObj, "length", {
writable: true
});
return false;
} catch (e) {
return e instanceof TypeError;
}
++The Calls:
//1. Call
Array.[[DefineOwnProperty]]("length", desc{writable: false}, true)
1.
oldLenDesc = [[GetOwnProperty]]("length")
// oldLenDesc = { value: 0, writable: true, enumerable: false, configurable:
false }
2.
oldLen = oldLenDesc.[[value]]
// oldLen = 0
3. if P == length // true
3.a. if value of desc is absend
//true
3.a.i return default [[DefineOwnProperty]]("length", desc{writable: false},
true)
// -> call 8.12.9
//8.12.9 [[DefineOwnProperty]] ("length", desc{writable: false}, true)
1. current = [[GetOwnProperty]]("length")
// current = { value: 0, writable: true, enumerable: false, configurable:
false }
2. extensible = [[Extensible]]
//extensible = true;
3. + 4. if current is undefined and ... (does not apply)
//false
5. if desc is empty
//false
6. if desc is current
//false, different in writable
7. if current.[[configurable]] is false
//true
7.a. if desc.[[configurable]] is true ...
//false, because not set, defaults to not configurable
7.b. if desc.[[Enumerable]] is true AND desc.[[Enumerable]] != current.
[[Enumerable]]
//false
8. If IsGenericDescriptor(Desc) is true, then no further validation is
required.
//true, jump to step 12+13
Final: put length, { value: 0, writable: false, enumerable: false,
configurable: false }
1. Call Done.
length == { value: 0, writable: false, enumerable: false, configurable: false
}
===================
//2. Call
Array.[[DefineOwnProperty]]("length", desc{writable: true}, true)
1.
oldLenDesc = [[GetOwnProperty]]("length")
// oldLenDesc = { value: 0, writable: false, enumerable: false, configurable:
false }
2.
oldLen = oldLenDesc.[[value]]
// oldLen = 0
3. if P == length // true
3.a. if value of desc is absend
//true
3.a.i return default [[DefineOwnProperty]]("length", desc{writable: true},
true)
// -> call 8.12.9
//8.12.9 [[DefineOwnProperty]] ("length", desc{writable: true}, true)
1. current = [[GetOwnProperty]]("length")
// current = { value: 0, writable: false, enumerable: false, configurable:
false }
2. extensible = [[Extensible]]
//extensible = true;
3. + 4. if current is undefined and ... (does not apply)
//false
5. if desc is empty
//false
6. if desc is current
//false, different in writable
7. if current.[[configurable]] is false
//true
7.a. if desc.[[configurable]] is true ...
//false, because not set, defaults to not configurable
7.b. if desc.[[Enumerable]] is true AND desc.[[Enumerable]] != current.
[[Enumerable]]
//false
8. If IsGenericDescriptor(Desc) is true, then no further validation is
required.
//true, jump to step 12+13
Final: put length, { value: 0, writable: true, enumerable: false,
configurable: false }
2. Call Done.
length == { value: 0, writable: true, enumerable: false, configurable: false }
So thats how I see what happens and I can not see where it fails. Please
enlighten me :)
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss