This repository was archived by the owner on Feb 22, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +14
-5
lines changed
binary/websocket_pages/trade Expand file tree Collapse file tree 4 files changed +14
-5
lines changed Original file line number Diff line number Diff line change @@ -62,6 +62,7 @@ var TradePage_Beta = (function(){
6262 BinarySocket . clear ( ) ;
6363 Defaults . clear ( ) ;
6464 PortfolioWS . onUnload ( ) ;
65+ chartFrameCleanup ( ) ;
6566 } ;
6667
6768 return {
Original file line number Diff line number Diff line change @@ -911,19 +911,24 @@ function showHighchart(){
911911 if ( window . chartAllowed ) {
912912 chartFrameSource ( ) ;
913913 } else {
914- /*
915- * Prevent IE memory leak (http://stackoverflow.com/questions/8407946).
916- */
917- document . getElementById ( 'chart_frame' ) . src = 'about:blank' ;
914+ chartFrameCleanup ( ) ;
918915 $ ( '#trade_live_chart' ) . hide ( ) ;
919916 $ ( '#chart-error' ) . text ( page . text . localize ( 'Chart is not available for this underlying.' ) )
920917 . show ( ) ;
921918 return ;
922919 }
923920}
924921
922+ function chartFrameCleanup ( ) {
923+ /*
924+ * Prevent IE memory leak (http://stackoverflow.com/questions/8407946).
925+ */
926+ document . getElementById ( 'chart_frame' ) . src = 'about:blank' ;
927+ }
928+
925929function chartFrameSource ( ) {
926- if ( $ ( '#tab_graph' ) . hasClass ( 'active' ) && ( sessionStorage . getItem ( 'old_underlying' ) !== sessionStorage . getItem ( 'underlying' ) || $ ( '#chart_frame' ) . attr ( 'src' ) === '' || $ ( '#chart_frame' ) . attr ( 'src' ) === 'about:blank' ) ) {
930+ if ( $ ( '#tab_graph' ) . hasClass ( 'active' ) && ( sessionStorage . getItem ( 'old_underlying' ) !== sessionStorage . getItem ( 'underlying' ) || / ^ ( | a b o u t : b l a n k ) $ / . test ( $ ( '#chart_frame' ) . attr ( 'src' ) ) ) ) {
931+ chartFrameCleanup ( ) ;
927932 setChartSource ( ) ;
928933 sessionStorage . setItem ( 'old_underlying' , document . getElementById ( 'underlying' ) . value ) ;
929934 }
@@ -1163,6 +1168,7 @@ module.exports = {
11631168 reloadPage : reloadPage ,
11641169 addComma : addComma ,
11651170 showHighchart : showHighchart ,
1171+ chartFrameCleanup : chartFrameCleanup ,
11661172 chartFrameSource : chartFrameSource ,
11671173 displayContractForms : displayContractForms ,
11681174 displayMarkets : displayMarkets ,
Original file line number Diff line number Diff line change @@ -60,6 +60,7 @@ var TradePage = (function(){
6060 forgetTradingStreams ( ) ;
6161 BinarySocket . clear ( ) ;
6262 Defaults . clear ( ) ;
63+ chartFrameCleanup ( ) ;
6364 } ;
6465
6566 return {
Original file line number Diff line number Diff line change @@ -36,6 +36,7 @@ var JPTradePage = (function() {
3636 } ;
3737
3838 var onUnload = function ( ) {
39+ chartFrameCleanup ( ) ;
3940 window . chartAllowed = false ;
4041 JapanPortfolio . hide ( ) ;
4142 isJapan = false ;
You can’t perform that action at this time.
0 commit comments