Skip to content
Merged
Show file tree
Hide file tree
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
18 changes: 11 additions & 7 deletions src/LiveDevelopment/LiveDevMultiBrowser.js
Original file line number Diff line number Diff line change
Expand Up @@ -189,15 +189,14 @@ define(function (require, exports, module) {
* @param {string} url Absolute URL of the related document
*/
function _handleRelatedDocumentDeleted(url) {
var liveDoc = _relatedDocuments[url];
const liveDoc = _relatedDocuments[url];
if (liveDoc) {
delete _relatedDocuments[url];
if (_server) {
_server.remove(liveDoc);
}
_closeDocument(liveDoc);
}

if (_server) {
_server.remove(liveDoc);
}
_closeDocument(liveDoc);
}

/**
Expand Down Expand Up @@ -313,12 +312,17 @@ define(function (require, exports, module) {
var docPromise = DocumentManager.getDocumentForPath(path);

docPromise.done(function (doc) {
// Re-check after async gap: another StylesheetAdded event may have
// already created a live document for this URL while we were waiting.
if (_relatedDocuments[url]) {
return;
}
if ((_classForDocument(doc) === LiveCSSDocument) &&
(!_liveDocument || (doc !== _liveDocument.doc))) {
var liveDoc = _createLiveDocument(doc, doc._masterEditor, roots);
if (liveDoc) {
_server.add(liveDoc);
_relatedDocuments[doc.url] = liveDoc;
_relatedDocuments[url] = liveDoc;
liveDoc.on("updateDoc", function (event, url) {
var path = _server.urlToPath(url),
doc = getLiveDocForPath(path);
Expand Down
2 changes: 1 addition & 1 deletion src/editor/EditorManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -775,7 +775,7 @@ define(function (require, exports, module) {

// Set up event dispatching
EventDispatcher.makeEventDispatcher(exports);
EventDispatcher.setLeakThresholdForEvent(EVENT_ACTIVE_EDITOR_CHANGED, 30);
EventDispatcher.setLeakThresholdForEvent(EVENT_ACTIVE_EDITOR_CHANGED, 50);

// File-based preferences handling
exports.on(EVENT_ACTIVE_EDITOR_CHANGED, function (e, current) {
Expand Down
Loading