Skip to content
This repository was archived by the owner on Feb 22, 2024. It is now read-only.

Commit 9ac49a2

Browse files
authored
Merge pull request #1 from binary-hamedanchi/mohammad/ie_memory_leak
mohammad/ie_memory_leak
2 parents f6ed93c + 4dfcdb1 commit 9ac49a2

File tree

4 files changed

+14
-5
lines changed

4 files changed

+14
-5
lines changed

src/javascript/binary/websocket_pages/trade/beta/tradepage.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff 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 {

src/javascript/binary/websocket_pages/trade/common.js

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff 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+
925929
function 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') || /^(|about:blank)$/.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,

src/javascript/binary/websocket_pages/trade/tradepage.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ var TradePage = (function(){
6060
forgetTradingStreams();
6161
BinarySocket.clear();
6262
Defaults.clear();
63+
chartFrameCleanup();
6364
};
6465

6566
return {

src/javascript/binary_japan/trade_japan/JPTradePage.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff 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;

0 commit comments

Comments
 (0)