Chods
11 Aug 2011, 9:36 AM
Hi - Not sure whether this is a bug or if i am going about this the wrong way. The issue only seems to occur in IE8. Basically if i dynamically create a panel with an iframe inside it allocates some memory as you would expect. But I would hope that when i destroyed that panel that the memory was freed up, but it isn't. eventually closing and opening an iframe will crash the browser. I have put together a simplified version of my code as a test base. if anyone could help me out here it would be a great help. Thanks.
<html>
<head>
<script type='text/javascript' src='/ECP_S/ext/ext-4.0.2a/bootstrap.js'></script>
<script type="text/javascript">
var ifr = null;
function createIFrame() {
Ext.createWidget('panel', {
id: 'ifpanel',
title: 'This is an iframe panel',
renderTo: 'iframeCt',
listeners: {
afterRender: function() {
ifr = this.body.createChild({
tag: 'iframe',
height: '100%',
width: '100%',
frameborder: 0,
src: 'http://news.bbc.co.uk'
});
}
}
});
}
Ext.onReady(function() {
Ext.createWidget('button', {
renderTo: 'createButtonCt',
text: 'Create IFrame',
handler: function () {
createIFrame();
},
style: 'margin-left: 8px;'
});
Ext.createWidget('button', {
renderTo: 'destroyButtonCt',
text: 'Destroy IFrame',
handler: function () {
//ifr.src = 'about:blank';
//ifr.destroy();
Ext.getCmp('ifpanel').destroy();
},
style: 'margin-left: 8px;'
});
});
</script>
</head>
<body>
<div id="createButtonCt"></div>
<div id="destroyButtonCt"></div>
<div id="iframeCt"></div>
</body>
</html>
<html>
<head>
<script type='text/javascript' src='/ECP_S/ext/ext-4.0.2a/bootstrap.js'></script>
<script type="text/javascript">
var ifr = null;
function createIFrame() {
Ext.createWidget('panel', {
id: 'ifpanel',
title: 'This is an iframe panel',
renderTo: 'iframeCt',
listeners: {
afterRender: function() {
ifr = this.body.createChild({
tag: 'iframe',
height: '100%',
width: '100%',
frameborder: 0,
src: 'http://news.bbc.co.uk'
});
}
}
});
}
Ext.onReady(function() {
Ext.createWidget('button', {
renderTo: 'createButtonCt',
text: 'Create IFrame',
handler: function () {
createIFrame();
},
style: 'margin-left: 8px;'
});
Ext.createWidget('button', {
renderTo: 'destroyButtonCt',
text: 'Destroy IFrame',
handler: function () {
//ifr.src = 'about:blank';
//ifr.destroy();
Ext.getCmp('ifpanel').destroy();
},
style: 'margin-left: 8px;'
});
});
</script>
</head>
<body>
<div id="createButtonCt"></div>
<div id="destroyButtonCt"></div>
<div id="iframeCt"></div>
</body>
</html>