[Webkit-unassigned] [Bug 197134] Can't create a const attribute via the JSC C API
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Mon Apr 22 10:49:35 PDT 2019
https://bugs.webkit.org/show_bug.cgi?id=197134
Saam Barati <sbarati at apple.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |sbarati at apple.com
--- Comment #3 from Saam Barati <sbarati at apple.com> ---
(In reply to Sam Weinig from comment #2)
> Or, if you don't want to go the callback route, you can create the
> properties after the object has been created.
>
> JSObjectSetProperty(ctx, objectToAddPropertyTo,
> JSStringCreateWithUTF8CString("constantValue), JSValueMakeNumber(ctx, 7),
> kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete,
> &exceptionPtr);
I think this is what you want.
>From the JS spec, these things mean:
- kJSPropertyAttributeReadOnly means you can't Put to the property. E.g, if you have kJSPropertyAttributeReadOnly property "foo", "x.foo = 42" won't succeed. This makes it a "writable: false" property.
- kJSPropertyAttributeDontDelete means the property descriptor is non-configurable. E.g, "delete x.foo" will fail. So will "Object.defineProperty(x, "foo", { ... })"
--
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20190422/d8635bce/attachment.html>
More information about the webkit-unassigned
mailing list