adobe / brackets

An open source code editor for the web, written in JavaScript, HTML and CSS.
http://brackets.io
MIT License
33.24k stars 7.62k forks source link

Live Preview doesn't close tab/window with Chrome 36 #8037

Open JeffryBooher opened 10 years ago

JeffryBooher commented 10 years ago

Install Chrome Version 36.0.1985.49 beta-m Launch release 0.40 Open sample project launch live prev ==> chrome launches with live dev profile File > Live Preview to close Chrome with live dev profile doesn't close [ Tested Windows Only ]

dangoor commented 10 years ago

This happens on Mac as well (removed Win Only label). This probably shouldn't be marked "tracking" because we don't know if this is a bug in Chrome (or if anyone has filed a bug against Chrome).

dangoor commented 10 years ago

Medium priority to @redmunds to investigate. Randy: if this looks like it's going to be a bunch of work to fix or isn't just a bug in Chrome that we can file, please put a comment here and mark "needs review".

This behavior is likely to change in the future because of the live preview work that's currently going on. (We can't close the window with our new live preview technique of a normal "content script" vs. privileged API access)

emanb29 commented 10 years ago

I haven't done a thorough overview of this, but you could natively close a browser window via javascript if you had, for example, a helper extension on the browser that opened a test window via window.open() or similar, since that window could then be closed by the script (background.js or similar on Chrome)

dangoor commented 10 years ago

@emanb29 Yep, we've thought of the helper extension as a possibility for optional features in the new Live Preview.

peterflynn commented 10 years ago

It looks like we currently use this trick to close the window: Inspector.Runtime.evaluate("window.open('', '_self').close();") (see LiveDevelopment._doInspectorDisconnect()). Chrome must be blocking that now.

I wonder if the remote debugging API itself gives any way to close tabs?

marcelgerber commented 10 years ago

@peterflynn This StackOverflow post approves your assumption. It also points out the Extension API method to close the window. I wonder if we can use it too.

emanb29 commented 10 years ago

@MarcelGerber that would of course require access to the extension API, which requires an extension.... Which has already been reviewed (and I believe discarded) as a possibility (at least that's the impression I got from Mr Dangoor)

peterflynn commented 10 years ago

The Chrome extensibility API is a lot bigger than the remote debugging API. I didn't see anything in the remote debugging API that looks like it would give us this...

dangoor commented 10 years ago

The live preview work that's underway to make live preview work cross-browser would require the help of an extension in order to close the tab as well, due to the browser permissions model.

dangoor commented 10 years ago

In other words, fixing this using the inspector protocol would likely be a temporary fix anyhow...

peterflynn commented 10 years ago

Yep...