简体   繁体   English

Extjs4和IE8:选项卡上的beforeclose事件引发“无法执行释放脚本中的代码”

[英]Extjs4 and IE8 : beforeclose event on a tab throw an 'cannot execute code from freed script'

I have a problem that make me crazy with extjs4 and IE8 with the tab panel. 我有一个问题,使我对使用选项卡面板的extjs4和IE8感到疯狂。

I must refresh a specific tab when I close another tab to take care of the modifications. 当我关闭另一个选项卡以进行修改时,我必须刷新特定的选项卡。 I use the 'beforeclose' event to trigger the refresh. 我使用“ beforeclose”事件触发刷新。 On FF it's ok. 在FF上还可以。 But with IE8 (the target of my application), I have a 'cannot execute code from freed script'. 但是使用IE8(我的应用程序的目标),我有一个“无法从释放的脚本中执行代码”。

Can someby help me ? 有人可以帮我吗?

Here is the code : 这是代码:

var activeTab = getTabPanel().getActiveTab(); // getTabPanel() give me the tab panel
activeTab.on('beforeclose', function(tab, opts) {
    alert("refresh !!!!");
    tab.refreshTab('order_'+id); // refreshTab(id) search the tab with the id identifier and refresh the contents
}

The alert is not displayed, so I supposed that the listener cannot be processed. 该警报未显示,因此我认为无法处理该侦听器。

EDIT : I use iframes as contents of the tab panel. 编辑:我使用iframe作为标签面板的内容。

I finally found where is the bug. 我终于找到了错误所在。

This code attach a listener on the beforeclose event, and the listener is called by the parent window. 此代码将侦听器附加到beforeclose事件上,并且该侦听器由父窗口调用。 If I refresh the iframe (via submitting a form or using the 'refresh' action), the event is still attached to the parent window BUT the callback function has disappeared from the memory. 如果我刷新iframe(通过提交表单或使用“刷新”操作),则该事件仍会附加到父窗口,但回调函数已从内存中消失。 With Firefox, the callback is successfully called twice, but IE throw a "can't execute code from a freed script" error. 使用Firefox,该回调已成功调用两次,但是IE抛出“无法从释放的脚本执行代码”错误。

For solving this, I attach a call on the beforeunload event to detach the listener. 为了解决这个问题,我在beforeunload事件上附加了一个调用以分离侦听器。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM