Re: Cross-process JS wrappers

Robert O'Callahan <[email protected]>
Newsgroups gmane.comp.mozilla.devel.dom
Organization Mozilla Corporation
Message-ID <[email protected]>
On 28/08/09 12:13 PM, Benjamin Smedberg wrote:
> In order to support some kinds of extension scripts and make it possible to
> get Firefox bootstrapped, we're going to have a synchronous wrapper that
> proxies a JS object across processes. The initial spec for this object is here:
>
> https://wiki.mozilla.org/Content_Processes/JPW

We need to think carefully about how JS run-to-completion semantics will 
work here. We can't allow arbitrary events to run in the content process 
between two synchronous JPW calls from the same chrome script execution.

My idea was to effectively lock the content process until the chrome 
script has run to completion. E.g., handle the first JPW call in a 
content process by dispatching an event to the content process' main 
thread. That event would wait for and process any further JPW calls 
until the chrome script execution has completed, at which time the event 
returns to the content process' main thread event loop.

When we fire an event in the content process that chrome is listening 
for, we'd enter that JPW handler in the content process before we run 
the chrome event handler. That way chrome event handlers can access that 
content process with nearly zero latency.

We also need to say something about timeouts --- if the content process 
is hung, how long do we wait before giving up, and what do we do? Just 
throw a JS exception?

Rob
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.