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
17 changes: 17 additions & 0 deletions src/LiveDevelopment/MultiBrowserImpl/documents/LiveHTMLDocument.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ define(function (require, exports, module) {
this._onChange = this._onChange.bind(this);
this.doc.on("change", this._onChange);

this._onDeleted = this._onDeleted.bind(this);
this.doc.on("deleted", this._onDeleted);

this._onRelated = this._onRelated.bind(this);
this.protocol.on("DocumentRelated", this._onRelated);

Expand Down Expand Up @@ -152,6 +155,7 @@ define(function (require, exports, module) {
LiveHTMLDocument.prototype.close = function () {
this.doc.releaseRef();
this.doc.off("change", this._onChange);
this.doc.off("deleted", this._onDeleted);
this.protocol.off("DocumentRelated", this._onRelated);
this.protocol.off("StylesheetAdded", this._onStylesheetAdded);
this.protocol.off("StylesheetRemoved", this._onStylesheetRemoved);
Expand All @@ -161,6 +165,19 @@ define(function (require, exports, module) {
this.parentClass.close.call(this);
};

/**
* @private
* Handles the backing Document's file being deleted from disk (eg. from the file tree).
* Without this, our extra addRef() on the doc (on top of any editor's own ref) would never
* be released - close() is otherwise only called by the live preview session lifecycle, not
* in response to the file disappearing.
* @param {$.Event} event
*/
LiveHTMLDocument.prototype._onDeleted = function (event) {
this.close();
this.trigger("deleted", [this]);
};

/**
* @override
* Update the highlights in the browser based on the cursor position.
Expand Down
2 changes: 1 addition & 1 deletion tracking-repos.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"phoenixPro": {
"commitID": "f07435fe2714e57ca69f49634255aee36b4802ca"
"commitID": "a69d2ed60ccb04bd245508fb2b4df943d2f43cfa"
}
}
Loading