[webkit-dev] Adding new JS bindings, having "slight" problems

Anton Muhin antonm at chromium.org
Thu Oct 28 04:22:42 PDT 2010


Good day, Nebojša.

Overall I am with Adam, that if it's ECMAScript feature it should go
in VM itself (JavaScriptCore or v8).  However, as a prototype hacking
bindings might be easier.

On Thu, Oct 28, 2010 at 4:35 AM, Nebojša Ćirić <cira at chromium.org> wrote:

> 2. What is a proper way to specify a constructor? I've browsed the code and
> it seems nobody uses constructors, or they specify custom ones. I would like
> to be able to do:
> var loc = new Locale();
> or
> var loc = new Locale("en");
> Specifying interface [Constructor, Constructor(in DOMString locale)]
> JSLocale doesn't work (script errors). This should work according to the
> WebIDL spec.

What exactly you're trying to achieve here?  Speaking of v8 you might
either describe all the properties and methods your instances would
have (v8 supports class-like inheritance model) or set your own custom
constructor which would do whatever you want with your instance.

> 3. I would like some of my functions to be static and some prototypes.
> WebIDL says that prototype is default for methods. I've heard we added
> support for static methods recently.

How do you want your static function look in JS?

> 4. How would one decide what parameter goes into static PassRef<JSLocale>
> create() method? Some put Frame* some put ScriptContent and other random
> parameters - and this doesn't seem to be idl related.

Are you talking of JSC or v8 bindings here?

yours,
anton.


More information about the webkit-dev mailing list