Skip to content
This repository was archived by the owner on Sep 6, 2021. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 25 additions & 4 deletions src/LiveDevelopment/LiveDevelopment.js
Original file line number Diff line number Diff line change
Expand Up @@ -798,8 +798,19 @@ define(function LiveDevelopment(require, exports, module) {
* the status accordingly.
*/
function cleanup() {
_setStatus(STATUS_INACTIVE, reason || "explicit_close");
deferred.resolve();
// Need to do this in order to trigger the corresponding CloseLiveBrowser cleanups required on
// the native Mac side
var closeDeferred = (brackets.platform === "mac") ? NativeApp.closeLiveBrowser() : $.Deferred().resolve();
closeDeferred.done(function () {
_setStatus(STATUS_INACTIVE, reason || "explicit_close");
deferred.resolve();
}).fail(function (err) {
if (err) {
reason += " (" + err + ")";
}
_setStatus(STATUS_INACTIVE, reason || "explicit_close");
deferred.resolve();
});
}

if (_openDeferred) {
Expand Down Expand Up @@ -1033,7 +1044,7 @@ define(function LiveDevelopment(require, exports, module) {
if (id === Dialogs.DIALOG_BTN_OK) {
// User has chosen to reload Chrome, quit the running instance
_setStatus(STATUS_INACTIVE);
NativeApp.closeLiveBrowser()
_close()
.done(function () {
browserStarted = false;
window.setTimeout(function () {
Expand All @@ -1048,7 +1059,17 @@ define(function LiveDevelopment(require, exports, module) {
_openDeferred.reject("CLOSE_LIVE_BROWSER");
});
} else {
_openDeferred.reject("CANCEL");
_close()
.done(function () {
browserStarted = false;
_openDeferred.reject("CANCEL");
})
.fail(function (err) {
// Report error?
_setStatus(STATUS_ERROR);
browserStarted = false;
_openDeferred.reject("CLOSE_LIVE_BROWSER");
});
}
});

Expand Down