Skip to content

Commit 7a972bd

Browse files
committed
fix: live preview event handler leak causing inconcsitant lp bugs caught by integ tests failures
the EditorManager.off(`activeEditorChange. code was accidentaly deleted during refactoring changes
1 parent 4f2427b commit 7a972bd

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/LiveDevelopment/MultiBrowserImpl/documents/LiveDocument.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ define(function (require, exports, module) {
7979
* Closes the live document, terminating its connection to the browser.
8080
*/
8181
LiveDocument.prototype.close = function () {
82-
82+
EditorManager.off(`activeEditorChange.LiveDocument-${this.doc.file.fullPath}`);
8383
this._clearErrorDisplay();
8484
this._detachFromEditor();
8585
};

test/spec/LiveDevelopmentMultiBrowser-test.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -924,14 +924,15 @@ define(function (require, exports, module) {
924924
}, 30000);
925925

926926
it("focus test: should html live previews never take focus from editor", async function () {
927-
// this test may fail if the test window doesn't have focus
928-
await awaitsForDone(SpecRunnerUtils.openProjectFiles(["inline-style.html"]),
927+
await awaitsForDone(SpecRunnerUtils.openProjectFiles(["simple1.html"]),
929928
"SpecRunnerUtils.openProjectFiles simple1.html");
930929

931930
await waitsForLiveDevelopmentToOpen();
931+
await _editFileAndVerifyLivePreview("simple1.html", { line: 11, ch: 45 }, 'hello world ',
932+
"testId", "Brackets is hello world awesome!");
932933

933934
let iFrame = testWindow.document.getElementById("panel-live-preview-frame");
934-
expect(iFrame.src.endsWith("inline-style.html")).toBeTrue();
935+
expect(iFrame.src.endsWith("simple1.html")).toBeTrue();
935936
iFrame.focus(); // live preview has focus but it can take html focus, the live preview has to
936937
// delegate focus to editor explicitly in case of html files.
937938
expect(testWindow.document.activeElement).toEqual(iFrame);

0 commit comments

Comments
 (0)