mozilla / positron

a experimental, Electron-compatible runtime on top of Gecko
Other
564 stars 64 forks source link

Close DevTools window on browser close #31

Closed jryans closed 8 years ago

jryans commented 8 years ago

This fixes #29 so that calls to quit() after the browser window closes correctly ends the application on Linux (and hopefully Windows as well).

There is still a bit of mystery, as I don't entirely follow why the unload handler is needed to make this work. Happy to revise if anyone has ideas!

r? @mykmelez

mykmelez commented 8 years ago

There is still a bit of mystery, as I don't entirely follow why the unload handler is needed to make this work. Happy to revise if anyone has ideas!

Hmm, indeed, that's strange!

I just built this on Windows, and it doesn't seem to work for me there. :-(

What if app.quit calls Services.startup.quit(Services.startup.eAttemptQuit) in a timeout to give the devtools window an extra turn of the event loop to close?

jryans commented 8 years ago

@mykmelez, does this version work on Windows? It works for me on Linux. It's a similar idea to the timeout, but uses dispatch which is the idiom I've seen more often in Gecko for setTimeout(0, func) type things.

mykmelez commented 8 years ago

@mykmelez, does this version work on Windows? It works for me on Linux.

It works for me on Windows!

It's a similar idea to the timeout, but uses dispatch which is the idiom I've seen more often in Gecko for setTimeout(0, func) type things.

Makes sense, let's use the common idiom!