archives

« Bugzilla Issues Index

#2207 — results of “hasownproperty” treated with “==” instead of “===”.


Hi,
I may be looking at a wrong version but for instance in the test 10.6-12-2.js and some of its neighbouring tests, the results of “hasownproperty” are treated using “==” instead of “===”, while “hasownproperty” shall return a boolean anyway (according to Section 15.2.4.5 of the ECMAScript specification).

Here is the current code of the test 10.6-12-2.js:
function testcase() {

var desc = Object.getOwnPropertyDescriptor(arguments,"callee");
if(desc.configurable === true &&
desc.enumerable === false &&
desc.writable === true &&
desc.hasOwnProperty('get') == false &&
desc.hasOwnProperty('put') == false)
return true;
}
runTestCase(testcase);

I suggest to replace it by:
function testcase() {

var desc = Object.getOwnPropertyDescriptor(arguments,"callee");
if(desc.configurable === true &&
desc.enumerable === false &&
desc.writable === true &&
desc.hasOwnProperty('get') === false &&
desc.hasOwnProperty('put') === false)
return true;
}
runTestCase(testcase);

This is relatively minor of course, but I was surprise to see this use of the “==” operator.
Hoping it can help,
Martin.


Fixed in https://github.com/tc39/test262/commit/27b234f70806be9a5cbd908558141d8e22d60176