Oh, certainly - I just started looking at the Worker constructor code, so I definitely have no sense of ownership there, so pick away. I was just trying to understand the issues well enough to understand what the Worker code is doing before I steal it :)<div>
<br></div><div>Looking at the Workers code (since that happens to be where I&#39;m poking around):</div><div><br></div><div><div>JSWorkerConstructor::JSWorkerConstructor(ExecState* exec)</div><div>    : DOMObject(JSWorkerConstructor::createStructure(exec-&gt;lexicalGlobalObject()-&gt;objectPrototype()))</div>
<div>{</div><div>    <b>putDirect(exec-&gt;propertyNames().prototype, JSWorkerPrototype::self(exec, exec-&gt;lexicalGlobalObject()), None);</b></div><div>    putDirect(exec-&gt;propertyNames().length, jsNumber(exec, 1), ReadOnly|DontDelete|DontEnum);</div>
<div>}</div><div><br></div><div>It looks like the constructor&#39;s .prototype is taken from the originating window (set at the time the constructor itself is created) - I haven&#39;t followed the construction code, but I&#39;m guessing that results in the prototype property of new objects being attached to the chain from the original window. Is that incorrect behavior?</div>
<div><br></div><div>-atw<br><br><div class="gmail_quote">On Tue, Jun 23, 2009 at 3:44 PM, Adam Barth <span dir="ltr">&lt;<a href="mailto:abarth@webkit.org">abarth@webkit.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
I don&#39;t mean to pick on workers specifically.  We have lots of bugs in<br>
the bindings where we attach the __proto__ property of new objects to<br>
the wrong prototype chain.  My specific concern is that we should fix<br>
these bugs.  :)<br>
<font color="#888888"><br>
Adam<br>
</font><div><div></div><div class="h5"><br>
<br>
On Tue, Jun 23, 2009 at 3:38 PM, Drew Wilson&lt;<a href="mailto:atwilson@google.com">atwilson@google.com</a>&gt; wrote:<br>
&gt; BTW, Adam - can you elaborate your specific concerns?<br>
&gt;<br>
&gt; On Tue, Jun 23, 2009 at 3:37 PM, Drew Wilson &lt;<a href="mailto:atwilson@google.com">atwilson@google.com</a>&gt; wrote:<br>
&gt;&gt;<br>
&gt;&gt; Not sure. There&#39;s language in the WebIDL spec around prototype objects of<br>
&gt;&gt; interface objects, but I&#39;m not sure how window.Worker.prototype is intended<br>
&gt;&gt; to relate to<br>
&gt;&gt; new Worker().prototype (if at all), based on my 10 minutes of scanning specs.<br>
&gt;&gt; -atw<br>
&gt;&gt;<br>
&gt;&gt; On Tue, Jun 23, 2009 at 3:26 PM, Adam Barth &lt;<a href="mailto:abarth@webkit.org">abarth@webkit.org</a>&gt; wrote:<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; 2009/6/23 Drew Wilson &lt;<a href="mailto:atwilson@google.com">atwilson@google.com</a>&gt;:<br>
&gt;&gt;&gt; &gt; On Tue, Jun 23, 2009 at 11:49 AM, Adam Barth &lt;<a href="mailto:abarth@webkit.org">abarth@webkit.org</a>&gt; wrote:<br>
&gt;&gt;&gt; &gt;&gt;<br>
&gt;&gt;&gt; &gt;&gt; &gt; I am not even sure all of these should have the same behavior,<br>
&gt;&gt;&gt; &gt;&gt; &gt; however. For instance, as I read the Web Workers spec, the lexical<br>
&gt;&gt;&gt; &gt;&gt; &gt; global<br>
&gt;&gt;&gt; &gt;&gt; &gt; object may be correct thing to use for the Worker constructor.<br>
&gt;&gt;&gt; &gt;&gt;<br>
&gt;&gt;&gt; &gt;&gt; I looked at the spec briefly.  What leads you to think that?  It&#39;s<br>
&gt;&gt;&gt; &gt;&gt; probably a bug in the spec.<br>
&gt;&gt;&gt; &gt;<br>
&gt;&gt;&gt; &gt; Section 4.5 of the web workers spec reads:<br>
&gt;&gt;&gt; &gt;&gt;<br>
&gt;&gt;&gt; &gt;&gt; Given a script&#39;s global scope o when creating or obtaining a worker,<br>
&gt;&gt;&gt; &gt;&gt; the list of relevant Document objects to add depends on the type of o. If o<br>
&gt;&gt;&gt; &gt;&gt; is a WorkerGlobalScope object (i.e. if we are creating a nested worker),<br>
&gt;&gt;&gt; &gt;&gt; then the relevant Documents are the Documents that are in o&#39;s own list of<br>
&gt;&gt;&gt; &gt;&gt; the worker&#39;s Documents. Otherwise, o is a Window object, and the relevant<br>
&gt;&gt;&gt; &gt;&gt; Document is just the Document that is the active document of the Window<br>
&gt;&gt;&gt; &gt;&gt; object o.<br>
&gt;&gt;&gt; &gt;<br>
&gt;&gt;&gt; &gt; So it seems to imply that parent document for a worker is derived from<br>
&gt;&gt;&gt; &gt; the currently executing script&#39;s global scope. I&#39;ll ping IanH about this -<br>
&gt;&gt;&gt; &gt; it may not be what he intended.<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; There&#39;s another question, which is where does the prototype chain of<br>
&gt;&gt;&gt; the JS object you get out of the worker constructor point?  It might<br>
&gt;&gt;&gt; not have anything to do with this Document calculation.<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; Adam<br>
&gt;&gt;<br>
&gt;<br>
&gt;<br>
</div></div></blockquote></div><br></div></div>