archives

« Bugzilla Issues Index

#333 — Coverage: this value in Object.prototype getters applied to numbers


IE10 Consumer Preview (as well as IE9) fails the following test:

> Object.defineProperty(Object.prototype, "x", { get: function () { return this; } });
> (5).x == 0 // IE gives true
> (5).x == 5 // IE gives false

> Object.defineProperty(Object.prototype, "y", { get: function () { "use strict"; return this; } });
> (5).y === 0 // IE gives false
> (5).y === 5 // IE gives false

The expected results are, of course, false/true/false/true

This is related to bug #284, but that bug only discussed the `typeof` value inside such getters. I didn't realize until now that some browsers might be crazy enough to get the wrong value entirely.


I've added the tests outlined below. See changelist http://hg.ecmascript.org/tests/test262/rev/ff16b87df1a3