David Bruant (2013-07-04T22:10:25.000Z)
forbes at lindesay.co.uk (2013-07-12T04:19:14.142Z)
So, there are [standard tests now for ES6!](http://samples.msdn.microsoft.com/ietestcenter/#javascript) I'd like to discuss some of [the `__proto__` tests](http://samples.msdn.microsoft.com/ietestcenter/Javascript/testcases__proto_.html). # 3.1.1-10 `Object.freeze(Object.prototype)` disables `__proto__` ```js function testcase() { Object.freeze(Object.prototype); var a = new Object(); a.__proto__ = { y: 2 }; return a.y === undefined; } ``` I'm not sure I see why this test should succeed. Freezing "a" should prevent its [[Prototype]] from being changed, but I don't see why it would be the case for `Object.prototype`. (same for 3.1.1-9 for `Object.seal`) # 3.1.1-11 [[DefineOwnProperty]] UnderScoreProtoEnabled is set to true when `Object.prototype` is set with default values ```js function testcase() { Object.defineProperty(Object.prototype, "__proto__", { writable: true, enumerable: false, configurable: true }); var obj = {}; obj.__proto__ = { x: 10 }; return obj.x === 10; } ``` I don't fully understand this test case. I think that overriding `Object.prototype.__proto__` with a data attribute should remove its magic. (same for 3.1.1-7, 3.1.2-4-1+bcd ) # 3.1.1-4 `Object.prototype.__proto__` is data property with `{writable:true, enumerable:false, configurable:true, value:null}` attributes ```js function testcase() { var desc = Object.getOwnPropertyDescriptor(Object.prototype, "__proto__"); return desc.writable === true && desc.enumerable === false && desc.configurable === true && desc.value === null; } ``` ... hmm... I admire the sense of humor of whoever wrote that test. [TC39 Meeting notes from May 2013](https://github.com/rwldrn/tc39-notes/blob/master/es6/2013-05/may-21.md#consensusresolution-5): > `__proto__` is an accessor on `Object.prototype`. # 3.1.1-6 Modification of `Object.prototype.__proto__` causes UnderScoreEnabled to be set to false. Setting it to `{}` ```js function testcase() { Object.defineProperty(Object.prototype, "__proto__", {}); var obj = new Object(); obj.__proto__ = { y: 2 }; return obj.y === undefined; } ``` I believe the `Object.defineProperty` line is a no-op, so the test should fail. # 3.1.2-2-14b [[Put]] `__proto__` with value `{y:2}` on `window` object ```js function testcase() { window.__proto__ = { y: 2 }; return window.y === undefined; } ``` `window` is not part of ECMAScript. This test might as well throw a `ReferenceError`. As far as the global object, I don't think it's status on [[Prototype]] is very clear from a standard standpoint, so I would recommend not having tests for that. I only looked at the tests failing in Firefox, there are probably other errors. It would be good if the tests were reviewed carefully *before* becoming part of any sort of "conformance" test suite.
github at esdiscuss.org (2013-07-12T02:27:45.679Z)
So, there are [standard tests now for ES6!](http://samples.msdn.microsoft.com/ietestcenter/#javascript) I'd like to discuss some of [the `__proto__` tests](http://samples.msdn.microsoft.com/ietestcenter/Javascript/testcases__proto_.html). # 3.1.1-10 `Object.freeze(Object.prototype)` disables `__proto__` ```js function testcase() { Object.freeze(Object.prototype); var a = new Object(); a.__proto__ = { y: 2 }; return a.y === undefined; } ``` I'm not sure I see why this test should succeed. Freezing "a" should prevent its [[Prototype]] from being changed, but I don't see why it would be the case for `Object.prototype`. (same for 3.1.1-9 for `Object.seal`) # 3.1.1-11 [[DefineOwnProperty]] UnderScoreProtoEnabled is set to true when `Object.prototype` is set with default values ```js function testcase() { Object.defineProperty(Object.prototype, "__proto__", { writable: true, enumerable: false, configurable: true }); var obj = {}; obj.__proto__ = { x: 10 }; return obj.x === 10; } ``` I don't fully understand this test case. I think that overriding `Object.prototype.__proto__` with a data attribute should remove its magic. (same for 3.1.1-7, 3.1.2-4-1+bcd ) # 3.1.1-4 `Object.prototype.__proto__` is data property with `{writable:true, enumerable:false, configurable:true, value:null}` attributes ```js function testcase() { var desc = Object.getOwnPropertyDescriptor(Object.prototype, "__proto__"); return desc.writable === true && desc.enumerable === false && desc.configurable === true && desc.value === null; } ``` ... hmm... I admire the sense of humor of whoever wrote that test. [TC39 Meeting notes from May 2013](https://github.com/rwldrn/tc39-notes/blob/master/es6/2013-05/may-21.md#consensusresolution-5): > `__proto__` is an accessor on `Object.prototype`. # 3.1.1-6 Modification of `Object.prototype.__proto__` causes UnderScoreEnabled to be set to false. Setting it to `{}` ```js function testcase() { Object.defineProperty(Object.prototype, "__proto__", {}); var obj = new Object(); obj.__proto__ = { y: 2 }; return obj.y === undefined; } ``` I believe the `Object.defineProperty` line is a no-op, so the test should fail. # 3.1.2-2-14b [[Put]] `__proto__` with value `{y:2}` on `window` object ```js function testcase() { window.__proto__ = { y: 2 }; return window.y === undefined; } ``` `window` is not part of ECMAScript. This test might as well throw a `ReferenceError`. As far as the global object, I don't think it's status on [[Prototype]] is very clear from a standard standpoint, so I would recommend not having tests for that. I only looked at the tests failing in Firefox, there are probably other errors. It would be good if the tests were reviewed carefully *before* becoming part of any sort of "conformance" test suite.