puma icon indicating copy to clipboard operation
puma copied to clipboard

Wrong return values for Object.prototype.toString() method

Open Undre4m opened this issue 9 years ago • 1 comments

The Object.prototype.toString() method, when called, should return the following:

  1. If the this value is undefined, return "[object Undefined]".
  2. If the this value is null, return "[object Null]". (...) as specified in the ECMA Standard [http://www.ecma-international.org/ecma-262/5.1/#sec-15.2.4.2]

Calling the method with the this parameter set as either undefined or null values returns [object DOMWindow] E.g.:

Object.prototype.toString.call(undefined);

Undre4m avatar Oct 05 '16 03:10 Undre4m

Correlated tests::

/test/suites/Tests-15-ECMA.js ~293 (Object.prototype.toString(): undefined)
/test/suites/Tests-15-ECMA.js ~300 (Object.prototype.toString(): null)

Undre4m avatar Nov 21 '16 07:11 Undre4m