[webkit-dev] [JavaScriptCore] Is property attribute ReadOnly working as intended here?

Alexei Sholik alcosholik at gmail.com
Mon Dec 2 11:51:50 PST 2013

Thank you very much. I've found both your hints about "use strict" and
Object.defineProperty very useful.

On Mon, Dec 2, 2013 at 9:29 PM, Gavin Barraclough <barraclough at apple.com>wrote:

> On Dec 2, 2013, at 10:53 AM, Geoffrey Garen <ggaren at apple.com> wrote:
> > Hi Alexei.
> >
> >> To my knowledge, an object's prototype is consulted when a property is
> not found on the object itself. Any new property is written to the object,
> never its prototype.
> >
> > That’s not quite right. The prototype chain is consulted when assigning
> a new property, if the prototype has a property of that name.
> Actually that statement is true – any newly created property will only
> ever be on the object, never its prototype.
> >> So I was expecting to add the "ctor" property on "newClassObj" directly
> and shadow the prototype's read-only "ctor", but it seems that either the
> property is set on the object's prototype (and the ReadOnly attribute makes
> it a no-op) or the ReadOnly attribute contaminates the object itself.
> The prototype chain is consulted, and presence of a read only property
> will cause assignment to fail.  Default is to fail silently, but if you use
> strict mode you’ll get an exception.
> If you want to create a shadowing property on the object you can do so via
> Object.defineProperty.
> cheers,
> G.
> > Geoff
> > _______________________________________________
> > webkit-dev mailing list
> > webkit-dev at lists.webkit.org
> > https://lists.webkit.org/mailman/listinfo/webkit-dev

Best regards
Alexei Sholik
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.webkit.org/pipermail/webkit-dev/attachments/20131202/6c7ee859/attachment.html>

More information about the webkit-dev mailing list