[webkit-dev] Adding read-only javascript properties via JavaScriptCore

Ryan Grimm grimm at xqdev.com
Tue Dec 1 11:19:40 PST 2009


I'm sorry about that, I intended to send it to webkit-help but typed in the wrong address.

--Ryan


On Dec 1, 2009, at 11:15 AM, Adam Barth wrote:

> This email seems like it would be better directed to webkit-help.
> 
> In general, that's not possible to create read-only properties in
> JavaScript because the environment is so malleable.
> 
> Adam
> 
> 
> On Tue, Dec 1, 2009 at 11:10 AM, Ryan Grimm <grimm at xqdev.com> wrote:
>> Hi,
>> 
>> I'm using the JavaScriptCore (Mac) API to add some properties into the javascript environment and would like to make sure that these properties are read only from the javascript side.  From the looks of the API, I thought adding the properties with calls like this would do the trick:
>> 
>> JSObjectSetProperty(ctx, globalObject, propertyName, propertyValue, kJSPropertyAttributeDontDelete | kJSPropertyAttributeReadOnly, NULL);
>> 
>> The property gets added without any troubles but in javascript (and the Web Inspector) I can modify and delete the properties that I've added.  Am I I missing something or just reading the docs wrong?
>> 
>> Thanks.
>> 
>> --Ryan
>> _______________________________________________
>> webkit-dev mailing list
>> webkit-dev at lists.webkit.org
>> http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev
>> 



More information about the webkit-dev mailing list