NEW 164335
Getter for Object.prototype which returns this ends up returning undefined
https://bugs.webkit.org/show_bug.cgi?id=164335
Summary Getter for Object.prototype which returns this ends up returning undefined
Lucas Fernandes da Costa
Reported 2016-11-02 13:44:06 PDT
When adding a property to the `Object.prototype` that returns `this` when it's accessed, `undefined` gets returned. You can check this by running the following code at `Safari`: ```js Object.defineProperty(Object.prototype, 'bla', { get: function() { return this; } }); var anObj = {example: 'foo'}; console.log(anObj.bla); ``` The expected behavior should be to return the object on which we're accessing the property. PS: You guys at Apple rock, thank you very much for the hard work!
Attachments
Lucas Fernandes da Costa
Comment 1 2016-11-02 13:54:37 PDT
Well, I've just tested this again and it actually works. I've had issues with this due to using Proxies which didn't forward the get operation to the default get action. Sorry for this.
Note You need to log in before you can comment on or make changes to this bug.