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

2009-12-01 Thread Ryan Grimm
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@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev


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

2009-12-01 Thread Ryan Grimm
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 gr...@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@lists.webkit.org
 http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev
 

___
webkit-dev mailing list
webkit-dev@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev


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

2009-12-01 Thread Ryan Grimm
Hi Geoff,

So I take it that I'm understanding the API correctly?  I'm currently using the 
WebKit framework bundled with the latest version of Safari.  Should I go ahead 
and file a bug report?

--Ryan


On Dec 1, 2009, at 12:28 PM, Geoffrey Garen wrote:

 Sounds like a bug.
 
 Geoff
 
 On Dec 1, 2009, at 11:10 AM, Ryan Grimm 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@lists.webkit.org
 http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev
 

___
webkit-dev mailing list
webkit-dev@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev


Re: [webkit-dev] Should we put the webkit.org mailing lists on Gmane?

2009-06-24 Thread Ryan Grimm


On Jun 24, 2009, at 9:38 AM, Adam Roben wrote:



On Jun 22, 2009, at 9:36 AM, Patrick Mueller wrote:


Adam Roben wrote:
Given the single vote in favor and no one opposed, I'm going to  
work on this today.

-Adam
On Jun 15, 2009, at 4:52 PM, Gustavo Noronha wrote:

On Sat, 2009-06-13 at 09:00 -0400, Adam Roben wrote:


Gmane (http://gmane.org) provides a few features that could be
useful for thewebkit.org mailing lists, including:

* a nicer web interface than Mailman's
* indexed search (maybe better than Mailman's, certainly at  
least as

good, and with a better interface)


Another option is using the MarkMail archives (http://webkit.markmail.org/ 
).  They have archives going back to 2005 for the dev, reviews and  
unassigned lists.  Outside of a pretty powerful search box, MarkMail  
has a couple of nice features including analytics and custom RSS feeds  
for any query you give it (disclaimer: I'm one of the developers on  
the site so I'm a little biased :).


--Ryan

___
webkit-dev mailing list
webkit-dev@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev


[webkit-dev] An oddity with windowScriptObject:setValue and apple events

2009-02-01 Thread Ryan Grimm
This may sound very strange (it does to me), but I've been stumped by  
this problem for weeks now so I figured I'd ask the list.


I'm working on embedding WebKit into an existing Mac application that  
exposes an API.  The API gives me a CGrafPtr to render into.  So to  
get WebKit into the window I simply call:


HIViewRef webView, contentView;

WindowRef window = GetWindowFromPort(myCGrafPtr);
WebInitForCarbon();
HIWebViewCreate(webView);
HIViewFindByID(HIViewGetRoot(window), kHIViewWindowContentID,  
contentView);

HIViewSetFrame(webView, bounds);
HIViewAddSubview(contentView, webView);
HIViewSetVisible(webView, true);

Which works fantastically.  I then try to expose some new functions to  
javascript via a windowScriptObject object:


WebView* nativeView;
nativeView = HIWebViewGetWebView(webView);

[[nativeView windowScriptObject] setValue:Metadata forKey:@metadata];

The addition of my Metadata object into javascript also succeeds.

However, here's crux of my problem.  Whenever one of these functions  
in javascript is called (eg: window.metadata.getUser()), all of the  
apple events that the main application has registered on the window  
become unusable.  For example, if you were to execute the following  
applescript:


tell application ApplicationWithWebKit to set user to foobar

It would return with an error of -1728: Can't get reference.  If you  
were to execute the same applescript before the javascript function is  
called it would execute correctly.


Anyone have any thoughts on what is going on here?

Thanks.

--Ryan
___
webkit-dev mailing list
webkit-dev@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev