diff options
author | Ananya Sen | 2012-03-06 17:01:39 -0800 |
---|---|---|
committer | Ananya Sen | 2012-03-06 17:01:39 -0800 |
commit | 9e4ee2470726e3334eb47d904a6f4079d4ed7aef (patch) | |
tree | 3638893a1e8711b23258a3caee79e8a5c03e5d19 /js/controllers | |
parent | f7641a9b2d6f33e73227d2f8398509b54fdc0aa1 (diff) | |
download | ninja-9e4ee2470726e3334eb47d904a6f4079d4ed7aef.tar.gz |
IKNINJA-1270: fixed browser crashing when you close a document while playing a video then wait for a while
Signed-off-by: Ananya Sen <Ananya.Sen@motorola.com>
Diffstat (limited to 'js/controllers')
-rwxr-xr-x | js/controllers/document-controller.js | 9 | ||||
-rwxr-xr-x | js/controllers/selection-controller.js | 13 |
2 files changed, 22 insertions, 0 deletions
diff --git a/js/controllers/document-controller.js b/js/controllers/document-controller.js index e29148c9..de080167 100755 --- a/js/controllers/document-controller.js +++ b/js/controllers/document-controller.js | |||
@@ -363,14 +363,23 @@ var DocumentController = exports.DocumentController = Montage.create(Component, | |||
363 | nextDocumentIndex = closeDocumentIndex - 1; | 363 | nextDocumentIndex = closeDocumentIndex - 1; |
364 | } | 364 | } |
365 | this.application.ninja.stage.stageView.switchDocument(this._documents[nextDocumentIndex]); | 365 | this.application.ninja.stage.stageView.switchDocument(this._documents[nextDocumentIndex]); |
366 | doc.stopVideos(); | ||
366 | this._removeDocumentView(doc.container); | 367 | this._removeDocumentView(doc.container); |
367 | }else if(this._documents.length === 0){ | 368 | }else if(this._documents.length === 0){ |
369 | if(typeof this.activeDocument.pauseVideos !== "undefined"){ | ||
370 | this.activeDocument.pauseVideos(true); | ||
371 | } | ||
368 | this.activeDocument = null; | 372 | this.activeDocument = null; |
369 | this._removeDocumentView(doc.container); | 373 | this._removeDocumentView(doc.container); |
370 | this.application.ninja.stage.stageView.hideRulers(); | 374 | this.application.ninja.stage.stageView.hideRulers(); |
371 | document.getElementById("iframeContainer").style.display="block"; | 375 | document.getElementById("iframeContainer").style.display="block"; |
372 | 376 | ||
373 | this.application.ninja.stage.hideCanvas(true); | 377 | this.application.ninja.stage.hideCanvas(true); |
378 | }else{//closing inactive document tab - just clear DOM | ||
379 | if(typeof doc.pauseVideos !== "undefined"){ | ||
380 | doc.pauseVideos(true); | ||
381 | } | ||
382 | this._removeDocumentView(doc.container); | ||
374 | } | 383 | } |
375 | 384 | ||
376 | NJevent("closeDocument", doc.uri); | 385 | NJevent("closeDocument", doc.uri); |
diff --git a/js/controllers/selection-controller.js b/js/controllers/selection-controller.js index 3f9d8514..49bf42b6 100755 --- a/js/controllers/selection-controller.js +++ b/js/controllers/selection-controller.js | |||
@@ -48,6 +48,7 @@ exports.SelectionController = Montage.create(Component, { | |||
48 | this.eventManager.addEventListener("selectAll", this, false); | 48 | this.eventManager.addEventListener("selectAll", this, false); |
49 | this.eventManager.addEventListener("deleteSelection", this, false); | 49 | this.eventManager.addEventListener("deleteSelection", this, false); |
50 | this.eventManager.addEventListener("switchDocument", this, false); | 50 | this.eventManager.addEventListener("switchDocument", this, false); |
51 | this.eventManager.addEventListener("closeDocument", this, false); | ||
51 | // defaultEventManager.addEventListener( "undo", this, false); | 52 | // defaultEventManager.addEventListener( "undo", this, false); |
52 | // defaultEventManager.addEventListener( "redo", this, false); | 53 | // defaultEventManager.addEventListener( "redo", this, false); |
53 | } | 54 | } |
@@ -105,6 +106,18 @@ exports.SelectionController = Montage.create(Component, { | |||
105 | } | 106 | } |
106 | }, | 107 | }, |
107 | 108 | ||
109 | handleCloseDocument:{ | ||
110 | value: function() { | ||
111 | //clear selections if all documents are closed | ||
112 | if(this.application.ninja.documentController._documents.length === 0){ | ||
113 | this._selectedItems.length =0; | ||
114 | this.application.ninja.selectedElements.length =0; | ||
115 | this._isDocument = true; | ||
116 | NJevent("selectionChange", {"elements": this.application.ninja.selectedElements, "isDocument": this._isDocument} ); | ||
117 | } | ||
118 | } | ||
119 | }, | ||
120 | |||
108 | handleElementAdded: { | 121 | handleElementAdded: { |
109 | value: function(event) { | 122 | value: function(event) { |
110 | this.executeSelectElement(event.detail); | 123 | this.executeSelectElement(event.detail); |