Re: [webkit-dev] JSObjectGetClass proposal

2016-07-22 Thread Danilo Cesar Lemes de Paula
On 21-07-2016 18:28, Darin Adler wrote:
>> On Jul 21, 2016, at 12:09 PM, Danilo Cesar Lemes de Paula 
>> <danilo...@gmail.com> wrote:
>>
>> How to create a JSObjectRef as the same type as another one.
> 
> Just curious: Is that something you can do in JavaScript itself?

Actually, this is a bit reduced version of my problem. I don't have much
contact with javascript itself. Basically we're working in a binding
engine so the user can call whatever system API they want using JS. We
export those interfaces when the javascript user asks for them.
Basically that's what Seed (dead) and Gjs (alive with SpiderMonkey) do.
But it's mainly C/C++ stuff with some javascript shell.

I did spend some time trying to apply javascripts hacks to avoid nasty
hacks in native code, without luck for this very specific this case. My
best option until now was defining a specific property during object
creation containing another object with the private pointer set to the
JSClassRef itself (as the main object SetPrivate structure is already
taken). But it also can be the root of more problems, despite the fact
that leaking implementation details to the user (like WTF is this
"OMG_PLEASE_DONT_TOUCH_THIS" property in my object?) is never a good
call (even with k..DontEnum and k..ReadOnly, imho).

Another suggestion I got was to save a list of created objects
statically... which can be problematic when memory addresses starts to
be reused after GC.

So, the API I proposed fixes that king of issue.

I do understand that adding more API to something that was quiet and
stable for a while raises some warnings. But, please, consider that this
API is simple enough, consistent, and the same API is available and had
been proven useful to other javascript engines (yep, I'm talking about
spidermonkey with its huge API monster.)

So, I guess that's it. If you can spare some time to review my patch I
would appreciate.

Thanks

Danilo


> 
> — Darin
> 
___
webkit-dev mailing list
webkit-dev@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-dev


[webkit-dev] JSObjectGetClass proposal

2016-07-21 Thread Danilo Cesar Lemes de Paula
Hello there,

So, when working on a javascript binding engine we faced the following
problem:
How to create a JSObjectRef as the same type as another one.

With SpiderMonkey, we could use JS_GetClass to get the JSObject's class,
and then use that JSClass to build the new object.
There's no such API on JavaScriptCore.

I'd heard some suggestions to workaround the issue with Set/Get privates
or prototypes, but it definitely didn't get the expected result.

So, I know the JSObjectRef API has been stable for a while, but I would
like to propose the inclusion of the following API in the public list of
jsc APIs.

* JSClassRef JSObjectGetClass(JSObjectRef obj).

I can see this API being used for:
 * Knowing if two objects are from the same class (by using
JSValueIsObjectOfClass)
 * Creating dynamic constructors using another JSObjectRef as reference
for the class.

I did submit a bug and a patch for it:
https://bugs.webkit.org/show_bug.cgi?id=160032

Would be lovely if a JSC engineer could drop some thoughts or maybe a
review there...

Thanks,

Danilo Cesar Lemes de Paula
___
webkit-dev mailing list
webkit-dev@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-dev


Re: [webkit-dev] Adding ENABLE_CSS_DIRECTIONAL_FOCUS to WebCore.

2013-07-24 Thread Danilo Cesar Lemes de Paula
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 07/23/2013 09:26 PM, Kyounga Ra wrote:
 -Which browsers are shipping the feature? -Which browsers are
 planning to ship the feature? A) other major browsers? opera
 presto also Webkit-based TV browsers support it.
 

nav-[dir] is a required part of the SmartTV Alliance spec, so it's
probably being used by Phillips, LG and Toshiba TVs.

Danilo Cesar

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.12 (GNU/Linux)
Comment: Using GnuPG with Icedove - http://www.enigmail.net/

iQIcBAEBAgAGBQJR79rsAAoJEIvTIZEF7lnMmcYQAJbn2ImfdCxphdZBJHCoA/yz
7nmgH9l/plC5uVU/tYPnNw+eQbyHISz4LAHFJEzQqn1jDJOark/zxrgmMv1LoVUB
/Ch0hRDPYbLlFSOqKjKCp/bWrWuD5KStRO75gKi+dwnF3zTHzhGp8oV7l1mWcyBd
q9xrKo/8AXmTwUrsPLabKuaAHm47rTIA192VzKuTtRUcAtSAA+loJKFEiQOSfS+6
c5QIjjcZbhFj3TPy5JkwbQarj9/h0T1IhEeYYa6/FW+kU2XP9WH30xFt/mx9fsks
XIWGjXABHhyf1iKPXd00LJSDhJ6KURAzAilNdkVGIUqesl22O8RCwg/wMfrZE84m
hAusxSOp3oZNelSwY1oAhxkBgR+qioMqIoDpVUIH3a72EDCdof4dcRkMTGT2v0iv
4FM1nUgKVtIPrEtHEkSbxGOL1mVuglnYLuqpzOnv7fUUEGZVdU/TGlaiKN6lOrmU
lLKPTIQGogXPoVIK8G66k2uDnfriejPIZL0NARx3e3Acil4tMMLh0WwhmfR4pNGB
WtZVT0Vmabt9UDJwbMczmkOUkAUJx5Y+c6ouioahR+DsL6Lp6hKb9MuEZz3pbIso
rBVPZRAB8OgcTCrPvoQbuEEWypSYrfnZomWMCI27wdjx8qfAA/IqxmdKWKiGTCDc
ec9WA5SBptZe7anQ/iO6
=er4X
-END PGP SIGNATURE-
___
webkit-dev mailing list
webkit-dev@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-dev


Re: [webkit-dev] Adding ENABLE_CSS_DIRECTIONAL_FOCUS to WebCore.

2013-07-24 Thread Danilo Cesar Lemes de Paula
On 07/23/2013 09:26 PM, Kyounga Ra wrote:
 -Which browsers are shipping the feature?
 -Which browsers are planning to ship the feature?
 A) other major browsers? opera presto
 also Webkit-based TV browsers support it.
 
 -Is it a mature standard (or an amazing feature) that one of the WebKit
 ports wants to maintain?
 A) not matured yet. but these properties are widely used by the TV
 industry. 
  TV industry people like me want to maintain.
 

nav-[dir] is a required part of the SmartTV Alliance spec, so it's
probably being used by Phillips, LG and Toshiba TVs.

Danilo Cesar

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