Re: Event loops in navigated-away-from windows

2014-10-15 Thread Adam Klein
On Tue, Oct 14, 2014 at 7:50 PM, Boris Zbarsky bzbar...@mit.edu wrote: On 9/26/14, 10:03 PM, Boris Zbarsky wrote: 2) Say someone runs this in a web page: (function f() Promise.resolve().then(f))() what should happen when the user navigates away from that web page and why? Given the

Re: Event loops in navigated-away-from windows

2014-10-15 Thread Boris Zbarsky
On 10/15/14, 1:10 PM, Adam Klein wrote: Sorry for my delay in responding. Can you say what is simplest for Gecko in this case? We're still deciding that, but probably something like this: since in Gecko every Promise is associated with a global from the point when it's created (this is the

Re: Event loops in navigated-away-from windows

2014-10-15 Thread Allen Wirfs-Brock
On Oct 14, 2014, at 7:50 PM, Boris Zbarsky wrote: On 9/26/14, 10:03 PM, Boris Zbarsky wrote: 2) Say someone runs this in a web page: (function f() Promise.resolve().then(f))() what should happen when the user navigates away from that web page and why? Given the lack of response

Re: Event loops in navigated-away-from windows

2014-10-15 Thread Boris Zbarsky
On 10/15/14, 3:05 PM, Allen Wirfs-Brock wrote: The above expression must be evaluated as part of some job running in a Vat V. The code of the expression must be associated with some Realm R within V. Correct. 17. Execution continues in this manner (essentially looping steps 8-16 with new

Re: Event loops in navigated-away-from windows

2014-10-15 Thread Allen Wirfs-Brock
On Oct 15, 2014, at 12:14 PM, Boris Zbarsky wrote: On 10/15/14, 3:05 PM, Allen Wirfs-Brock wrote: ... So, the basic question becomes one how the browser maps web pages to Vats. If each pages get a separate Vat They don't. Basically, same-origin web pages correspond to multiple Realms

Holy mixed metaphors, Batman! (was: Event loops in navigated-away-from windows)

2014-10-15 Thread Brendan Eich
Allen Wirfs-Brock wrote: realms and vats and ES jobs. I like mixed metaphors as much as the next person, but srsly, can we talk? Realm : Quest :: ??? : Job Vat : Realm :: WindowProxy : Window I'm not sure of these, help wanted fixing them and filling in the ??? slot -- but we have too many

Re: Event loops in navigated-away-from windows

2014-10-15 Thread Boris Zbarsky
On 10/15/14, 3:45 PM, Allen Wirfs-Brock wrote: Right, but in practice, for different-origin pages, don't you use various forms of serialization/proxying to provide Vat-like object reference isolation? Maybe. First, note that being different-origin is not a static property due to

Re: Holy mixed metaphors, Batman! (was: Event loops in navigated-away-from windows)

2014-10-15 Thread Mark S. Miller
I don't understand Vat : Realm :: WindowProxy : Window. In what way are these analogous? On Wed, Oct 15, 2014 at 1:34 PM, Brendan Eich bren...@mozilla.org wrote: Allen Wirfs-Brock wrote: realms and vats and ES jobs. I like mixed metaphors as much as the next person, but srsly, can we

Re: Event loops in navigated-away-from windows

2014-10-15 Thread Allen Wirfs-Brock
On Oct 15, 2014, at 1:36 PM, Boris Zbarsky wrote: On 10/15/14, 3:45 PM, Allen Wirfs-Brock wrote: ... A PromiseReactionJob that is associated with a marked Realm Are PromiseReactionJobs associated with a Realm at all? If so, how is that Realm determined? Every PendingJob [1] has has a

Re: Holy mixed metaphors, Batman! (was: Event loops in navigated-away-from windows)

2014-10-15 Thread Allen Wirfs-Brock
On Oct 15, 2014, at 1:34 PM, Brendan Eich wrote: Allen Wirfs-Brock wrote: realms and vats and ES jobs. I like mixed metaphors as much as the next person, but srsly, can we talk? Realm : Quest :: ??? : Job Vat : Realm :: WindowProxy : Window I'm not sure of these, help wanted fixing

Re: Holy mixed metaphors, Batman! (was: Event loops in navigated-away-from windows)

2014-10-15 Thread Allen Wirfs-Brock
s/connivance/ conveyance/ On Oct 15, 2014, at 2:18 PM, Allen Wirfs-Brock wrote: On Oct 15, 2014, at 1:34 PM, Brendan Eich wrote: Allen Wirfs-Brock wrote: realms and vats and ES jobs. I like mixed metaphors as much as the next person, but srsly, can we talk? Realm : Quest :: ??? :

Re: Event loops in navigated-away-from windows

2014-10-15 Thread Boris Zbarsky
On 10/15/14, 5:10 PM, Allen Wirfs-Brock wrote: Every PendingJob [1] has has a [[Realm]] field that is set to the realm of the active execution context when the job is enqueued [2]. Ah, I see. That makes sense, thanks. For the PromiseResolutionJobs we are talking about that will be the realm

Re: Event loops in navigated-away-from windows

2014-10-14 Thread Boris Zbarsky
On 9/26/14, 10:03 PM, Boris Zbarsky wrote: 2) Say someone runs this in a web page: (function f() Promise.resolve().then(f))() what should happen when the user navigates away from that web page and why? Given the lack of response from other implementors, I guess we'll just implement

Re: Event loops in navigated-away-from windows

