[webkit-dev] Question about Constructors in WebKit JS Bindings

Maciej Stachowiak mjs at apple.com
Thu Jul 2 22:33:35 PDT 2009


On Jul 2, 2009, at 10:12 PM, Drew Wilson wrote:

> I had another question - I'm looking at JSWorkerConstructor code,  
> but this pattern exists elsewhere as well:
>
> JSWorkerConstructor::JSWorkerConstructor(ExecState* exec)
>     : DOMObject(JSWorkerConstructor::createStructure(exec- 
> >lexicalGlobalObject()->objectPrototype()))
> {
>     putDirect(exec->propertyNames().prototype,  
> JSWorkerPrototype::self(exec, exec->lexicalGlobalObject()), None);
>     putDirect(exec->propertyNames().length, jsNumber(exec, 1),  
> ReadOnly|DontDelete|DontEnum);
> }
>
> What is the purpose of the second putDirect() call? I don't see this  
> in other constructors like JSXMLHttpRequestConstructor, but I do see  
> it in things like JSOptionConstructor and JSAudioConstructor.
>
> At first I thought it was just some kind of copy/paste error, but  
> now I'm not so sure given how many files it's found in.

In theory, JavaScript host functions are supposed to have a "length"  
property that gives the expected number of arguments. Web IDL might  
specify what it's supposed to be. The fact that we are inconsistent is  
likely because this is very very unimportant to actual Web  
compatibility.

  - Maciej

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20090702/7b18ff47/attachment.html>


More information about the webkit-dev mailing list