Closed
Bug 1060870
Opened 10 years ago
Closed 10 years ago
Changes to handling of primitive values as input in some static methods of `Object`
Categories
(Core :: JavaScript: Standard Library, defect)
Core
JavaScript: Standard Library
Tracking
()
RESOLVED
FIXED
People
(Reporter: 446240525, Unassigned)
References
(Blocks 1 open bug)
Details
(Keywords: dev-doc-complete, meta)
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2139.0 Safari/537.36
Steps to reproduce:
The quote from ES6 draft rev27 Annex E:
"19.1.2.5: In Edition 6, if the argument to Object.freeze is not an object it is treated as if it was a non-extensible ordinary object with no own properties. In Edition 5, a non-object argument always causes a TypeError to be thrown.
19.1.2.6: In Edition 6, if the argument to Object.getOwnPropertyDescriptor is not an object an attempt is make to coerce the argument using ToObject. If the coercion is successful the result is used in place of the original argument value. In Edition 5, a non-object argument always causes a TypeError to be thrown.
19.1.2.7: In Edition 6, if the argument to Object.getOwnPropertyNames is not an object an attempt is make to coerce the argument using ToObject. If the coercion is successful the result is used in place of the original argument value. In Edition 5, a non-object argument always causes a TypeError to be thrown.
19.1.2.9: In Edition 6, if the argument to Object.getPrototypeOf is not an object an attempt is make to coerce the argument using ToObject. If the coercion is successful the result is used in place of the original argument value. In Edition 5, a non-object argument always causes a TypeError to be thrown.
19.1.2.11: In Edition 6, if the argument to Object.isExtensible is not an object it is treated as if it was a non-extensible ordinary object with no own properties. In Edition 5, a non-object argument always causes a TypeError to be thrown.
19.1.2.12: In Edition 6, if the argument to Object.isFrozen is not an object it is treated as if it was a non-extensible ordinary object with no own properties. In Edition 5, a non-object argument always causes a TypeError to be thrown.
19.1.2.13: In Edition 6, if the argument to Object.isSealed is not an object it is treated as if it was a non-extensible ordinary object with no own properties. In Edition 5, a non-object argument always causes a TypeError to be thrown.
19.1.2.14: In Edition 6, if the argument to Object.keys is not an object an attempt is make to coerce the argument using ToObject. If the coercion is successful the result is used in place of the original argument value. In Edition 5, a non-object argument always causes a TypeError to be thrown.
19.1.2.15: In Edition 6, if the argument to Object.preventExtensions is not an object it is treated as if it was a non-extensible ordinary object with no own properties. In Edition 5, a non-object argument always causes a TypeError to be thrown.
19.1.2.17: In Edition 6, if the argument to Object.seal is not an object it is treated as if it was a non-extensible ordinary object with no own properties. In Edition 5, a non-object argument always causes a TypeError to be thrown."
Actual results:
js> Object.freeze("foo")
TypeError: "foo" is not an object
// should return "foo"
js> Object.getOwnPropertyDescriptor("foo", 0)
TypeError: "foo" is not an object
// should return {configurable:false, enumerable:true, value:"f", writable:false}
js> Object.getOwnPropertyNames("foo")
["length", "0", "1", "2"]
// this one was fixed in https://bugzilla.mozilla.org/page.cgi?id=splinter.html&bug=645416&attachment=8437119
js> Object.getPrototypeOf("foo")
TypeError: "foo" is not an object
// should return `String.prototype`
js> Object.isExtensible("foo")
TypeError: "foo" is not an object
// should return false
js> Object.isFrozen("foo")
TypeError: "foo" is not an object
// should return true
js> Object.isSealed("foo")
TypeError: "foo" is not an object
// should return true
js> Object.keys("foo")
TypeError: "foo" is not an object
// should return ["0", "1", "2"]
js> Object.preventExtensions("foo")
TypeError: "foo" is not an object
// should return "foo"
js> Object.seal("foo")
TypeError: "foo" is not an object
// should return "foo"
Comment 2•10 years ago
|
||
As explained in bug 1038545, let's use this as a meta bug for tracking all these changes. Please file individual bugs blocking this one for each of the issues if you intend to work on them.
Blocks: es6
Status: UNCONFIRMED → NEW
Ever confirmed: true
Keywords: dev-doc-needed,
meta
OS: Mac OS X → All
Hardware: x86 → All
Summary: The backward-incompatible changes of some static methods of `Object` in ES6 → Changes to handling of primitive values as input in some static methods of `Object`
Status: NEW → RESOLVED
Closed: 10 years ago
Keywords: dev-doc-needed → dev-doc-complete
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•