Closed Bug 1032197 Opened 11 years ago Closed 11 years ago

propertiesObject is not used by Object.create

Categories

(Firefox :: Untriaged, defect)

30 Branch
x86
macOS
defect
Not set
normal

Tracking

()

VERIFIED INVALID

People

(Reporter: pedz, Unassigned)

Details

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:30.0) Gecko/20100101 Firefox/30.0 (Beta/Release) Build ID: 20140605174243 Steps to reproduce: o = { apple: 0 }; function Obj() { } Obj.prototype = Object.create(o, { meth: function () { return 1 + 2; } }); f = new Obj(); f.meth(); A jsFiddle of this is here: http://jsfiddle.net/pedz/C2zLQ/1/ Turn on Firebug, hit run, and you will see the error. Actual results: calling f.meth() results in detailed error: TypeError: f.meth is not a function Expected results: No error should be produced.
This doesn't work in Chrome, either, because the code you're using is incorrect, as best I can tell. The second argument to Object.create should work for https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/defineProperties , and defineProperties takes object values of the form: { meth: { enumerable: true, configurable: true, writable: true, value: function() { console.log("hello"); } } }
Status: UNCONFIRMED → RESOLVED
Closed: 11 years ago
Resolution: --- → INVALID
(in particular, see http://jsbin.com/roxab/1/edit for a valid example along the lines of your testcase)
Status: RESOLVED → VERIFIED
Oh wow. Thank you for the correction. Sorry for the spam.
You need to log in before you can comment on or make changes to this bug.