From 130cd6d4b99c9db344ec0ab44a54a59d11b31d2f Mon Sep 17 00:00:00 2001 From: Ananya Sen Date: Thu, 8 Mar 2012 13:29:58 -0800 Subject: IKNINJA-1270: fixed browser crashing when you close a document while playing a video Signed-off-by: Ananya Sen --- js/controllers/document-controller.js | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'js/controllers') diff --git a/js/controllers/document-controller.js b/js/controllers/document-controller.js index 194496a6..a8056519 100755 --- a/js/controllers/document-controller.js +++ b/js/controllers/document-controller.js @@ -336,14 +336,23 @@ var DocumentController = exports.DocumentController = Montage.create(Component, nextDocumentIndex = closeDocumentIndex - 1; } this.application.ninja.stage.stageView.switchDocument(this._documents[nextDocumentIndex]); + if(typeof this.activeDocument.stopVideos !== "undefined"){doc.stopVideos();} this._removeDocumentView(doc.container); }else if(this._documents.length === 0){ + if(typeof this.activeDocument.pauseAndStopVideos !== "undefined"){ + this.activeDocument.pauseAndStopVideos(); + } this.activeDocument = null; this._removeDocumentView(doc.container); this.application.ninja.stage.stageView.hideRulers(); document.getElementById("iframeContainer").style.display="block"; this.application.ninja.stage.hideCanvas(true); + }else{//closing inactive document tab - just clear DOM + if(typeof doc.pauseAndStopVideos !== "undefined"){ + doc.pauseAndStopVideos(); + } + this._removeDocumentView(doc.container); } NJevent("closeDocument", doc.uri); -- cgit v1.2.3