From 9e4ee2470726e3334eb47d904a6f4079d4ed7aef Mon Sep 17 00:00:00 2001 From: Ananya Sen Date: Tue, 6 Mar 2012 17:01:39 -0800 Subject: IKNINJA-1270: fixed browser crashing when you close a document while playing a video then wait for a while Signed-off-by: Ananya Sen --- js/document/html-document.js | 41 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) (limited to 'js/document/html-document.js') diff --git a/js/document/html-document.js b/js/document/html-document.js index 80930af2..d90231e3 100755 --- a/js/document/html-document.js +++ b/js/document/html-document.js @@ -824,6 +824,9 @@ exports.HTMLDocument = Montage.create(TextDocument, { this.undoStack = this.application.ninja.undocontroller.undoQueue.slice(0); this.redoStack = this.application.ninja.undocontroller.redoQueue.slice(0); this.application.ninja.undocontroller.clearHistory();//clear history to give the next document a fresh start + + //pause videos on switching or closing the document, so that the browser does not keep downloading the media data + this.pauseVideos(); } }, @@ -852,6 +855,42 @@ exports.HTMLDocument = Montage.create(TextDocument, { } - } + }, //////////////////////////////////////////////////////////////////// + /** + *pause videos on switching or closing the document, so that the browser does not keep downloading the media data + *removeSrc : boolean to remove the src if the video... set only in the close document flow + */ + pauseVideos:{ + value:function(removeSrc){ + console.log("$$$ pauseVideos"); + var videosArr = this.documentRoot.getElementsByTagName("video"), i=0; + for(i=0;i --- js/document/html-document.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'js/document/html-document.js') diff --git a/js/document/html-document.js b/js/document/html-document.js index d90231e3..924a013d 100755 --- a/js/document/html-document.js +++ b/js/document/html-document.js @@ -863,16 +863,16 @@ exports.HTMLDocument = Montage.create(TextDocument, { */ pauseVideos:{ value:function(removeSrc){ - console.log("$$$ pauseVideos"); + //console.log("$$$ pauseVideos"); var videosArr = this.documentRoot.getElementsByTagName("video"), i=0; for(i=0;i --- js/document/html-document.js | 1 - 1 file changed, 1 deletion(-) (limited to 'js/document/html-document.js') diff --git a/js/document/html-document.js b/js/document/html-document.js index 9670e0c4..83f91c19 100755 --- a/js/document/html-document.js +++ b/js/document/html-document.js @@ -894,7 +894,6 @@ exports.HTMLDocument = Montage.create(TextDocument, { /** * remove the video src on closing the document, so that the browser does not keep downloading the media data, if the tag does not get garbage collected - *removeSrc : boolean to remove the src if the video... set only in the close document flow */ stopVideos:{ value:function(){ -- cgit v1.2.3 From 250420d8c6154172b27fe53aff30e78c227e8a67 Mon Sep 17 00:00:00 2001 From: Ananya Sen Date: Wed, 7 Mar 2012 14:26:37 -0800 Subject: minor fixes Signed-off-by: Ananya Sen --- js/document/html-document.js | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) (limited to 'js/document/html-document.js') diff --git a/js/document/html-document.js b/js/document/html-document.js index 83f91c19..f730b853 100755 --- a/js/document/html-document.js +++ b/js/document/html-document.js @@ -872,22 +872,15 @@ exports.HTMLDocument = Montage.create(TextDocument, { }, //////////////////////////////////////////////////////////////////// /** - *pause videos on switching or closing the document, so that the browser does not keep downloading the media data - *removeSrc : boolean to remove the src if the video... set only in the close document flow + *pause videos on switching or closing the document */ pauseVideos:{ - value:function(removeSrc){ - //console.log("$$$ pauseVideos"); + value:function(){ var videosArr = this.documentRoot.getElementsByTagName("video"), i=0; for(i=0;i