Re: Sync API for workers

On Sat, Sep 1, 2012 at 11:49 AM, David Bruant <bruant.d@gmail.com> wrote:
> Also, I don't think I have seen mentionned use cases of things that are
> not possible without a Sync API. Everything presented is already
> possible (sometimes at arguably high costs like Glenn Maynard's use case
> in discussion [1]).

I have a use case: at USENIX I presented Treehouse [1, 2], a system that
sandboxes (mostly) unmodified JavaScript by running it in a worker with a
virtual DOM and browser API. Treehouse presents guest code a synchronous
interface to the virtual DOM, and then asynchronously updates the real DOM in
the parent page.

This works surprisingly well, but has some limitations (S3.4 of [1]). First,
Treehouse cannot virtualize synchronous API calls such as window.prompt.
Second, sharing resources like cookies and DOM nodes between workers is
difficult. We punted on this. For example, we require that a given DOM node in
the parent page appear in the virtual DOM of at most one worker.

I can't weigh in on the implementation debate, but I can say that a blocking
message API would make Treehouse more powerful and simplify its
implementation.

Whether this is a *real world* use case is another matter entirely...

[1] paper: https://www.usenix.org/system/files/conference/atc12/atc12-final159.pdf
[2] video, audio:
https://www.usenix.org/conference/usenixfederatedconferencesweek/treehouse-javascript-sandboxes-help-web-developers-help

--
Lon Ingram
@lawnsea

Received on Tuesday, 4 September 2012 22:09:38 UTC