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
15 changes: 13 additions & 2 deletions src/document/DocumentCommandHandlers.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ define(function (require, exports, module) {
/** @type {Number} index to use for next, new Untitled document */
var _nextUntitledIndexToUse = 1;

/** @type {boolean} prevents reentrancy of browserReload() */
var _isReloading = false;

/** Unique token used to indicate user-driven cancellation of Save As (as opposed to file IO error) */
var USER_CANCELED = { userCanceled: true };

Expand Down Expand Up @@ -1438,12 +1441,18 @@ define(function (require, exports, module) {

return result.promise();
}

/**
* Does a full reload of the browser window
* @param {string} href The url to reload into the window
*/
function browserReload(href) {
if (_isReloading) {
return;
}

_isReloading = true;

return CommandManager.execute(Commands.FILE_CLOSE_ALL, { promptOnly: true }).done(function () {
// Give everyone a chance to save their state - but don't let any problems block
// us from quitting
Expand All @@ -1452,7 +1461,7 @@ define(function (require, exports, module) {
} catch (ex) {
console.error(ex);
}

// Disable the cache to make reloads work
_disableCache().always(function () {
// Remove all menus to assure every part of Brackets is reloaded
Expand All @@ -1462,6 +1471,8 @@ define(function (require, exports, module) {

window.location.href = href;
});
}).fail(function () {
_isReloading = false;
});
}

Expand Down