Subclassing ES6 objects with ES5 syntax.

Claude Pache claude.pache at gmail.com
Tue Apr 28 14:57:45 UTC 2015


> Le 26 avr. 2015 à 00:58, Kevin Smith <zenparsing at gmail.com> a écrit :
> 
> If we used "x.constructor" to determine the actual constructor, then someone could just change the "constructor" property for x and fool someone who wrote "C.resolve(x)" and expected to get an instance of C back.

Note that if you want to protect yourself against tampering the `constructor` property, you should seriously consider to protect yourself against tampering the `then` property. That means that you should at the very least execute `preventExtensions` on your promise anyway.

—Claude
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20150428/6296d36c/attachment.html>


More information about the es-discuss mailing list