The "initialization" steps for Web browsers

Allen Wirfs-Brock allen at wirfs-brock.com
Wed Jul 23 09:02:46 PDT 2014


On Jul 22, 2014, at 7:14 PM, Boris Zbarsky wrote:
> 
>> BTW, I'm also assuming that a batch of events would be
>> handled as a single ES job
> 
> Hmm... event dispatch can happen synchronously from script like so:
> 
>  target.dispatchEvent(new Event("foo"));
> 
> which will trigger all event listeners for "foo" on the target before the dispatchEvent call returns.
> 
> So we're starting out in an ES job here; are you saying the dispatchEvent call creates a new one?

No, synchronous dispatchEvent looks like it could just work depending upon  how the browser specific contextual state (origin, etc. scripting settings, etc. in the HTML spec.) is modeled.   Currently we have a [[HostDefined]] field in a Job record where, based on a previous conversation, you could stash that state when running a script.  If dispatchEvent is going to synchronously dispatch event handlers it may have to do browser context switch for each handler.  How does it know to do this?  Perhaps we also need a [[HostDefined]] field in Realm records? (Each function is associated with a realm, so it is a good place to put context that is shared by all functions for a specific realm).

In my original comment above I was thinking about handling asynchronous events. I was assuming that you would create a separate job that would fire the handlers triggered async events. 

Allen



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20140723/0310af43/attachment-0001.html>


More information about the es-discuss mailing list