2014-09-30 Thread David Bruant
Le 29/09/2014 23:08, Anne van Kesteren a écrit : On Mon, Sep 29, 2014 at 8:18 PM, Ian Hickson i...@hixie.ch wrote: I certainly wouldn't object to the ES spec's event loop algorithms being turned inside out (search for RunCode on the esdiscuss thread above for an e-mail where I propose this) but

Re: Event loops in navigated-away-from windows

2014-09-29 Thread Ian Hickson
On Sat, 27 Sep 2014, Anne van Kesteren wrote: Well, I for one find it confusing that while HTML had a fairly worked out event loop concept, ECMAScript added another and now I somehow mentally need to integrate them. It would be way clearer if ECMAScript just queued tasks/jobs/microtasks

Re: Event loops in navigated-away-from windows

2014-09-29 Thread Anne van Kesteren
On Mon, Sep 29, 2014 at 8:18 PM, Ian Hickson i...@hixie.ch wrote: I certainly wouldn't object to the ES spec's event loop algorithms being turned inside out (search for RunCode on the esdiscuss thread above for an e-mail where I propose this) but that would be purely an editorial change, it

Re: Event loops in navigated-away-from windows

2014-09-29 Thread Ian Hickson
On Mon, 29 Sep 2014, Anne van Kesteren wrote: On Mon, Sep 29, 2014 at 8:18 PM, Ian Hickson i...@hixie.ch wrote: I certainly wouldn't object to the ES spec's event loop algorithms being turned inside out (search for RunCode on the esdiscuss thread above for an e-mail where I propose this)

Re: Event loops in navigated-away-from windows

2014-09-27 Thread Anne van Kesteren
On Sat, Sep 27, 2014 at 4:03 AM, Boris Zbarsky bzbar...@mit.edu wrote: Now that JS is growing an event loop, what should happen to it in navigated-away-from windows? I still don't understand why JavaScript needs to have the loop itself and can't just queue jobs for the Host to take care of.

Re: Event loops in navigated-away-from windows

2014-09-27 Thread Mark S. Miller
What happens if someone runs (function f() {setImmediate(f);})(); in a web page? On Fri, Sep 26, 2014 at 10:03 PM, Boris Zbarsky bzbar...@mit.edu wrote: Now that JS is growing an event loop, what should happen to it in navigated-away-from windows? To make this concrete: 1) Say I

Re: Event loops in navigated-away-from windows

2014-09-27 Thread Mark S. Miller
What confusion is being caused? AFAICT, this change is causing only the clarification of things that were/are confusing, such as Boris' question. On Sat, Sep 27, 2014 at 2:20 AM, Anne van Kesteren ann...@annevk.nl wrote: On Sat, Sep 27, 2014 at 4:03 AM, Boris Zbarsky bzbar...@mit.edu wrote:

Re: Event loops in navigated-away-from windows

2014-09-27 Thread Anne van Kesteren
On Sat, Sep 27, 2014 at 3:52 PM, Mark S. Miller erig...@google.com wrote: What happens if someone runs (function f() {setImmediate(f);})(); in a web page? As far as I can tell from https://developer.mozilla.org/en-US/docs/Web/API/Window.setImmediate that seems like a proprietary API from

Re: Event loops in navigated-away-from windows

2014-09-27 Thread Anne van Kesteren
On Sat, Sep 27, 2014 at 3:54 PM, Mark S. Miller erig...@google.com wrote: What confusion is being caused? AFAICT, this change is causing only the clarification of things that were/are confusing, such as Boris' question. Well, I for one find it confusing that while HTML had a fairly worked out

Re: Event loops in navigated-away-from windows

2014-09-27 Thread Mark S. Miller
My intent was not to refer to a nonstd api. Instead, what happens with (function f() {setTimeout(f, 0);})(); in a web page that is navigated away from? On Sat, Sep 27, 2014 at 9:56 AM, Anne van Kesteren ann...@annevk.nl wrote: On Sat, Sep 27, 2014 at 3:52 PM, Mark S. Miller

Re: Event loops in navigated-away-from windows

2014-09-27 Thread Anne van Kesteren
On Sat, Sep 27, 2014 at 4:02 PM, Mark S. Miller erig...@google.com wrote: My intent was not to refer to a nonstd api. Instead, what happens with (function f() {setTimeout(f, 0);})(); in a web page that is navigated away from? Now we get to why having two loops is bad... Tasks in a

Re: Event loops in navigated-away-from windows

2014-09-27 Thread Boris Zbarsky
On 9/27/14, 9:52 AM, Mark S. Miller wrote: What happens if someone runs (function f() {setImmediate(f);})(); in a web page? You get into https://dvcs.w3.org/hg/webperf/raw-file/tip/specs/setImmediate/Overview.html#processingmodel step 5, which waits forever (modulo back/forward

Re: Event loops in navigated-away-from windows

2014-09-27 Thread Boris Zbarsky
On 9/27/14, 10:02 AM, Mark S. Miller wrote: My intent was not to refer to a nonstd api. Instead, what happens with (function f() {setTimeout(f, 0);})(); in a web page that is navigated away from? See https://html.spec.whatwg.org/multipage/webappapis.html#processing-model-9 step 1 and

Event loops in navigated-away-from windows

2014-09-26 Thread Boris Zbarsky
Now that JS is growing an event loop, what should happen to it in navigated-away-from windows? To make this concrete: 1) Say I have an object that came from such a window and it has an Object.observe observer on it that mutates the property being observed. Should this continue to run