<div class="gmail_quote">On Sat, Sep 11, 2010 at 11:07 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;">
<div class="im">On Sat, Sep 11, 2010 at 10:52 PM, Darin Fisher &lt;<a href="mailto:darin@chromium.org">darin@chromium.org</a>&gt; wrote:<br>
&gt; On Sat, Sep 11, 2010 at 10:42 PM, Adam Barth &lt;<a href="mailto:abarth@webkit.org">abarth@webkit.org</a>&gt; wrote:<br>
&gt;&gt; On Sat, Sep 11, 2010 at 10:02 PM, Darin Fisher &lt;<a href="mailto:darin@chromium.org">darin@chromium.org</a>&gt; wrote:<br>
</div><div class="im">&gt;&gt; &gt; I don&#39;t understand.  WebWorkers use ThreadableLoader, which routes the<br>
&gt;&gt; &gt; network request back to the main thread where there is an associated<br>
&gt;&gt; &gt; Frame.<br>
&gt;&gt; &gt;  (SharedWorkers have a dummy frame associated with them.)<br>
&gt;&gt;<br>
&gt;&gt; See.  The dummy frame sounds unfortunate.<br>
&gt;<br>
&gt; It solved/avoided a load of problems/complexity.  What are your concerns?<br>
<br>
</div>Having fake versions of objects add complexity to all the code that<br>
expects to talk to real versions of those objects. </blockquote><div><br></div><div>This sounds like trading off one form of complexity for another.  Maybe the answer is something like a base class.</div><div><br></div><div>
 </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"> For example,<br>
SVG-in-&lt;img&gt; creates a ton of fake objects and has been the source of<br>
a lot of bugs (including security bugs).  It seems like having a<br>
notion of a networking context makes more sense than pretending shared<br>
workers are associated with a rectangular region of a screen<br>
somewhere.<br>
<div class="im"><br>
&gt;&gt;  In general, there are also<br>
&gt;&gt; situations on the main thread where we&#39;d like to perform a load<br>
&gt;&gt; without a Frame.  I&#39;d have to look at the details, but there are<br>
&gt;&gt; long-standing bugs about applying XSLT to Frame-less documents.  Also,<br>
&gt;&gt; the PingLoader doesn&#39;t have a Frame available (it&#39;s job is to make<br>
&gt;&gt; image requests that outlive the Frame).<br>
&gt;<br>
&gt; PingLoader has an associated Frame when it kicks off the load.  That is the<br>
&gt; critical time when Frame association is usually needed.<br>
<br>
</div>What happens when code later in the loading cycle assumes this Frame<br>
is still present?  To avoid exploding, that code needs to understand<br>
that in this tiny corner of the loader, life is different, which is a<br>
big testing and maintenance burden.<br></blockquote><div><br></div><div>I agree that those later steps need not have a frame association.  I was referring to the frame association given to a ResourceRequest (via FrameLoaderClient::dispatchWillSendRequest) or via the explicit Frame pointer that was once passed to ResourceHandle.</div>
<div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im"><br>
&gt; For example, you<br>
&gt; cannot load any network requests in Chromium unless you know what Page (you<br>
&gt; need to know the routing ID of the tab) is requesting the resource.  I<br>
&gt; assume PingLoader still generates the<br>
&gt; FrameLoaderClient::dispatchWillSendRequest notification, right?<br>
<br>
</div>I don&#39;t think so.  PingLoader talks directly to ResourceHandle.<br>
PingLoader knows about the Frame, but it looks like it only uses it to<br>
determine the outgoing referrer, to<br>
addExtraFieldsToSubresourceRequest, and to grab the networking<br>
context.<br></blockquote><div><br></div><div><br></div><div>Hmm... it seems like a bug that it doesn&#39;t call dispatchWillSendRequest.  That does some important work that should apply to all network requests.</div><div>
<br></div><div>Take a look at FrameLoaderClientImpl::dispatchWillSendRequest under WebKit/chromium/src/.  It calls setFirstPartyForCookies in one case!</div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

<div class="im"><br>
&gt; How do you get a frame-less document?  Via XMLHttpRequest.responseXML?<br>
&gt; Perhaps it could use the Frame of the script execution context?  (Which<br>
&gt; script execution context is a good question.)<br>
<br>
</div>There are are lots of ways to get a Frameless document.  For example,<br>
JavaScript can call document.implementation.createDocument.  Also, the<br>
DOMParser will given you a document.  XMLHttpRequest will give you<br>
one.  You can get one by having an XSLT.  The PageCache has some.<br>
<br>
There was a patch that someone was pushing at some point to chain<br>
these documents back to a &quot;master&quot; document that has a frame.  That&#39;s<br>
certainly one approach, but I don&#39;t think it should be necessary.<br></blockquote><div><br></div><div>That&#39;s the solution I would have expected.  It fits more naturally with our system.</div><div><br></div><div> </div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im"><br>
&gt;&gt; In general, there is no necessary connection between network requests<br>
&gt;&gt; made by WebCore and Frames.  Techniques that aim to associate a frame<br>
&gt;&gt; with every network request won&#39;t work in some cases because such a<br>
&gt;&gt; Frame might not exist.<br>
&gt;<br>
&gt; There always has been such an association.<br>
<br>
</div>Right, and there are bugs we&#39;ve never been able to fix because of that coupling.<br>
<div class="im"><br>
&gt; I would like to understand the<br>
&gt; concerns better.  I guess it means that I need to understand the frame-less<br>
&gt; document issue and why you think having a dummy frame associated with shared<br>
&gt; workers is a problem.<br>
<br>
</div>Here&#39;s an example bug from 2006 that&#39;s marked Critical:<br>
<br>
<a href="https://bugs.webkit.org/show_bug.cgi?id=10313" target="_blank">https://bugs.webkit.org/show_bug.cgi?id=10313</a><br>
<br>
The patch attached to that bug is a giant workaround for the fact that<br>
the loader is too dependent on Frame.<br>
<font color="#888888"><br>
Adam<br></font></blockquote><div><br></div><div><br></div><div>I see.  It seems like it is always possible to find an associated Frame.  I agree that it would be simpler if we didn&#39;t have to.  I just worry that that isn&#39;t an option.</div>
<div><br></div><div>One thing to consider:  It is important for network requests to have an associated browser tab so that any associated UI (auth prompts, security warning dialogs, cookie prompts, etc.) can be anchored properly.  It turns out that the only context Chromium really needs to associate with network requests is an identifier that corresponds to the Page (routing ID).  You can see that ResourceRequest (in the Chromium port) has such a member variable named m_requestorID.  This is used to stash the routing ID, which Chromium uses inside its implementation of ResourceHandle (actually in the implementation of WebKit::WebURLLoader).</div>
<div><br></div><div>-Darin</div></div><br>