It looks like WebKit binds the XMLHttpRequest object to its parent document at instantiation time, so the source of the constructor doesn't make a difference. And it looks like that binding is cleared when the document is closed so invoking xhr.send() on an XHR object whose parent document is no longer open fails silently. I'm basing this on code inspection, not on extensive knowledge of the codebase, so the webkit folks should feel free to correct me here.<br>
<br>Why is having the window proxy on behalf of its workers a poor workaround for worker MessagePorts? I totally understand the utility of MessagePorts for things like cross-window and cross-iframe communication, but it seems like the use cases for external access to workers are far more obscure.<br>
<br>-atw<br><br><div class="gmail_quote">On Thu, May 7, 2009 at 2:47 PM, Ian Hickson <span dir="ltr"><<a href="mailto:ian@hixie.ch">ian@hixie.ch</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="im">On Thu, 7 May 2009, Drew Wilson wrote:<br>
><br>
> Having MessagePorts in worker context means that Workers can outlive<br>
> their parent window(s) - I can create a worker, pass off an entangled<br>
> MessagePort to another window (say, to a different domain), then close<br>
> the original window, and the worker should stay alive. In the case of<br>
> WebKit, this causes some problems for things like worker-initiated<br>
> network requests - if workers can continue to run even though there are<br>
> no open windows for that origin, then it becomes problematic to perform<br>
> network requests (part of this is due to the architecture of WebKit<br>
> which requires proxying network requests to window context, but part of<br>
> this is just a general problem of "how do you handle things like HTTP<br>
> Auth when there are no open windows for that origin?")<br>
<br>
</div>How does WebKit handle this case for regular Windows? (e.g. if a script<br>
does x=window.open(), grabs the x.XMLHttpRequest constructor, calls<br>
x.close(), and then invokes the constructor.)<br>
<div class="im"><br>
<br>
> The thing we'd give up is the capabilities-based API that MessagePorts<br>
> provide, but I'd argue that the workaround is simple: the creating<br>
> window can just act as a proxy for the worker.<br>
<br>
</div>That's a rather poor workaround. :-)<br>
<font color="#888888"><br>
--<br>
Ian Hickson U+1047E )\._.,--....,'``. fL<br>
<a href="http://ln.hixie.ch/" target="_blank">http://ln.hixie.ch/</a> U+263A /, _.. \ _\ ;`._ ,.<br>
Things that are impossible just take longer. `._.-(,_..'--(,_..'`-.;.'<br>
</font></blockquote></div><br>